Skip to content

Commit c44da62

Browse files
committed
ALSA: hda - Fix inconsistent monitor_present state until repoll
While the previous commit fixed the missing monitor_present flag update, it may be still in an inconsistent state while the driver repolls: the flag itself is updated, but the eld_valid flag and the contents don't follow until the repoll finishes (and may be repeated for a few times). The basic problem is that pin_eld->monitor_present is updated in the caller side. This should have been updated only in update_eld(). So, the proper fix is to avoid accessing pin_eld but only spec->temp_eld. Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 023d821 commit c44da62

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

sound/pci/hda/patch_hdmi.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,6 @@ static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
13961396
struct hda_codec *codec = per_pin->codec;
13971397
struct hdmi_spec *spec = codec->spec;
13981398
struct hdmi_eld *eld = &spec->temp_eld;
1399-
struct hdmi_eld *pin_eld = &per_pin->sink_eld;
14001399
hda_nid_t pin_nid = per_pin->pin_nid;
14011400
/*
14021401
* Always execute a GetPinSense verb here, even when called from
@@ -1413,17 +1412,15 @@ static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
14131412
present = snd_hda_pin_sense(codec, pin_nid);
14141413

14151414
mutex_lock(&per_pin->lock);
1416-
pin_eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE);
1417-
eld->monitor_present = pin_eld->monitor_present;
1418-
1419-
if (pin_eld->monitor_present)
1415+
eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE);
1416+
if (eld->monitor_present)
14201417
eld->eld_valid = !!(present & AC_PINSENSE_ELDV);
14211418
else
14221419
eld->eld_valid = false;
14231420

14241421
codec_dbg(codec,
14251422
"HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n",
1426-
codec->addr, pin_nid, pin_eld->monitor_present, eld->eld_valid);
1423+
codec->addr, pin_nid, eld->monitor_present, eld->eld_valid);
14271424

14281425
if (eld->eld_valid) {
14291426
if (spec->ops.pin_get_eld(codec, pin_nid, eld->eld_buffer,
@@ -1443,7 +1440,7 @@ static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
14431440
else
14441441
update_eld(codec, per_pin, eld);
14451442

1446-
ret = !repoll || !pin_eld->monitor_present || pin_eld->eld_valid;
1443+
ret = !repoll || !eld->monitor_present || eld->eld_valid;
14471444

14481445
jack = snd_hda_jack_tbl_get(codec, pin_nid);
14491446
if (jack)

0 commit comments

Comments
 (0)