* [PATCH 0/4] ASoC: codecs: Fix hw_params return values
@ 2026-10-23 9:01 phucduc.bui
2026-10-23 9:01 ` [PATCH 1/4] ASoC: codec: cs4341: Handle hw_params return value phucduc.bui
` (3 more replies)
0 siblings, 4 replies; 7+ 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>
Hi all,
These patches ensure that the codec drivers return 0 on successful
.hw_params() callbacks and propagate negative errors.
Compile-tested only.
Best regards,
Phuc
bui duc phuc (4):
ASoC: codec: cs4341: Handle hw_params return value
ASoC: codecs: si476x: Handle hw_params return value
ASoC: codecs: tfa989x: Handle hw_params return value
ASoC: codecs: wm8994: Handle hw_params return value
sound/soc/codecs/cs4341.c | 14 ++++++++++++--
sound/soc/codecs/si476x.c | 6 ++++++
sound/soc/codecs/tfa989x.c | 17 +++++++++++++----
sound/soc/codecs/wm8994.c | 12 +++++++++++-
4 files changed, 42 insertions(+), 7 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [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
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ 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 [flat|nested] 7+ 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
2026-10-23 9:01 ` [PATCH 4/4] ASoC: codecs: wm8994: " phucduc.bui
3 siblings, 0 replies; 7+ 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 [flat|nested] 7+ 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
3 siblings, 0 replies; 7+ 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 [flat|nested] 7+ 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
3 siblings, 1 reply; 7+ 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 [flat|nested] 7+ 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; 7+ 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] 7+ 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; 7+ 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] 7+ messages in thread
end of thread, other threads:[~2026-10-23 9:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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:34 ` Charles Keepax
2026-10-23 9:01 ` [PATCH 2/4] ASoC: codecs: si476x: " phucduc.bui
2026-10-23 9:01 ` [PATCH 3/4] ASoC: codecs: tfa989x: " phucduc.bui
2026-10-23 9:01 ` [PATCH 4/4] ASoC: codecs: wm8994: " phucduc.bui
2026-10-23 9:35 ` Charles Keepax
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®