[PATCH v2 15/25] ASoC: codecs: nau8825: Ensure the DAI is marked as started on success
phucduc.bui at gmail.com
phucduc.bui at gmail.com
Wed Oct 14 18:43:14 PDT 2026
From: bui duc phuc <phucduc.bui at gmail.com>
snd_pcm_hw_constraint_minmax() may return 1, which is then returned
from nau8825_dai_startup(). ASoC only marks the DAI as started when
.startup() returns 0.
This currently has no functional impact, as nau8825_dai_ops has no
.shutdown() callback. Still, return 0 explicitly on success to
match what ASoC expects and ensure the DAI is correctly marked as
started.
Signed-off-by: bui duc phuc <phucduc.bui at gmail.com>
---
sound/soc/codecs/nau8825.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c
index 63d927f31409..af2a49c893d3 100644
--- a/sound/soc/codecs/nau8825.c
+++ b/sound/soc/codecs/nau8825.c
@@ -1261,14 +1261,24 @@ static int nau8825_dai_startup(struct snd_pcm_substream *substream,
struct snd_soc_component *component = dai->component;
struct nau8825 *nau8825 = snd_soc_component_get_drvdata(component);
const struct nau8825_osr_attr *osr;
+ int ret;
osr = nau8825_get_osr(nau8825, substream->stream);
if (!osr || !osr->osr)
return -EINVAL;
- return snd_pcm_hw_constraint_minmax(substream->runtime,
- SNDRV_PCM_HW_PARAM_RATE,
- 0, CLK_DA_AD_MAX / osr->osr);
+ ret = snd_pcm_hw_constraint_minmax(substream->runtime,
+ SNDRV_PCM_HW_PARAM_RATE,
+ 0, CLK_DA_AD_MAX / osr->osr);
+ if (ret < 0)
+ return ret;
+
+ /*
+ * ASoC only marks the DAI as started when .startup() returns 0.
+ * Since snd_pcm_hw_constraint_minmax() may return 1, explicitly
+ * return 0 to ensure the DAI is correctly marked as started.
+ */
+ return 0;
}
static int nau8825_hw_params(struct snd_pcm_substream *substream,
--
2.43.0
More information about the Linux-rockchip
mailing list