]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/kernel-audio.git/commitdiff
ASoC: davinci-mcasp: Fix receive right-rotation value
authorMisael Lopez Cruz <misael.lopez@ti.com>
Fri, 28 Jun 2013 06:31:19 +0000 (01:31 -0500)
committerMisael Lopez Cruz <misael.lopez@ti.com>
Mon, 22 Jul 2013 19:43:20 +0000 (14:43 -0500)
Receive right-rotation (RROT) for I2S/TDM falls in the MSB-first,
left-aligned streams whose suggested rotation value is slot size -
word size.

Change-Id: I53ac6a0a9c02cf78cc4a2f37c34b6dbc4f9a0bcc
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
sound/soc/davinci/davinci-mcasp.c

index 0072cfa26818420439cc3c95c68bfabdbd9ce08f..818732de0f750808db3905bcf3ae93feccc3a01f 100644 (file)
@@ -667,8 +667,9 @@ static int davinci_config_channel_size(struct davinci_audio_dev *dev,
 {
        u32 fmt;
        u32 tx_rotate = (word_length / 4) & 0x7;
-       u32 rx_rotate = (32 - word_length) / 4;
+       u32 rx_rotate;
        u32 mask = (1ULL << word_length) - 1;
+       u32 slot_length;
 
        /*
         * if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv()
@@ -680,10 +681,14 @@ static int davinci_config_channel_size(struct davinci_audio_dev *dev,
         * tdm-slots (for I2S - divided by 2).
         */
        if (dev->bclk_lrclk_ratio)
-               word_length = dev->bclk_lrclk_ratio / dev->tdm_slots;
+               slot_length = dev->bclk_lrclk_ratio / dev->tdm_slots;
+       else
+               slot_length = word_length;
 
        /* mapping of the XSSZ bit-field as described in the datasheet */
-       fmt = (word_length >> 1) - 1;
+       fmt = (slot_length >> 1) - 1;
+
+       rx_rotate = (slot_length - word_length) / 4;
 
        if (dev->op_mode != DAVINCI_MCASP_DIT_MODE) {
                mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMT_REG,