Skip to content

Commit 15be353

Browse files
jbrun3tbroonie
authored andcommitted
ASoC: hdmi-codec: register hpd callback on component probe
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: 25ce4f2 ("ASoC: hdmi-codec: Get ELD in before reporting plugged event") Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20231106104013.704356-1-jbrunet@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 004fc58 commit 15be353

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

sound/soc/codecs/hdmi-codec.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -877,18 +877,13 @@ static int hdmi_codec_set_jack(struct snd_soc_component *component,
877877
void *data)
878878
{
879879
struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component);
880-
int ret = -ENOTSUPP;
881880

882881
if (hcp->hcd.ops->hook_plugged_cb) {
883882
hcp->jack = jack;
884-
ret = hcp->hcd.ops->hook_plugged_cb(component->dev->parent,
885-
hcp->hcd.data,
886-
plugged_cb,
887-
component->dev);
888-
if (ret)
889-
hcp->jack = NULL;
883+
return 0;
890884
}
891-
return ret;
885+
886+
return -ENOTSUPP;
892887
}
893888

894889
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,
982977
return ret;
983978
}
984979

980+
static int hdmi_probe(struct snd_soc_component *component)
981+
{
982+
struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component);
983+
int ret = 0;
984+
985+
if (hcp->hcd.ops->hook_plugged_cb) {
986+
ret = hcp->hcd.ops->hook_plugged_cb(component->dev->parent,
987+
hcp->hcd.data,
988+
plugged_cb,
989+
component->dev);
990+
}
991+
992+
return ret;
993+
}
994+
985995
static void hdmi_remove(struct snd_soc_component *component)
986996
{
987997
struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component);
@@ -992,6 +1002,7 @@ static void hdmi_remove(struct snd_soc_component *component)
9921002
}
9931003

9941004
static const struct snd_soc_component_driver hdmi_driver = {
1005+
.probe = hdmi_probe,
9951006
.remove = hdmi_remove,
9961007
.dapm_widgets = hdmi_widgets,
9971008
.num_dapm_widgets = ARRAY_SIZE(hdmi_widgets),

0 commit comments

Comments
 (0)