aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMengdong Lin <mengdong.lin@intel.com>2013-09-04 16:37:12 -0400
committerTakashi Iwai <tiwai@suse.de>2013-09-06 12:23:54 -0400
commit58f7d28da6994e4292ade2ac9eabebb723a9bbe6 (patch)
tree988b43e1b074e7552f40de079fa36eb60b1a852a /sound
parentfb87fa3a79823c15e70d4fc7653bde59f8556ca1 (diff)
ALSA: hda - unmute pin amplifier in infoframe setup for Haswell
When Gfx driver reconnects a port and transcoder, the pin amplifier will be muted. To enable sound, the pin amp need to be unmuted. This patch - moves pin amp unmuting from stream preparing to hdmi_setup_audio_infoframe(). So if port:transcoder reconnection happens during stream playback, the ELDV unsol event can stil trigger pin's amp unmuting when re-setting up audio info frame. - remove reading pin amp status before unmuting for speed-up, since pin amp should always be unmuted. - rename haswell_verify_pin_D0() to haswell_verify_D0(), since the convertor power state is also fixed here. This patch is mostly based on suggestion of David Henningsson. Cc: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_hdmi.c36
1 files changed, 9 insertions, 27 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 009bcccbee7a..3a15225d6982 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -896,6 +896,11 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
896 if (!channels) 896 if (!channels)
897 return; 897 return;
898 898
899 if (is_haswell(codec))
900 snd_hda_codec_write(codec, pin_nid, 0,
901 AC_VERB_SET_AMP_GAIN_MUTE,
902 AMP_OUT_UNMUTE);
903
899 eld = &per_pin->sink_eld; 904 eld = &per_pin->sink_eld;
900 if (!eld->monitor_present) 905 if (!eld->monitor_present)
901 return; 906 return;
@@ -1035,10 +1040,10 @@ static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res)
1035 hdmi_non_intrinsic_event(codec, res); 1040 hdmi_non_intrinsic_event(codec, res);
1036} 1041}
1037 1042
1038static void haswell_verify_pin_D0(struct hda_codec *codec, 1043static void haswell_verify_D0(struct hda_codec *codec,
1039 hda_nid_t cvt_nid, hda_nid_t nid) 1044 hda_nid_t cvt_nid, hda_nid_t nid)
1040{ 1045{
1041 int pwr, lamp, ramp; 1046 int pwr;
1042 1047
1043 /* For Haswell, the converter 1/2 may keep in D3 state after bootup, 1048 /* For Haswell, the converter 1/2 may keep in D3 state after bootup,
1044 * thus pins could only choose converter 0 for use. Make sure the 1049 * thus pins could only choose converter 0 for use. Make sure the
@@ -1054,25 +1059,6 @@ static void haswell_verify_pin_D0(struct hda_codec *codec,
1054 pwr = (pwr & AC_PWRST_ACTUAL) >> AC_PWRST_ACTUAL_SHIFT; 1059 pwr = (pwr & AC_PWRST_ACTUAL) >> AC_PWRST_ACTUAL_SHIFT;
1055 snd_printd("Haswell HDMI audio: Power for pin 0x%x is now D%d\n", nid, pwr); 1060 snd_printd("Haswell HDMI audio: Power for pin 0x%x is now D%d\n", nid, pwr);
1056 } 1061 }
1057
1058 lamp = snd_hda_codec_read(codec, nid, 0,
1059 AC_VERB_GET_AMP_GAIN_MUTE,
1060 AC_AMP_GET_LEFT | AC_AMP_GET_OUTPUT);
1061 ramp = snd_hda_codec_read(codec, nid, 0,
1062 AC_VERB_GET_AMP_GAIN_MUTE,
1063 AC_AMP_GET_RIGHT | AC_AMP_GET_OUTPUT);
1064 if (lamp != ramp) {
1065 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
1066 AC_AMP_SET_RIGHT | AC_AMP_SET_OUTPUT | lamp);
1067
1068 lamp = snd_hda_codec_read(codec, nid, 0,
1069 AC_VERB_GET_AMP_GAIN_MUTE,
1070 AC_AMP_GET_LEFT | AC_AMP_GET_OUTPUT);
1071 ramp = snd_hda_codec_read(codec, nid, 0,
1072 AC_VERB_GET_AMP_GAIN_MUTE,
1073 AC_AMP_GET_RIGHT | AC_AMP_GET_OUTPUT);
1074 snd_printd("Haswell HDMI audio: Mute after set on pin 0x%x: [0x%x 0x%x]\n", nid, lamp, ramp);
1075 }
1076} 1062}
1077 1063
1078/* 1064/*
@@ -1090,7 +1076,7 @@ static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
1090 int new_pinctl = 0; 1076 int new_pinctl = 0;
1091 1077
1092 if (is_haswell(codec)) 1078 if (is_haswell(codec))
1093 haswell_verify_pin_D0(codec, cvt_nid, pin_nid); 1079 haswell_verify_D0(codec, cvt_nid, pin_nid);
1094 1080
1095 if (snd_hda_query_pin_caps(codec, pin_nid) & AC_PINCAP_HBR) { 1081 if (snd_hda_query_pin_caps(codec, pin_nid) & AC_PINCAP_HBR) {
1096 pinctl = snd_hda_codec_read(codec, pin_nid, 0, 1082 pinctl = snd_hda_codec_read(codec, pin_nid, 0,
@@ -1361,13 +1347,9 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
1361 * changed during the stream playback 1347 * changed during the stream playback
1362 */ 1348 */
1363 if (is_haswell(codec) && 1349 if (is_haswell(codec) &&
1364 eld->eld_valid && !old_eld_valid && per_pin->setup) { 1350 eld->eld_valid && !old_eld_valid && per_pin->setup)
1365 snd_hda_codec_write(codec, pin_nid, 0,
1366 AC_VERB_SET_AMP_GAIN_MUTE,
1367 AMP_OUT_UNMUTE);
1368 hdmi_setup_audio_infoframe(codec, per_pin, 1351 hdmi_setup_audio_infoframe(codec, per_pin,
1369 per_pin->non_pcm); 1352 per_pin->non_pcm);
1370 }
1371 } 1353 }
1372 mutex_unlock(&pin_eld->lock); 1354 mutex_unlock(&pin_eld->lock);
1373 1355