linux-yocto/sound/soc/qcom
Srinivas Kandagatla 9314cd0fb1 ASoC: qcom: use drvdata instead of component to keep id
[ Upstream commit 8167f4f425 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-20 18:30:28 +02:00
..
qdsp6 ASoC: qdsp6: q6asm-dai: fix q6asm_dai_compr_set_params error path 2025-04-20 10:15:41 +02:00
apq8016_sbc.c
apq8096.c
common.c
common.h
Kconfig ASoC: qcom: sc7280: Fix missing Soundwire runtime stream alloc 2024-10-22 21:00:38 +01:00
lpass-apq8016.c ASoC: Switch back to struct platform_driver::remove() 2024-09-09 18:26:49 +01:00
lpass-cdc-dma.c
lpass-cpu.c ASoC: qcom: Fix NULL Dereference in asoc_qcom_lpass_cpu_platform_probe() 2024-10-07 15:35:34 +01:00
lpass-hdmi.c
lpass-hdmi.h
lpass-ipq806x.c ASoC: Switch back to struct platform_driver::remove() 2024-09-09 18:26:49 +01:00
lpass-lpaif-reg.h
lpass-platform.c ASoC: qcom: use drvdata instead of component to keep id 2025-08-20 18:30:28 +02:00
lpass-sc7180.c ASoC: Switch back to struct platform_driver::remove() 2024-09-09 18:26:49 +01:00
lpass-sc7280.c ASoC: Switch back to struct platform_driver::remove() 2024-09-09 18:26:49 +01:00
lpass.h ASoC: qcom: Fix sc7280 lpass potential buffer overflow 2025-04-25 10:47:50 +02:00
Makefile
sc7180.c
sc7280.c ASoC: qcom: sc7280: Fix missing Soundwire runtime stream alloc 2024-10-22 21:00:38 +01:00
sc8280xp.c
sdm845.c ASoC: qcom: sdm845: Add error handling in sdm845_slim_snd_hw_params() 2025-06-27 11:11:13 +01:00
sdw.c
sdw.h
sm8250.c ASoC: qcom: sm8250: explicitly set format in sm8250_be_hw_params_fixup() 2025-05-29 11:02:24 +02:00
storm.c
x1e80100.c