public inbox for linuxppc-dev@ozlabs.org
 help / color / mirror / Atom feed
From: Shengjiu Wang <shengjiu.wang@nxp.com>
To: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com,
	nicoleotsuka@gmail.com, lgirdwood@gmail.com, broonie@kernel.org,
	perex@perex.cz, tiwai@suse.com, linux-sound@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 08/11] ASoC: fsl_xcvr: Fix event generation in fsl_xcvr_mode_put()
Date: Wed,  1 Apr 2026 17:42:23 +0800	[thread overview]
Message-ID: <20260401094226.2900532-9-shengjiu.wang@nxp.com> (raw)
In-Reply-To: <20260401094226.2900532-1-shengjiu.wang@nxp.com>

ALSA controls should return 1 if the value in the control changed but the
control put operation fsl_xcvr_mode_put() only returns 0 or a negative
error code, causing ALSA to not generate any change events.

Add a suitable check in the function before updating the mode variable.

Fixes: 28564486866f ("ASoC: fsl_xcvr: Add XCVR ASoC CPU DAI driver")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 sound/soc/fsl/fsl_xcvr.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c
index 109e3e03f455..ee16cf681488 100644
--- a/sound/soc/fsl/fsl_xcvr.c
+++ b/sound/soc/fsl/fsl_xcvr.c
@@ -277,10 +277,17 @@ static int fsl_xcvr_mode_put(struct snd_kcontrol *kcontrol,
 	struct fsl_xcvr *xcvr = snd_soc_dai_get_drvdata(dai);
 	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
 	unsigned int *item = ucontrol->value.enumerated.item;
+	int val = snd_soc_enum_item_to_val(e, item[0]);
 	struct snd_soc_card *card = dai->component->card;
 	struct snd_soc_pcm_runtime *rtd;
+	int ret;
+
+	if (val < FSL_XCVR_MODE_SPDIF || val > FSL_XCVR_MODE_EARC)
+		return -EINVAL;
 
-	xcvr->mode = snd_soc_enum_item_to_val(e, item[0]);
+	ret = (xcvr->mode != val);
+
+	xcvr->mode = val;
 
 	fsl_xcvr_activate_ctl(dai, fsl_xcvr_arc_mode_kctl.name,
 			      (xcvr->mode == FSL_XCVR_MODE_ARC));
@@ -290,7 +297,7 @@ static int fsl_xcvr_mode_put(struct snd_kcontrol *kcontrol,
 	rtd = snd_soc_get_pcm_runtime(card, card->dai_link);
 	rtd->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream_count =
 		(xcvr->mode == FSL_XCVR_MODE_SPDIF ? 1 : 0);
-	return 0;
+	return ret;
 }
 
 static int fsl_xcvr_mode_get(struct snd_kcontrol *kcontrol,
-- 
2.34.1



  parent reply	other threads:[~2026-04-01  9:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-01  9:42 [PATCH v2 00/11] ASoC: fsl: fix mixer-test failures Shengjiu Wang
2026-04-01  9:42 ` [PATCH v2 01/11] ASoC: fsl_micfil: Add access property for "VAD Detected" Shengjiu Wang
2026-04-01  9:42 ` [PATCH v2 02/11] ASoC: fsl_micfil: Fix event generation in hwvad_put_enable() Shengjiu Wang
2026-04-01  9:42 ` [PATCH v2 03/11] ASoC: fsl_micfil: Fix event generation in hwvad_put_init_mode() Shengjiu Wang
2026-04-01  9:42 ` [PATCH v2 04/11] ASoC: fsl_micfil: Fix event generation in micfil_range_set() Shengjiu Wang
2026-04-01  9:42 ` [PATCH v2 05/11] ASoC: fsl_micfil: Fix event generation in micfil_put_dc_remover_state() Shengjiu Wang
2026-04-01  9:42 ` [PATCH v2 06/11] ASoC: fsl_micfil: Fix event generation in micfil_quality_set() Shengjiu Wang
2026-04-01  9:42 ` [PATCH v2 07/11] ASoC: fsl_xcvr: Fix event generation in fsl_xcvr_arc_mode_put() Shengjiu Wang
2026-04-01  9:42 ` Shengjiu Wang [this message]
2026-04-01  9:42 ` [PATCH v2 09/11] ASoC: fsl_easrc: Check the variable range in fsl_easrc_iec958_put_bits() Shengjiu Wang
2026-04-01  9:42 ` [PATCH v2 10/11] ASoC: fsl_easrc: Fix value type in fsl_easrc_iec958_get_bits() Shengjiu Wang
2026-04-01  9:42 ` [PATCH v2 11/11] ASoC: fsl_easrc: Change the type for iec958 channel status controls Shengjiu Wang
2026-04-01 17:24 ` [PATCH v2 00/11] ASoC: fsl: fix mixer-test failures Mark Brown

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=20260401094226.2900532-9-shengjiu.wang@nxp.com \
    --to=shengjiu.wang@nxp.com \
    --cc=Xiubo.Lee@gmail.com \
    --cc=broonie@kernel.org \
    --cc=festevam@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=nicoleotsuka@gmail.com \
    --cc=perex@perex.cz \
    --cc=shengjiu.wang@gmail.com \
    --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