* [PATCH 0/4] ASoC: mediatek: Return 0 from FE startup on success
@ 2026-10-06 10:16 phucduc.bui
2026-10-06 10:16 ` [PATCH 1/4] ASoC: mediatek: common: return 0 from mtk_afe_fe_startup() " phucduc.bui
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: phucduc.bui @ 2026-10-06 10:16 UTC (permalink / raw)
To: Mark Brown, AngeloGioacchino Del Regno, Trevor Wu
Cc: Liam Girdwood, Matthias Brugger, Jaroslav Kysela, Takashi Iwai,
Kuninori Morimoto, cassiogabrielcontato, Haotian Zhang,
Christian Marangi, Cezary Rojewski, Cyril Chao, Tuo Li,
Rosen Penev, Garlic Tseng, Alexandre Mergnat, Dan Carpenter,
linux-sound, linux-arm-kernel, linux-mediatek, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Hi all,
Some FE startup callbacks may return a positive value from constraint
helpers, but ASoC expects 0 on success. This can cause .shutdown() to be
skipped during rollback.
Return 0 explicitly on success.
Compile-tested only.
Best regards,
Phuc
bui duc phuc (4):
ASoC: mediatek: common: return 0 from mtk_afe_fe_startup() on success
ASoC: mediatek: mt8188: return 0 from mt8188_afe_fe_startup() on
success
ASoC: mediatek: mt8189:return 0 from mt8189_fe_startup() on success
ASoC: mediatek: mt8365: return 0 from mt8365_afe_fe_startup() on
success
sound/soc/mediatek/common/mtk-afe-fe-dai.c | 8 +++++---
sound/soc/mediatek/mt8188/mt8188-afe-pcm.c | 5 ++++-
sound/soc/mediatek/mt8189/mt8189-afe-pcm.c | 8 +++++---
sound/soc/mediatek/mt8365/mt8365-afe-pcm.c | 7 +++++--
4 files changed, 19 insertions(+), 9 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] ASoC: mediatek: common: return 0 from mtk_afe_fe_startup() on success
2026-10-06 10:16 [PATCH 0/4] ASoC: mediatek: Return 0 from FE startup on success phucduc.bui
@ 2026-10-06 10:16 ` phucduc.bui
2026-10-06 10:16 ` [PATCH 2/4] ASoC: mediatek: mt8188: return 0 from mt8188_afe_fe_startup() " phucduc.bui
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: phucduc.bui @ 2026-10-06 10:16 UTC (permalink / raw)
To: Mark Brown, AngeloGioacchino Del Regno, Trevor Wu
Cc: Liam Girdwood, Matthias Brugger, Jaroslav Kysela, Takashi Iwai,
Kuninori Morimoto, cassiogabrielcontato, Haotian Zhang,
Christian Marangi, Cezary Rojewski, Cyril Chao, Tuo Li,
Rosen Penev, Garlic Tseng, Alexandre Mergnat, Dan Carpenter,
linux-sound, linux-arm-kernel, linux-mediatek, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
snd_pcm_hw_constraint_integer() may return 1, which is then returned
from mtk_afe_fe_startup(). ASoC only treats 0 as success when marking
the DAI as started, so .shutdown() can be skipped on rollback.
Return 0 explicitly on success.
Fixes: 283b612429a2 ("ASoC: mediatek: implement mediatek common structure")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/mediatek/common/mtk-afe-fe-dai.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.c b/sound/soc/mediatek/common/mtk-afe-fe-dai.c
index 948f606cbaf2..ec99bc4a5d5e 100644
--- a/sound/soc/mediatek/common/mtk-afe-fe-dai.c
+++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.c
@@ -75,8 +75,10 @@ int mtk_afe_fe_startup(struct snd_pcm_substream *substream,
ret = snd_pcm_hw_constraint_integer(runtime,
SNDRV_PCM_HW_PARAM_PERIODS);
- if (ret < 0)
+ if (ret < 0) {
dev_err(afe->dev, "snd_pcm_hw_constraint_integer failed\n");
+ return ret;
+ }
/* dynamic allocate irq to memif */
if (memif->irq_usage < 0) {
@@ -88,10 +90,10 @@ int mtk_afe_fe_startup(struct snd_pcm_substream *substream,
} else {
dev_err(afe->dev, "%s() error: no more asys irq\n",
__func__);
- ret = -EBUSY;
+ return -EBUSY;
}
}
- return ret;
+ return 0;
}
EXPORT_SYMBOL_GPL(mtk_afe_fe_startup);
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/4] ASoC: mediatek: mt8188: return 0 from mt8188_afe_fe_startup() on success
2026-10-06 10:16 [PATCH 0/4] ASoC: mediatek: Return 0 from FE startup on success phucduc.bui
2026-10-06 10:16 ` [PATCH 1/4] ASoC: mediatek: common: return 0 from mtk_afe_fe_startup() " phucduc.bui
@ 2026-10-06 10:16 ` phucduc.bui
2026-10-06 10:39 ` Cezary Rojewski
2026-10-06 10:16 ` [PATCH 3/4] ASoC: mediatek: mt8189:return 0 from mt8189_fe_startup() " phucduc.bui
2026-10-06 10:16 ` [PATCH 4/4] ASoC: mediatek: mt8365: return 0 from mt8365_afe_fe_startup() " phucduc.bui
3 siblings, 1 reply; 9+ messages in thread
From: phucduc.bui @ 2026-10-06 10:16 UTC (permalink / raw)
To: Mark Brown, AngeloGioacchino Del Regno, Trevor Wu
Cc: Liam Girdwood, Matthias Brugger, Jaroslav Kysela, Takashi Iwai,
Kuninori Morimoto, cassiogabrielcontato, Haotian Zhang,
Christian Marangi, Cezary Rojewski, Cyril Chao, Tuo Li,
Rosen Penev, Garlic Tseng, Alexandre Mergnat, Dan Carpenter,
linux-sound, linux-arm-kernel, linux-mediatek, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
snd_pcm_hw_constraint_minmax() may return 1, which is then returned
from mt8188_afe_fe_startup(). ASoC only treats 0 as success when marking
the DAI as started, so .shutdown() can be skipped on rollback.
Return 0 explicitly on success.
Fixes: bf106bf09376 ("ASoC: mediatek: mt8188: add platform driver")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/mediatek/mt8188/mt8188-afe-pcm.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c b/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c
index 4010879ad1d3..87d6098caf99 100644
--- a/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c
+++ b/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c
@@ -318,8 +318,11 @@ static int mt8188_afe_fe_startup(struct snd_pcm_substream *substream,
ret = snd_pcm_hw_constraint_minmax(runtime,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 1,
MT8188_MEMIF_DL7_MAX_PERIOD_SIZE);
- if (ret < 0)
+ if (ret >= 0)
+ ret = 0;
+ else
dev_dbg(afe->dev, "hw_constraint_minmax failed\n");
+
out:
return ret;
}
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/4] ASoC: mediatek: mt8189:return 0 from mt8189_fe_startup() on success
2026-10-06 10:16 [PATCH 0/4] ASoC: mediatek: Return 0 from FE startup on success phucduc.bui
2026-10-06 10:16 ` [PATCH 1/4] ASoC: mediatek: common: return 0 from mtk_afe_fe_startup() " phucduc.bui
2026-10-06 10:16 ` [PATCH 2/4] ASoC: mediatek: mt8188: return 0 from mt8188_afe_fe_startup() " phucduc.bui
@ 2026-10-06 10:16 ` phucduc.bui
2026-10-06 10:44 ` Cezary Rojewski
2026-10-06 10:16 ` [PATCH 4/4] ASoC: mediatek: mt8365: return 0 from mt8365_afe_fe_startup() " phucduc.bui
3 siblings, 1 reply; 9+ messages in thread
From: phucduc.bui @ 2026-10-06 10:16 UTC (permalink / raw)
To: Mark Brown, AngeloGioacchino Del Regno, Trevor Wu
Cc: Liam Girdwood, Matthias Brugger, Jaroslav Kysela, Takashi Iwai,
Kuninori Morimoto, cassiogabrielcontato, Haotian Zhang,
Christian Marangi, Cezary Rojewski, Cyril Chao, Tuo Li,
Rosen Penev, Garlic Tseng, Alexandre Mergnat, Dan Carpenter,
linux-sound, linux-arm-kernel, linux-mediatek, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
snd_pcm_hw_constraint_integer() may return 1, which is then returned
from mt8189_fe_startup(). ASoC only treats 0 as success when marking
the DAI as started, so .shutdown() can be skipped on rollback.
Return 0 explicitly on success.
Fixes: 7eb153585598 ("ASoC: mediatek: mt8189: add platform driver")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/mediatek/mt8189/mt8189-afe-pcm.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c b/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c
index c0f340a6cc09..eefa96b701a5 100644
--- a/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c
+++ b/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c
@@ -155,8 +155,10 @@ static int mt8189_fe_startup(struct snd_pcm_substream *substream,
ret = snd_pcm_hw_constraint_integer(runtime,
SNDRV_PCM_HW_PARAM_PERIODS);
- if (ret < 0)
+ if (ret < 0) {
dev_warn(afe->dev, "snd_pcm_hw_constraint_integer failed\n");
+ return ret;
+ }
/* dynamic allocate irq to memif */
if (memif->irq_usage < 0) {
@@ -168,11 +170,11 @@ static int mt8189_fe_startup(struct snd_pcm_substream *substream,
} else {
dev_err(afe->dev, "%s() error: no more asys irq\n",
__func__);
- ret = -EBUSY;
+ return -EBUSY;
}
}
- return ret;
+ return 0;
}
static void mt8189_fe_shutdown(struct snd_pcm_substream *substream,
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/4] ASoC: mediatek: mt8365: return 0 from mt8365_afe_fe_startup() on success
2026-10-06 10:16 [PATCH 0/4] ASoC: mediatek: Return 0 from FE startup on success phucduc.bui
` (2 preceding siblings ...)
2026-10-06 10:16 ` [PATCH 3/4] ASoC: mediatek: mt8189:return 0 from mt8189_fe_startup() " phucduc.bui
@ 2026-10-06 10:16 ` phucduc.bui
3 siblings, 0 replies; 9+ messages in thread
From: phucduc.bui @ 2026-10-06 10:16 UTC (permalink / raw)
To: Mark Brown, AngeloGioacchino Del Regno, Trevor Wu
Cc: Liam Girdwood, Matthias Brugger, Jaroslav Kysela, Takashi Iwai,
Kuninori Morimoto, cassiogabrielcontato, Haotian Zhang,
Christian Marangi, Cezary Rojewski, Cyril Chao, Tuo Li,
Rosen Penev, Garlic Tseng, Alexandre Mergnat, Dan Carpenter,
linux-sound, linux-arm-kernel, linux-mediatek, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
snd_pcm_hw_constraint_integer() may return 1, which is then returned
from mt8365_afe_fe_startup(). ASoC only treats 0 as success when marking
the DAI as started, so .shutdown() can be skipped on rollback.
Return 0 explicitly on success.
Fixes: e1991d102bc2 ("ASoC: mediatek: mt8365: Add the AFE driver support")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/mediatek/mt8365/mt8365-afe-pcm.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sound/soc/mediatek/mt8365/mt8365-afe-pcm.c b/sound/soc/mediatek/mt8365/mt8365-afe-pcm.c
index e9497246f37c..314235557fdf 100644
--- a/sound/soc/mediatek/mt8365/mt8365-afe-pcm.c
+++ b/sound/soc/mediatek/mt8365/mt8365-afe-pcm.c
@@ -514,11 +514,14 @@ static int mt8365_afe_fe_startup(struct snd_pcm_substream *substream,
snd_soc_set_runtime_hwparams(substream, afe->mtk_afe_hardware);
ret = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
- if (ret < 0)
+ if (ret < 0) {
dev_err(afe->dev, "snd_pcm_hw_constraint_integer failed\n");
+ return ret;
+ }
mt8365_afe_enable_main_clk(afe);
- return ret;
+
+ return 0;
}
static void mt8365_afe_fe_shutdown(struct snd_pcm_substream *substream,
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/4] ASoC: mediatek: mt8188: return 0 from mt8188_afe_fe_startup() on success
2026-10-06 10:16 ` [PATCH 2/4] ASoC: mediatek: mt8188: return 0 from mt8188_afe_fe_startup() " phucduc.bui
@ 2026-10-06 10:39 ` Cezary Rojewski
2026-10-06 11:09 ` Bui Duc Phuc
0 siblings, 1 reply; 9+ messages in thread
From: Cezary Rojewski @ 2026-10-06 10:39 UTC (permalink / raw)
To: phucduc.bui
Cc: Liam Girdwood, Matthias Brugger, Jaroslav Kysela, Takashi Iwai,
Kuninori Morimoto, cassiogabrielcontato, Haotian Zhang,
Christian Marangi, Cyril Chao, Tuo Li, Rosen Penev, Garlic Tseng,
Alexandre Mergnat, Dan Carpenter, linux-sound, linux-arm-kernel,
linux-mediatek, linux-kernel, Mark Brown,
AngeloGioacchino Del Regno, Trevor Wu
On 10/6/2026 12:16 PM, phucduc.bui@gmail.com wrote:
> --- a/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c
> +++ b/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c
> @@ -318,8 +318,11 @@ static int mt8188_afe_fe_startup(struct snd_pcm_substream *substream,
> ret = snd_pcm_hw_constraint_minmax(runtime,
> SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 1,
> MT8188_MEMIF_DL7_MAX_PERIOD_SIZE);
> - if (ret < 0)
> + if (ret >= 0)
> + ret = 0;
> + else
> dev_dbg(afe->dev, "hw_constraint_minmax failed\n");
You can reduce the delta by leaving the original if-statement as-is and
following it up with:
else
ret = 0;
> +
> out:
> return ret;
> }
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] ASoC: mediatek: mt8189:return 0 from mt8189_fe_startup() on success
2026-10-06 10:16 ` [PATCH 3/4] ASoC: mediatek: mt8189:return 0 from mt8189_fe_startup() " phucduc.bui
@ 2026-10-06 10:44 ` Cezary Rojewski
2026-10-06 11:18 ` Bui Duc Phuc
0 siblings, 1 reply; 9+ messages in thread
From: Cezary Rojewski @ 2026-10-06 10:44 UTC (permalink / raw)
To: phucduc.bui
Cc: Liam Girdwood, Matthias Brugger, Jaroslav Kysela, Takashi Iwai,
Kuninori Morimoto, cassiogabrielcontato, Haotian Zhang,
Christian Marangi, Cyril Chao, Tuo Li, Rosen Penev, Garlic Tseng,
Alexandre Mergnat, Dan Carpenter, linux-sound, linux-arm-kernel,
linux-mediatek, linux-kernel, Mark Brown,
AngeloGioacchino Del Regno, Trevor Wu
On 10/6/2026 12:16 PM, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> snd_pcm_hw_constraint_integer() may return 1, which is then returned
> from mt8189_fe_startup(). ASoC only treats 0 as success when marking
> the DAI as started, so .shutdown() can be skipped on rollback.
Nothing major here, just the missing space between 'mt8189:return' in
the title.
IMHO the title could be made more explicit as you're in fact fixing how
the snd_pcm_hw_constraint_xxx() is handled by the driver. "Return 0 from
(...)" misses the point.
Kind regards,
Czarek
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/4] ASoC: mediatek: mt8188: return 0 from mt8188_afe_fe_startup() on success
2026-10-06 10:39 ` Cezary Rojewski
@ 2026-10-06 11:09 ` Bui Duc Phuc
0 siblings, 0 replies; 9+ messages in thread
From: Bui Duc Phuc @ 2026-10-06 11:09 UTC (permalink / raw)
To: Cezary Rojewski
Cc: Liam Girdwood, Matthias Brugger, Jaroslav Kysela, Takashi Iwai,
Kuninori Morimoto, cassiogabrielcontato, Haotian Zhang,
Christian Marangi, Cyril Chao, Tuo Li, Rosen Penev, Garlic Tseng,
Alexandre Mergnat, Dan Carpenter, linux-sound, linux-arm-kernel,
linux-mediatek, linux-kernel, Mark Brown,
AngeloGioacchino Del Regno, Trevor Wu
Hi Cezary,
>
> You can reduce the delta by leaving the original if-statement as-is and
> following it up with:
>
> else
> ret = 0;
Thanks, I'll make this change and include it in v2.
Best regards,
Phuc
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] ASoC: mediatek: mt8189:return 0 from mt8189_fe_startup() on success
2026-10-06 10:44 ` Cezary Rojewski
@ 2026-10-06 11:18 ` Bui Duc Phuc
0 siblings, 0 replies; 9+ messages in thread
From: Bui Duc Phuc @ 2026-10-06 11:18 UTC (permalink / raw)
To: Cezary Rojewski
Cc: Liam Girdwood, Matthias Brugger, Jaroslav Kysela, Takashi Iwai,
Kuninori Morimoto, cassiogabrielcontato, Haotian Zhang,
Christian Marangi, Cyril Chao, Tuo Li, Rosen Penev,
Alexandre Mergnat, Dan Carpenter, linux-sound, linux-arm-kernel,
linux-mediatek, linux-kernel, Mark Brown,
AngeloGioacchino Del Regno, Trevor Wu
Hi Cezary,
> Nothing major here, just the missing space between 'mt8189:return' in
> the title.
>
> IMHO the title could be made more explicit as you're in fact fixing how
> the snd_pcm_hw_constraint_xxx() is handled by the driver. "Return 0 from
> (...)" misses the point.
Thanks. I'll fix the missing space and update the title to:
ASoC: mediatek: mt8189: Handle constraint return value in FE startup
in v2.
Best regards,
Phuc
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-10-06 11:18 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-06 10:16 [PATCH 0/4] ASoC: mediatek: Return 0 from FE startup on success phucduc.bui
2026-10-06 10:16 ` [PATCH 1/4] ASoC: mediatek: common: return 0 from mtk_afe_fe_startup() " phucduc.bui
2026-10-06 10:16 ` [PATCH 2/4] ASoC: mediatek: mt8188: return 0 from mt8188_afe_fe_startup() " phucduc.bui
2026-10-06 10:39 ` Cezary Rojewski
2026-10-06 11:09 ` Bui Duc Phuc
2026-10-06 10:16 ` [PATCH 3/4] ASoC: mediatek: mt8189:return 0 from mt8189_fe_startup() " phucduc.bui
2026-10-06 10:44 ` Cezary Rojewski
2026-10-06 11:18 ` Bui Duc Phuc
2026-10-06 10:16 ` [PATCH 4/4] ASoC: mediatek: mt8365: return 0 from mt8365_afe_fe_startup() " phucduc.bui
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®