aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_hdmi.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_hdmi.c')
-rw-r--r--sound/pci/hda/patch_hdmi.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 36badba2dcec..39862e98551c 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -50,6 +50,8 @@ MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info");
50#define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec)) 50#define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec))
51 51
52#define is_valleyview(codec) ((codec)->vendor_id == 0x80862882) 52#define is_valleyview(codec) ((codec)->vendor_id == 0x80862882)
53#define is_cherryview(codec) ((codec)->vendor_id == 0x80862883)
54#define is_valleyview_plus(codec) (is_valleyview(codec) || is_cherryview(codec))
53 55
54struct hdmi_spec_per_cvt { 56struct hdmi_spec_per_cvt {
55 hda_nid_t cvt_nid; 57 hda_nid_t cvt_nid;
@@ -1161,17 +1163,23 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
1161 1163
1162static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll); 1164static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll);
1163 1165
1164static void jack_callback(struct hda_codec *codec, struct hda_jack_tbl *jack) 1166static void check_presence_and_report(struct hda_codec *codec, hda_nid_t nid)
1165{ 1167{
1166 struct hdmi_spec *spec = codec->spec; 1168 struct hdmi_spec *spec = codec->spec;
1167 int pin_idx = pin_nid_to_pin_index(codec, jack->nid); 1169 int pin_idx = pin_nid_to_pin_index(codec, nid);
1170
1168 if (pin_idx < 0) 1171 if (pin_idx < 0)
1169 return; 1172 return;
1170
1171 if (hdmi_present_sense(get_pin(spec, pin_idx), 1)) 1173 if (hdmi_present_sense(get_pin(spec, pin_idx), 1))
1172 snd_hda_jack_report_sync(codec); 1174 snd_hda_jack_report_sync(codec);
1173} 1175}
1174 1176
1177static void jack_callback(struct hda_codec *codec,
1178 struct hda_jack_callback *jack)
1179{
1180 check_presence_and_report(codec, jack->tbl->nid);
1181}
1182
1175static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) 1183static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
1176{ 1184{
1177 int tag = res >> AC_UNSOL_RES_TAG_SHIFT; 1185 int tag = res >> AC_UNSOL_RES_TAG_SHIFT;
@@ -1188,7 +1196,7 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
1188 codec->addr, jack->nid, dev_entry, !!(res & AC_UNSOL_RES_IA), 1196 codec->addr, jack->nid, dev_entry, !!(res & AC_UNSOL_RES_IA),
1189 !!(res & AC_UNSOL_RES_PD), !!(res & AC_UNSOL_RES_ELDV)); 1197 !!(res & AC_UNSOL_RES_PD), !!(res & AC_UNSOL_RES_ELDV));
1190 1198
1191 jack_callback(codec, jack); 1199 check_presence_and_report(codec, jack->nid);
1192} 1200}
1193 1201
1194static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) 1202static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res)
@@ -1459,7 +1467,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
1459 mux_idx); 1467 mux_idx);
1460 1468
1461 /* configure unused pins to choose other converters */ 1469 /* configure unused pins to choose other converters */
1462 if (is_haswell_plus(codec) || is_valleyview(codec)) 1470 if (is_haswell_plus(codec) || is_valleyview_plus(codec))
1463 intel_not_share_assigned_cvt(codec, per_pin->pin_nid, mux_idx); 1471 intel_not_share_assigned_cvt(codec, per_pin->pin_nid, mux_idx);
1464 1472
1465 snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid); 1473 snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid);
@@ -1598,7 +1606,8 @@ static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
1598 * and this can make HW reset converter selection on a pin. 1606 * and this can make HW reset converter selection on a pin.
1599 */ 1607 */
1600 if (eld->eld_valid && !old_eld_valid && per_pin->setup) { 1608 if (eld->eld_valid && !old_eld_valid && per_pin->setup) {
1601 if (is_haswell_plus(codec) || is_valleyview(codec)) { 1609 if (is_haswell_plus(codec) ||
1610 is_valleyview_plus(codec)) {
1602 intel_verify_pin_cvt_connect(codec, per_pin); 1611 intel_verify_pin_cvt_connect(codec, per_pin);
1603 intel_not_share_assigned_cvt(codec, pin_nid, 1612 intel_not_share_assigned_cvt(codec, pin_nid,
1604 per_pin->mux_idx); 1613 per_pin->mux_idx);
@@ -1779,7 +1788,7 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1779 bool non_pcm; 1788 bool non_pcm;
1780 int pinctl; 1789 int pinctl;
1781 1790
1782 if (is_haswell_plus(codec) || is_valleyview(codec)) { 1791 if (is_haswell_plus(codec) || is_valleyview_plus(codec)) {
1783 /* Verify pin:cvt selections to avoid silent audio after S3. 1792 /* Verify pin:cvt selections to avoid silent audio after S3.
1784 * After S3, the audio driver restores pin:cvt selections 1793 * After S3, the audio driver restores pin:cvt selections
1785 * but this can happen before gfx is ready and such selection 1794 * but this can happen before gfx is ready and such selection
@@ -2162,7 +2171,7 @@ static int generic_hdmi_init(struct hda_codec *codec)
2162 hda_nid_t pin_nid = per_pin->pin_nid; 2171 hda_nid_t pin_nid = per_pin->pin_nid;
2163 2172
2164 hdmi_init_pin(codec, pin_nid); 2173 hdmi_init_pin(codec, pin_nid);
2165 snd_hda_jack_detect_enable_callback(codec, pin_nid, pin_nid, 2174 snd_hda_jack_detect_enable_callback(codec, pin_nid,
2166 codec->jackpoll_interval > 0 ? jack_callback : NULL); 2175 codec->jackpoll_interval > 0 ? jack_callback : NULL);
2167 } 2176 }
2168 return 0; 2177 return 0;
@@ -2330,9 +2339,8 @@ static int patch_generic_hdmi(struct hda_codec *codec)
2330 intel_haswell_fixup_enable_dp12(codec); 2339 intel_haswell_fixup_enable_dp12(codec);
2331 } 2340 }
2332 2341
2333 if (is_haswell(codec) || is_valleyview(codec)) { 2342 if (is_haswell_plus(codec) || is_valleyview_plus(codec))
2334 codec->depop_delay = 0; 2343 codec->depop_delay = 0;
2335 }
2336 2344
2337 if (hdmi_parse_codec(codec) < 0) { 2345 if (hdmi_parse_codec(codec) < 0) {
2338 codec->spec = NULL; 2346 codec->spec = NULL;
@@ -2426,7 +2434,7 @@ static int simple_playback_init(struct hda_codec *codec)
2426 if (get_wcaps(codec, pin) & AC_WCAP_OUT_AMP) 2434 if (get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)
2427 snd_hda_codec_write(codec, pin, 0, AC_VERB_SET_AMP_GAIN_MUTE, 2435 snd_hda_codec_write(codec, pin, 0, AC_VERB_SET_AMP_GAIN_MUTE,
2428 AMP_OUT_UNMUTE); 2436 AMP_OUT_UNMUTE);
2429 snd_hda_jack_detect_enable(codec, pin, pin); 2437 snd_hda_jack_detect_enable(codec, pin);
2430 return 0; 2438 return 0;
2431} 2439}
2432 2440