wm8750.c (abadfc928a27e1cf27c834e8e29e6b1f64ca2d55) | wm8750.c (527541f9a8a83eedb4d732657dbfdcd2c4ca8bb4) |
---|---|
1/* 2 * wm8750.c -- WM8750 ALSA SoC audio driver 3 * 4 * Copyright 2005 Openedhand Ltd. 5 * 6 * Author: Richard Purdie <richard@openedhand.com> 7 * 8 * Based on WM8753.c --- 83 unchanged lines hidden (view full) --- 92 93#define WM8750_HIFI_BITS \ 94 (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ 95 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 96 97static struct snd_soc_dai_mode wm8750_modes[] = { 98 /* common codec frame and clock master modes */ 99 /* 8k */ | 1/* 2 * wm8750.c -- WM8750 ALSA SoC audio driver 3 * 4 * Copyright 2005 Openedhand Ltd. 5 * 6 * Author: Richard Purdie <richard@openedhand.com> 7 * 8 * Based on WM8753.c --- 83 unchanged lines hidden (view full) --- 92 93#define WM8750_HIFI_BITS \ 94 (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ 95 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 96 97static struct snd_soc_dai_mode wm8750_modes[] = { 98 /* common codec frame and clock master modes */ 99 /* 8k */ |
100 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 101 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_8000, 102 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 1536, WM8750_HIFI_FSB}, 103 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 104 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_8000, 105 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 1408, WM8750_HIFI_FSB}, 106 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 107 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_8000, 108 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 2304, WM8750_HIFI_FSB}, 109 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 110 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_8000, 111 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 2112, WM8750_HIFI_FSB}, 112 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 113 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_8000, 114 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 1500, WM8750_HIFI_FSB}, | 100 { 101 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 102 .pcmfmt = WM8750_HIFI_BITS, 103 .pcmrate = SNDRV_PCM_RATE_8000, 104 .pcmdir = WM8750_DIR, 105 .flags = SND_SOC_DAI_BFS_DIV, 106 .fs = 1536, 107 .bfs = WM8750_HIFI_FSB, 108 }, 109 { 110 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 111 .pcmfmt = WM8750_HIFI_BITS, 112 .pcmrate = SNDRV_PCM_RATE_8000, 113 .pcmdir = WM8750_DIR, 114 .flags = SND_SOC_DAI_BFS_DIV, 115 .fs = 1408, 116 .bfs = WM8750_HIFI_FSB, 117 }, 118 { 119 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 120 .pcmfmt = WM8750_HIFI_BITS, 121 .pcmrate = SNDRV_PCM_RATE_8000, 122 .pcmdir = WM8750_DIR, 123 .flags = SND_SOC_DAI_BFS_DIV, 124 .fs = 2304, 125 .bfs = WM8750_HIFI_FSB, 126 }, 127 { 128 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 129 .pcmfmt = WM8750_HIFI_BITS, 130 .pcmrate = SNDRV_PCM_RATE_8000, 131 .pcmdir = WM8750_DIR, 132 .flags = SND_SOC_DAI_BFS_DIV, 133 .fs = 2112, 134 .bfs = WM8750_HIFI_FSB, 135 }, 136 { 137 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 138 .pcmfmt = WM8750_HIFI_BITS, 139 .pcmrate = SNDRV_PCM_RATE_8000, 140 .pcmdir = WM8750_DIR, 141 .flags = SND_SOC_DAI_BFS_DIV, 142 .fs = 1500, 143 .bfs = WM8750_HIFI_FSB, 144 }, |
115 116 /* 11.025k */ | 145 146 /* 11.025k */ |
117 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 118 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_11025, 119 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 1024, WM8750_HIFI_FSB}, 120 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 121 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_11025, 122 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 1536, WM8750_HIFI_FSB}, 123 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 124 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_11025, 125 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 1088, WM8750_HIFI_FSB}, | 147 { 148 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 149 .pcmfmt = WM8750_HIFI_BITS, 150 .pcmrate = SNDRV_PCM_RATE_11025, 151 .pcmdir = WM8750_DIR, 152 .flags = SND_SOC_DAI_BFS_DIV, 153 .fs = 1024, 154 .bfs = WM8750_HIFI_FSB, 155 }, 156 { 157 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 158 .pcmfmt = WM8750_HIFI_BITS, 159 .pcmrate = SNDRV_PCM_RATE_11025, 160 .pcmdir = WM8750_DIR, 161 .flags = SND_SOC_DAI_BFS_DIV, 162 .fs = 1536, 163 .bfs = WM8750_HIFI_FSB, 164 }, 165 { 166 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 167 .pcmfmt = WM8750_HIFI_BITS, 168 .pcmrate = SNDRV_PCM_RATE_11025, 169 .pcmdir = WM8750_DIR, 170 .flags = SND_SOC_DAI_BFS_DIV, 171 .fs = 1088, 172 .bfs = WM8750_HIFI_FSB, 173 }, |
126 127 /* 16k */ | 174 175 /* 16k */ |
128 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 129 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_16000, 130 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 768, WM8750_HIFI_FSB}, 131 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 132 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_16000, 133 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 1152, WM8750_HIFI_FSB}, 134 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 135 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_16000, 136 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 750, WM8750_HIFI_FSB}, | 176 { 177 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 178 .pcmfmt = WM8750_HIFI_BITS, 179 .pcmrate = SNDRV_PCM_RATE_16000, 180 .pcmdir = WM8750_DIR, 181 .flags = SND_SOC_DAI_BFS_DIV, 182 .fs = 768, 183 .bfs = WM8750_HIFI_FSB, 184 }, 185 { 186 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 187 .pcmfmt = WM8750_HIFI_BITS, 188 .pcmrate = SNDRV_PCM_RATE_16000, 189 .pcmdir = WM8750_DIR, 190 .flags = SND_SOC_DAI_BFS_DIV, 191 .fs = 1152, 192 .bfs = WM8750_HIFI_FSB 193 }, 194 { 195 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 196 .pcmfmt = WM8750_HIFI_BITS, 197 .pcmrate = SNDRV_PCM_RATE_16000, 198 .pcmdir = WM8750_DIR, 199 .flags = SND_SOC_DAI_BFS_DIV, 200 .fs = 750, 201 .bfs = WM8750_HIFI_FSB, 202 }, |
137 138 /* 22.05k */ | 203 204 /* 22.05k */ |
139 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 140 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_22050, 141 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 512, WM8750_HIFI_FSB}, 142 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 143 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_22050, 144 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 768, WM8750_HIFI_FSB}, 145 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 146 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_22050, 147 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 544, WM8750_HIFI_FSB}, | 205 { 206 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 207 .pcmfmt = WM8750_HIFI_BITS, 208 .pcmrate = SNDRV_PCM_RATE_22050, 209 .pcmdir = WM8750_DIR, 210 .flags = SND_SOC_DAI_BFS_DIV, 211 .fs = 512, 212 .bfs = WM8750_HIFI_FSB, 213 }, 214 { 215 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 216 .pcmfmt = WM8750_HIFI_BITS, 217 .pcmrate = SNDRV_PCM_RATE_22050, 218 .pcmdir = WM8750_DIR, 219 .flags = SND_SOC_DAI_BFS_DIV, 220 .fs = 768, 221 .bfs = WM8750_HIFI_FSB, 222 }, 223 { 224 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 225 .pcmfmt = WM8750_HIFI_BITS, 226 .pcmrate = SNDRV_PCM_RATE_22050, 227 .pcmdir = WM8750_DIR, 228 .flags = SND_SOC_DAI_BFS_DIV, 229 .fs = 544, 230 .bfs = WM8750_HIFI_FSB, 231 }, |
148 149 /* 32k */ | 232 233 /* 32k */ |
150 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 151 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_16000, 152 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 384, WM8750_HIFI_FSB}, 153 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 154 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_16000, 155 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 576, WM8750_HIFI_FSB}, 156 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 157 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_16000, 158 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 375, WM8750_HIFI_FSB}, | 234 { 235 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 236 .pcmfmt = WM8750_HIFI_BITS, 237 .pcmrate = SNDRV_PCM_RATE_32000, 238 .pcmdir = WM8750_DIR, 239 .flags = SND_SOC_DAI_BFS_DIV, 240 .fs = 384, 241 .bfs = WM8750_HIFI_FSB, 242 }, 243 { 244 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 245 .pcmfmt = WM8750_HIFI_BITS, 246 .pcmrate = SNDRV_PCM_RATE_32000, 247 .pcmdir = WM8750_DIR, 248 .flags = SND_SOC_DAI_BFS_DIV, 249 .fs = 576, 250 .bfs = WM8750_HIFI_FSB, 251 }, 252 { 253 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 254 .pcmfmt = WM8750_HIFI_BITS, 255 .pcmrate = SNDRV_PCM_RATE_32000, 256 .pcmdir = WM8750_DIR, 257 .flags = SND_SOC_DAI_BFS_DIV, 258 .fs = 375, 259 .bfs = WM8750_HIFI_FSB, 260 }, |
159 160 /* 44.1k & 48k */ | 261 262 /* 44.1k & 48k */ |
161 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 162 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_44100 | 163 SNDRV_PCM_RATE_48000, WM8750_DIR, SND_SOC_DAI_BFS_DIV, 256, 164 WM8750_HIFI_FSB}, 165 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 166 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_44100 | 167 SNDRV_PCM_RATE_48000, WM8750_DIR, SND_SOC_DAI_BFS_DIV, 384, 168 WM8750_HIFI_FSB}, 169 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 170 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_44100, 171 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 272, WM8750_HIFI_FSB}, 172 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 173 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_48000, 174 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 250, WM8750_HIFI_FSB}, | 263 { 264 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 265 .pcmfmt = WM8750_HIFI_BITS, 266 .pcmrate = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000, 267 .pcmdir = WM8750_DIR, 268 .flags = SND_SOC_DAI_BFS_DIV, 269 .fs = 256, 270 .bfs = WM8750_HIFI_FSB, 271 }, 272 { 273 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 274 .pcmfmt = WM8750_HIFI_BITS, 275 .pcmrate = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000, 276 .pcmdir = WM8750_DIR, 277 .flags = SND_SOC_DAI_BFS_DIV, 278 .fs = 384, 279 .bfs = WM8750_HIFI_FSB, 280 }, 281 { 282 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 283 .pcmfmt = WM8750_HIFI_BITS, 284 .pcmrate = SNDRV_PCM_RATE_44100, 285 .pcmdir = WM8750_DIR, 286 .flags = SND_SOC_DAI_BFS_DIV, 287 .fs = 272, 288 .bfs = WM8750_HIFI_FSB, 289 }, 290 { 291 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 292 .pcmfmt = WM8750_HIFI_BITS, 293 .pcmrate = SNDRV_PCM_RATE_48000, 294 .pcmdir = WM8750_DIR, 295 .flags = SND_SOC_DAI_BFS_DIV, 296 .fs = 250, 297 .bfs = WM8750_HIFI_FSB, 298 }, |
175 176 /* 88.2k & 96k */ | 299 300 /* 88.2k & 96k */ |
177 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 178 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_88200 | 179 SNDRV_PCM_RATE_96000, WM8750_DIR, SND_SOC_DAI_BFS_DIV, 128, 180 WM8750_HIFI_FSB}, 181 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 182 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_88200 | 183 SNDRV_PCM_RATE_96000, WM8750_DIR, SND_SOC_DAI_BFS_DIV, 192, 184 WM8750_HIFI_FSB}, 185 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 186 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_88200, 187 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 136, WM8750_HIFI_FSB}, 188 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 189 SND_SOC_DAITDM_LRDW(0,0), WM8750_HIFI_BITS, SNDRV_PCM_RATE_96000, 190 WM8750_DIR, SND_SOC_DAI_BFS_DIV, 125, WM8750_HIFI_FSB}, | 301 { 302 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 303 .pcmfmt = WM8750_HIFI_BITS, 304 .pcmrate = SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000, 305 .pcmdir = WM8750_DIR, 306 .flags = SND_SOC_DAI_BFS_DIV, 307 .fs = 128, 308 .bfs = WM8750_HIFI_FSB, 309 }, 310 { 311 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 312 .pcmfmt = WM8750_HIFI_BITS, 313 .pcmrate = SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000, 314 .pcmdir = WM8750_DIR, 315 .flags = SND_SOC_DAI_BFS_DIV, 316 .fs = 192, 317 .bfs = WM8750_HIFI_FSB, 318 }, 319 { 320 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 321 .pcmfmt = WM8750_HIFI_BITS, 322 .pcmrate = SNDRV_PCM_RATE_88200, 323 .pcmdir = WM8750_DIR, 324 .flags = SND_SOC_DAI_BFS_DIV, 325 .fs = 136, 326 .bfs = WM8750_HIFI_FSB, 327 }, 328 { 329 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBM_CFM, 330 .pcmfmt = WM8750_HIFI_BITS, 331 .pcmrate = SNDRV_PCM_RATE_96000, 332 .pcmdir = WM8750_DIR, 333 .flags = SND_SOC_DAI_BFS_DIV, 334 .fs = 125, 335 .bfs = WM8750_HIFI_FSB, 336 }, |
191 192 /* codec frame and clock slave modes */ | 337 338 /* codec frame and clock slave modes */ |
193 {WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBS_CFS, SND_SOC_DAITDM_LRDW(0,0), 194 WM8750_HIFI_BITS, WM8750_HIFI_RATES, WM8750_DIR, 195 SND_SOC_DAI_BFS_DIV, SND_SOC_FS_ALL, SND_SOC_FSBD_ALL}, | 339 { 340 .fmt = WM8750_HIFI_DAIFMT | SND_SOC_DAIFMT_CBS_CFS, 341 .pcmfmt = WM8750_HIFI_BITS, 342 .pcmrate = WM8750_HIFI_RATES, 343 .pcmdir = WM8750_DIR, 344 .flags = SND_SOC_DAI_BFS_DIV, 345 .fs = SND_SOC_FS_ALL, 346 .bfs = SND_SOC_FSBD_ALL, 347 }, |
196}; 197 198/* 199 * read wm8750 register cache 200 */ 201static inline unsigned int wm8750_read_reg_cache(struct snd_soc_codec *codec, 202 unsigned int reg) 203{ --- 928 unchanged lines hidden --- | 348}; 349 350/* 351 * read wm8750 register cache 352 */ 353static inline unsigned int wm8750_read_reg_cache(struct snd_soc_codec *codec, 354 unsigned int reg) 355{ --- 928 unchanged lines hidden --- |