diff mbox

[1/2] ASoC: fsl_sai: Reset FIFOs after disabling TE/RE

Message ID 9ef07dc9cc98b19e3f81f8374617605bf0d9faeb.1405603108.git.nicoleotsuka@gmail.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Nicolin Chen July 17, 2014, 1:21 p.m. UTC
SAI will not clear their FIFOs after disabling TE/RE. Therfore, the driver
should take care the task so as not to let useless data remain in the FIFO.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
---
 sound/soc/fsl/fsl_sai.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Nicolin Chen July 18, 2014, 10:18 a.m. UTC | #1
Mark,

	Please disregard this single patch. 

On Thu, Jul 17, 2014 at 09:21:37PM +0800, Nicolin Chen wrote:
> SAI will not clear their FIFOs after disabling TE/RE. Therfore, the driver
> should take care the task so as not to let useless data remain in the FIFO.
> 
> Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
> ---
>  sound/soc/fsl/fsl_sai.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
> index c5a0e8a..b10dbd8 100644
> --- a/sound/soc/fsl/fsl_sai.c
> +++ b/sound/soc/fsl/fsl_sai.c
> @@ -371,10 +371,13 @@ static int fsl_sai_trigger(struct snd_pcm_substream *substream, int cmd,
>  
>  		/* Check if the opposite FRDE is also disabled */
>  		if (!(tx ? rcsr & FSL_SAI_CSR_FRDE : tcsr & FSL_SAI_CSR_FRDE)) {
> +			/* Disable both directions and reset their FIFOs */
>  			regmap_update_bits(sai->regmap, FSL_SAI_TCSR,
> -					   FSL_SAI_CSR_TERE, 0);
> +					   FSL_SAI_CSR_TERE | FSL_SAI_CSR_FR,
> +					   FSL_SAI_CSR_FR);
>  			regmap_update_bits(sai->regmap, FSL_SAI_RCSR,
> -					   FSL_SAI_CSR_TERE, 0);
> +					   FSL_SAI_CSR_TERE | FSL_SAI_CSR_FR,
> +					   FSL_SAI_CSR_FR);


The FR should be set _after_ clear TERE, not at the same time because it
still may have tiny possibility to remain data.

I'll send another version later for this patch.

The other patch for isr() should be still fine.

Thank you,
Nicolin

>  		}
>  		break;
>  	default:
> -- 
> 1.8.4
>
Nicolin Chen July 23, 2014, 9:52 a.m. UTC | #2
Sir,

I found this two patches are merged into for-next branch, although I haven't
got the 'applied' email. 

Is that possible for you to drop this one? If not, I'll send another patch
to fix this.

Thank you,
Nicolin

On Fri, Jul 18, 2014 at 06:18:12PM +0800, Nicolin Chen wrote:
> Mark,
> 
> 	Please disregard this single patch. 
> 
> On Thu, Jul 17, 2014 at 09:21:37PM +0800, Nicolin Chen wrote:
> > SAI will not clear their FIFOs after disabling TE/RE. Therfore, the driver
> > should take care the task so as not to let useless data remain in the FIFO.
> > 
> > Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
> > ---
> >  sound/soc/fsl/fsl_sai.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
> > index c5a0e8a..b10dbd8 100644
> > --- a/sound/soc/fsl/fsl_sai.c
> > +++ b/sound/soc/fsl/fsl_sai.c
> > @@ -371,10 +371,13 @@ static int fsl_sai_trigger(struct snd_pcm_substream *substream, int cmd,
> >  
> >  		/* Check if the opposite FRDE is also disabled */
> >  		if (!(tx ? rcsr & FSL_SAI_CSR_FRDE : tcsr & FSL_SAI_CSR_FRDE)) {
> > +			/* Disable both directions and reset their FIFOs */
> >  			regmap_update_bits(sai->regmap, FSL_SAI_TCSR,
> > -					   FSL_SAI_CSR_TERE, 0);
> > +					   FSL_SAI_CSR_TERE | FSL_SAI_CSR_FR,
> > +					   FSL_SAI_CSR_FR);
> >  			regmap_update_bits(sai->regmap, FSL_SAI_RCSR,
> > -					   FSL_SAI_CSR_TERE, 0);
> > +					   FSL_SAI_CSR_TERE | FSL_SAI_CSR_FR,
> > +					   FSL_SAI_CSR_FR);
> 
> 
> The FR should be set _after_ clear TERE, not at the same time because it
> still may have tiny possibility to remain data.
> 
> I'll send another version later for this patch.
> 
> The other patch for isr() should be still fine.
> 
> Thank you,
> Nicolin
> 
> >  		}
> >  		break;
> >  	default:
> > -- 
> > 1.8.4
> >
Nicolin Chen July 23, 2014, 9:59 a.m. UTC | #3
On Wed, Jul 23, 2014 at 11:07:46AM +0100, Mark Brown wrote:
> On Wed, Jul 23, 2014 at 05:52:32PM +0800, Nicolin Chen wrote:
> 
> > I found this two patches are merged into for-next branch, although I haven't
> > got the 'applied' email. 
> 
> > Is that possible for you to drop this one? If not, I'll send another patch
> > to fix this.
> 
> Please send a patch, I'd already applied it by the time you asked me to
> drop it.

Got it. Thank you.
Nicolin
Mark Brown July 23, 2014, 10:07 a.m. UTC | #4
On Wed, Jul 23, 2014 at 05:52:32PM +0800, Nicolin Chen wrote:

> I found this two patches are merged into for-next branch, although I haven't
> got the 'applied' email. 

> Is that possible for you to drop this one? If not, I'll send another patch
> to fix this.

Please send a patch, I'd already applied it by the time you asked me to
drop it.
diff mbox

Patch

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index c5a0e8a..b10dbd8 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -371,10 +371,13 @@  static int fsl_sai_trigger(struct snd_pcm_substream *substream, int cmd,
 
 		/* Check if the opposite FRDE is also disabled */
 		if (!(tx ? rcsr & FSL_SAI_CSR_FRDE : tcsr & FSL_SAI_CSR_FRDE)) {
+			/* Disable both directions and reset their FIFOs */
 			regmap_update_bits(sai->regmap, FSL_SAI_TCSR,
-					   FSL_SAI_CSR_TERE, 0);
+					   FSL_SAI_CSR_TERE | FSL_SAI_CSR_FR,
+					   FSL_SAI_CSR_FR);
 			regmap_update_bits(sai->regmap, FSL_SAI_RCSR,
-					   FSL_SAI_CSR_TERE, 0);
+					   FSL_SAI_CSR_TERE | FSL_SAI_CSR_FR,
+					   FSL_SAI_CSR_FR);
 		}
 		break;
 	default: