[PATCH 09/10] ASoC: mediatek: mt8196: propagate I2S clock errors

From: phucduc . bui

Date: Tue Sep 29 2026 - 02:15:38 EST


From: bui duc phuc <phucduc.bui@xxxxxxxxx>

Propagate errors from APLL and MCK clock operations in the DAPM event
callbacks instead of always returning success.

Fixes: 65a195132669 ("ASoC: mediatek: mt8196: support I2S in platform driver")
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
sound/soc/mediatek/mt8196/mt8196-dai-i2s.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/sound/soc/mediatek/mt8196/mt8196-dai-i2s.c b/sound/soc/mediatek/mt8196/mt8196-dai-i2s.c
index ef5cde0ba829..adebf75629be 100644
--- a/sound/soc/mediatek/mt8196/mt8196-dai-i2s.c
+++ b/sound/soc/mediatek/mt8196/mt8196-dai-i2s.c
@@ -985,27 +985,30 @@ static int mtk_apll_event(struct snd_soc_dapm_widget *w,
{
struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt);
+ int ret;

dev_dbg(cmpnt->dev, "name %s, event 0x%x\n", w->name, event);

switch (event) {
case SND_SOC_DAPM_PRE_PMU:
if (strcmp(w->name, APLL1_W_NAME) == 0)
- mt8196_apll1_enable(afe);
+ ret = mt8196_apll1_enable(afe);
else
- mt8196_apll2_enable(afe);
+ ret = mt8196_apll2_enable(afe);
break;
case SND_SOC_DAPM_POST_PMD:
if (strcmp(w->name, APLL1_W_NAME) == 0)
mt8196_apll1_disable(afe);
else
mt8196_apll2_disable(afe);
+ ret = 0;
break;
default:
+ ret = 0;
break;
}

- return 0;
+ return ret;
}

static int mtk_mclk_en_event(struct snd_soc_dapm_widget *w,
@@ -1015,6 +1018,7 @@ static int mtk_mclk_en_event(struct snd_soc_dapm_widget *w,
struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt);
struct mtk_afe_i2s_priv *i2s_priv;
+ int ret;

dev_dbg(cmpnt->dev, "name %s, event 0x%x\n", w->name, event);

@@ -1025,17 +1029,18 @@ static int mtk_mclk_en_event(struct snd_soc_dapm_widget *w,

switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- mt8196_mck_enable(afe, i2s_priv->mclk_id, i2s_priv->mclk_rate);
+ ret = mt8196_mck_enable(afe, i2s_priv->mclk_id, i2s_priv->mclk_rate);
break;
case SND_SOC_DAPM_POST_PMD:
i2s_priv->mclk_rate = 0;
- mt8196_mck_disable(afe, i2s_priv->mclk_id);
+ ret = mt8196_mck_disable(afe, i2s_priv->mclk_id);
break;
default:
+ ret = 0;
break;
}

- return 0;
+ return ret;
}

static const struct snd_soc_dapm_widget mtk_dai_i2s_widgets[] = {
--
2.43.0