davinci-mcasp: don't overwrite DIT settings
PATCH 1/1 davinci-mcasp: don't overwrite DIT settings
From: Yegor Yefremov <[email protected]>
Channel size settings will be made at the end of davinci_mcasp_hw_params() routine and thus overwrite frame format settings made for DIT mode. This patch fixes this issue by taking op_mode into account. Tested with official PSP 3.2 kernel and sii9022a HDMI transmitter.
--- sound/soc/davinci/davinci-mcasp.c | 27 +++++++++++++++++---------- 1 files changed, 17 insertions(+), 10 deletions(-)
sound/soc/davinci/davinci-mcasp.c +17 -10
@@ -643,16 +643,23 @@ static int davinci_config_channel_size(struct davinci_audio_dev *dev,/* mapping of the XSSZ bit-field as described in the datasheet */ fmt = (word_length >>1 ) -1 ; -mcasp_mod_bits (dev->base +DAVINCI_MCASP_RXFMT_REG , -RXSSZ (fmt),RXSSZ (0x0F )); -mcasp_mod_bits (dev->base +DAVINCI_MCASP_TXFMT_REG , -TXSSZ (fmt),TXSSZ (0x0F )); -mcasp_mod_bits (dev->base +DAVINCI_MCASP_TXFMT_REG ,TXROT (rotate), -TXROT (7 )); -mcasp_mod_bits (dev->base +DAVINCI_MCASP_RXFMT_REG ,RXROT (rotate), -RXROT (7 )); -mcasp_set_reg (dev->base +DAVINCI_MCASP_TXMASK_REG , mask); -mcasp_set_reg (dev->base +DAVINCI_MCASP_RXMASK_REG , mask); +if (dev->op_mode ==DAVINCI_MCASP_DIT_MODE ) + { +mcasp_set_reg (dev->base +DAVINCI_MCASP_TXMASK_REG , mask); + } +else + { +mcasp_mod_bits (dev->base +DAVINCI_MCASP_RXFMT_REG , +RXSSZ (fmt),RXSSZ (0x0F )); +mcasp_mod_bits (dev->base +DAVINCI_MCASP_TXFMT_REG , +TXSSZ (fmt),TXSSZ (0x0F )); +mcasp_mod_bits (dev->base +DAVINCI_MCASP_TXFMT_REG ,TXROT (rotate), +TXROT (7 )); +mcasp_mod_bits (dev->base +DAVINCI_MCASP_RXFMT_REG ,RXROT (rotate), +RXROT (7 )); +mcasp_set_reg (dev->base +DAVINCI_MCASP_TXMASK_REG , mask); +mcasp_set_reg (dev->base +DAVINCI_MCASP_RXMASK_REG , mask); + }return 0 ; }
Signature · 1 line
1.7.7
Hi Yegor,
Quoted 26 lines · On 04.03.2013 10:38, [email protected] wrote:
From: Yegor Yefremov <[email protected]>
Channel size settings will be made at the end of
davinci_mcasp_hw_params()routine and thus overwrite frame format settings made for DIT mode. This patch fixes this issue by takingop_modeinto account. Tested with official PSP 3.2 kernel and sii9022a HDMI transmitter.Signed-off-by Yegor Yefremov <[email protected]>--- sound/soc/davinci/davinci-mcasp.c | 27 +++++++++++++++++---------- 1 files changed, 17 insertions(+), 10 deletions(-)sound/soc/davinci/davinci-mcasp.c +0
-5@@ -643,16 +643,23 @@ static int davinci_config_channel_size(struct davinci_audio_dev *dev,/* mapping of the XSSZ bit-field as described in the datasheet */ fmt = (word_length >>1 ) -1 ; -mcasp_mod_bits (dev->base +DAVINCI_MCASP_RXFMT_REG , -RXSSZ (fmt),RXSSZ (0x0F )); -mcasp_mod_bits (dev->base +DAVINCI_MCASP_TXFMT_REG , -TXSSZ (fmt),TXSSZ (0x0F )); - mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXROT(rotate),
sound/soc/davinci/davinci-mcasp.c static int davinci_config_channel_size(struct davinci_audio_dev *dev, · line 650
Quoted 10 lines
sound/soc/davinci/davinci-mcasp.c +5
-5- TXROT(7)); -mcasp_mod_bits (dev->base +DAVINCI_MCASP_RXFMT_REG ,RXROT (rotate), -RXROT (7 )); -mcasp_set_reg (dev->base +DAVINCI_MCASP_TXMASK_REG , mask); -mcasp_set_reg (dev->base +DAVINCI_MCASP_RXMASK_REG , mask); +if (dev->op_mode ==DAVINCI_MCASP_DIT_MODE ) + { +mcasp_set_reg (dev->base +DAVINCI_MCASP_TXMASK_REG , mask); + } +else
The indentation is wrong here. Please see Documentation/CodingStyle, or let scripts/checkpatch.pl have a look :)
sound/soc/davinci/davinci-mcasp.c static int davinci_config_channel_size(struct davinci_audio_dev *dev, · line 660
Quoted 10 lines
sound/soc/davinci/davinci-mcasp.c +10
-0+ { +mcasp_mod_bits (dev->base +DAVINCI_MCASP_RXFMT_REG , +RXSSZ (fmt),RXSSZ (0x0F )); +mcasp_mod_bits (dev->base +DAVINCI_MCASP_TXFMT_REG , +TXSSZ (fmt),TXSSZ (0x0F )); +mcasp_mod_bits (dev->base +DAVINCI_MCASP_TXFMT_REG ,TXROT (rotate), +TXROT (7 )); +mcasp_mod_bits (dev->base +DAVINCI_MCASP_RXFMT_REG ,RXROT (rotate), +RXROT (7 )); +mcasp_set_reg (dev->base +DAVINCI_MCASP_TXMASK_REG , mask);
As you do the same thing with the DAVINCI_MCASP_TXMASK_REG here as in the branch above, you can as well pull it out of the if-block and invert the condition, right?
Thanks,
Daniel
Quoted 34 lines · Daniel Mack
Hi Yegor,
Quoted 31 lines · On 04.03.2013 10:38, [email protected] wrote:
From: Yegor Yefremov <[email protected]>
Channel size settings will be made at the end of
davinci_mcasp_hw_params()routine and thus overwrite frame format settings made for DIT mode. This patch fixes this issue by takingop_modeinto account. Tested with official PSP 3.2 kernel and sii9022a HDMI transmitter.Signed-off-by Yegor Yefremov <[email protected]>--- sound/soc/davinci/davinci-mcasp.c | 27 +++++++++++++++++---------- 1 files changed, 17 insertions(+), 10 deletions(-)sound/soc/davinci/davinci-mcasp.c +0
-10@@ -643,16 +643,23 @@ static int davinci_config_channel_size(struct davinci_audio_dev *dev,/* mapping of the XSSZ bit-field as described in the datasheet */ fmt = (word_length >>1 ) -1 ; -mcasp_mod_bits (dev->base +DAVINCI_MCASP_RXFMT_REG , -RXSSZ (fmt),RXSSZ (0x0F )); -mcasp_mod_bits (dev->base +DAVINCI_MCASP_TXFMT_REG , -TXSSZ (fmt),TXSSZ (0x0F )); -mcasp_mod_bits (dev->base +DAVINCI_MCASP_TXFMT_REG ,TXROT (rotate), -TXROT (7 )); -mcasp_mod_bits (dev->base +DAVINCI_MCASP_RXFMT_REG ,RXROT (rotate), -RXROT (7 )); -mcasp_set_reg (dev->base +DAVINCI_MCASP_TXMASK_REG , mask); -mcasp_set_reg (dev->base +DAVINCI_MCASP_RXMASK_REG , mask);
Quoted 8 lines
sound/soc/davinci/davinci-mcasp.c static int davinci_config_channel_size(struct davinci_audio_dev *dev, · line 650
Quoted 5 lines
sound/soc/davinci/davinci-mcasp.c +5
-0+if (dev->op_mode ==DAVINCI_MCASP_DIT_MODE ) + { +mcasp_set_reg (dev->base +DAVINCI_MCASP_TXMASK_REG , mask); + } +else The indentation is wrong here. Please see
Documentation/CodingStyle, or letscripts/checkpatch.plhave a look :)
Sorry. Forgot about it :-(
Quoted 11 lines
sound/soc/davinci/davinci-mcasp.c static int davinci_config_channel_size(struct davinci_audio_dev *dev, · line 660
Quoted 10 lines
sound/soc/davinci/davinci-mcasp.c +10
-0+ { +mcasp_mod_bits (dev->base +DAVINCI_MCASP_RXFMT_REG , +RXSSZ (fmt),RXSSZ (0x0F )); +mcasp_mod_bits (dev->base +DAVINCI_MCASP_TXFMT_REG , +TXSSZ (fmt),TXSSZ (0x0F )); +mcasp_mod_bits (dev->base +DAVINCI_MCASP_TXFMT_REG ,TXROT (rotate), +TXROT (7 )); +mcasp_mod_bits (dev->base +DAVINCI_MCASP_RXFMT_REG ,RXROT (rotate), +RXROT (7 )); +mcasp_set_reg (dev->base +DAVINCI_MCASP_TXMASK_REG , mask);
Quoted 3 lines
As you do the same thing with the
DAVINCI_MCASP_TXMASK_REGhere as in the branch above, you can as well pull it out of the if-block and invert the condition, right?
This way it looks much prettier :-)
One can actually remove mask settings from davinci_hw_dit_param(). I'll send a v3.
Yegor