Commit 9d5e3ecd authored by Shuming Fan's avatar Shuming Fan Committed by Zheng Zengkai
Browse files

ASoC: rt712-sdca: fix speaker route missing issue

stable inclusion
from stable-v6.6.2
commit d68a32ebff921181a474831200703fe6d65228f4
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8IW7G

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=d68a32ebff921181a474831200703fe6d65228f4



--------------------------------

[ Upstream commit 1a3b7eab8500a6b923f7b62cc8aa4d832c7dfb3e ]

Sometimes the codec probe would be called earlier than the hardware initialization.
Therefore, the speaker route should be added before the the first_hw_init check.

Signed-off-by: default avatarShuming Fan <shumingf@realtek.com>
Fixes: f3da2ed1 ("ASoC: rt1712-sdca: enable pm_runtime in probe,  keep status as 'suspended'")?
Link: https://lore.kernel.org/r/20231030103644.1787948-1-shumingf@realtek.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 9706b904
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -963,13 +963,6 @@ static int rt712_sdca_probe(struct snd_soc_component *component)
	rt712_sdca_parse_dt(rt712, &rt712->slave->dev);
	rt712->component = component;

	if (!rt712->first_hw_init)
		return 0;

	ret = pm_runtime_resume(component->dev);
	if (ret < 0 && ret != -EACCES)
		return ret;

	/* add SPK route */
	if (rt712->hw_id != RT712_DEV_ID_713) {
		snd_soc_add_component_controls(component,
@@ -980,6 +973,13 @@ static int rt712_sdca_probe(struct snd_soc_component *component)
			rt712_sdca_spk_dapm_routes, ARRAY_SIZE(rt712_sdca_spk_dapm_routes));
	}

	if (!rt712->first_hw_init)
		return 0;

	ret = pm_runtime_resume(component->dev);
	if (ret < 0 && ret != -EACCES)
		return ret;

	return 0;
}