diff options
| author | bui duc phuc <phucduc.bui@gmail.com> | 2026-10-14 18:27:42 +0700 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-10-15 23:20:05 +0100 |
| commit | b1db7408c8e0761d17b49b74f8f2d60c0c1929e8 (patch) | |
| tree | 9184b7190b43913785689a3417e6d69b86069147 | |
| parent | c0ec135cf3fd7c7c7cdefd234111e5d4f069a7e6 (diff) | |
| download | linux-b1db7408c8e0761d17b49b74f8f2d60c0c1929e8.tar.gz linux-b1db7408c8e0761d17b49b74f8f2d60c0c1929e8.zip | |
ASoC: mediatek: mt8195: Fix FE startup error handling
Check and propagate errors from paired memif clock preparation and
PCM hardware constraints during FE startup.
Unprepare the paired memif clocks and shut down the FE when a later
startup step fails to avoid leaving resources enabled on error.
Fixes: 6746cc858259 ("ASoC: mediatek: mt8195: add platform driver")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20261014112752.683032-8-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | sound/soc/mediatek/mt8195/mt8195-afe-pcm.c | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c index 1d3e01e2c3e7..02736949ae6a 100644 --- a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c +++ b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c @@ -364,24 +364,38 @@ static int mt8195_afe_fe_startup(struct snd_pcm_substream *substream, int id = snd_soc_rtd_to_cpu(rtd, 0)->id; int ret = 0; - mt8195_afe_paired_memif_clk_prepare(substream, dai, 1); + ret = mt8195_afe_paired_memif_clk_prepare(substream, dai, 1); + if (ret) + return ret; ret = mtk_afe_fe_startup(substream, dai); + if (ret < 0) + goto err_clk_unprepare; - snd_pcm_hw_constraint_step(runtime, 0, - SNDRV_PCM_HW_PARAM_BUFFER_BYTES, - MT8195_MEMIF_BUFFER_BYTES_ALIGN); + ret = snd_pcm_hw_constraint_step(runtime, 0, + SNDRV_PCM_HW_PARAM_BUFFER_BYTES, + MT8195_MEMIF_BUFFER_BYTES_ALIGN); + if (ret) + goto err_fe_shutdow; + + if (id == MT8195_AFE_MEMIF_DL7) { + ret = snd_pcm_hw_constraint_minmax(runtime, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + 1, + MT8195_MEMIF_DL7_MAX_PERIOD_SIZE); + if (ret < 0) { + dev_dbg(afe->dev, "hw_constraint_minmax failed\n"); + goto err_fe_shutdow; + } + } - if (id != MT8195_AFE_MEMIF_DL7) - goto out; + return 0; + +err_fe_shutdow: + mtk_afe_fe_shutdown(substream, dai); +err_clk_unprepare: + mt8195_afe_paired_memif_clk_prepare(substream, dai, 0); - ret = snd_pcm_hw_constraint_minmax(runtime, - SNDRV_PCM_HW_PARAM_PERIOD_SIZE, - 1, - MT8195_MEMIF_DL7_MAX_PERIOD_SIZE); - if (ret < 0) - dev_dbg(afe->dev, "hw_constraint_minmax failed\n"); -out: return ret; } |
