* [PATCH 1/5] ASoC: fsl_sai: Fix PM QoS cleanup on resume failure
2026-10-30 9:13 [PATCH 0/5] ASoC: fsl_sai: Address several issues in the driver phucduc.bui
@ 2026-10-30 9:14 ` phucduc.bui
2026-10-30 9:14 ` [PATCH 2/5] ASoC: fsl_sai: Use optional clock getter for MCLKs phucduc.bui
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: phucduc.bui @ 2026-10-30 9:14 UTC (permalink / raw)
To: Shengjiu Wang, Shengjiu Wang, Xiubo Li, Fabio Estevam,
Nicolin Chen, Mark Brown
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linuxppc-dev,
linux-sound, linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
If regcache_sync() fails during runtime resume, the CPU latency
QoS request remains active even though the resume operation
failed.
Switch the regmap back to cache-only mode and remove the PM QoS
request before disabling the clocks, ensuring that the resources
enabled earlier in the resume path are properly cleaned up.
Fixes: 907e0cdebc1f ("ASoC: fsl_sai: Add pm qos cpu latency support")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/fsl/fsl_sai.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index d232c8f53061..042885ba415e 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -1981,7 +1981,7 @@ static int fsl_sai_runtime_resume(struct device *dev)
ret = regcache_sync(sai->regmap);
if (ret)
- goto disable_rx_clk;
+ goto remove_qos;
if (sai->soc_data->mclk_with_tere && sai->mclk_direction_output)
regmap_update_bits(sai->regmap, FSL_SAI_TCSR(ofs),
@@ -1989,7 +1989,12 @@ static int fsl_sai_runtime_resume(struct device *dev)
return 0;
-disable_rx_clk:
+remove_qos:
+ regcache_cache_only(sai->regmap, true);
+
+ if (sai->soc_data->flags & PMQOS_CPU_LATENCY)
+ cpu_latency_qos_remove_request(&sai->pm_qos_req);
+
if (sai->mclk_streams & BIT(SNDRV_PCM_STREAM_CAPTURE))
clk_disable_unprepare(sai->mclk_clk[sai->mclk_id[0]]);
disable_tx_clk:
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 2/5] ASoC: fsl_sai: Use optional clock getter for MCLKs
2026-10-30 9:13 [PATCH 0/5] ASoC: fsl_sai: Address several issues in the driver phucduc.bui
2026-10-30 9:14 ` [PATCH 1/5] ASoC: fsl_sai: Fix PM QoS cleanup on resume failure phucduc.bui
@ 2026-10-30 9:14 ` phucduc.bui
2026-10-30 9:14 ` [PATCH 3/5] ASoC: fsl_sai: Remove redundant error messages phucduc.bui
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: phucduc.bui @ 2026-10-30 9:14 UTC (permalink / raw)
To: Shengjiu Wang, Shengjiu Wang, Xiubo Li, Fabio Estevam,
Nicolin Chen, Mark Brown
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linuxppc-dev,
linux-sound, linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
The current code uses devm_clk_get() and sets the clock pointer
to NULL when it returns an error. However, this silently ignores
errors such as -EPROBE_DEFER, allowing the driver to continue
probing without the requested clock.
Use devm_clk_get_optional() to handle missing optional clocks
automatically, and dev_err_probe() to properly propagate other
errors, including -EPROBE_DEFER.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/fsl/fsl_sai.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 042885ba415e..44a34f48a0cf 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -1589,12 +1589,10 @@ static int fsl_sai_probe(struct platform_device *pdev)
for (i = 1; i < FSL_SAI_MCLK_MAX; i++) {
sprintf(tmp, "mclk%d", i);
- sai->mclk_clk[i] = devm_clk_get(dev, tmp);
- if (IS_ERR(sai->mclk_clk[i])) {
- dev_err(dev, "failed to get mclk%d clock: %ld\n",
- i, PTR_ERR(sai->mclk_clk[i]));
- sai->mclk_clk[i] = NULL;
- }
+ sai->mclk_clk[i] = devm_clk_get_optional(dev, tmp);
+ if (IS_ERR(sai->mclk_clk[i]))
+ return dev_err_probe(dev, PTR_ERR(sai->mclk_clk[i]),
+ "failed to get mclk%d clock\n", i);
}
if (sai->soc_data->mclk0_is_mclk1)
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 3/5] ASoC: fsl_sai: Remove redundant error messages
2026-10-30 9:13 [PATCH 0/5] ASoC: fsl_sai: Address several issues in the driver phucduc.bui
2026-10-30 9:14 ` [PATCH 1/5] ASoC: fsl_sai: Fix PM QoS cleanup on resume failure phucduc.bui
2026-10-30 9:14 ` [PATCH 2/5] ASoC: fsl_sai: Use optional clock getter for MCLKs phucduc.bui
@ 2026-10-30 9:14 ` phucduc.bui
2026-10-30 9:14 ` [PATCH 4/5] ASoC: fsl_sai: Propagate device tree property read errors phucduc.bui
2026-10-30 9:14 ` [PATCH 5/5] ASoC: fsl_sai: Drop redundant dataline mask AND phucduc.bui
4 siblings, 0 replies; 6+ messages in thread
From: phucduc.bui @ 2026-10-30 9:14 UTC (permalink / raw)
To: Shengjiu Wang, Shengjiu Wang, Xiubo Li, Fabio Estevam,
Nicolin Chen, Mark Brown
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linuxppc-dev,
linux-sound, linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
The errors are either reported directly by these functions
or already reported deeper in the call chain, so additional
dev_err() and dev_warn() calls are unnecessary.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/fsl/fsl_sai.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 44a34f48a0cf..5532fab80be0 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -1615,10 +1615,8 @@ static int fsl_sai_probe(struct platform_device *pdev)
/* read dataline mask for rx and tx*/
ret = fsl_sai_read_dlcfg(sai);
- if (ret < 0) {
- dev_err(dev, "failed to read dlcfg %d\n", ret);
+ if (ret < 0)
return ret;
- }
irq = platform_get_irq(pdev, 0);
if (irq < 0)
@@ -1698,9 +1696,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
if (ret < 0)
dev_warn(dev, "Error reading SAI version: %d\n", ret);
- ret = fsl_sai_reset_hw(dev);
- if (ret < 0)
- dev_warn(dev, "Failed to reset hardware: %d\n", ret);
+ fsl_sai_reset_hw(dev);
/* Select MCLK direction */
if (sai->mclk_direction_output &&
@@ -1715,10 +1711,8 @@ static int fsl_sai_probe(struct platform_device *pdev)
ret = devm_request_irq(dev, irq, fsl_sai_isr, IRQF_SHARED,
np->name, sai);
- if (ret) {
- dev_err(dev, "failed to claim irq %u\n", irq);
+ if (ret)
goto err_pm_get_sync;
- }
if (of_device_is_compatible(np, "fsl,imx952-sai") &&
!of_property_read_string(np, "fsl,sai-amix-mode", &str)) {
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 4/5] ASoC: fsl_sai: Propagate device tree property read errors
2026-10-30 9:13 [PATCH 0/5] ASoC: fsl_sai: Address several issues in the driver phucduc.bui
` (2 preceding siblings ...)
2026-10-30 9:14 ` [PATCH 3/5] ASoC: fsl_sai: Remove redundant error messages phucduc.bui
@ 2026-10-30 9:14 ` phucduc.bui
2026-10-30 9:14 ` [PATCH 5/5] ASoC: fsl_sai: Drop redundant dataline mask AND phucduc.bui
4 siblings, 0 replies; 6+ messages in thread
From: phucduc.bui @ 2026-10-30 9:14 UTC (permalink / raw)
To: Shengjiu Wang, Shengjiu Wang, Xiubo Li, Fabio Estevam,
Nicolin Chen, Mark Brown
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linuxppc-dev,
linux-sound, linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Return the original error codes from of_property_read_u32_index()
instead of replacing them with -EINVAL.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/fsl/fsl_sai.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 5532fab80be0..cb07e7d13132 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -1495,15 +1495,15 @@ static int fsl_sai_read_dlcfg(struct fsl_sai *sai)
*/
ret = of_property_read_u32_index(np, propname, index++, &type);
if (ret)
- return -EINVAL;
+ return ret;
ret = of_property_read_u32_index(np, propname, index++, &rx);
if (ret)
- return -EINVAL;
+ return ret;
ret = of_property_read_u32_index(np, propname, index++, &tx);
if (ret)
- return -EINVAL;
+ return ret;
if ((rx & ~soc_dl) || (tx & ~soc_dl)) {
dev_err(dev, "dataline cfg[%d] setting error, mask is 0x%x\n", i, soc_dl);
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 5/5] ASoC: fsl_sai: Drop redundant dataline mask AND
2026-10-30 9:13 [PATCH 0/5] ASoC: fsl_sai: Address several issues in the driver phucduc.bui
` (3 preceding siblings ...)
2026-10-30 9:14 ` [PATCH 4/5] ASoC: fsl_sai: Propagate device tree property read errors phucduc.bui
@ 2026-10-30 9:14 ` phucduc.bui
4 siblings, 0 replies; 6+ messages in thread
From: phucduc.bui @ 2026-10-30 9:14 UTC (permalink / raw)
To: Shengjiu Wang, Shengjiu Wang, Xiubo Li, Fabio Estevam,
Nicolin Chen, Mark Brown
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linuxppc-dev,
linux-sound, linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
The rx/tx masks with bits outside soc_dl are already rejected just above,
so masking them with soc_dl again is no-op. Remove it.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/fsl/fsl_sai.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index cb07e7d13132..8315a0d8893b 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -1510,9 +1510,6 @@ static int fsl_sai_read_dlcfg(struct fsl_sai *sai)
return -EINVAL;
}
- rx = rx & soc_dl;
- tx = tx & soc_dl;
-
cfg[i].type = type;
cfg[i].pins[0] = hweight8(rx);
cfg[i].mask[0] = rx;
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread