From: Markus Pargmann <mpa@pengutronix.de>
To: Timur Tabi <timur@tabi.org>, Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org,
"Jürgen Beisert" <jbe@pengutronix.de>,
kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] ASoC: fsl-ssi: Fix interrupt enable/disable
Date: Wed, 13 Nov 2013 14:43:50 +0100 [thread overview]
Message-ID: <20131113134350.GJ30263@pengutronix.de> (raw)
In-Reply-To: <1384348330-23117-1-git-send-email-mpa@pengutronix.de>
On Wed, Nov 13, 2013 at 02:12:10PM +0100, Markus Pargmann wrote:
> The fsl_ssi_trigger function enables all interrupts (for RX and TX) when a stream is
> started. The enabled interrupts are never cleared. We don't need all
> interrupts enabled for one active stream, e.g. RX interrupts are not
> necessary for playback. Next to the interrupts, the DMA enable bits are
> set at the same time. This can lead to lost DMA requests and SDMA
> starvation.
>
> This patch seperates the SIER flags into DMA_TX and DMA_RX flags to
> seperatly enable/disable the TX/RX channels.
This patch is not correct either, sorry.
imx53 reference manual does not list registers which may not be modified
while the SSI unit is enabled, but e.g. imx27 reference manual contains
such a list. SIER TDMAE and RDMAE is listed there, so it is not correct
to change these bits for some SoCs when the ssi unit is already running.
I am not sure what's the best thing to do here as we can run into issues
with the SDMA unit on imx53 when we have RDMAE and TDMAE enabled the
whole time. We could set the SIER flags in different functions for
different chips, but this doesn't seem the best way. Any ideas?
Regards,
Markus
>
> Based on Jürgen Beisert's patch 'ASoC: fsl-ssi: fix SDMA starvation'.
>
> Cc: Jürgen Beisert <jbe@pengutronix.de>
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
> sound/soc/fsl/fsl_ssi.c | 33 ++++++++++++++++++++-------------
> 1 file changed, 20 insertions(+), 13 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
> index 6b81d0c..905b8db 100644
> --- a/sound/soc/fsl/fsl_ssi.c
> +++ b/sound/soc/fsl/fsl_ssi.c
> @@ -107,11 +107,18 @@ static inline void write_ssi_mask(u32 __iomem *addr, u32 clear, u32 set)
> #endif
>
> /* SIER bitflag of interrupts to enable */
> -#define SIER_FLAGS (CCSR_SSI_SIER_TFRC_EN | CCSR_SSI_SIER_TDMAE | \
> - CCSR_SSI_SIER_TIE | CCSR_SSI_SIER_TUE0_EN | \
> - CCSR_SSI_SIER_TUE1_EN | CCSR_SSI_SIER_RFRC_EN | \
> - CCSR_SSI_SIER_RDMAE | CCSR_SSI_SIER_RIE | \
> - CCSR_SSI_SIER_ROE0_EN | CCSR_SSI_SIER_ROE1_EN)
> +#define FSLSSI_TX_SIER_FLAGS (CCSR_SSI_SIER_TIE | CCSR_SSI_SIER_TFE0_EN)
> +#define FSLSSI_RX_SIER_FLAGS (CCSR_SSI_SIER_RIE | CCSR_SSI_SIER_RFF0_EN)
> +
> +#define FSLSSI_DMA_TX_SIER_FLAGS (CCSR_SSI_SIER_TFRC_EN | \
> + CCSR_SSI_SIER_TDMAE | CCSR_SSI_SIER_TIE | \
> + CCSR_SSI_SIER_TUE0_EN | CCSR_SSI_SIER_TUE1_EN)
> +#define FSLSSI_DMA_RX_SIER_FLAGS (CCSR_SSI_SIER_RFRC_EN | \
> + CCSR_SSI_SIER_RDMAE | CCSR_SSI_SIER_RIE | \
> + CCSR_SSI_SIER_ROE0_EN | CCSR_SSI_SIER_ROE1_EN)
> +
> +#define FSLSSI_SISR_MASK (FSLSSI_TX_SIER_FLAGS | FSLSSI_RX_SIER_FLAGS | \
> + FSLSSI_DMA_TX_SIER_FLAGS | FSLSSI_DMA_RX_SIER_FLAGS)
>
> /**
> * fsl_ssi_private: per-SSI private data
> @@ -201,7 +208,7 @@ static irqreturn_t fsl_ssi_isr(int irq, void *dev_id)
> were interrupted for. We mask it with the Interrupt Enable register
> so that we only check for events that we're interested in.
> */
> - sisr = read_ssi(&ssi->sisr) & SIER_FLAGS;
> + sisr = read_ssi(&ssi->sisr) & FSLSSI_SISR_MASK;
>
> if (sisr & CCSR_SSI_SISR_RFRC) {
> ssi_private->stats.rfrc++;
> @@ -567,19 +574,20 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
>
> if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
> if (ssi_private->use_dma)
> - sier_bits = SIER_FLAGS;
> + sier_bits = FSLSSI_DMA_TX_SIER_FLAGS;
> else
> - sier_bits = CCSR_SSI_SIER_TIE | CCSR_SSI_SIER_TFE0_EN;
> + sier_bits = FSLSSI_TX_SIER_FLAGS;
> } else {
> if (ssi_private->use_dma)
> - sier_bits = SIER_FLAGS;
> + sier_bits = FSLSSI_DMA_RX_SIER_FLAGS;
> else
> - sier_bits = CCSR_SSI_SIER_RIE | CCSR_SSI_SIER_RFF0_EN;
> + sier_bits = FSLSSI_RX_SIER_FLAGS;
> }
>
> switch (cmd) {
> case SNDRV_PCM_TRIGGER_START:
> case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
> + write_ssi_mask(&ssi->sier, 0, sier_bits);
> if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
> write_ssi_mask(&ssi->scr, 0,
> CCSR_SSI_SCR_SSIEN | CCSR_SSI_SCR_TE);
> @@ -590,6 +598,7 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
>
> case SNDRV_PCM_TRIGGER_STOP:
> case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
> + write_ssi_mask(&ssi->sier, sier_bits, 0);
> if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
> write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_TE, 0);
> else
> @@ -604,8 +613,6 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
> return -EINVAL;
> }
>
> - write_ssi(sier_bits, &ssi->sier);
> -
> return 0;
> }
>
> @@ -801,7 +808,7 @@ static struct snd_ac97_bus_ops fsl_ssi_ac97_ops = {
> */
> #define SIER_SHOW(flag, name) \
> do { \
> - if (SIER_FLAGS & CCSR_SSI_SIER_##flag) \
> + if (FSLSSI_SISR_MASK & CCSR_SSI_SIER_##flag) \
> length += sprintf(buf + length, #name "=%u\n", \
> ssi_private->stats.name); \
> } while (0)
> --
> 1.8.4.2
>
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
prev parent reply other threads:[~2013-11-13 13:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-13 13:12 [PATCH] ASoC: fsl-ssi: Fix interrupt enable/disable Markus Pargmann
2013-11-13 13:43 ` Markus Pargmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131113134350.GJ30263@pengutronix.de \
--to=mpa@pengutronix.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=jbe@pengutronix.de \
--cc=kernel@pengutronix.de \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=timur@tabi.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).