2 * MC-1N2 ASoC codec driver
4 * Copyright (c) 2010-2011 Yamaha Corporation
6 * This software is provided 'as-is', without any express or implied
7 * warranty. In no event will the authors be held liable for any damages
8 * arising from the use of this software.
10 * Permission is granted to anyone to use this software for any purpose,
11 * including commercial applications, and to alter it and redistribute it
12 * freely, subject to the following restrictions:
14 * 1. The origin of this software must not be misrepresented; you must not
15 * claim that you wrote the original software. If you use this software
16 * in a product, an acknowledgment in the product documentation would be
17 * appreciated but is not required.
18 * 2. Altered source versions must be plainly marked as such, and must not be
19 * misrepresented as being the original software.
20 * 3. This notice may not be removed or altered from any source distribution.
27 #include <linux/mfd/mc1n2_pdata.h>
35 /* default freq for MC1N2_CLKI */
36 #define MC1N2_DEFAULT_CLKI 19200000
47 #define MC1N2_BCLK_MULT 5
49 /* div for MC1N2_BCLK_MULT */
50 #define MC1N2_LRCK_X8 0
51 #define MC1N2_LRCK_X16 1
52 #define MC1N2_LRCK_X24 2
53 #define MC1N2_LRCK_X32 3
54 #define MC1N2_LRCK_X48 4
55 #define MC1N2_LRCK_X64 5
56 #define MC1N2_LRCK_X128 6
57 #define MC1N2_LRCK_X256 7
58 #define MC1N2_LRCK_X512 8
63 #define MC1N2_MAGIC 'N'
64 #define MC1N2_IOCTL_NR_GET 1
65 #define MC1N2_IOCTL_NR_SET 2
66 #define MC1N2_IOCTL_NR_BOTH 3
67 #define MC1N2_IOCTL_NR_NOTIFY 4
69 #define MC1N2_IOCTL_GET_CTRL \
70 _IOR(MC1N2_MAGIC, MC1N2_IOCTL_NR_GET, struct mc1n2_ctrl_args)
71 #define MC1N2_IOCTL_SET_CTRL \
72 _IOW(MC1N2_MAGIC, MC1N2_IOCTL_NR_SET, struct mc1n2_ctrl_args)
74 #define MC1N2_IOCTL_READ_REG \
75 _IOWR(MC1N2_MAGIC, MC1N2_IOCTL_NR_BOTH, struct mc1n2_ctrl_args)
77 #define MC1N2_IOCTL_NOTIFY \
78 _IOW(MC1N2_MAGIC, MC1N2_IOCTL_NR_NOTIFY, struct mc1n2_ctrl_args)
80 struct mc1n2_ctrl_args {
87 * MC1N2_IOCTL_NOTIFY dCmd definitions
89 #define MCDRV_NOTIFY_CALL_START 0x00000000
90 #define MCDRV_NOTIFY_CALL_STOP 0x00000001
91 #define MCDRV_NOTIFY_MEDIA_PLAY_START 0x00000002
92 #define MCDRV_NOTIFY_MEDIA_PLAY_STOP 0x00000003
93 #define MCDRV_NOTIFY_FM_PLAY_START 0x00000004
94 #define MCDRV_NOTIFY_FM_PLAY_STOP 0x00000005
95 #define MCDRV_NOTIFY_BT_SCO_ENABLE 0x00000006
96 #define MCDRV_NOTIFY_BT_SCO_DISABLE 0x00000007
97 #define MCDRV_NOTIFY_VOICE_REC_START 0x00000008
98 #define MCDRV_NOTIFY_VOICE_REC_STOP 0x00000009
99 #define MCDRV_NOTIFY_HDMI_START 0x0000000A
100 #define MCDRV_NOTIFY_HDMI_STOP 0x0000000B
101 #define MCDRV_NOTIFY_RECOVER 0x0000000C
102 #define MCDRV_NOTIFY_2MIC_CALL_START 0x0000000D
103 #define MCDRV_NOTIFY_LINEOUT_START 0x00000010
104 #define MCDRV_NOTIFY_LINEOUT_STOP 0x00000011
106 #define MC1N2_MODE_IDLE (0x00)
107 #define MC1N2_MODE_CALL_ON (0x1<<0)
108 #define MC1N2_MODE_FM_ON (0x1<<1)
114 MCDRV_INIT_INFO init;
115 unsigned char pcm_extend[IOPORT_NUM];
116 unsigned char pcm_hiz_redge[IOPORT_NUM];
117 unsigned char pcm_hperiod[IOPORT_NUM];
118 unsigned char slot[IOPORT_NUM][SNDRV_PCM_STREAM_LAST+1][DIO_CHANNELS];
122 * Codec Status definitions (for backward compatibility)
124 #define CMD_CODEC_EMERGENCY_RECOVERY 9 // Emergency recovery for Error like -EIO, -ESTRPIPE, and etc.