Skip to content

Commit ca76282

Browse files
kv2019itiwai
authored andcommitted
ALSA: hda/hdmi: fix race in monitor detection during probe
A race exists between build_pcms() and build_controls() phases of codec setup. Build_pcms() sets up notifier for jack events. If a monitor event is received before build_controls() is run, the initial jack state is lost and never reported via mixer controls. The problem can be hit at least with SOF as the controller driver. SOF calls snd_hda_codec_build_controls() in its workqueue-based probe and this can be delayed enough to hit the race condition. Fix the issue by invalidating the per-pin ELD information when build_controls() is called. The existing call to hdmi_present_sense() will update the ELD contents. This ensures initial monitor state is correctly reflected via mixer controls. BugLink: thesofproject#1687 Signed-off-by: Kai Vehmanen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent ef0b320 commit ca76282

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sound/pci/hda/patch_hdmi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2198,7 +2198,9 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)
21982198

21992199
for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
22002200
struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
2201+
struct hdmi_eld *pin_eld = &per_pin->sink_eld;
22012202

2203+
pin_eld->eld_valid = false;
22022204
hdmi_present_sense(per_pin, 0);
22032205
}
22042206

0 commit comments

Comments
 (0)