[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D0F6E958E@AcuExch.aculab.com>
Date: Wed, 26 Mar 2014 11:59:53 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Nicolin Chen' <Guangyu.Chen@...escale.com>,
"broonie@...nel.org" <broonie@...nel.org>,
"Li.Xiubo@...escale.com" <Li.Xiubo@...escale.com>
CC: "alsa-devel@...a-project.org" <alsa-devel@...a-project.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] ASoC: fsl_sai: Add isr to deal with error flag
From: Nicolin Chen
> It's quite cricial to clear error flags because SAI might hang if getting
> FIFO underrun during playback (I haven't confirmed the same issue on Rx
> overflow though).
>
> So this patch enables those irq and adds isr() to clear the flags so as to
> keep playback entirely safe.
>
> Signed-off-by: Nicolin Chen <Guangyu.Chen@...escale.com>
> ---
> sound/soc/fsl/fsl_sai.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++---
> sound/soc/fsl/fsl_sai.h | 9 +++++++
> 2 files changed, 75 insertions(+), 3 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
> index c4a4231..5f91aff 100644
> --- a/sound/soc/fsl/fsl_sai.c
> +++ b/sound/soc/fsl/fsl_sai.c
> @@ -23,6 +23,55 @@
>
> #include "fsl_sai.h"
>
> +#define FSL_SAI_FLAGS (FSL_SAI_CSR_SEIE |\
> + FSL_SAI_CSR_FEIE |\
> + FSL_SAI_CSR_FWIE)
> +
> +static irqreturn_t fsl_sai_isr(int irq, void *devid)
> +{
> + struct fsl_sai *sai = (struct fsl_sai *)devid;
> + struct device *dev = &sai->pdev->dev;
> + u32 xcsr;
> +
> + regmap_read(sai->regmap, FSL_SAI_TCSR, &xcsr);
> + regmap_write(sai->regmap, FSL_SAI_TCSR, xcsr);
Assuming these are 'write to clear' bits, you might want
to make the write (above) and all the traces (below)
conditional on the value being non-zero.
> + if (xcsr & FSL_SAI_CSR_WSF)
> + dev_dbg(dev, "isr: Start of Tx word detected\n");
> +
> + if (xcsr & FSL_SAI_CSR_SEF)
> + dev_dbg(dev, "isr: Tx Frame sync error detected\n");
> +
> + if (xcsr & FSL_SAI_CSR_FEF)
> + dev_dbg(dev, "isr: Transmit underrun detected\n");
> +
> + if (xcsr & FSL_SAI_CSR_FWF)
> + dev_dbg(dev, "isr: Enabled transmit FIFO is empty\n");
> +
> + if (xcsr & FSL_SAI_CSR_FRF)
> + dev_dbg(dev, "isr: Transmit FIFO watermark has been reached\n");
Some of those look like 'normal' interrupts, others are clearly
abnormal conditions.
Maybe the tracing should reflect this.
> +
> + regmap_read(sai->regmap, FSL_SAI_RCSR, &xcsr);
> + regmap_write(sai->regmap, FSL_SAI_RCSR, xcsr);
Same comments apply...
David
Powered by blists - more mailing lists