* [PATCH 1/4] ASoC: codec: cs4341: Handle hw_params return value
2026-10-23 9:01 [PATCH 0/4] ASoC: codecs: Fix hw_params return values phucduc.bui
@ 2026-10-23 9:01 ` phucduc.bui
2026-10-23 9:34 ` Charles Keepax
2026-10-23 9:01 ` [PATCH 2/4] ASoC: codecs: si476x: " phucduc.bui
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: phucduc.bui @ 2026-10-23 9:01 UTC (permalink / raw)
To: David Rhodes, Mark Brown, Richard Fitzgerald, Stephan Gerhold
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
Charles Keepax, Wentao Liang, HyeongJun An, linux-sound,
linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
snd_soc_component_update_bits() may return 1 when the register value
changes, but ASoC only marks the DAI hw_params as done when .hw_params()
returns 0.
Propagate negative errors and return 0 on success.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/codecs/cs4341.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/cs4341.c b/sound/soc/codecs/cs4341.c
index 74544c58a415..be0ab0b128cd 100644
--- a/sound/soc/codecs/cs4341.c
+++ b/sound/soc/codecs/cs4341.c
@@ -83,6 +83,7 @@ static int cs4341_hw_params(struct snd_pcm_substream *substream,
struct cs4341_priv *cs4341 = snd_soc_component_get_drvdata(component);
unsigned int mode = 0;
int b24 = 0;
+ int ret;
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S24_LE:
@@ -112,8 +113,17 @@ static int cs4341_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- return snd_soc_component_update_bits(component, CS4341_REG_MODE2,
- CS4341_MODE2_DIF, mode);
+ ret = snd_soc_component_update_bits(component, CS4341_REG_MODE2,
+ CS4341_MODE2_DIF, mode);
+ if (ret < 0)
+ return ret;
+
+ /*
+ * ASoC only marks the DAI hw_params as done when .hw_params() returns 0.
+ * Since snd_soc_component_update_bits() may return 1, explicitly
+ * return 0 to ensure the DAI is correctly marked.
+ */
+ return 0;
}
static int cs4341_mute(struct snd_soc_dai *dai, int mute, int direction)
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 1/4] ASoC: codec: cs4341: Handle hw_params return value
2026-10-23 9:01 ` [PATCH 1/4] ASoC: codec: cs4341: Handle hw_params return value phucduc.bui
@ 2026-10-23 9:34 ` Charles Keepax
0 siblings, 0 replies; 8+ messages in thread
From: Charles Keepax @ 2026-10-23 9:34 UTC (permalink / raw)
To: phucduc.bui
Cc: David Rhodes, Mark Brown, Richard Fitzgerald, Stephan Gerhold,
Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
Wentao Liang, HyeongJun An, linux-sound, linux-kernel
On Fri, Oct 23, 2026 at 04:01:54PM +0700, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> snd_soc_component_update_bits() may return 1 when the register value
> changes, but ASoC only marks the DAI hw_params as done when .hw_params()
> returns 0.
>
> Propagate negative errors and return 0 on success.
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/4] ASoC: codecs: si476x: Handle hw_params return value
2026-10-23 9:01 [PATCH 0/4] ASoC: codecs: Fix hw_params return values phucduc.bui
2026-10-23 9:01 ` [PATCH 1/4] ASoC: codec: cs4341: Handle hw_params return value phucduc.bui
@ 2026-10-23 9:01 ` phucduc.bui
2026-10-23 9:01 ` [PATCH 3/4] ASoC: codecs: tfa989x: " phucduc.bui
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: phucduc.bui @ 2026-10-23 9:01 UTC (permalink / raw)
To: David Rhodes, Mark Brown, Richard Fitzgerald, Stephan Gerhold
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
Charles Keepax, Wentao Liang, HyeongJun An, linux-sound,
linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
snd_soc_component_update_bits() may return 1 when the register value
changes, but ASoC only marks the DAI hw_params as done when .hw_params()
returns 0.
Propagate negative errors and return 0 on success.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/codecs/si476x.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c
index 9b904450ab8a..1738377d7d7c 100644
--- a/sound/soc/codecs/si476x.c
+++ b/sound/soc/codecs/si476x.c
@@ -193,6 +193,12 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream,
goto out;
}
+ /*
+ * ASoC only marks the DAI hw_params as done when .hw_params() returns 0.
+ * Since snd_soc_component_update_bits() may return 1, explicitly
+ * return 0 to ensure the DAI is correctly marked.
+ */
+ err = 0;
out:
si476x_core_unlock(core);
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 3/4] ASoC: codecs: tfa989x: Handle hw_params return value
2026-10-23 9:01 [PATCH 0/4] ASoC: codecs: Fix hw_params return values phucduc.bui
2026-10-23 9:01 ` [PATCH 1/4] ASoC: codec: cs4341: Handle hw_params return value phucduc.bui
2026-10-23 9:01 ` [PATCH 2/4] ASoC: codecs: si476x: " phucduc.bui
@ 2026-10-23 9:01 ` phucduc.bui
2026-10-23 9:01 ` [PATCH 4/4] ASoC: codecs: wm8994: " phucduc.bui
2026-11-02 0:22 ` [PATCH 0/4] ASoC: codecs: Fix hw_params return values Mark Brown
4 siblings, 0 replies; 8+ messages in thread
From: phucduc.bui @ 2026-10-23 9:01 UTC (permalink / raw)
To: David Rhodes, Mark Brown, Richard Fitzgerald, Stephan Gerhold
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
Charles Keepax, Wentao Liang, HyeongJun An, linux-sound,
linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
snd_soc_component_update_bits() may return 1 when the register value
changes, but ASoC only marks the DAI hw_params as done when .hw_params()
returns 0.
Propagate negative errors and return 0 on success.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/codecs/tfa989x.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/tfa989x.c b/sound/soc/codecs/tfa989x.c
index 7204be155eb9..885b3ea19c2c 100644
--- a/sound/soc/codecs/tfa989x.c
+++ b/sound/soc/codecs/tfa989x.c
@@ -160,15 +160,24 @@ static int tfa989x_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_component *component = dai->component;
- int sr;
+ int sr, ret;
sr = tfa989x_find_sample_rate(params_rate(params));
if (sr < 0)
return sr;
- return snd_soc_component_update_bits(component, TFA989X_I2SREG,
- TFA989X_I2SREG_I2SSR_MSK,
- sr << TFA989X_I2SREG_I2SSR);
+ ret = snd_soc_component_update_bits(component, TFA989X_I2SREG,
+ TFA989X_I2SREG_I2SSR_MSK,
+ sr << TFA989X_I2SREG_I2SSR);
+ if (ret < 0)
+ return ret;
+
+ /*
+ * ASoC only marks the DAI hw_params as done when .hw_params() returns 0.
+ * Since snd_soc_component_update_bits() may return 1, explicitly
+ * return 0 to ensure the DAI is correctly marked.
+ */
+ return 0;
}
static const struct snd_soc_dai_ops tfa989x_dai_ops = {
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 4/4] ASoC: codecs: wm8994: Handle hw_params return value
2026-10-23 9:01 [PATCH 0/4] ASoC: codecs: Fix hw_params return values phucduc.bui
` (2 preceding siblings ...)
2026-10-23 9:01 ` [PATCH 3/4] ASoC: codecs: tfa989x: " phucduc.bui
@ 2026-10-23 9:01 ` phucduc.bui
2026-10-23 9:35 ` Charles Keepax
2026-11-02 0:22 ` [PATCH 0/4] ASoC: codecs: Fix hw_params return values Mark Brown
4 siblings, 1 reply; 8+ messages in thread
From: phucduc.bui @ 2026-10-23 9:01 UTC (permalink / raw)
To: David Rhodes, Mark Brown, Richard Fitzgerald, Stephan Gerhold
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
Charles Keepax, Wentao Liang, HyeongJun An, linux-sound,
linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
snd_soc_component_update_bits() may return 1 when the register value
changes, but ASoC only marks the DAI hw_params as done when .hw_params()
returns 0.
Propagate negative errors and return 0 on success.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/codecs/wm8994.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index c65a7769a9d2..6cda0aa4c3be 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -3093,6 +3093,7 @@ static int wm8994_aif3_hw_params(struct snd_pcm_substream *substream,
struct wm8994 *control = wm8994->wm8994;
int aif1_reg;
int aif1 = 0;
+ int ret;
switch (dai->id) {
case 3:
@@ -3125,7 +3126,16 @@ static int wm8994_aif3_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- return snd_soc_component_update_bits(component, aif1_reg, WM8994_AIF1_WL_MASK, aif1);
+ ret = snd_soc_component_update_bits(component, aif1_reg, WM8994_AIF1_WL_MASK, aif1);
+ if (ret < 0)
+ return ret;
+
+ /*
+ * ASoC only marks the DAI hw_params as done when .hw_params() returns 0.
+ * Since snd_soc_component_update_bits() may return 1, explicitly
+ * return 0 to ensure the DAI is correctly marked.
+ */
+ return 0;
}
static int wm8994_aif_mute(struct snd_soc_dai *codec_dai, int mute,
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 4/4] ASoC: codecs: wm8994: Handle hw_params return value
2026-10-23 9:01 ` [PATCH 4/4] ASoC: codecs: wm8994: " phucduc.bui
@ 2026-10-23 9:35 ` Charles Keepax
0 siblings, 0 replies; 8+ messages in thread
From: Charles Keepax @ 2026-10-23 9:35 UTC (permalink / raw)
To: phucduc.bui
Cc: David Rhodes, Mark Brown, Richard Fitzgerald, Stephan Gerhold,
Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
Wentao Liang, HyeongJun An, linux-sound, linux-kernel
On Fri, Oct 23, 2026 at 04:01:57PM +0700, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> snd_soc_component_update_bits() may return 1 when the register value
> changes, but ASoC only marks the DAI hw_params as done when .hw_params()
> returns 0.
>
> Propagate negative errors and return 0 on success.
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] ASoC: codecs: Fix hw_params return values
2026-10-23 9:01 [PATCH 0/4] ASoC: codecs: Fix hw_params return values phucduc.bui
` (3 preceding siblings ...)
2026-10-23 9:01 ` [PATCH 4/4] ASoC: codecs: wm8994: " phucduc.bui
@ 2026-11-02 0:22 ` Mark Brown
4 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2026-11-02 0:22 UTC (permalink / raw)
To: David Rhodes, Richard Fitzgerald, Stephan Gerhold, phucduc.bui
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
Charles Keepax, Wentao Liang, HyeongJun An, linux-sound,
linux-kernel
On Fri, 23 Oct 2026 16:01:53 +0700, phucduc.bui@gmail.com wrote:
> ASoC: codecs: Fix hw_params return values
>
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> Hi all,
>
> These patches ensure that the codec drivers return 0 on successful
> .hw_params() callbacks and propagate negative errors.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.5
Thanks!
[1/4] ASoC: codec: cs4341: Handle hw_params return value
https://git.kernel.org/broonie/sound/c/b622ec286008
[2/4] ASoC: codecs: si476x: Handle hw_params return value
https://git.kernel.org/broonie/sound/c/7b2c273dbadf
[3/4] ASoC: codecs: tfa989x: Handle hw_params return value
https://git.kernel.org/broonie/sound/c/eddb6aa0c3b8
[4/4] ASoC: codecs: wm8994: Handle hw_params return value
https://git.kernel.org/broonie/sound/c/d310df0fb2ab
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] 8+ messages in thread