diff mbox

[6/6] ASoC: fsl_ssi: adjust set DAI format in AC'97 mode

Message ID 55BA364E.1000803@maciej.szmigiero.name (mailing list archive)
State New, archived
Headers show

Commit Message

Maciej S. Szmigiero July 30, 2015, 2:35 p.m. UTC
Adjust set DAI format function in fsl_ssi driver so it
doesn't fail and clears RXDIR in AC'97 mode.

Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>
---
 sound/soc/fsl/fsl_ssi.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

Comments

Markus Pargmann July 31, 2015, 5:58 a.m. UTC | #1
On Thu, Jul 30, 2015 at 04:35:58PM +0200, Maciej S. Szmigiero wrote:
> Adjust set DAI format function in fsl_ssi driver so it
> doesn't fail and clears RXDIR in AC'97 mode.
> 
> Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>
> ---
>  sound/soc/fsl/fsl_ssi.c |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
> index 8e5ff5e..37aabe3 100644
> --- a/sound/soc/fsl/fsl_ssi.c
> +++ b/sound/soc/fsl/fsl_ssi.c
> @@ -900,14 +900,16 @@ static int _fsl_ssi_set_dai_fmt(struct device *dev,
>  		scr &= ~CCSR_SSI_SCR_SYS_CLK_EN;
>  		break;
>  	default:
> -		return -EINVAL;
> +		if (!fsl_ssi_is_ac97(ssi_private))
> +			return -EINVAL;

I think it would be better to add another case for the other mode which
is supported (AC97) instead of using the default case.

>  	}
>  
>  	stcr |= strcr;
>  	srcr |= strcr;
>  
> -	if (ssi_private->cpu_dai_drv.symmetric_rates) {
> -		/* Need to clear RXDIR when using SYNC mode */
> +	if (ssi_private->cpu_dai_drv.symmetric_rates
> +		|| fsl_ssi_is_ac97(ssi_private)) {

Please fix this indention. Most of the driver is written with 2 tab
indention after a line break and the new policy seems to be to indent on
the opening bracket.

Regards,

Markus

> +		/* Need to clear RXDIR when using SYNC or AC97 mode */
>  		srcr &= ~CCSR_SSI_SRCR_RXDIR;
>  		scr |= CCSR_SSI_SCR_SYN;
>  	}
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
Maciej S. Szmigiero July 31, 2015, 3:13 p.m. UTC | #2
On 31.07.2015 07:58, Markus Pargmann wrote:
> On Thu, Jul 30, 2015 at 04:35:58PM +0200, Maciej S. Szmigiero wrote:
>> Adjust set DAI format function in fsl_ssi driver so it
>> doesn't fail and clears RXDIR in AC'97 mode.
>>
>> Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>
>> ---
>>  sound/soc/fsl/fsl_ssi.c |    8 +++++---
>>  1 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
>> index 8e5ff5e..37aabe3 100644
>> --- a/sound/soc/fsl/fsl_ssi.c
>> +++ b/sound/soc/fsl/fsl_ssi.c
>> @@ -900,14 +900,16 @@ static int _fsl_ssi_set_dai_fmt(struct device *dev,
>>  		scr &= ~CCSR_SSI_SCR_SYS_CLK_EN;
>>  		break;
>>  	default:
>> -		return -EINVAL;
>> +		if (!fsl_ssi_is_ac97(ssi_private))
>> +			return -EINVAL;
> 
> I think it would be better to add another case for the other mode which
> is supported (AC97) instead of using the default case.

This is a switch of DAI clock masters and AC'97 is none of them:
while "case 0:" can be added this would be very similar to the current code.

Alternatively, the whole switch statement could be wrapped inside
"if (!fsl_ssi_is_ac97(ssi_private))" if that would be better
with regards to code style.

>>  	}
>>  
>>  	stcr |= strcr;
>>  	srcr |= strcr;
>>  
>> -	if (ssi_private->cpu_dai_drv.symmetric_rates) {
>> -		/* Need to clear RXDIR when using SYNC mode */
>> +	if (ssi_private->cpu_dai_drv.symmetric_rates
>> +		|| fsl_ssi_is_ac97(ssi_private)) {
> 
> Please fix this indention. Most of the driver is written with 2 tab
> indention after a line break and the new policy seems to be to indent on
> the opening bracket.

Will reindent this.

> 
> Regards,
> 
> Markus

Best regards,
Maciej Szmigiero
Markus Pargmann Aug. 2, 2015, 6:51 p.m. UTC | #3
On Fri, Jul 31, 2015 at 05:13:06PM +0200, Maciej S. Szmigiero wrote:
> On 31.07.2015 07:58, Markus Pargmann wrote:
> > On Thu, Jul 30, 2015 at 04:35:58PM +0200, Maciej S. Szmigiero wrote:
> >> Adjust set DAI format function in fsl_ssi driver so it
> >> doesn't fail and clears RXDIR in AC'97 mode.
> >>
> >> Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>
> >> ---
> >>  sound/soc/fsl/fsl_ssi.c |    8 +++++---
> >>  1 files changed, 5 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
> >> index 8e5ff5e..37aabe3 100644
> >> --- a/sound/soc/fsl/fsl_ssi.c
> >> +++ b/sound/soc/fsl/fsl_ssi.c
> >> @@ -900,14 +900,16 @@ static int _fsl_ssi_set_dai_fmt(struct device *dev,
> >>  		scr &= ~CCSR_SSI_SCR_SYS_CLK_EN;
> >>  		break;
> >>  	default:
> >> -		return -EINVAL;
> >> +		if (!fsl_ssi_is_ac97(ssi_private))
> >> +			return -EINVAL;
> > 
> > I think it would be better to add another case for the other mode which
> > is supported (AC97) instead of using the default case.
> 
> This is a switch of DAI clock masters and AC'97 is none of them:
> while "case 0:" can be added this would be very similar to the current code.
> 
> Alternatively, the whole switch statement could be wrapped inside
> "if (!fsl_ssi_is_ac97(ssi_private))" if that would be better
> with regards to code style.

I looked at the wrong switch/case the DAIFMT_AC97 is actually used
but this patch is about the master clocks. It's fine then.

Thanks,

Markus

> 
> >>  	}
> >>  
> >>  	stcr |= strcr;
> >>  	srcr |= strcr;
> >>  
> >> -	if (ssi_private->cpu_dai_drv.symmetric_rates) {
> >> -		/* Need to clear RXDIR when using SYNC mode */
> >> +	if (ssi_private->cpu_dai_drv.symmetric_rates
> >> +		|| fsl_ssi_is_ac97(ssi_private)) {
> > 
> > Please fix this indention. Most of the driver is written with 2 tab
> > indention after a line break and the new policy seems to be to indent on
> > the opening bracket.
> 
> Will reindent this.
> 
> > 
> > Regards,
> > 
> > Markus
> 
> Best regards,
> Maciej Szmigiero
> 
>
diff mbox

Patch

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 8e5ff5e..37aabe3 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -900,14 +900,16 @@  static int _fsl_ssi_set_dai_fmt(struct device *dev,
 		scr &= ~CCSR_SSI_SCR_SYS_CLK_EN;
 		break;
 	default:
-		return -EINVAL;
+		if (!fsl_ssi_is_ac97(ssi_private))
+			return -EINVAL;
 	}
 
 	stcr |= strcr;
 	srcr |= strcr;
 
-	if (ssi_private->cpu_dai_drv.symmetric_rates) {
-		/* Need to clear RXDIR when using SYNC mode */
+	if (ssi_private->cpu_dai_drv.symmetric_rates
+		|| fsl_ssi_is_ac97(ssi_private)) {
+		/* Need to clear RXDIR when using SYNC or AC97 mode */
 		srcr &= ~CCSR_SSI_SRCR_RXDIR;
 		scr |= CCSR_SSI_SCR_SYN;
 	}