UPSTREAM: 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.

Bug: 239396464
Change-Id: I2245de6e6f7dbc64863267db864dafdd3af95747
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>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 25ce4f2b3593fa6bba70ddabbd2ee297b262784f)
This commit is contained in:
Cheng-Yi Chiang 2020-11-18 12:38:52 +08:00 committed by Todd Kjos
parent d6207c39cb
commit 5e75deab3a

View File

@ -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,