aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_hdmi.c
diff options
context:
space:
mode:
authorMengdong Lin <mengdong.lin@intel.com>2014-03-20 01:01:06 -0400
committerTakashi Iwai <tiwai@suse.de>2014-03-20 02:36:17 -0400
commit2df6742f613840a0b0a1590fb28f7af5b058a673 (patch)
treefa4ba7e30daf271d847ad65e573968d46ef58de8 /sound/pci/hda/patch_hdmi.c
parent67b2fb48cbd593ebb2796eb0c918abc17b88c1b5 (diff)
ALSA: hda - verify pin:cvt connection on preparing a stream for Intel HDMI codec
This is a temporary fix for some Intel HDMI codecs to avoid no sound output for a resuming playback after S3. After S3, the audio driver restores pin:cvt connection selections by snd_hda_codec_resume_cache(). However this can happen before the gfx side is ready and such connect selection is overlooked by HW. After gfx is ready, the pins make the default selection again. And this will cause multiple pins share a same convertor and mute control will affect each other. Thus a resumed audio playback become silent after S3. This patch verifies pin:cvt connection on preparing a stream, to assure the pin selects the right convetor and an assigned convertor is not shared by other unused pins. Apply this fix-up on Haswell, Broadwell and Valleyview (Baytrail). We need this temporary fix before a reliable software communication channel is established between audio and gfx, to sync audio/gfx operations. Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_hdmi.c')
-rw-r--r--sound/pci/hda/patch_hdmi.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 4751eab69ab7..0cb5b89cd0c8 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -68,6 +68,7 @@ struct hdmi_spec_per_pin {
68 hda_nid_t pin_nid; 68 hda_nid_t pin_nid;
69 int num_mux_nids; 69 int num_mux_nids;
70 hda_nid_t mux_nids[HDA_MAX_CONNECTIONS]; 70 hda_nid_t mux_nids[HDA_MAX_CONNECTIONS];
71 int mux_idx;
71 hda_nid_t cvt_nid; 72 hda_nid_t cvt_nid;
72 73
73 struct hda_codec *codec; 74 struct hda_codec *codec;
@@ -1344,6 +1345,8 @@ static int hdmi_choose_cvt(struct hda_codec *codec,
1344 if (cvt_idx == spec->num_cvts) 1345 if (cvt_idx == spec->num_cvts)
1345 return -ENODEV; 1346 return -ENODEV;
1346 1347
1348 per_pin->mux_idx = mux_idx;
1349
1347 if (cvt_id) 1350 if (cvt_id)
1348 *cvt_id = cvt_idx; 1351 *cvt_id = cvt_idx;
1349 if (mux_id) 1352 if (mux_id)
@@ -1352,6 +1355,22 @@ static int hdmi_choose_cvt(struct hda_codec *codec,
1352 return 0; 1355 return 0;
1353} 1356}
1354 1357
1358/* Assure the pin select the right convetor */
1359static void intel_verify_pin_cvt_connect(struct hda_codec *codec,
1360 struct hdmi_spec_per_pin *per_pin)
1361{
1362 hda_nid_t pin_nid = per_pin->pin_nid;
1363 int mux_idx, curr;
1364
1365 mux_idx = per_pin->mux_idx;
1366 curr = snd_hda_codec_read(codec, pin_nid, 0,
1367 AC_VERB_GET_CONNECT_SEL, 0);
1368 if (curr != mux_idx)
1369 snd_hda_codec_write_cache(codec, pin_nid, 0,
1370 AC_VERB_SET_CONNECT_SEL,
1371 mux_idx);
1372}
1373
1355/* Intel HDMI workaround to fix audio routing issue: 1374/* Intel HDMI workaround to fix audio routing issue:
1356 * For some Intel display codecs, pins share the same connection list. 1375 * For some Intel display codecs, pins share the same connection list.
1357 * So a conveter can be selected by multiple pins and playback on any of these 1376 * So a conveter can be selected by multiple pins and playback on any of these
@@ -1753,6 +1772,19 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1753 bool non_pcm; 1772 bool non_pcm;
1754 int pinctl; 1773 int pinctl;
1755 1774
1775 if (is_haswell_plus(codec) || is_valleyview(codec)) {
1776 /* Verify pin:cvt selections to avoid silent audio after S3.
1777 * After S3, the audio driver restores pin:cvt selections
1778 * but this can happen before gfx is ready and such selection
1779 * is overlooked by HW. Thus multiple pins can share a same
1780 * default convertor and mute control will affect each other,
1781 * which can cause a resumed audio playback become silent
1782 * after S3.
1783 */
1784 intel_verify_pin_cvt_connect(codec, per_pin);
1785 intel_not_share_assigned_cvt(codec, pin_nid, per_pin->mux_idx);
1786 }
1787
1756 non_pcm = check_non_pcm_per_cvt(codec, cvt_nid); 1788 non_pcm = check_non_pcm_per_cvt(codec, cvt_nid);
1757 mutex_lock(&per_pin->lock); 1789 mutex_lock(&per_pin->lock);
1758 per_pin->channels = substream->runtime->channels; 1790 per_pin->channels = substream->runtime->channels;