Skip to contentSkip to conversation

ALSA: hda - Turn on PIN_OUT from hdmi playback prepare.

PATCH Superseded Dylan Reid 2 participants 3 messages Jul 19, 2012 Sound

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Dylan Reid

author
#0 lore raw

PATCH v2 1/1 ALSA: hda - Turn on PIN_OUT from hdmi playback prepare.

Turn on the pin widget's PIN_OUT bit from playback prepare. The pin is enabled in open, but is disabled in hdmi_init_pin which is called during system resume. This causes a system suspend/resume during playback to mute HDMI/DP. Enabling the pin in prepare instead of open allows calling snd_pcm_prepare after a system resume to restore audio.

---
 sound/pci/hda/patch_hdmi.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
sound/pci/hda/patch_hdmi.c +6 -3
index 0b4a1ea..764b975 100644
@@ -914,9 +914,6 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
 			    mux_idx);
 	pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0,
 				    AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
-	snd_hda_codec_write(codec, per_pin->pin_nid, 0,
-			    AC_VERB_SET_PIN_WIDGET_CONTROL,
-			    pinctl | PIN_OUT);
 	snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid);
 
 	/* Initially set the converter's capabilities */
@@ -1153,11 +1150,17 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
 	struct hdmi_spec *spec = codec->spec;
 	int pin_idx = hinfo_to_pin_index(spec, hinfo);
 	hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid;
+	int pinctl;
 
 	hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
 
 	hdmi_setup_audio_infoframe(codec, pin_idx, substream);
 
+	pinctl = snd_hda_codec_read(codec, pin_nid, 0,
+				    AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
+	snd_hda_codec_write(codec, pin_nid, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl | PIN_OUT);
+
 	return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
 }
 
Signature · 1 line
1.7.11.2.138.g2b53359
#1 lore raw

At Thu, 19 Jul 2012 02:42:54 -0700,

Quoted 17 lines · Dylan Reid

Turn on the pin widget's PIN_OUT bit from playback prepare. The pin is enabled in open, but is disabled in hdmi_init_pin which is called during system resume. This causes a system suspend/resume during playback to mute HDMI/DP. Enabling the pin in prepare instead of open allows calling snd_pcm_prepare after a system resume to restore audio.

---
 sound/pci/hda/patch_hdmi.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
sound/pci/hda/patch_hdmi.c +0 -0
index 0b4a1ea..764b975 100644

sound/pci/hda/patch_hdmi.c static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, · line 916

Quoted 3 lines
sound/pci/hda/patch_hdmi.c +0 -0
@@ -914,9 +914,6 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
 			    mux_idx);
 	pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0,
 				    AC_VERB_GET_PIN_WIDGET_CONTROL, 0);

Do we still need to keep this line (and pinctl variable) in this function?

thanks,

Takashi

Quoted 27 lines
sound/pci/hda/patch_hdmi.c +6 -3
-	snd_hda_codec_write(codec, per_pin->pin_nid, 0,
-			    AC_VERB_SET_PIN_WIDGET_CONTROL,
-			    pinctl | PIN_OUT);
 	snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid);
 
 	/* Initially set the converter's capabilities */
@@ -1153,11 +1150,17 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
 	struct hdmi_spec *spec = codec->spec;
 	int pin_idx = hinfo_to_pin_index(spec, hinfo);
 	hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid;
+	int pinctl;
 
 	hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
 
 	hdmi_setup_audio_infoframe(codec, pin_idx, substream);
 
+	pinctl = snd_hda_codec_read(codec, pin_nid, 0,
+				    AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
+	snd_hda_codec_write(codec, pin_nid, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl | PIN_OUT);
+
 	return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
 }
 
Signature · 1 line
1.7.11.2.138.g2b53359
author
#2 lore raw
Quoted 14 lines · Takashi Iwai

At Thu, 19 Jul 2012 02:42:54 -0700,

Quoted 12 lines · Dylan Reid

Turn on the pin widget's PIN_OUT bit from playback prepare. The pin is enabled in open, but is disabled in hdmi_init_pin which is called during system resume. This causes a system suspend/resume during playback to mute HDMI/DP. Enabling the pin in prepare instead of open allows calling snd_pcm_prepare after a system resume to restore audio.

---
 sound/pci/hda/patch_hdmi.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
Quoted 11 lines

sound/pci/hda/patch_hdmi.c static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, · line 916

Quoted 8 lines
sound/pci/hda/patch_hdmi.c +0 -0
index 0b4a1ea..764b975 100644
@@ -914,9 +914,6 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
                          mux_idx);
      pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0,
                                  AC_VERB_GET_PIN_WIDGET_CONTROL, 0);

Do we still need to keep this line (and pinctl variable) in this function?

Of course not, I might be getting too old to do this at 3am... v3 re-tested and on the way.

Thanks for the quick review,
Dylan

Quoted 33 lines

thanks,

Takashi

Quoted 27 lines
sound/pci/hda/patch_hdmi.c +6 -4
-     snd_hda_codec_write(codec, per_pin->pin_nid, 0,
-                         AC_VERB_SET_PIN_WIDGET_CONTROL,
-                         pinctl | PIN_OUT);
      snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid);
 
      /* Initially set the converter's capabilities */
@@ -1153,11 +1150,17 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
      struct hdmi_spec *spec = codec->spec;
      int pin_idx = hinfo_to_pin_index(spec, hinfo);
      hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid;
+     int pinctl;
 
      hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
 
      hdmi_setup_audio_infoframe(codec, pin_idx, substream);
 
+     pinctl = snd_hda_codec_read(codec, pin_nid, 0,
+                                 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
+     snd_hda_codec_write(codec, pin_nid, 0,
+                         AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl | PIN_OUT);
+
      return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
 }
 
--

1.7.11.2.138.g2b53359