linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: lars@metafoo.de (Lars-Peter Clausen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/6] ASoC: dwc: Ensure FIFOs are flushed to prevent channel swap
Date: Fri, 12 Dec 2014 10:37:34 +0100	[thread overview]
Message-ID: <548AB75E.9030302@metafoo.de> (raw)
In-Reply-To: <a3b4a11dfe1688eea07471c6cfa27676cc9a58a8.1418372910.git.Andrew.Jackson@arm.com>

On 12/12/2014 10:25 AM, Andrew Jackson wrote:
> From: Andrew Jackson <Andrew.Jackson@arm.com>
>
> If the FIFOs aren't flushed, the left/right channels may be swapped:
> this may occur if the FIFOs are not empty when the streams start.
>
> Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com>
> ---
>   sound/soc/dwc/designware_i2s.c |    2 ++
>   1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c
> index ef771ea..b9d6a25 100644
> --- a/sound/soc/dwc/designware_i2s.c
> +++ b/sound/soc/dwc/designware_i2s.c
> @@ -228,12 +228,14 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream,
>   	i2s_disable_channels(dev, substream->stream);
>
>   	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
> +		i2s_write_reg(dev->i2s_base, TXFFR, 1);
>   		i2s_write_reg(dev->i2s_base, TCR(ch_reg), xfer_resolution);
>   		i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02);
>   		irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg));
>   		i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30);
>   		i2s_write_reg(dev->i2s_base, TER(ch_reg), 1);
>   	} else {
> +		i2s_write_reg(dev->i2s_base, RXFFR, 1);
>   		i2s_write_reg(dev->i2s_base, RCR(ch_reg), xfer_resolution);
>   		i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07);
>   		irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg));
>

This should probably go into the prepare callback. prepare is for example 
also called when recovering from a underrun/overrun. Whereas hwparams is 
only called during initial setup of the stream.

  reply	other threads:[~2014-12-12  9:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-12  9:24 [PATCH v2 0/6] ASoC: dwc: Add device tree support to designware I2S Andrew Jackson
2014-12-12  9:25 ` [PATCH v2 1/6] ASoC: dwc: Remove unnecessary debug messages and tests Andrew Jackson
2014-12-12  9:31   ` Joe Perches
2014-12-12  9:33     ` Lars-Peter Clausen
2014-12-12  9:39     ` Andrew Jackson
2014-12-12 10:06       ` Joe Perches
2014-12-12 19:29   ` Mark Brown
2014-12-12  9:25 ` [PATCH v2 2/6] ASoC: dwc: Ensure FIFOs are flushed to prevent channel swap Andrew Jackson
2014-12-12  9:37   ` Lars-Peter Clausen [this message]
2014-12-12 18:12     ` Mark Brown
2014-12-15  8:37     ` Andrew Jackson
2014-12-12  9:25 ` [PATCH v2 3/6] ASoC: dwc: Iterate over all channels Andrew Jackson
2014-12-12  9:25 ` [PATCH v2 4/6] ASoC: dwc: Reorder code in preparation for DT support Andrew Jackson
2014-12-12  9:25 ` [PATCH v2 5/6] ASoC: dwc: Add devicetree support for Designware I2S Andrew Jackson
2014-12-12  9:25 ` [PATCH v2 6/6] ASoC: dwc: Add documentation for I2S DT Andrew Jackson

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=548AB75E.9030302@metafoo.de \
    --to=lars@metafoo.de \
    --cc=linux-arm-kernel@lists.infradead.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).