Commit f6baee71 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jiri Slaby

ALSA: hda - Delay HDMI presence reports while waiting for ELD information

commit efe47108 upstream.

There is a small gap between the jack detection unsolicited event and
the time the ELD is updated.  When user-space queries the HDMI ELD
immediately after receiving the notification, it might fail because of
this gap.

For avoiding such a problem, this patch tries to delay the HDMI jack
detect notification until ELD information is fully updated.  The
workaround is imperfect, but good enough as a starting point.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 19c7fb34
...@@ -1092,7 +1092,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, ...@@ -1092,7 +1092,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
* Unsolicited events * Unsolicited events
*/ */
static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll); static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll);
static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
{ {
...@@ -1118,8 +1118,8 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) ...@@ -1118,8 +1118,8 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
if (pin_idx < 0) if (pin_idx < 0)
return; return;
hdmi_present_sense(get_pin(spec, pin_idx), 1); if (hdmi_present_sense(get_pin(spec, pin_idx), 1))
snd_hda_jack_report_sync(codec); snd_hda_jack_report_sync(codec);
} }
static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res)
...@@ -1416,7 +1416,7 @@ static int hdmi_read_pin_conn(struct hda_codec *codec, int pin_idx) ...@@ -1416,7 +1416,7 @@ static int hdmi_read_pin_conn(struct hda_codec *codec, int pin_idx)
return 0; return 0;
} }
static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
{ {
struct hda_codec *codec = per_pin->codec; struct hda_codec *codec = per_pin->codec;
struct hdmi_spec *spec = codec->spec; struct hdmi_spec *spec = codec->spec;
...@@ -1434,6 +1434,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) ...@@ -1434,6 +1434,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
int present = snd_hda_pin_sense(codec, pin_nid); int present = snd_hda_pin_sense(codec, pin_nid);
bool update_eld = false; bool update_eld = false;
bool eld_changed = false; bool eld_changed = false;
bool ret;
mutex_lock(&per_pin->lock); mutex_lock(&per_pin->lock);
pin_eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE); pin_eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE);
...@@ -1499,7 +1500,12 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) ...@@ -1499,7 +1500,12 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
SNDRV_CTL_EVENT_MASK_VALUE | SNDRV_CTL_EVENT_MASK_INFO, SNDRV_CTL_EVENT_MASK_VALUE | SNDRV_CTL_EVENT_MASK_INFO,
&per_pin->eld_ctl->id); &per_pin->eld_ctl->id);
unlock: unlock:
if ((codec->vendor_id & 0xffff0000) == 0x10020000)
ret = true; /* AMD codecs create ELD by itself */
else
ret = !repoll || !pin_eld->monitor_present || pin_eld->eld_valid;
mutex_unlock(&per_pin->lock); mutex_unlock(&per_pin->lock);
return ret;
} }
static void hdmi_repoll_eld(struct work_struct *work) static void hdmi_repoll_eld(struct work_struct *work)
...@@ -1510,7 +1516,8 @@ static void hdmi_repoll_eld(struct work_struct *work) ...@@ -1510,7 +1516,8 @@ static void hdmi_repoll_eld(struct work_struct *work)
if (per_pin->repoll_count++ > 6) if (per_pin->repoll_count++ > 6)
per_pin->repoll_count = 0; per_pin->repoll_count = 0;
hdmi_present_sense(per_pin, per_pin->repoll_count); if (hdmi_present_sense(per_pin, per_pin->repoll_count))
snd_hda_jack_report_sync(per_pin->codec);
} }
static void intel_haswell_fixup_connect_list(struct hda_codec *codec, static void intel_haswell_fixup_connect_list(struct hda_codec *codec,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment