]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ASoC: qcom: use drvdata instead of component to keep id
authorSrinivas Kandagatla <srini@kernel.org>
Wed, 4 Jun 2025 02:06:48 +0000 (02:06 +0000)
committerMark Brown <broonie@kernel.org>
Sun, 8 Jun 2025 22:31:01 +0000 (23:31 +0100)
commit8167f4f42572818fa8153be2b03e4c2120846603
tree0cb347f2b73f33c9a9970dfc6f380a2dd5903f14
parent19272b37aa4f83ca52bdf9c16d5d81bdd1354494
ASoC: qcom: use drvdata instead of component to keep id

Qcom lpass is using component->id to keep DAI ID (A).

(S) static int lpass_platform_pcmops_open(
sruct snd_soc_component *component,
struct snd_pcm_substream *substream)
{                           ^^^^^^^^^(B0)
...
(B1) struct snd_soc_pcm_runtime *soc_runtime = snd_soc_substream_to_rtd(substream);
(B2) struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(soc_runtime, 0);
...
(B3) unsigned int dai_id = cpu_dai->driver->id;

(A) component->id = dai_id;
...
}

This driver can get dai_id from substream (B0 - B3).
In this driver, below functions get dai_id from component->id (A).

(X) lpass_platform_pcmops_suspend()
(Y) lpass_platform_pcmops_resume()
(Z) lpass_platform_copy()

Here, (Z) can get it from substream (B0 - B3), don't need to use
component->id (A). On suspend/resume (X)(Y), dai_id can only be obtained
from component->id (A), because there is no substream (B0) in function
parameter.

But, component->id (A) itself should not be used for such purpose.
It is intilialized at snd_soc_component_initialize(), and parsed its ID
(= component->id) from device name (a).

int snd_soc_component_initialize(...)
{
...
if (!component->name) {
(a) component->name = fmt_single_name(dev, &component->id);
...                                     ^^^^^^^^^^^^^
}
...
}

Unfortunately, current code is broken to start with.

There are many regmaps that the driver cares about, however its only
managing one (either dp or i2s) in component suspend/resume path.

I2S regmap is mandatory however other regmaps are setup based on flags
like "hdmi_port_enable" and "codec_dma_enable".

Correct thing for suspend/resume path to handle is by checking these
flags, instead of using component->id.

Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
Suggested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87a56ouuob.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/qcom/lpass-platform.c