aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2012-12-05 12:20:38 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-07 00:47:10 -0500
commit1b3bc060fb008ddd75fe60c876c24784a517c10c (patch)
tree5cad74b24aec395aef242745a6c8c9d5a890318b /sound
parentba764b3def0b979fd22884779f1a02f701e3af72 (diff)
ASoC: McASP: implement a way to force BCLK/LRCLK ratios
Depending on the Codec, the the BCLK/LRCLK ratio might not be freely chosen by the CPU DAI. For example, some Codec might want to be supplied with 32-bit samples for both its channels regardless of the actual audio word size the CPU sends. In such cases, the rest of the bits on the data lines must be padded with zeros: _______________________________ LRCLK / \ --' `---------- ..... BCLK ||||||||||||||||||||||||||||||||||||||||||||||| ..... DATA ____||||||||||||||||_________________|||||||||| ..... |<-- data -->|<-- pads --> | This patch adds a new clock divider to configure the BCLK/LRCLK ratio. If the machine code uses that divider, the driver uses the specified value, instead of deriving that information from the audio word size. Otherwise, the original behaviour is retained. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/davinci/davinci-mcasp.c15
-rw-r--r--sound/soc/davinci/davinci-mcasp.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 1b0aac9dbf35..55e2bf652bef 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -593,6 +593,10 @@ static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div
593 ACLKRDIV(div - 1), ACLKRDIV_MASK); 593 ACLKRDIV(div - 1), ACLKRDIV_MASK);
594 break; 594 break;
595 595
596 case 2: /* BCLK/LRCLK ratio */
597 dev->bclk_lrclk_ratio = div;
598 break;
599
596 default: 600 default:
597 return -EINVAL; 601 return -EINVAL;
598 } 602 }
@@ -625,6 +629,17 @@ static int davinci_config_channel_size(struct davinci_audio_dev *dev,
625 u32 rotate = (32 - word_length) / 4; 629 u32 rotate = (32 - word_length) / 4;
626 u32 mask = (1ULL << word_length) - 1; 630 u32 mask = (1ULL << word_length) - 1;
627 631
632 /*
633 * if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv()
634 * callback, take it into account here. That allows us to for example
635 * send 32 bits per channel to the codec, while only 16 of them carry
636 * audio payload.
637 * The clock ratio is given for a full period of data (both left and
638 * right channels), so it has to be divided by 2.
639 */
640 if (dev->bclk_lrclk_ratio)
641 word_length = dev->bclk_lrclk_ratio / 2;
642
628 /* mapping of the XSSZ bit-field as described in the datasheet */ 643 /* mapping of the XSSZ bit-field as described in the datasheet */
629 fmt = (word_length >> 1) - 1; 644 fmt = (word_length >> 1) - 1;
630 645
diff --git a/sound/soc/davinci/davinci-mcasp.h b/sound/soc/davinci/davinci-mcasp.h
index d2449a865fc2..0edd3b5a37fd 100644
--- a/sound/soc/davinci/davinci-mcasp.h
+++ b/sound/soc/davinci/davinci-mcasp.h
@@ -38,6 +38,7 @@ struct davinci_audio_dev {
38 u8 num_serializer; 38 u8 num_serializer;
39 u8 *serial_dir; 39 u8 *serial_dir;
40 u8 version; 40 u8 version;
41 u8 bclk_lrclk_ratio;
41 42
42 /* McASP FIFO related */ 43 /* McASP FIFO related */
43 u8 txnumevt; 44 u8 txnumevt;