aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/sound
diff options
context:
space:
mode:
authorLiam Girdwood <lg@opensource.wolfsonmicro.com>2006-10-19 14:35:56 -0400
committerJaroslav Kysela <perex@suse.cz>2007-02-09 03:01:07 -0500
commita71a468a50f1385855e28864e26251b02df829bb (patch)
tree243daee96ea5c55c88a186aa03b7917f7ad533f6 /Documentation/sound
parent543a0fbe18d0b44f3d037fe6b59458fa0c0d5e4b (diff)
[ALSA] ASoC: Add support for BCLK based on (Rate * Chn * Word Size)
This patch adds support for the DAI BCLK to be generated by multiplying Rate * Channels * Word Size (RCW). This now gives 3 options for BCLK clocking and synchronisation :- 1. BCLK = Rate * x 2. BCLK = MCLK / x 3. BCLK = Rate * Chn * Word Size. (New) Changes:- o Add support for RCW generation of BCLK o Update Documentation to include RCW. o Update DAI documentation for label = value DAI modes. o Add RCW support to wm8731, wm8750 and pxa2xx-i2s drivers. Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'Documentation/sound')
-rw-r--r--Documentation/sound/alsa/soc/DAI.txt358
-rw-r--r--Documentation/sound/alsa/soc/clocking.txt13
2 files changed, 271 insertions, 100 deletions
diff --git a/Documentation/sound/alsa/soc/DAI.txt b/Documentation/sound/alsa/soc/DAI.txt
index 919de76bab8d..251545a88693 100644
--- a/Documentation/sound/alsa/soc/DAI.txt
+++ b/Documentation/sound/alsa/soc/DAI.txt
@@ -12,7 +12,8 @@ The bit clock (BCLK) is always driven by the CODEC (usually 12.288MHz) and the
12frame (FRAME) (usually 48kHz) is always driven by the controller. Each AC97 12frame (FRAME) (usually 48kHz) is always driven by the controller. Each AC97
13frame is 21uS long and is divided into 13 time slots. 13frame is 21uS long and is divided into 13 time slots.
14 14
15The AC97 specification can be found at http://intel.com/ 15The AC97 specification can be found at :-
16http://www.intel.com/design/chipsets/audio/ac97_r23.pdf
16 17
17 18
18I2S 19I2S
@@ -77,16 +78,16 @@ sample rates first and then test your interface.
77struct snd_soc_dai_mode is defined (in soc.h) as:- 78struct snd_soc_dai_mode is defined (in soc.h) as:-
78 79
79/* SoC DAI mode */ 80/* SoC DAI mode */
80struct snd_soc_hw_mode { 81struct snd_soc_dai_mode {
81 unsigned int fmt:16; /* SND_SOC_DAIFMT_* */ 82 u16 fmt; /* SND_SOC_DAIFMT_* */
82 unsigned int tdm:16; /* SND_SOC_DAITDM_* */ 83 u16 tdm; /* SND_SOC_HWTDM_* */
83 unsigned int pcmfmt:6; /* SNDRV_PCM_FORMAT_* */ 84 u64 pcmfmt; /* SNDRV_PCM_FMTBIT_* */
84 unsigned int pcmrate:16; /* SND_SOC_DAIRATE_* */ 85 u16 pcmrate; /* SND_SOC_HWRATE_* */
85 unsigned int pcmdir:2; /* SND_SOC_DAIDIR_* */ 86 u16 pcmdir:2; /* SND_SOC_HWDIR_* */
86 unsigned int flags:8; /* hw flags */ 87 u16 flags:8; /* hw flags */
87 unsigned int fs:32; /* mclk to rate dividers */ 88 u16 fs; /* mclk to rate divider */
88 unsigned int bfs:16; /* mclk to bclk dividers */ 89 u64 bfs; /* mclk to bclk dividers */
89 unsigned long priv; /* private mode data */ 90 unsigned long priv; /* private mode data */
90}; 91};
91 92
92fmt: 93fmt:
@@ -140,14 +141,14 @@ pcmfmt:
140The hardware PCM format. This describes the PCM formats supported by the DAI 141The hardware PCM format. This describes the PCM formats supported by the DAI
141mode e.g. 142mode e.g.
142 143
143 .hwpcmfmt = SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S20_3LE | \ 144 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S20_3LE | \
144 SNDRV_PCM_FORMAT_S24_3LE 145 SNDRV_PCM_FORMAT_S24_3LE
145 146
146pcmrate: 147pcmrate:
147---------- 148----------
148The PCM sample rates supported by the DAI mode. e.g. 149The PCM sample rates supported by the DAI mode. e.g.
149 150
150 .hwpcmrate = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \ 151 .pcmrate = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \
151 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ 152 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
152 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 153 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000
153 154
@@ -161,9 +162,14 @@ flags:
161-------- 162--------
162The DAI hardware flags supported by the mode. 163The DAI hardware flags supported by the mode.
163 164
164SND_SOC_DAI_BFS_DIV 165/* use bfs mclk divider mode (BCLK = MCLK / x) */
165This flag states that bit clock is generated by dividing MCLK in this mode, if 166#define SND_SOC_DAI_BFS_DIV 0x1
166this flag is absent the bitclock generated by mulitiplying sample rate. 167/* use bfs rate mulitplier (BCLK = RATE * x)*/
168#define SND_SOC_DAI_BFS_RATE 0x2
169/* use bfs rcw multiplier (BCLK = RATE * CHN * WORD SIZE) */
170#define SND_SOC_DAI_BFS_RCW 0x4
171/* capture and playback can use different clocks */
172#define SND_SOC_DAI_ASYNC 0x8
167 173
168NOTE: Bitclock division and mulitiplication modes can be safely matched by the 174NOTE: Bitclock division and mulitiplication modes can be safely matched by the
169core logic. 175core logic.
@@ -181,7 +187,7 @@ depends on the codec or CPU DAI).
181 187
182The BFS supported by the DAI mode. This can either be the ratio between the 188The BFS supported by the DAI mode. This can either be the ratio between the
183bitclock (BCLK) and the sample rate OR the ratio between the system clock and 189bitclock (BCLK) and the sample rate OR the ratio between the system clock and
184the sample rate. Depends on the SND_SOC_DAI_BFS_DIV flag above. 190the sample rate. Depends on the flags above.
185 191
186priv: 192priv:
187----- 193-----
@@ -207,10 +213,15 @@ Simple codec that only runs at 8k & 48k @ 256FS in master mode, can generate a
207BCLK of either MCLK/2 or MCLK/4. 213BCLK of either MCLK/2 or MCLK/4.
208 214
209 /* codec master */ 215 /* codec master */
210 {SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM, SND_SOC_DAITDM_LRDW(0,0), 216 {
211 SNDRV_PCM_FORMAT_S16_LE, SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_48000, 217 .fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
212 SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE, SND_SOC_DAI_BFS_DIV, 218 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE,
213 256, SND_SOC_FSBD(2) | SND_SOC_FSBD(4)}, 219 .pcmrate = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_48000,
220 .pcmdir = SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE,
221 .flags = SND_SOC_DAI_BFS_DIV,
222 .fs = 256,
223 .bfs = SND_SOC_FSBD(2) | SND_SOC_FSBD(4),
224 }
214 225
215 226
216Example 2 227Example 2
@@ -219,32 +230,95 @@ Simple codec that only runs at 8k & 48k @ 256FS in master mode, can generate a
219BCLK of either Rate * 32 or Rate * 64. 230BCLK of either Rate * 32 or Rate * 64.
220 231
221 /* codec master */ 232 /* codec master */
222 {SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM, SND_SOC_DAITDM_LRDW(0,0), 233 {
223 SNDRV_PCM_FORMAT_S16_LE, SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_48000, 234 .fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
224 SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE, 0, 235 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE,
225 256, SND_SOC_FSB(32) | SND_SOC_FSB(64)}, 236 .pcmrate = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_48000,
237 .pcmdir = SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE,
238 .flags = SND_SOC_DAI_BFS_RATE,
239 .fs = 256,
240 .bfs = 32,
241 },
242 {
243 .fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
244 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE,
245 .pcmrate = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_48000,
246 .pcmdir = SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE,
247 .flags = SND_SOC_DAI_BFS_RATE,
248 .fs = 256,
249 .bfs = 64,
250 },
226 251
227 252
228Example 3 253Example 3
229--------- 254---------
255Codec that runs at 8k & 48k @ 256FS in master mode, can generate a BCLK that
256is a multiple of Rate * channels * word size. (RCW) i.e.
257
258 BCLK = 8000 * 2 * 16 (8k, stereo, 16bit)
259 = 256kHz
260
261This codecs supports a RCW multiple of 1,2
262
263 {
264 .fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
265 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE,
266 .pcmrate = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_48000,
267 .pcmdir = SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE,
268 .flags = SND_SOC_DAI_BFS_RCW,
269 .fs = 256,
270 .bfs = SND_SOC_FSBW(1) | SND_SOC_FSBW(2),
271 }
272
273
274Example 4
275---------
230Codec that only runs at 8k & 48k @ 256FS in master mode, can generate a 276Codec that only runs at 8k & 48k @ 256FS in master mode, can generate a
231BCLK of either Rate * 32 or Rate * 64. Codec can also run in slave mode as long 277BCLK of either Rate * 32 or Rate * 64. Codec can also run in slave mode as long
232as BCLK is rate * 32 or rate * 64. 278as BCLK is rate * 32 or rate * 64.
233 279
234 /* codec master */ 280 /* codec master */
235 {SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM, SND_SOC_DAITDM_LRDW(0,0), 281 {
236 SNDRV_PCM_FORMAT_S16_LE, SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_48000, 282 .fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
237 SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE, 0, 283 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE,
238 256, SND_SOC_FSB(32) | SND_SOC_FSB(64)}, 284 .pcmrate = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_48000,
285 .pcmdir = SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE,
286 .flags = SND_SOC_DAI_BFS_RATE,
287 .fs = 256,
288 .bfs = 32,
289 },
290 {
291 .fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
292 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE,
293 .pcmrate = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_48000,
294 .pcmdir = SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE,
295 .flags = SND_SOC_DAI_BFS_RATE,
296 .fs = 256,
297 .bfs = 64,
298 },
239 299
240 /* codec slave */ 300 /* codec slave */
241 {SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS, SND_SOC_DAITDM_LRDW(0,0), 301 {
242 SNDRV_PCM_FORMAT_S16_LE, SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_48000, 302 .fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS,
243 SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE, 0, 303 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE,
244 SND_SOC_FS_ALL, SND_SOC_FSB(32) | SND_SOC_FSB(64)}, 304 .pcmdir = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_48000,
305 .pcmdir = SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE,
306 .flags = SND_SOC_DAI_BFS_RATE,
307 .fs = SND_SOC_FS_ALL,
308 .bfs = 32,
309 },
310 {
311 .fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS,
312 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE,
313 .pcmdir = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_48000,
314 .pcmdir = SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE,
315 .flags = SND_SOC_DAI_BFS_RATE,
316 .fs = SND_SOC_FS_ALL,
317 .bfs = 64,
318 },
245 319
246 320
247Example 4 321Example 5
248--------- 322---------
249Codec that only runs at 8k, 16k, 32k, 48k, 96k @ 128FS, 192FS & 256FS in master 323Codec that only runs at 8k, 16k, 32k, 48k, 96k @ 128FS, 192FS & 256FS in master
250mode and can generate a BCLK of MCLK / (1,2,4,8,16). Codec can also run in slave 324mode and can generate a BCLK of MCLK / (1,2,4,8,16). Codec can also run in slave
@@ -259,29 +333,48 @@ mode as and does not care about FS or BCLK (as long as there is enough bandwidth
259 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000) 333 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000)
260 334
261 /* codec master @ 128, 192 & 256 FS */ 335 /* codec master @ 128, 192 & 256 FS */
262 {SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM, SND_SOC_DAITDM_LRDW(0,0), 336 {
263 SNDRV_PCM_FORMAT_S16_LE, CODEC_RATES, 337 .fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
264 SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE, SND_SOC_DAI_BFS_DIV, 338 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE,
265 128, CODEC_FSB}, 339 .pcmrate = CODEC_RATES,
266 340 .pcmdir = SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE,
267 {SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM, SND_SOC_DAITDM_LRDW(0,0), 341 .flags = SND_SOC_DAI_BFS_DIV,
268 SNDRV_PCM_FORMAT_S16_LE, CODEC_RATES, 342 .fs = 128,
269 SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE, SND_SOC_DAI_BFS_DIV, 343 .bfs = CODEC_FSB,
270 192, CODEC_FSB}, 344 },
271 345
272 {SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM, SND_SOC_DAITDM_LRDW(0,0), 346 {
273 SNDRV_PCM_FORMAT_S16_LE, CODEC_RATES, 347 .fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
274 SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE, SND_SOC_DAI_BFS_DIV, 348 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE,
275 256, CODEC_FSB}, 349 .pcmrate = CODEC_RATES,
350 .pcmdir = SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE,
351 .flags = SND_SOC_DAI_BFS_DIV,
352 .fs = 192,
353 .bfs = CODEC_FSB
354 },
355
356 {
357 .fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
358 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE,
359 .pcmrate = CODEC_RATES,
360 .pcmdir = SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE,
361 .flags = SND_SOC_DAI_BFS_DIV,
362 .fs = 256,
363 .bfs = CODEC_FSB,
364 },
276 365
277 /* codec slave */ 366 /* codec slave */
278 {SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS, SND_SOC_DAITDM_LRDW(0,0), 367 {
279 SNDRV_PCM_FORMAT_S16_LE, CODEC_RATES, 368 .fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS,
280 SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE, 0, 369 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE,
281 SND_SOC_FS_ALL, SND_SOC_FSB_ALL}, 370 .pcmrate = CODEC_RATES,
371 .pcmdir = SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE,
372 .fs = SND_SOC_FS_ALL,
373 .bfs = SND_SOC_FSB_ALL,
374 },
282 375
283 376
284Example 5 377Example 6
285--------- 378---------
286Codec that only runs at 8k, 44.1k, 48k @ different FS in master mode (for use 379Codec that only runs at 8k, 44.1k, 48k @ different FS in master mode (for use
287with a fixed MCLK) and can generate a BCLK of MCLK / (1,2,4,8,16). 380with a fixed MCLK) and can generate a BCLK of MCLK / (1,2,4,8,16).
@@ -298,45 +391,66 @@ sizes.
298 SNDRV_PCM_FORMAT_S24_3LE | SNDRV_PCM_FORMAT_S24_LE | SNDRV_PCM_FORMAT_S32_LE) 391 SNDRV_PCM_FORMAT_S24_3LE | SNDRV_PCM_FORMAT_S24_LE | SNDRV_PCM_FORMAT_S32_LE)
299 392
300 /* codec master */ 393 /* codec master */
301 {SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM, SND_SOC_DAITDM_LRDW(0,0), 394 {
302 SNDRV_PCM_FORMAT_S16_LE, SNDRV_PCM_RATE_8000, 395 .fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
303 SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE, SND_SOC_DAI_BFS_DIV, 396 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE,
304 1536, CODEC_FSB}, 397 .pcmrate = SNDRV_PCM_RATE_8000,
305 398 .pcmdir = SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE,
306 {SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM, SND_SOC_DAITDM_LRDW(0,0), 399 .flags = SND_SOC_DAI_BFS_DIV,
307 SNDRV_PCM_FORMAT_S16_LE, SNDRV_PCM_RATE_44100, 400 .fs = 1536,
308 SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE, SND_SOC_DAI_BFS_DIV, 401 .bfs = CODEC_FSB,
309 272, CODEC_FSB}, 402 },
310 403
311 {SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM, SND_SOC_DAITDM_LRDW(0,0), 404 {
312 SNDRV_PCM_FORMAT_S16_LE, SNDRV_PCM_RATE_48000, 405 .fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
313 SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE, SND_SOC_DAI_BFS_DIV, 406 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE,
314 256, CODEC_FSB}, 407 .pcmrate = SNDRV_PCM_RATE_44100,
408 .pcmdir = SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE,
409 .flags = SND_SOC_DAI_BFS_DIV,
410 .fs = 272,
411 .bfs = CODEC_FSB,
412 },
413
414 {
415 .fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
416 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE,
417 .pcmrate = SNDRV_PCM_RATE_48000,
418 .pcmdir = SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE,
419 .flags = SND_SOC_DAI_BFS_DIV,
420 .fs = 256,
421 .bfs = CODEC_FSB,
422 },
315 423
316 /* codec slave */ 424 /* codec slave */
317 {SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS, SND_SOC_DAITDM_LRDW(0,0), 425 {
318 SNDRV_PCM_FORMAT_S16_LE, CODEC_RATES, 426 .fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS,
319 SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE, 0, 427 .pcmfmt = SNDRV_PCM_FORMAT_S16_LE,
320 SND_SOC_FS_ALL, SND_SOC_FSB_ALL}, 428 .pcmrate = CODEC_RATES,
429 .pcmdir = SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE,
430 .fs = SND_SOC_FS_ALL,
431 .bfs = SND_SOC_FSB_ALL,
432 },
321 433
322 434
323Example 6 435Example 7
324--------- 436---------
325AC97 Codec that does not support VRA (i.e only runs at 48k). 437AC97 Codec that does not support VRA (i.e only runs at 48k).
326 438
327 #define AC97_DIR \ 439 #define AC97_DIR \
328 (SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE) 440 (SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE)
329 441
330
331 #define AC97_PCM_FORMATS \ 442 #define AC97_PCM_FORMATS \
332 (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S18_3LE | \ 443 (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S18_3LE | \
333 SNDRV_PCM_FORMAT_S20_3LE) 444 SNDRV_PCM_FORMAT_S20_3LE)
334 445
335 /* AC97 with no VRA */ 446 /* AC97 with no VRA */
336 {0, 0, AC97_PCM_FORMATS, SNDRV_PCM_RATE_48000}, 447 {
448 .pcmfmt = AC97_PCM_FORMATS,
449 .pcmrate = SNDRV_PCM_RATE_48000,
450 }
337 451
338 452
339Example 7 453Example 8
340--------- 454---------
341 455
342CPU DAI that supports 8k - 48k @ 256FS and BCLK = MCLK / 4 in master mode. 456CPU DAI that supports 8k - 48k @ 256FS and BCLK = MCLK / 4 in master mode.
@@ -354,27 +468,79 @@ BCLK = 64 * rate. (Intel XScale I2S controller).
354 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ 468 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
355 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) 469 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
356 470
471 /* priv is divider */
472 static struct snd_soc_dai_mode pxa2xx_i2s_modes[] = {
357 /* pxa2xx I2S frame and clock master modes */ 473 /* pxa2xx I2S frame and clock master modes */
358 {PXA_I2S_DAIFMT | SND_SOC_DAIFMT_CBS_CFS, SND_SOC_DAITDM_LRDW(0,0), SNDRV_PCM_FORMAT_S16_LE, 474 {
359 SNDRV_PCM_RATE_8000, PXA_I2S_DIR, SND_SOC_DAI_BFS_DIV, 256, 475 .fmt = PXA_I2S_DAIFMT | SND_SOC_DAIFMT_CBS_CFS,
360 SND_SOC_FSBD(4), 0x48}, 476 .pcmfmt = SNDRV_PCM_FMTBIT_S16_LE,
361 {PXA_I2S_DAIFMT | SND_SOC_DAIFMT_CBS_CFS, SND_SOC_DAITDM_LRDW(0,0), SNDRV_PCM_FORMAT_S16_LE, 477 .pcmrate = SNDRV_PCM_RATE_8000,
362 SNDRV_PCM_RATE_11025, PXA_I2S_DIR, SND_SOC_DAI_BFS_DIV, 256, 478 .pcmdir = PXA_I2S_DIR,
363 SND_SOC_FSBD(4), 0x34}, 479 .flags = SND_SOC_DAI_BFS_DIV,
364 {PXA_I2S_DAIFMT | SND_SOC_DAIFMT_CBS_CFS, SND_SOC_DAITDM_LRDW(0,0), SNDRV_PCM_FORMAT_S16_LE, 480 .fs = 256,
365 SNDRV_PCM_RATE_16000, PXA_I2S_DIR, SND_SOC_DAI_BFS_DIV, 256, 481 .bfs = SND_SOC_FSBD(4),
366 SND_SOC_FSBD(4), 0x24}, 482 .priv = 0x48,
367 {PXA_I2S_DAIFMT | SND_SOC_DAIFMT_CBS_CFS, SND_SOC_DAITDM_LRDW(0,0), SNDRV_PCM_FORMAT_S16_LE, 483 },
368 SNDRV_PCM_RATE_22050, PXA_I2S_DIR, SND_SOC_DAI_BFS_DIV, 256, 484 {
369 SND_SOC_FSBD(4), 0x1a}, 485 .fmt = PXA_I2S_DAIFMT | SND_SOC_DAIFMT_CBS_CFS,
370 {PXA_I2S_DAIFMT | SND_SOC_DAIFMT_CBS_CFS, SND_SOC_DAITDM_LRDW(0,0), SNDRV_PCM_FORMAT_S16_LE, 486 .pcmfmt = SNDRV_PCM_FMTBIT_S16_LE,
371 SNDRV_PCM_RATE_44100, PXA_I2S_DIR, SND_SOC_DAI_BFS_DIV, 256, 487 .pcmrate = SNDRV_PCM_RATE_11025,
372 SND_SOC_FSBD(4), 0xd}, 488 .pcmdir = PXA_I2S_DIR,
373 {PXA_I2S_DAIFMT | SND_SOC_DAIFMT_CBS_CFS, SND_SOC_DAITDM_LRDW(0,0), SNDRV_PCM_FORMAT_S16_LE, 489 .flags = SND_SOC_DAI_BFS_DIV,
374 SNDRV_PCM_RATE_48000, PXA_I2S_DIR, SND_SOC_DAI_BFS_DIV, 256, 490 .fs = 256,
375 SND_SOC_FSBD(4), 0xc}, 491 .bfs = SND_SOC_FSBD(4),
492 .priv = 0x34,
493 },
494 {
495 .fmt = PXA_I2S_DAIFMT | SND_SOC_DAIFMT_CBS_CFS,
496 .pcmfmt = SNDRV_PCM_FMTBIT_S16_LE,
497 .pcmrate = SNDRV_PCM_RATE_16000,
498 .pcmdir = PXA_I2S_DIR,
499 .flags = SND_SOC_DAI_BFS_DIV,
500 .fs = 256,
501 .bfs = SND_SOC_FSBD(4),
502 .priv = 0x24,
503 },
504 {
505 .fmt = PXA_I2S_DAIFMT | SND_SOC_DAIFMT_CBS_CFS,
506 .pcmfmt = SNDRV_PCM_FMTBIT_S16_LE,
507 .pcmrate = SNDRV_PCM_RATE_22050,
508 .pcmdir = PXA_I2S_DIR,
509 .flags = SND_SOC_DAI_BFS_DIV,
510 .fs = 256,
511 .bfs = SND_SOC_FSBD(4),
512 .priv = 0x1a,
513 },
514 {
515 .fmt = PXA_I2S_DAIFMT | SND_SOC_DAIFMT_CBS_CFS,
516 .pcmfmt = SNDRV_PCM_FMTBIT_S16_LE,
517 .pcmrate = SNDRV_PCM_RATE_44100,
518 .pcmdir = PXA_I2S_DIR,
519 .flags = SND_SOC_DAI_BFS_DIV,
520 .fs = 256,
521 .bfs = SND_SOC_FSBD(4),
522 .priv = 0xd,
523 },
524 {
525 .fmt = PXA_I2S_DAIFMT | SND_SOC_DAIFMT_CBS_CFS,
526 .pcmfmt = SNDRV_PCM_FMTBIT_S16_LE,
527 .pcmrate = SNDRV_PCM_RATE_48000,
528 .pcmdir = PXA_I2S_DIR,
529 .flags = SND_SOC_DAI_BFS_DIV,
530 .fs = 256,
531 .bfs = SND_SOC_FSBD(4),
532 .priv = 0xc,
533 },
376 534
377 /* pxa2xx I2S frame master and clock slave mode */ 535 /* pxa2xx I2S frame master and clock slave mode */
378 {PXA_I2S_DAIFMT | SND_SOC_DAIFMT_CBM_CFS, SND_SOC_DAITDM_LRDW(0,0), SNDRV_PCM_FORMAT_S16_LE, 536 {
379 PXA_I2S_RATES, PXA_I2S_DIR, 0, SND_SOC_FS_ALL, SND_SOC_FSB(64)}, 537 .fmt = PXA_I2S_DAIFMT | SND_SOC_DAIFMT_CBM_CFS,
380 538 .pcmfmt = SNDRV_PCM_FMTBIT_S16_LE,
539 .pcmrate = PXA_I2S_RATES,
540 .pcmdir = PXA_I2S_DIR,
541 .fs = SND_SOC_FS_ALL,
542 .flags = SND_SOC_DAI_BFS_RATE,
543 .bfs = 64,
544 .priv = 0x48,
545 },
546};
diff --git a/Documentation/sound/alsa/soc/clocking.txt b/Documentation/sound/alsa/soc/clocking.txt
index 88a16c9e1979..1f55fd8cb117 100644
--- a/Documentation/sound/alsa/soc/clocking.txt
+++ b/Documentation/sound/alsa/soc/clocking.txt
@@ -26,9 +26,9 @@ between the codec and CPU.
26 26
27The DAI also has a frame clock to signal the start of each audio frame. This 27The DAI also has a frame clock to signal the start of each audio frame. This
28clock is sometimes referred to as LRC (left right clock) or FRAME. This clock 28clock is sometimes referred to as LRC (left right clock) or FRAME. This clock
29runs at exactly the sample rate. 29runs at exactly the sample rate (LRC = Rate).
30 30
31Bit Clock is usually always a ratio of MCLK or a multiple of LRC. i.e. 31Bit Clock can be generated as follows:-
32 32
33BCLK = MCLK / x 33BCLK = MCLK / x
34 34
@@ -36,9 +36,14 @@ BCLK = MCLK / x
36 36
37BCLK = LRC * x 37BCLK = LRC * x
38 38
39 or
40
41BCLK = LRC * Channels * Word Size
42
39This relationship depends on the codec or SoC CPU in particular. ASoC can quite 43This relationship depends on the codec or SoC CPU in particular. ASoC can quite
40easily match a codec that generates BCLK by division (FSBD) with a CPU that 44easily match BCLK generated by division (SND_SOC_DAI_BFS_DIV) with BCLK by
41generates BCLK by multiplication (FSB). 45multiplication (SND_SOC_DAI_BFS_RATE) or BCLK generated by
46Rate * Channels * Word size (RCW or SND_SOC_DAI_BFS_RCW).
42 47
43 48
44ASoC Clocking 49ASoC Clocking