From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: [PATCH 05/10] intelhdmi - probe for monitor/eld presence at module init time Date: Wed, 18 Nov 2009 12:38:03 +0800 Message-ID: <20091118043935.310210374@intel.com> References: <20091118043758.141785140@intel.com> Content-Type: multipart/mixed; boundary="===============0146894415069171148==" Return-path: Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by alsa0.perex.cz (Postfix) with ESMTP id 8A6A310392E for ; Wed, 18 Nov 2009 05:42:49 +0100 (CET) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Takashi Iwai Cc: alsa-devel@alsa-project.org, Wu Fengguang , Shane W , =?UTF-8?q?David=20H=C3=A4rdeman?= List-Id: alsa-devel@alsa-project.org --===============0146894415069171148== Content-Disposition: inline; filename=hdmi-pin-sense.patch 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 Signed-off-by: Wu Fengguang --- sound/pci/hda/patch_intelhdmi.c | 33 ++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) --- sound-2.6.orig/sound/pci/hda/patch_intelhdmi.c 2009-11-02 15:44:26.000000000 +0800 +++ sound-2.6/sound/pci/hda/patch_intelhdmi.c 2009-11-02 15:47:43.000000000 +0800 @@ -259,6 +259,25 @@ static int intel_hdmi_read_pin_conn(stru 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) { struct intel_hdmi_spec *spec = codec->spec; @@ -269,6 +288,8 @@ static int intel_hdmi_add_pin(struct hda return -EINVAL; } + hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]); + spec->pin[spec->num_pins] = pin_nid; spec->num_pins++; @@ -436,15 +457,6 @@ static void hdmi_debug_channel_mapping(s #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 @@ -677,7 +690,7 @@ static void hdmi_intrinsic_event(struct spec->sink_eld[index].eld_valid = 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 */ } } --===============0146894415069171148== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel --===============0146894415069171148==--