summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerio Setti <vsetti@baylibre.com>2026-07-10 23:09:51 +0200
committerMark Brown <broonie@kernel.org>2026-07-27 14:39:24 +0100
commite82159384a5052212e7d2f2aa1de39827f1bed3c (patch)
treee975a524b21ad9901b54be688f1cfb31eba33d8f
parentdf3c987ab3d70146e2c657bc50efe8737aa4da28 (diff)
downloadlinux-next-e82159384a5052212e7d2f2aa1de39827f1bed3c.tar.gz
linux-next-e82159384a5052212e7d2f2aa1de39827f1bed3c.zip
ASoC: meson: aiu-encoder-i2s: use the core symmetric_rate handling
The driver manually implement the interface-wide rate symmetry enforcement in hw_params(), which suffers from the same problem addressed in the previous patch: the restriction is not visible in the hw parameter constraints, so a stream with a mismatching rate only finds out via -EINVAL late in the stream setup. The ASoC core already provides this feature through the DAI's 'symmetric_rate' flag: when another stream of the DAI is active, soc_pcm_apply_symmetry() constrains the rate at open time so the restriction shows up during parameter refinement, and soc_pcm_params_symmetry() still rejects a mismatch at hw_params() time as a backstop. Set 'symmetric_rate' on the I2S encoder DAI and drop the open-coded check along with the now unused 'rate' member of struct gx_iface. Signed-off-by: Valerio Setti <vsetti@baylibre.com> Link: https://patch.msgid.link/20260710-aiu-improve-quirk-check-v1-3-2fdd1b6f8896@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/meson/aiu-encoder-i2s.c21
-rw-r--r--sound/soc/meson/aiu.c1
-rw-r--r--sound/soc/meson/gx-interface.h3
3 files changed, 3 insertions, 22 deletions
diff --git a/sound/soc/meson/aiu-encoder-i2s.c b/sound/soc/meson/aiu-encoder-i2s.c
index 4c62ea41d7e8..58dce9f08c9d 100644
--- a/sound/soc/meson/aiu-encoder-i2s.c
+++ b/sound/soc/meson/aiu-encoder-i2s.c
@@ -179,28 +179,14 @@ static int aiu_encoder_i2s_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct gx_stream *ts = snd_soc_dai_get_dma_data(dai, substream);
- struct gx_iface *iface = ts->iface;
int ret;
- /*
- * Enforce interface wide rate symmetry only if there is more than
- * 1 stream active.
- */
- if (snd_soc_dai_active(dai) > 1) {
- if (iface->rate && iface->rate != params_rate(params)) {
- dev_err(dai->dev, "can't set iface rate (%d != %d)\n",
- iface->rate, params_rate(params));
- return -EINVAL;
- }
- }
-
ret = aiu_encoder_i2s_set_clocks(substream, params, dai);
if (ret) {
dev_err(dai->dev, "setting i2s clocks failed: %d\n", ret);
return ret;
}
- iface->rate = params_rate(params);
ts->physical_width = params_physical_width(params);
ts->width = params_width(params);
ts->channels = params_channels(params);
@@ -233,17 +219,14 @@ static int aiu_encoder_i2s_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct gx_stream *ts = snd_soc_dai_get_dma_data(dai, substream);
- struct gx_iface *iface = ts->iface;
struct snd_soc_component *component = dai->component;
/*
* If this is the last substream being closed then disable the i2s
- * clock divider and clear 'iface->rate'.
+ * clock divider.
*/
- if (snd_soc_dai_active(dai) <= 1) {
+ if (snd_soc_dai_active(dai) <= 1)
aiu_encoder_i2s_divider_enable(component, 0);
- iface->rate = 0;
- }
if (ts->clk_enabled) {
clk_disable_unprepare(ts->iface->mclk);
diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c
index 64ace4d25d92..2668646e3597 100644
--- a/sound/soc/meson/aiu.c
+++ b/sound/soc/meson/aiu.c
@@ -154,6 +154,7 @@ static struct snd_soc_dai_driver aiu_cpu_dai_drv[] = {
.formats = AIU_FORMATS,
},
.ops = &aiu_encoder_i2s_dai_ops,
+ .symmetric_rate = 1,
},
[CPU_SPDIF_ENCODER] = {
.name = "SPDIF Encoder",
diff --git a/sound/soc/meson/gx-interface.h b/sound/soc/meson/gx-interface.h
index d9ab894589fa..2a6207e393e8 100644
--- a/sound/soc/meson/gx-interface.h
+++ b/sound/soc/meson/gx-interface.h
@@ -19,9 +19,6 @@ struct gx_iface {
/* format is common to all the DAIs of the iface */
unsigned int fmt;
-
- /* For component wide symmetry */
- int rate;
};
struct gx_stream {