aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorWu Fengguang <fengguang.wu@intel.com>2009-11-17 23:38:03 -0500
committerTakashi Iwai <tiwai@suse.de>2009-11-18 01:42:07 -0500
commit3f54aa5091f48e9d8ce6e99b248449d08acccb26 (patch)
tree10b2264c878d9f3d7d7235289b2b27e783d60eb8 /sound
parent864f92be7e8d4a0ba11d912e3f03d1a92a031dee (diff)
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: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_intelhdmi.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c
index 095c993f4b76..c5fd011567fb 100644
--- a/sound/pci/hda/patch_intelhdmi.c
+++ b/sound/pci/hda/patch_intelhdmi.c
@@ -259,6 +259,25 @@ static int intel_hdmi_read_pin_conn(struct hda_codec *codec, hda_nid_t pin_nid)
259 return 0; 259 return 0;
260} 260}
261 261
262static void hdmi_get_show_eld(struct hda_codec *codec, hda_nid_t pin_nid,
263 struct hdmi_eld *eld)
264{
265 if (!snd_hdmi_get_eld(eld, codec, pin_nid))
266 snd_hdmi_show_eld(eld);
267}
268
269static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid,
270 struct hdmi_eld *eld)
271{
272 int present = snd_hda_pin_sense(codec, pin_nid);
273
274 eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE);
275 eld->eld_valid = !!(present & AC_PINSENSE_ELDV);
276
277 if (present & AC_PINSENSE_ELDV)
278 hdmi_get_show_eld(codec, pin_nid, eld);
279}
280
262static int intel_hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) 281static int intel_hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
263{ 282{
264 struct intel_hdmi_spec *spec = codec->spec; 283 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 return -EINVAL; 288 return -EINVAL;
270 } 289 }
271 290
291 hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]);
292
272 spec->pin[spec->num_pins] = pin_nid; 293 spec->pin[spec->num_pins] = pin_nid;
273 spec->num_pins++; 294 spec->num_pins++;
274 295
@@ -436,15 +457,6 @@ static void hdmi_debug_channel_mapping(struct hda_codec *codec, hda_nid_t nid)
436#endif 457#endif
437} 458}
438 459
439static void hdmi_parse_eld(struct hda_codec *codec, int index)
440{
441 struct intel_hdmi_spec *spec = codec->spec;
442 struct hdmi_eld *eld = &spec->sink_eld[index];
443
444 if (!snd_hdmi_get_eld(eld, codec, spec->pin[index]))
445 snd_hdmi_show_eld(eld);
446}
447
448 460
449/* 461/*
450 * Audio InfoFrame routines 462 * Audio InfoFrame routines
@@ -677,7 +689,7 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
677 spec->sink_eld[index].eld_valid = eldv; 689 spec->sink_eld[index].eld_valid = eldv;
678 690
679 if (pind && eldv) { 691 if (pind && eldv) {
680 hdmi_parse_eld(codec, index); 692 hdmi_get_show_eld(codec, spec->pin[index], &spec->sink_eld[index]);
681 /* TODO: do real things about ELD */ 693 /* TODO: do real things about ELD */
682 } 694 }
683} 695}