linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: hdmi-codec: Get ELD in before reporting plugged event
@ 2020-11-17 11:26 Cheng-Yi Chiang
  0 siblings, 0 replies; only message in thread
From: Cheng-Yi Chiang @ 2020-11-17 11:26 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mark Brown, Rohit kumar, Liam Girdwood, Rob Herring,
	Jaroslav Kysela, Takashi Iwai, Matthias Brugger, Heiko Stuebner,
	Srinivasa Rao, dianders, dgreid, tzungbi, judyhsiao,
	linux-arm-kernel, alsa-devel, linux-mediatek, linux-rockchip,
	Cheng-Yi Chiang

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>
---
 sound/soc/codecs/hdmi-codec.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index 403d4c6a49a8..f0e0e1836000 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 {
+		memset(hcp->eld, 0, sizeof(hcp->eld));
 		hdmi_codec_jack_report(hcp, 0);
+	}
 }
 
 static int hdmi_codec_set_jack(struct snd_soc_component *component,
-- 
2.29.2.299.gdc1121823c-goog


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-17 11:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17 11:26 [PATCH] ASoC: hdmi-codec: Get ELD in before reporting plugged event Cheng-Yi Chiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).