Skip to contentSkip to conversation

ALSA: hda - fix DigEn for Valleyview2 display codec

PATCH In review [email protected] 2 participants 2 messages Oct 25, 2013 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda - fix DigEn for Valleyview2 display codec

From: Mengdong Lin <[email protected]>

On some Baytrail/Vallleyview platforms, DigEn is disabled on convertors. Thus audio data is blocked from passing through the node and no sound can be heard over HDMI/DP.

This patch fixes the covertor's DigEn when setting up a stream.

sound/pci/hda/patch_hdmi.c +18 -0
index e332db8..f619732 100644
@@ -45,6 +45,7 @@ module_param(static_hdmi_pcm, bool, 0644);
 MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info");
 
 #define is_haswell(codec)  ((codec)->vendor_id == 0x80862807)
+#define is_valleyview(codec) ((codec)->vendor_id == 0x80862882)
 
 struct hdmi_spec_per_cvt {
 	hda_nid_t cvt_nid;
@@ -1061,6 +1062,20 @@ static void haswell_verify_D0(struct hda_codec *codec,
 	}
 }
 
+static void vlv_verify_digen(struct hda_codec *codec, hda_nid_t cvt_nid)
+{
+	unsigned int digi1;
+
+	digi1 = snd_hda_codec_read(codec, cvt_nid, 0,
+				  AC_VERB_GET_DIGI_CONVERT_1, 0);
+
+	if (!(digi1 & AC_DIG1_ENABLE))
+		snd_hda_codec_write_cache(codec, cvt_nid, 0,
+			AC_VERB_SET_DIGI_CONVERT_1,
+			(digi1 | AC_DIG1_ENABLE) & 0xff);
+
+}
+
 /*
  * Callbacks
  */
@@ -1078,6 +1093,9 @@ static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
 	if (is_haswell(codec))
 		haswell_verify_D0(codec, cvt_nid, pin_nid);
 
+	if (is_valleyview(codec))
+		vlv_verify_digen(codec, cvt_nid);
+
 	if (snd_hda_query_pin_caps(codec, pin_nid) & AC_PINCAP_HBR) {
 		pinctl = snd_hda_codec_read(codec, pin_nid, 0,
 					    AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
Signature · 1 line
1.8.1.2
#1 lore raw

At Thu, 24 Oct 2013 18:02:40 -0400,

Quoted 6 lines · [email protected] wrote:

From: Mengdong Lin <[email protected]>

On some Baytrail/Vallleyview platforms, DigEn is disabled on convertors. Thus audio data is blocked from passing through the node and no sound can be heard over HDMI/DP.

The DigEn bit is controlled via "IEC958 Playback Switch", so it's user's intention even if it's turned off.

thanks,

Takashi

Quoted 51 lines

This patch fixes the covertor's DigEn when setting up a stream.

sound/pci/hda/patch_hdmi.c +18 -0
index e332db8..f619732 100644
@@ -45,6 +45,7 @@ module_param(static_hdmi_pcm, bool, 0644);
 MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info");
 
 #define is_haswell(codec)  ((codec)->vendor_id == 0x80862807)
+#define is_valleyview(codec) ((codec)->vendor_id == 0x80862882)
 
 struct hdmi_spec_per_cvt {
 	hda_nid_t cvt_nid;
@@ -1061,6 +1062,20 @@ static void haswell_verify_D0(struct hda_codec *codec,
 	}
 }
 
+static void vlv_verify_digen(struct hda_codec *codec, hda_nid_t cvt_nid)
+{
+	unsigned int digi1;
+
+	digi1 = snd_hda_codec_read(codec, cvt_nid, 0,
+				  AC_VERB_GET_DIGI_CONVERT_1, 0);
+
+	if (!(digi1 & AC_DIG1_ENABLE))
+		snd_hda_codec_write_cache(codec, cvt_nid, 0,
+			AC_VERB_SET_DIGI_CONVERT_1,
+			(digi1 | AC_DIG1_ENABLE) & 0xff);
+
+}
+
 /*
  * Callbacks
  */
@@ -1078,6 +1093,9 @@ static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
 	if (is_haswell(codec))
 		haswell_verify_D0(codec, cvt_nid, pin_nid);
 
+	if (is_valleyview(codec))
+		vlv_verify_digen(codec, cvt_nid);
+
 	if (snd_hda_query_pin_caps(codec, pin_nid) & AC_PINCAP_HBR) {
 		pinctl = snd_hda_codec_read(codec, pin_nid, 0,
 					    AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
Signature · 1 line
1.8.1.2