* [PATCH] ASoC: fsl_xcvr: Improve suspend/resume flow in fsl_xcvr_trigger()
@ 2024-06-28 9:43 Chancel Liu
2024-07-03 9:12 ` Shengjiu Wang
2024-07-03 16:30 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Chancel Liu @ 2024-06-28 9:43 UTC (permalink / raw)
To: shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood,
broonie, perex, tiwai, alsa-devel, linuxppc-dev, linux-sound,
linux-kernel
Cc: Chancel Liu
In the current flow all interrupts are disabled in runtime suspend
phase. However interrupts enablement only exists in fsl_xcvr_prepare().
After resume fsl_xcvr_prepare() may not be called so it will cause all
interrupts still disabled even if resume from suspend. Interrupts
should be explictily enabled after resume.
Also, DPATH reset setting only exists in fsl_xcvr_prepare(). After
resume from suspend DPATH should be reset otherwise there'll be channel
swap issue.
Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
---
sound/soc/fsl/fsl_xcvr.c | 43 +++++++++++++++++++++-------------------
1 file changed, 23 insertions(+), 20 deletions(-)
diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c
index 337da46a2f90..bf9a4e90978e 100644
--- a/sound/soc/fsl/fsl_xcvr.c
+++ b/sound/soc/fsl/fsl_xcvr.c
@@ -529,16 +529,6 @@ static int fsl_xcvr_prepare(struct snd_pcm_substream *substream,
break;
}
- ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_IER0,
- FSL_XCVR_IRQ_EARC_ALL, FSL_XCVR_IRQ_EARC_ALL);
- if (ret < 0) {
- dev_err(dai->dev, "Error while setting IER0: %d\n", ret);
- return ret;
- }
-
- /* set DPATH RESET */
- m_ctl |= FSL_XCVR_EXT_CTRL_DPTH_RESET(tx);
- v_ctl |= FSL_XCVR_EXT_CTRL_DPTH_RESET(tx);
ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_CTRL, m_ctl, v_ctl);
if (ret < 0) {
dev_err(dai->dev, "Error while setting EXT_CTRL: %d\n", ret);
@@ -679,6 +669,15 @@ static int fsl_xcvr_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+ /* set DPATH RESET */
+ ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_CTRL,
+ FSL_XCVR_EXT_CTRL_DPTH_RESET(tx),
+ FSL_XCVR_EXT_CTRL_DPTH_RESET(tx));
+ if (ret < 0) {
+ dev_err(dai->dev, "Failed to set DPATH RESET: %d\n", ret);
+ return ret;
+ }
+
if (tx) {
switch (xcvr->mode) {
case FSL_XCVR_MODE_EARC:
@@ -711,6 +710,13 @@ static int fsl_xcvr_trigger(struct snd_pcm_substream *substream, int cmd,
return ret;
}
+ ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_IER0,
+ FSL_XCVR_IRQ_EARC_ALL, FSL_XCVR_IRQ_EARC_ALL);
+ if (ret < 0) {
+ dev_err(dai->dev, "Error while setting IER0: %d\n", ret);
+ return ret;
+ }
+
/* clear DPATH RESET */
ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_CTRL,
FSL_XCVR_EXT_CTRL_DPTH_RESET(tx),
@@ -733,6 +739,13 @@ static int fsl_xcvr_trigger(struct snd_pcm_substream *substream, int cmd,
return ret;
}
+ ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_IER0,
+ FSL_XCVR_IRQ_EARC_ALL, 0);
+ if (ret < 0) {
+ dev_err(dai->dev, "Failed to clear IER0: %d\n", ret);
+ return ret;
+ }
+
if (tx) {
switch (xcvr->mode) {
case FSL_XCVR_MODE_SPDIF:
@@ -1411,16 +1424,6 @@ static int fsl_xcvr_runtime_suspend(struct device *dev)
struct fsl_xcvr *xcvr = dev_get_drvdata(dev);
int ret;
- /*
- * Clear interrupts, when streams starts or resumes after
- * suspend, interrupts are enabled in prepare(), so no need
- * to enable interrupts in resume().
- */
- ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_IER0,
- FSL_XCVR_IRQ_EARC_ALL, 0);
- if (ret < 0)
- dev_err(dev, "Failed to clear IER0: %d\n", ret);
-
if (!xcvr->soc_data->spdif_only) {
/* Assert M0+ reset */
ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_CTRL,
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ASoC: fsl_xcvr: Improve suspend/resume flow in fsl_xcvr_trigger()
2024-06-28 9:43 [PATCH] ASoC: fsl_xcvr: Improve suspend/resume flow in fsl_xcvr_trigger() Chancel Liu
@ 2024-07-03 9:12 ` Shengjiu Wang
2024-07-03 16:30 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Shengjiu Wang @ 2024-07-03 9:12 UTC (permalink / raw)
To: Chancel Liu
Cc: alsa-devel, Xiubo.Lee, linuxppc-dev, tiwai, lgirdwood,
linux-sound, perex, nicoleotsuka, broonie, festevam, linux-kernel
On Fri, Jun 28, 2024 at 5:44 PM Chancel Liu <chancel.liu@nxp.com> wrote:
>
> In the current flow all interrupts are disabled in runtime suspend
> phase. However interrupts enablement only exists in fsl_xcvr_prepare().
> After resume fsl_xcvr_prepare() may not be called so it will cause all
> interrupts still disabled even if resume from suspend. Interrupts
> should be explictily enabled after resume.
>
> Also, DPATH reset setting only exists in fsl_xcvr_prepare(). After
> resume from suspend DPATH should be reset otherwise there'll be channel
> swap issue.
>
> Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Best regards
Shengjiu Wang
> ---
> sound/soc/fsl/fsl_xcvr.c | 43 +++++++++++++++++++++-------------------
> 1 file changed, 23 insertions(+), 20 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c
> index 337da46a2f90..bf9a4e90978e 100644
> --- a/sound/soc/fsl/fsl_xcvr.c
> +++ b/sound/soc/fsl/fsl_xcvr.c
> @@ -529,16 +529,6 @@ static int fsl_xcvr_prepare(struct snd_pcm_substream *substream,
> break;
> }
>
> - ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_IER0,
> - FSL_XCVR_IRQ_EARC_ALL, FSL_XCVR_IRQ_EARC_ALL);
> - if (ret < 0) {
> - dev_err(dai->dev, "Error while setting IER0: %d\n", ret);
> - return ret;
> - }
> -
> - /* set DPATH RESET */
> - m_ctl |= FSL_XCVR_EXT_CTRL_DPTH_RESET(tx);
> - v_ctl |= FSL_XCVR_EXT_CTRL_DPTH_RESET(tx);
> ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_CTRL, m_ctl, v_ctl);
> if (ret < 0) {
> dev_err(dai->dev, "Error while setting EXT_CTRL: %d\n", ret);
> @@ -679,6 +669,15 @@ static int fsl_xcvr_trigger(struct snd_pcm_substream *substream, int cmd,
> case SNDRV_PCM_TRIGGER_START:
> case SNDRV_PCM_TRIGGER_RESUME:
> case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
> + /* set DPATH RESET */
> + ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_CTRL,
> + FSL_XCVR_EXT_CTRL_DPTH_RESET(tx),
> + FSL_XCVR_EXT_CTRL_DPTH_RESET(tx));
> + if (ret < 0) {
> + dev_err(dai->dev, "Failed to set DPATH RESET: %d\n", ret);
> + return ret;
> + }
> +
> if (tx) {
> switch (xcvr->mode) {
> case FSL_XCVR_MODE_EARC:
> @@ -711,6 +710,13 @@ static int fsl_xcvr_trigger(struct snd_pcm_substream *substream, int cmd,
> return ret;
> }
>
> + ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_IER0,
> + FSL_XCVR_IRQ_EARC_ALL, FSL_XCVR_IRQ_EARC_ALL);
> + if (ret < 0) {
> + dev_err(dai->dev, "Error while setting IER0: %d\n", ret);
> + return ret;
> + }
> +
> /* clear DPATH RESET */
> ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_CTRL,
> FSL_XCVR_EXT_CTRL_DPTH_RESET(tx),
> @@ -733,6 +739,13 @@ static int fsl_xcvr_trigger(struct snd_pcm_substream *substream, int cmd,
> return ret;
> }
>
> + ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_IER0,
> + FSL_XCVR_IRQ_EARC_ALL, 0);
> + if (ret < 0) {
> + dev_err(dai->dev, "Failed to clear IER0: %d\n", ret);
> + return ret;
> + }
> +
> if (tx) {
> switch (xcvr->mode) {
> case FSL_XCVR_MODE_SPDIF:
> @@ -1411,16 +1424,6 @@ static int fsl_xcvr_runtime_suspend(struct device *dev)
> struct fsl_xcvr *xcvr = dev_get_drvdata(dev);
> int ret;
>
> - /*
> - * Clear interrupts, when streams starts or resumes after
> - * suspend, interrupts are enabled in prepare(), so no need
> - * to enable interrupts in resume().
> - */
> - ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_IER0,
> - FSL_XCVR_IRQ_EARC_ALL, 0);
> - if (ret < 0)
> - dev_err(dev, "Failed to clear IER0: %d\n", ret);
> -
> if (!xcvr->soc_data->spdif_only) {
> /* Assert M0+ reset */
> ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_CTRL,
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ASoC: fsl_xcvr: Improve suspend/resume flow in fsl_xcvr_trigger()
2024-06-28 9:43 [PATCH] ASoC: fsl_xcvr: Improve suspend/resume flow in fsl_xcvr_trigger() Chancel Liu
2024-07-03 9:12 ` Shengjiu Wang
@ 2024-07-03 16:30 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2024-07-03 16:30 UTC (permalink / raw)
To: shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood,
perex, tiwai, alsa-devel, linuxppc-dev, linux-sound, linux-kernel,
Chancel Liu
On Fri, 28 Jun 2024 18:43:54 +0900, Chancel Liu wrote:
> In the current flow all interrupts are disabled in runtime suspend
> phase. However interrupts enablement only exists in fsl_xcvr_prepare().
> After resume fsl_xcvr_prepare() may not be called so it will cause all
> interrupts still disabled even if resume from suspend. Interrupts
> should be explictily enabled after resume.
>
> Also, DPATH reset setting only exists in fsl_xcvr_prepare(). After
> resume from suspend DPATH should be reset otherwise there'll be channel
> swap issue.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: fsl_xcvr: Improve suspend/resume flow in fsl_xcvr_trigger()
commit: c288f0a1c08efa65f9e3bb7954eb3cefb966c97d
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] 3+ messages in thread
end of thread, other threads:[~2024-07-03 16:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-28 9:43 [PATCH] ASoC: fsl_xcvr: Improve suspend/resume flow in fsl_xcvr_trigger() Chancel Liu
2024-07-03 9:12 ` Shengjiu Wang
2024-07-03 16:30 ` Mark Brown
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).