All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: fsl_sai: Remove unnecessary FIFO reset in ISR
@ 2022-08-17  5:24 Shengjiu Wang
  2022-08-17  6:20   ` Nicolin Chen
  2022-08-17 17:58   ` Mark Brown
  0 siblings, 2 replies; 11+ messages in thread
From: Shengjiu Wang @ 2022-08-17  5:24 UTC (permalink / raw)
  To: nicoleotsuka, Xiubo.Lee, festevam, shengjiu.wang, lgirdwood,
	broonie, perex, tiwai, alsa-devel
  Cc: linuxppc-dev, linux-kernel

The FIFO reset drops the words in the FIFO, which may cause
channel swap when SAI module is running, especially when the
DMA speed is low. So it is not good to do FIFO reset in ISR,
then remove the operation.

Fixes: e2681a1bf5ae ("ASoC: fsl_sai: Add isr to deal with error flag")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 sound/soc/fsl/fsl_sai.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index d430eece1d6b..a7fa6f0bf83d 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -114,11 +114,8 @@ static irqreturn_t fsl_sai_isr(int irq, void *devid)
 	if (flags & FSL_SAI_CSR_SEF)
 		dev_dbg(dev, "isr: Tx Frame sync error detected\n");
 
-	if (flags & FSL_SAI_CSR_FEF) {
+	if (flags & FSL_SAI_CSR_FEF)
 		dev_dbg(dev, "isr: Transmit underrun detected\n");
-		/* FIFO reset for safety */
-		xcsr |= FSL_SAI_CSR_FR;
-	}
 
 	if (flags & FSL_SAI_CSR_FWF)
 		dev_dbg(dev, "isr: Enabled transmit FIFO is empty\n");
@@ -148,11 +145,8 @@ static irqreturn_t fsl_sai_isr(int irq, void *devid)
 	if (flags & FSL_SAI_CSR_SEF)
 		dev_dbg(dev, "isr: Rx Frame sync error detected\n");
 
-	if (flags & FSL_SAI_CSR_FEF) {
+	if (flags & FSL_SAI_CSR_FEF)
 		dev_dbg(dev, "isr: Receive overflow detected\n");
-		/* FIFO reset for safety */
-		xcsr |= FSL_SAI_CSR_FR;
-	}
 
 	if (flags & FSL_SAI_CSR_FWF)
 		dev_dbg(dev, "isr: Enabled receive FIFO is full\n");
-- 
2.34.1


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

* Re: [PATCH] ASoC: fsl_sai: Remove unnecessary FIFO reset in ISR
  2022-08-17  5:24 [PATCH] ASoC: fsl_sai: Remove unnecessary FIFO reset in ISR Shengjiu Wang
  2022-08-17  6:20   ` Nicolin Chen
@ 2022-08-17  6:20   ` Nicolin Chen
  1 sibling, 0 replies; 11+ messages in thread
From: Nicolin Chen @ 2022-08-17  6:20 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: Xiubo.Lee, festevam, shengjiu.wang, lgirdwood, broonie, perex,
	tiwai, alsa-devel, linuxppc-dev, linux-kernel

On Tue, Aug 16, 2022 at 10:41 PM Shengjiu Wang <shengjiu.wang@nxp.com> wrote:
>
> The FIFO reset drops the words in the FIFO, which may cause
> channel swap when SAI module is running, especially when the
> DMA speed is low. So it is not good to do FIFO reset in ISR,
> then remove the operation.

I don't recall the details of adding this many years ago, but
leaving underrun/overrun errors unhandled does not sound right
to me either. Would it result in a channel swap also? Perhaps
there needs to be a reset routine that stops and restarts the
DMA as well?

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

* Re: [PATCH] ASoC: fsl_sai: Remove unnecessary FIFO reset in ISR
@ 2022-08-17  6:20   ` Nicolin Chen
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolin Chen @ 2022-08-17  6:20 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: alsa-devel, linuxppc-dev, Xiubo.Lee, festevam, tiwai, lgirdwood,
	broonie, shengjiu.wang, linux-kernel

On Tue, Aug 16, 2022 at 10:41 PM Shengjiu Wang <shengjiu.wang@nxp.com> wrote:
>
> The FIFO reset drops the words in the FIFO, which may cause
> channel swap when SAI module is running, especially when the
> DMA speed is low. So it is not good to do FIFO reset in ISR,
> then remove the operation.

I don't recall the details of adding this many years ago, but
leaving underrun/overrun errors unhandled does not sound right
to me either. Would it result in a channel swap also? Perhaps
there needs to be a reset routine that stops and restarts the
DMA as well?

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

* Re: [PATCH] ASoC: fsl_sai: Remove unnecessary FIFO reset in ISR
@ 2022-08-17  6:20   ` Nicolin Chen
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolin Chen @ 2022-08-17  6:20 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: alsa-devel, linuxppc-dev, Xiubo.Lee, festevam, tiwai, lgirdwood,
	perex, broonie, shengjiu.wang, linux-kernel

On Tue, Aug 16, 2022 at 10:41 PM Shengjiu Wang <shengjiu.wang@nxp.com> wrote:
>
> The FIFO reset drops the words in the FIFO, which may cause
> channel swap when SAI module is running, especially when the
> DMA speed is low. So it is not good to do FIFO reset in ISR,
> then remove the operation.

I don't recall the details of adding this many years ago, but
leaving underrun/overrun errors unhandled does not sound right
to me either. Would it result in a channel swap also? Perhaps
there needs to be a reset routine that stops and restarts the
DMA as well?

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

* Re: [PATCH] ASoC: fsl_sai: Remove unnecessary FIFO reset in ISR
  2022-08-17  6:20   ` Nicolin Chen
@ 2022-08-17  6:29     ` Shengjiu Wang
  -1 siblings, 0 replies; 11+ messages in thread
From: Shengjiu Wang @ 2022-08-17  6:29 UTC (permalink / raw)
  To: Nicolin Chen
  Cc: alsa-devel, Xiubo Li, linuxppc-dev, Shengjiu Wang, Takashi Iwai,
	Liam Girdwood, Mark Brown, Fabio Estevam, linux-kernel

On Wed, Aug 17, 2022 at 2:21 PM Nicolin Chen <nicoleotsuka@gmail.com> wrote:

> On Tue, Aug 16, 2022 at 10:41 PM Shengjiu Wang <shengjiu.wang@nxp.com>
> wrote:
> >
> > The FIFO reset drops the words in the FIFO, which may cause
> > channel swap when SAI module is running, especially when the
> > DMA speed is low. So it is not good to do FIFO reset in ISR,
> > then remove the operation.
>
> I don't recall the details of adding this many years ago, but
> leaving underrun/overrun errors unhandled does not sound right
> to me either. Would it result in a channel swap also? Perhaps
> there needs to be a reset routine that stops and restarts the
> DMA as well?
>

Remove the reset, the channel swap is gone.

IMO, no need to handle the underrun/overrun in driver, the SAI
hardware can handle the read/write pointer itself when xrun happen,
and we don't need reset routine.

For ESAI, because it can't handle read/write pointer correctly when
xrun happen, so we need reset routine.

Best regards
Wang shengjiu

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

* Re: [PATCH] ASoC: fsl_sai: Remove unnecessary FIFO reset in ISR
@ 2022-08-17  6:29     ` Shengjiu Wang
  0 siblings, 0 replies; 11+ messages in thread
From: Shengjiu Wang @ 2022-08-17  6:29 UTC (permalink / raw)
  To: Nicolin Chen
  Cc: alsa-devel, Xiubo Li, linuxppc-dev, Shengjiu Wang, Takashi Iwai,
	Liam Girdwood, Jaroslav Kysela, Mark Brown, Fabio Estevam,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]

On Wed, Aug 17, 2022 at 2:21 PM Nicolin Chen <nicoleotsuka@gmail.com> wrote:

> On Tue, Aug 16, 2022 at 10:41 PM Shengjiu Wang <shengjiu.wang@nxp.com>
> wrote:
> >
> > The FIFO reset drops the words in the FIFO, which may cause
> > channel swap when SAI module is running, especially when the
> > DMA speed is low. So it is not good to do FIFO reset in ISR,
> > then remove the operation.
>
> I don't recall the details of adding this many years ago, but
> leaving underrun/overrun errors unhandled does not sound right
> to me either. Would it result in a channel swap also? Perhaps
> there needs to be a reset routine that stops and restarts the
> DMA as well?
>

Remove the reset, the channel swap is gone.

IMO, no need to handle the underrun/overrun in driver, the SAI
hardware can handle the read/write pointer itself when xrun happen,
and we don't need reset routine.

For ESAI, because it can't handle read/write pointer correctly when
xrun happen, so we need reset routine.

Best regards
Wang shengjiu

[-- Attachment #2: Type: text/html, Size: 1596 bytes --]

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

* Re: [PATCH] ASoC: fsl_sai: Remove unnecessary FIFO reset in ISR
  2022-08-17  6:29     ` Shengjiu Wang
  (?)
@ 2022-08-17  6:35       ` Nicolin Chen
  -1 siblings, 0 replies; 11+ messages in thread
From: Nicolin Chen @ 2022-08-17  6:35 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: Shengjiu Wang, Xiubo Li, Fabio Estevam, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, Takashi Iwai, alsa-devel,
	linuxppc-dev, linux-kernel

On Tue, Aug 16, 2022 at 11:29 PM Shengjiu Wang <shengjiu.wang@gmail.com> wrote:

>> > The FIFO reset drops the words in the FIFO, which may cause
>> > channel swap when SAI module is running, especially when the
>> > DMA speed is low. So it is not good to do FIFO reset in ISR,
>> > then remove the operation.
>>
>> I don't recall the details of adding this many years ago, but
>> leaving underrun/overrun errors unhandled does not sound right
>> to me either. Would it result in a channel swap also? Perhaps
>> there needs to be a reset routine that stops and restarts the
>> DMA as well?
>
>
> Remove the reset, the channel swap is gone.

I have no doubt about that :)

> IMO, no need to handle the underrun/overrun in driver, the SAI
> hardware can handle the read/write pointer itself when xrun happen,
> and we don't need reset routine.

That'd be okay then.

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

* Re: [PATCH] ASoC: fsl_sai: Remove unnecessary FIFO reset in ISR
@ 2022-08-17  6:35       ` Nicolin Chen
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolin Chen @ 2022-08-17  6:35 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: alsa-devel, Xiubo Li, linuxppc-dev, Shengjiu Wang, Takashi Iwai,
	Liam Girdwood, Jaroslav Kysela, Mark Brown, Fabio Estevam,
	linux-kernel

On Tue, Aug 16, 2022 at 11:29 PM Shengjiu Wang <shengjiu.wang@gmail.com> wrote:

>> > The FIFO reset drops the words in the FIFO, which may cause
>> > channel swap when SAI module is running, especially when the
>> > DMA speed is low. So it is not good to do FIFO reset in ISR,
>> > then remove the operation.
>>
>> I don't recall the details of adding this many years ago, but
>> leaving underrun/overrun errors unhandled does not sound right
>> to me either. Would it result in a channel swap also? Perhaps
>> there needs to be a reset routine that stops and restarts the
>> DMA as well?
>
>
> Remove the reset, the channel swap is gone.

I have no doubt about that :)

> IMO, no need to handle the underrun/overrun in driver, the SAI
> hardware can handle the read/write pointer itself when xrun happen,
> and we don't need reset routine.

That'd be okay then.

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

* Re: [PATCH] ASoC: fsl_sai: Remove unnecessary FIFO reset in ISR
@ 2022-08-17  6:35       ` Nicolin Chen
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolin Chen @ 2022-08-17  6:35 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: alsa-devel, Xiubo Li, linuxppc-dev, Shengjiu Wang, Takashi Iwai,
	Liam Girdwood, Mark Brown, Fabio Estevam, linux-kernel

On Tue, Aug 16, 2022 at 11:29 PM Shengjiu Wang <shengjiu.wang@gmail.com> wrote:

>> > The FIFO reset drops the words in the FIFO, which may cause
>> > channel swap when SAI module is running, especially when the
>> > DMA speed is low. So it is not good to do FIFO reset in ISR,
>> > then remove the operation.
>>
>> I don't recall the details of adding this many years ago, but
>> leaving underrun/overrun errors unhandled does not sound right
>> to me either. Would it result in a channel swap also? Perhaps
>> there needs to be a reset routine that stops and restarts the
>> DMA as well?
>
>
> Remove the reset, the channel swap is gone.

I have no doubt about that :)

> IMO, no need to handle the underrun/overrun in driver, the SAI
> hardware can handle the read/write pointer itself when xrun happen,
> and we don't need reset routine.

That'd be okay then.

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

* Re: [PATCH] ASoC: fsl_sai: Remove unnecessary FIFO reset in ISR
  2022-08-17  5:24 [PATCH] ASoC: fsl_sai: Remove unnecessary FIFO reset in ISR Shengjiu Wang
@ 2022-08-17 17:58   ` Mark Brown
  2022-08-17 17:58   ` Mark Brown
  1 sibling, 0 replies; 11+ messages in thread
From: Mark Brown @ 2022-08-17 17:58 UTC (permalink / raw)
  To: perex, shengjiu.wang, tiwai, lgirdwood, Shengjiu Wang, festevam,
	Xiubo.Lee, alsa-devel, nicoleotsuka
  Cc: linux-kernel, linuxppc-dev

On Wed, 17 Aug 2022 13:24:27 +0800, Shengjiu Wang wrote:
> The FIFO reset drops the words in the FIFO, which may cause
> channel swap when SAI module is running, especially when the
> DMA speed is low. So it is not good to do FIFO reset in ISR,
> then remove the operation.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: fsl_sai: Remove unnecessary FIFO reset in ISR
      commit: cb225ac125a9c82889f4796a6092dd0bed39720a

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

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

* Re: [PATCH] ASoC: fsl_sai: Remove unnecessary FIFO reset in ISR
@ 2022-08-17 17:58   ` Mark Brown
  0 siblings, 0 replies; 11+ messages in thread
From: Mark Brown @ 2022-08-17 17:58 UTC (permalink / raw)
  To: perex, shengjiu.wang, tiwai, lgirdwood, Shengjiu Wang, festevam,
	Xiubo.Lee, alsa-devel, nicoleotsuka
  Cc: linuxppc-dev, linux-kernel

On Wed, 17 Aug 2022 13:24:27 +0800, Shengjiu Wang wrote:
> The FIFO reset drops the words in the FIFO, which may cause
> channel swap when SAI module is running, especially when the
> DMA speed is low. So it is not good to do FIFO reset in ISR,
> then remove the operation.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: fsl_sai: Remove unnecessary FIFO reset in ISR
      commit: cb225ac125a9c82889f4796a6092dd0bed39720a

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

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

end of thread, other threads:[~2022-08-17 17:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-17  5:24 [PATCH] ASoC: fsl_sai: Remove unnecessary FIFO reset in ISR Shengjiu Wang
2022-08-17  6:20 ` Nicolin Chen
2022-08-17  6:20   ` Nicolin Chen
2022-08-17  6:20   ` Nicolin Chen
2022-08-17  6:29   ` Shengjiu Wang
2022-08-17  6:29     ` Shengjiu Wang
2022-08-17  6:35     ` Nicolin Chen
2022-08-17  6:35       ` Nicolin Chen
2022-08-17  6:35       ` Nicolin Chen
2022-08-17 17:58 ` Mark Brown
2022-08-17 17:58   ` Mark Brown

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.