All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] davinci-mcasp: don't overwrite DIT settings
@ 2013-03-04  9:38 yegorslists
  2013-03-04  9:45 ` Daniel Mack
  0 siblings, 1 reply; 3+ messages in thread
From: yegorslists @ 2013-03-04  9:38 UTC (permalink / raw)
  To: alsa-devel; +Cc: mporter, Yegor Yefremov, vaibhav.bedia, zonque

From: Yegor Yefremov <yegorslists@googlemail.com>

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.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 sound/soc/davinci/davinci-mcasp.c |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 90a9b99..de59075 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -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;
 }
-- 
1.7.7

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] davinci-mcasp: don't overwrite DIT settings
  2013-03-04  9:38 [PATCH] davinci-mcasp: don't overwrite DIT settings yegorslists
@ 2013-03-04  9:45 ` Daniel Mack
  2013-03-04  9:58   ` Yegor Yefremov
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Mack @ 2013-03-04  9:45 UTC (permalink / raw)
  To: yegorslists; +Cc: mporter, alsa-devel, vaibhav.bedia

Hi Yegor,

On 04.03.2013 10:38, yegorslists@googlemail.com wrote:
> From: Yegor Yefremov <yegorslists@googlemail.com>
> 
> 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.
> 
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> ---
>  sound/soc/davinci/davinci-mcasp.c |   27 +++++++++++++++++----------
>  1 files changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
> index 90a9b99..de59075 100644
> --- a/sound/soc/davinci/davinci-mcasp.c
> +++ b/sound/soc/davinci/davinci-mcasp.c
> @@ -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

The indentation is wrong here. Please see Documentation/CodingStyle, or
let scripts/checkpatch.pl have a look :)

> +	{
> +		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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] davinci-mcasp: don't overwrite DIT settings
  2013-03-04  9:45 ` Daniel Mack
@ 2013-03-04  9:58   ` Yegor Yefremov
  0 siblings, 0 replies; 3+ messages in thread
From: Yegor Yefremov @ 2013-03-04  9:58 UTC (permalink / raw)
  To: Daniel Mack; +Cc: Porter, Matt, alsa-devel@alsa-project.org, Vaibhav Bedia

On Mon, Mar 4, 2013 at 10:45 AM, Daniel Mack <zonque@gmail.com> wrote:
> Hi Yegor,
>
> On 04.03.2013 10:38, yegorslists@googlemail.com wrote:
>> From: Yegor Yefremov <yegorslists@googlemail.com>
>>
>> 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.
>>
>> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
>> ---
>>  sound/soc/davinci/davinci-mcasp.c |   27 +++++++++++++++++----------
>>  1 files changed, 17 insertions(+), 10 deletions(-)
>>
>> diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
>> index 90a9b99..de59075 100644
>> --- a/sound/soc/davinci/davinci-mcasp.c
>> +++ b/sound/soc/davinci/davinci-mcasp.c
>> @@ -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
>
> The indentation is wrong here. Please see Documentation/CodingStyle, or
> let scripts/checkpatch.pl have a look :)

Sorry. Forgot about it :-(

>> +     {
>> +             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?


This way it looks much prettier :-)

One can actually remove mask settings from davinci_hw_dit_param().
I'll send a v3.

Yegor

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-04  9:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-04  9:38 [PATCH] davinci-mcasp: don't overwrite DIT settings yegorslists
2013-03-04  9:45 ` Daniel Mack
2013-03-04  9:58   ` Yegor Yefremov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.