alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: mengdong.lin@intel.com
To: alsa-devel@alsa-project.org, tiwai@suse.de
Cc: Mengdong Lin <mengdong.lin@intel.com>
Subject: [RFC PATCH] ALSA : hda - not use assigned converters for all unused pins
Date: Sun, 15 Sep 2013 22:40:44 -0400	[thread overview]
Message-ID: <1379299244-18559-1-git-send-email-mengdong.lin@intel.com> (raw)

From: Mengdong Lin <mengdong.lin@intel.com>

BIOS can mark a pin as "no physical connection" if the port is used by an
integrated display which is not audio capable. And audio driver will overlook
such pins.

On Haswell, such a disconneted pin will keep muted and connected to the 1st
converter by default. But if the 1st convertor is assigned to a connected pin
for audio streaming. The muted disconnected pin can make the connected pin
no sound output.

So this patch avoids using assigned converters for all unused pins for Haswell,
including the disconected pins.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 3d8cd044..4960695 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1152,29 +1152,34 @@ static void haswell_config_cvts(struct hda_codec *codec,
 			int pin_id, int mux_id)
 {
 	struct hdmi_spec *spec = codec->spec;
-	struct hdmi_spec_per_pin *per_pin;
-	int pin_idx, mux_idx;
+	hda_nid_t  pin_nid;
+	int pin_idx, cvt_idx;
 	int curr;
-	int err;
-
-	for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
-		per_pin = get_pin(spec, pin_idx);
+	struct hdmi_spec_per_cvt *per_cvt;
 
+	/* configure all 3 pins, including "no physical connection" ones */
+	for (pin_nid = 5; pin_nid < 8; pin_nid++) {
+		pin_idx = pin_nid_to_pin_index(spec, pin_nid);
 		if (pin_idx == pin_id)
 			continue;
 
-		curr = snd_hda_codec_read(codec, per_pin->pin_nid, 0,
+		curr = snd_hda_codec_read(codec, pin_nid, 0,
 					  AC_VERB_GET_CONNECT_SEL, 0);
+		if (curr != mux_id)
+			continue;
+
+		for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) {
+			per_cvt = get_cvt(spec, cvt_idx);
 
-		/* Choose another unused converter */
-		if (curr == mux_id) {
-			err = hdmi_choose_cvt(codec, pin_idx, NULL, &mux_idx);
-			if (err < 0)
-				return;
-			snd_printdd("HDMI: choose converter %d for pin %d\n", mux_idx, pin_idx);
-			snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0,
+			/* Must not already be assigned */
+			if (!per_cvt->assigned) {
+				snd_printdd("choose converter %d for pin %d\n",
+					cvt_idx, pin_idx);
+				snd_hda_codec_write_cache(codec, pin_nid, 0,
 					    AC_VERB_SET_CONNECT_SEL,
-					    mux_idx);
+					    cvt_idx);
+				break;
+			}
 		}
 	}
 }
-- 
1.8.1.2

             reply	other threads:[~2013-09-16  9:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-16  2:40 mengdong.lin [this message]
2013-09-16 22:40 ` [RFC PATCH] ALSA : hda - not use assigned converters for all unused pins David Henningsson
2013-09-20  8:00   ` Lin, Mengdong
2013-09-20  9:32     ` David Henningsson
2013-09-20 14:48       ` Lin, Mengdong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1379299244-18559-1-git-send-email-mengdong.lin@intel.com \
    --to=mengdong.lin@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).