From: Lin Tzu Yang <rongh7426@gmail.com>
To: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Dmitry Baryshkov <lumag@kernel.org>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/2] ASoC: hdmi-codec: Clear the parsed ELD on unplug
Date: Mon, 30 Nov 2026 11:47:59 +0800 [thread overview]
Message-ID: <20261130034800.824934-2-rongh7426@gmail.com> (raw)
In-Reply-To: <20261130034800.824934-1-rongh7426@gmail.com>
When the sink goes away, plugged_cb() clears the raw ELD but leaves
hcp->eld_parsed as it was. The eld#N procfs file prints eld_parsed, so
after an unplug it keeps showing the monitor that was last connected
until something is plugged in again.
On a Raspberry Pi 5 (vc4 HDMI), forcing the connector off through
/sys/class/drm/card1-HDMI-A-1/status leaves /proc/asound/card0/eld#0
at:
monitor_name WaveShare
eld_version [0x2] CEA-861D or below
sad_count 1
Clear eld_parsed together with the raw ELD, as hdmi_codec_startup()
already does when it finds an empty ELD. eld_parsed is only used for the
procfs file and the log message in plugged_cb(), so nothing else
changes.
While at it, clear both before reporting the jack change rather than
after, so that userspace reacting to the unplug event doesn't read the
old ELD. The plug path already updates the ELD before reporting.
Tested on a Raspberry Pi 5 (Raspberry Pi OS kernel 6.18.39, with this
change applied to its snd-soc-hdmi-codec module), forcing HDMI-A-1 off
and back on twice:
- before: eld#0 still shows WaveShare after each unplug
- after: eld#0 shows an empty ELD (eld_version [0x0], sad_count 0) after
each unplug and WaveShare again after each replug
- HDMI audio playback still works
This change and its description were written with the help of an AI
coding assistant (Claude); the testing above was done on real hardware.
Fixes: 0ecd24a6d8b2 ("ASoC: hdmi-codec: dump ELD through procfs")
Signed-off-by: Lin Tzu Yang <rongh7426@gmail.com>
---
v2: clear the ELD before the jack report instead of after (Mark).
The reorder was only build-tested; the v1 test above still applies
to the procfs result.
sound/soc/codecs/hdmi-codec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index bc59da2..7946f61 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -971,8 +971,9 @@ static void plugged_cb(struct device *dev, bool plugged)
}
hdmi_codec_jack_report(hcp, SND_JACK_AVOUT);
} else {
- hdmi_codec_jack_report(hcp, 0);
memset(hcp->eld, 0, sizeof(hcp->eld));
+ memset(&hcp->eld_parsed, 0, sizeof(hcp->eld_parsed));
+ hdmi_codec_jack_report(hcp, 0);
}
}
--
2.51.1.windows.1
next prev parent reply other threads:[~2026-11-30 3:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 3:47 [PATCH v2 0/2] ASoC: hdmi-codec: ELD fixes for unplug and hotplug races Lin Tzu Yang
2026-11-30 3:47 ` Lin Tzu Yang [this message]
2026-11-30 3:48 ` [PATCH v2 2/2] ASoC: hdmi-codec: Hold the lock while the ELD is updated or read Lin Tzu Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130034800.824934-2-rongh7426@gmail.com \
--to=rongh7426@gmail.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=lumag@kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox