Commit b22d6a6c authored by Jerome Brunet's avatar Jerome Brunet Committed by Zheng Zengkai
Browse files

ASoC: hdmi-codec: register hpd callback on component probe

stable inclusion
from stable-v6.6.2
commit f4d32c52d829d007303c5fe1638f2a6725f7fed3
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=f4d32c52d829d007303c5fe1638f2a6725f7fed3



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

[ Upstream commit 15be353d55f9e12e34f9a819f51eb41fdef5eda8 ]

The HDMI hotplug callback to the hdmi-codec is currently registered when
jack is set.

The hotplug not only serves to report the ASoC jack state but also to get
the ELD. It should be registered when the component probes instead, so it
does not depend on the card driver registering a jack for the HDMI to
properly report the ELD.

Fixes: 25ce4f2b ("ASoC: hdmi-codec: Get ELD in before reporting plugged event")
Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20231106104013.704356-1-jbrunet@baylibre.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 908a4a6f
Loading
Loading
Loading
Loading
+19 −8
Original line number Diff line number Diff line
@@ -877,18 +877,13 @@ static int hdmi_codec_set_jack(struct snd_soc_component *component,
			       void *data)
{
	struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component);
	int ret = -ENOTSUPP;

	if (hcp->hcd.ops->hook_plugged_cb) {
		hcp->jack = jack;
		ret = hcp->hcd.ops->hook_plugged_cb(component->dev->parent,
						    hcp->hcd.data,
						    plugged_cb,
						    component->dev);
		if (ret)
			hcp->jack = NULL;
		return 0;
	}
	return ret;

	return -ENOTSUPP;
}

static int hdmi_dai_spdif_probe(struct snd_soc_dai *dai)
@@ -982,6 +977,21 @@ static int hdmi_of_xlate_dai_id(struct snd_soc_component *component,
	return ret;
}

static int hdmi_probe(struct snd_soc_component *component)
{
	struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component);
	int ret = 0;

	if (hcp->hcd.ops->hook_plugged_cb) {
		ret = hcp->hcd.ops->hook_plugged_cb(component->dev->parent,
						    hcp->hcd.data,
						    plugged_cb,
						    component->dev);
	}

	return ret;
}

static void hdmi_remove(struct snd_soc_component *component)
{
	struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component);
@@ -992,6 +1002,7 @@ static void hdmi_remove(struct snd_soc_component *component)
}

static const struct snd_soc_component_driver hdmi_driver = {
	.probe			= hdmi_probe,
	.remove			= hdmi_remove,
	.dapm_widgets		= hdmi_widgets,
	.num_dapm_widgets	= ARRAY_SIZE(hdmi_widgets),