Commit 3f54aa50 authored by Wu Fengguang's avatar Wu Fengguang Committed by Takashi Iwai

ALSA: intelhdmi - probe for monitor/eld presence at module init time

This avoids lost of presence info on module reloading.
The presence info used to be only updated at the (rare) hotplug events.

Proposed by David, thanks!

CC: David Härdeman <david@hardeman.nu>
Signed-off-by: default avatarWu Fengguang <fengguang.wu@intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 864f92be
...@@ -259,6 +259,25 @@ static int intel_hdmi_read_pin_conn(struct hda_codec *codec, hda_nid_t pin_nid) ...@@ -259,6 +259,25 @@ static int intel_hdmi_read_pin_conn(struct hda_codec *codec, hda_nid_t pin_nid)
return 0; return 0;
} }
static void hdmi_get_show_eld(struct hda_codec *codec, hda_nid_t pin_nid,
struct hdmi_eld *eld)
{
if (!snd_hdmi_get_eld(eld, codec, pin_nid))
snd_hdmi_show_eld(eld);
}
static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid,
struct hdmi_eld *eld)
{
int present = snd_hda_pin_sense(codec, pin_nid);
eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE);
eld->eld_valid = !!(present & AC_PINSENSE_ELDV);
if (present & AC_PINSENSE_ELDV)
hdmi_get_show_eld(codec, pin_nid, eld);
}
static int intel_hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) static int intel_hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
{ {
struct intel_hdmi_spec *spec = codec->spec; struct intel_hdmi_spec *spec = codec->spec;
...@@ -269,6 +288,8 @@ static int intel_hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) ...@@ -269,6 +288,8 @@ static int intel_hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
return -EINVAL; return -EINVAL;
} }
hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]);
spec->pin[spec->num_pins] = pin_nid; spec->pin[spec->num_pins] = pin_nid;
spec->num_pins++; spec->num_pins++;
...@@ -436,15 +457,6 @@ static void hdmi_debug_channel_mapping(struct hda_codec *codec, hda_nid_t nid) ...@@ -436,15 +457,6 @@ static void hdmi_debug_channel_mapping(struct hda_codec *codec, hda_nid_t nid)
#endif #endif
} }
static void hdmi_parse_eld(struct hda_codec *codec, int index)
{
struct intel_hdmi_spec *spec = codec->spec;
struct hdmi_eld *eld = &spec->sink_eld[index];
if (!snd_hdmi_get_eld(eld, codec, spec->pin[index]))
snd_hdmi_show_eld(eld);
}
/* /*
* Audio InfoFrame routines * Audio InfoFrame routines
...@@ -677,7 +689,7 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) ...@@ -677,7 +689,7 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
spec->sink_eld[index].eld_valid = eldv; spec->sink_eld[index].eld_valid = eldv;
if (pind && eldv) { if (pind && eldv) {
hdmi_parse_eld(codec, index); hdmi_get_show_eld(codec, spec->pin[index], &spec->sink_eld[index]);
/* TODO: do real things about ELD */ /* TODO: do real things about ELD */
} }
} }
......
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