diff options
| -rw-r--r-- | sound/pci/hda/patch_hdmi.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 08407bed093e..c4a66ef6cf6f 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
| @@ -1142,32 +1142,34 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, | |||
| 1142 | 1142 | ||
| 1143 | static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll); | 1143 | static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll); |
| 1144 | 1144 | ||
| 1145 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | 1145 | static void jack_callback(struct hda_codec *codec, struct hda_jack_tbl *jack) |
| 1146 | { | 1146 | { |
| 1147 | struct hdmi_spec *spec = codec->spec; | 1147 | struct hdmi_spec *spec = codec->spec; |
| 1148 | int pin_idx = pin_nid_to_pin_index(spec, jack->nid); | ||
| 1149 | if (pin_idx < 0) | ||
| 1150 | return; | ||
| 1151 | |||
| 1152 | if (hdmi_present_sense(get_pin(spec, pin_idx), 1)) | ||
| 1153 | snd_hda_jack_report_sync(codec); | ||
| 1154 | } | ||
| 1155 | |||
| 1156 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | ||
| 1157 | { | ||
| 1148 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | 1158 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; |
| 1149 | int pin_nid; | ||
| 1150 | int pin_idx; | ||
| 1151 | struct hda_jack_tbl *jack; | 1159 | struct hda_jack_tbl *jack; |
| 1152 | int dev_entry = (res & AC_UNSOL_RES_DE) >> AC_UNSOL_RES_DE_SHIFT; | 1160 | int dev_entry = (res & AC_UNSOL_RES_DE) >> AC_UNSOL_RES_DE_SHIFT; |
| 1153 | 1161 | ||
| 1154 | jack = snd_hda_jack_tbl_get_from_tag(codec, tag); | 1162 | jack = snd_hda_jack_tbl_get_from_tag(codec, tag); |
| 1155 | if (!jack) | 1163 | if (!jack) |
| 1156 | return; | 1164 | return; |
| 1157 | pin_nid = jack->nid; | ||
| 1158 | jack->jack_dirty = 1; | 1165 | jack->jack_dirty = 1; |
| 1159 | 1166 | ||
| 1160 | _snd_printd(SND_PR_VERBOSE, | 1167 | _snd_printd(SND_PR_VERBOSE, |
| 1161 | "HDMI hot plug event: Codec=%d Pin=%d Device=%d Inactive=%d Presence_Detect=%d ELD_Valid=%d\n", | 1168 | "HDMI hot plug event: Codec=%d Pin=%d Device=%d Inactive=%d Presence_Detect=%d ELD_Valid=%d\n", |
| 1162 | codec->addr, pin_nid, dev_entry, !!(res & AC_UNSOL_RES_IA), | 1169 | codec->addr, jack->nid, dev_entry, !!(res & AC_UNSOL_RES_IA), |
| 1163 | !!(res & AC_UNSOL_RES_PD), !!(res & AC_UNSOL_RES_ELDV)); | 1170 | !!(res & AC_UNSOL_RES_PD), !!(res & AC_UNSOL_RES_ELDV)); |
| 1164 | 1171 | ||
| 1165 | pin_idx = pin_nid_to_pin_index(spec, pin_nid); | 1172 | jack_callback(codec, jack); |
| 1166 | if (pin_idx < 0) | ||
| 1167 | return; | ||
| 1168 | |||
| 1169 | if (hdmi_present_sense(get_pin(spec, pin_idx), 1)) | ||
| 1170 | snd_hda_jack_report_sync(codec); | ||
| 1171 | } | 1173 | } |
| 1172 | 1174 | ||
| 1173 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) | 1175 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) |
| @@ -2095,7 +2097,8 @@ static int generic_hdmi_init(struct hda_codec *codec) | |||
| 2095 | hda_nid_t pin_nid = per_pin->pin_nid; | 2097 | hda_nid_t pin_nid = per_pin->pin_nid; |
| 2096 | 2098 | ||
| 2097 | hdmi_init_pin(codec, pin_nid); | 2099 | hdmi_init_pin(codec, pin_nid); |
| 2098 | snd_hda_jack_detect_enable(codec, pin_nid, pin_nid); | 2100 | snd_hda_jack_detect_enable_callback(codec, pin_nid, pin_nid, |
| 2101 | codec->jackpoll_interval > 0 ? jack_callback : NULL); | ||
| 2099 | } | 2102 | } |
| 2100 | return 0; | 2103 | return 0; |
| 2101 | } | 2104 | } |
