summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/hdmi-codec.c
diff options
context:
space:
mode:
authorCheng-Yi Chiang <cychiang@chromium.org>2020-11-18 12:38:52 +0800
committerMark Brown <broonie@kernel.org>2020-11-23 18:37:35 +0000
commit25ce4f2b3593fa6bba70ddabbd2ee297b262784f (patch)
tree656ea2588bd1cdd0e10b4d6ca76a62d84c059117 /sound/soc/codecs/hdmi-codec.c
parent3371c6f9f4115d8949e093be8299a9c1ebe29137 (diff)
ASoC: hdmi-codec: Get ELD in before reporting plugged event
In plugged callback, ELD should be updated from display driver so that user space can query information from ELD immediately after receiving jack plugged event. When jack is unplugged, clear ELD buffer so that user space does not get obsolete information of unplugged HDMI. Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org> Link: https://lore.kernel.org/r/20201118043852.1338877-1-cychiang@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/hdmi-codec.c')
-rw-r--r--sound/soc/codecs/hdmi-codec.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index 403d4c6a49a8..e8410b2433de 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -692,10 +692,16 @@ static void plugged_cb(struct device *dev, bool plugged)
{
struct hdmi_codec_priv *hcp = dev_get_drvdata(dev);
- if (plugged)
+ if (plugged) {
+ if (hcp->hcd.ops->get_eld) {
+ hcp->hcd.ops->get_eld(dev->parent, hcp->hcd.data,
+ hcp->eld, sizeof(hcp->eld));
+ }
hdmi_codec_jack_report(hcp, SND_JACK_LINEOUT);
- else
+ } else {
hdmi_codec_jack_report(hcp, 0);
+ memset(hcp->eld, 0, sizeof(hcp->eld));
+ }
}
static int hdmi_codec_set_jack(struct snd_soc_component *component,