From: "Mika Penttilä" <mika.penttila@nextfour.com>
To: Nicolin Chen <nicoleotsuka@gmail.com>, broonie@kernel.org
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
alsa-devel@alsa-project.org, tiwai@suse.com, perex@perex.cz,
lgirdwood@gmail.com, fabio.estevam@nxp.com, timur@tabi.org
Subject: Re: [PATCH] ASoC: fsl_ssi: Fix mode setting when changing channel number
Date: Mon, 9 Apr 2018 09:55:11 +0300 [thread overview]
Message-ID: <757bf30b-60fc-5ff8-e9b3-7978bae2264d@nextfour.com> (raw)
In-Reply-To: <1523162421-26400-1-git-send-email-nicoleotsuka@gmail.com>
On 04/08/2018 07:40 AM, Nicolin Chen wrote:
> This is a partial revert (in a cleaner way) of commit ebf08ae3bc90
> ("ASoC: fsl_ssi: Keep ssi->i2s_net updated") to fix a regression
> at test cases when switching between mono and stereo audio.
>
> The problem is that ssi->i2s_net is initialized in set_dai_fmt()
> only, while this set_dai_fmt() is only called during the dai-link
> probe(). The original patch assumed set_dai_fmt() would be called
> during every playback instance, so it failed at the overriding use
> cases.
>
> This patch adds the local variable i2s_net back to let regular use
> cases still follow the mode settings from the set_dai_fmt().
>
> Meanwhile, the original commit of keeping ssi->i2s_net updated was
> to make set_tdm_slot() clean by checking the ssi->i2s_net directly
> instead of reading SCR register. However, the change itself is not
> necessary (or even harmful) because the set_tdm_slot() might fail
> to check the slot number for Normal-Mode-None-Net settings while
> mono audio cases still need 2 slots. So this patch can also fix it.
> And it adds an extra line of comments to declare ssi->i2s_net does
> not reflect the register value but merely the initial setting from
> the set_dai_fmt().
>
> Reported-by: Mika Penttilä <mika.penttila@nextfour.com>
> Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
> Cc: Mika Penttilä <mika.penttila@nextfour.com>
> ---
> sound/soc/fsl/fsl_ssi.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
> index 0823b08..89df2d9 100644
> --- a/sound/soc/fsl/fsl_ssi.c
> +++ b/sound/soc/fsl/fsl_ssi.c
> @@ -217,6 +217,7 @@ struct fsl_ssi_soc_data {
> * @dai_fmt: DAI configuration this device is currently used with
> * @streams: Mask of current active streams: BIT(TX) and BIT(RX)
> * @i2s_net: I2S and Network mode configurations of SCR register
> + * (this is the initial settings based on the DAI format)
> * @synchronous: Use synchronous mode - both of TX and RX use STCK and SFCK
> * @use_dma: DMA is used or FIQ with stream filter
> * @use_dual_fifo: DMA with support for dual FIFO mode
> @@ -829,16 +830,23 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
> }
>
> if (!fsl_ssi_is_ac97(ssi)) {
> + /*
> + * Keep the ssi->i2s_net intact while having a local variable
> + * to override settings for special use cases. Otherwise, the
> + * ssi->i2s_net will lose the settings for regular use cases.
> + */
> + u8 i2s_net = ssi->i2s_net;
> +
> /* Normal + Network mode to send 16-bit data in 32-bit frames */
> if (fsl_ssi_is_i2s_cbm_cfs(ssi) && sample_size == 16)
> - ssi->i2s_net = SSI_SCR_I2S_MODE_NORMAL | SSI_SCR_NET;
> + i2s_net = SSI_SCR_I2S_MODE_NORMAL | SSI_SCR_NET;
>
> /* Use Normal mode to send mono data at 1st slot of 2 slots */
> if (channels == 1)
> - ssi->i2s_net = SSI_SCR_I2S_MODE_NORMAL;
> + i2s_net = SSI_SCR_I2S_MODE_NORMAL;
>
> regmap_update_bits(regs, REG_SSI_SCR,
> - SSI_SCR_I2S_NET_MASK, ssi->i2s_net);
> + SSI_SCR_I2S_NET_MASK, i2s_net);
> }
>
> /* In synchronous mode, the SSI uses STCCR for capture */
>
This patch fixes my problems, so:
Tested-by: Mika Penttilä <mika.penttila@nextfour.com>
--Mika
prev parent reply other threads:[~2018-04-09 6:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-08 4:40 Nicolin Chen
2018-04-09 6:55 ` Mika Penttilä [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=757bf30b-60fc-5ff8-e9b3-7978bae2264d@nextfour.com \
--to=mika.penttila@nextfour.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=fabio.estevam@nxp.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nicoleotsuka@gmail.com \
--cc=perex@perex.cz \
--cc=timur@tabi.org \
--cc=tiwai@suse.com \
/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
Powered by JetHome