All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: HDA: Fix DAC assignment for secondary headphone on Sigmatel/IDT
@ 2011-10-05  8:00 David Henningsson
  2011-10-05 10:58 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: David Henningsson @ 2011-10-05  8:00 UTC (permalink / raw)
  To: Takashi Iwai, ALSA Development Mailing List

[-- Attachment #1: Type: text/plain, Size: 412 bytes --]

This patch should be safe enough for 3.2, but do you think it is safe 
enough for stable as well?

If we run out of DACs when trying to assign a DAC to a secondary
headphone, prefer the DAC of the first headphone to the primary
(usually line out) DAC.

BugLink: http://bugs.launchpad.net/bugs/845275 (there are codec info at 
this link as well)

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic

[-- Attachment #2: 0001-ALSA-HDA-Fix-DAC-assignment-for-secondary-headphone-.patch --]
[-- Type: text/x-patch, Size: 2066 bytes --]

>From 465121dd0bbb8e5da99b0fd709bfdcd42a4961e9 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Wed, 5 Oct 2011 09:49:05 +0200
Subject: [PATCH] ALSA: HDA: Fix DAC assignment for secondary headphone on
 Sigmatel/IDT

If we run out of DACs when trying to assign a DAC to a secondary
headphone, prefer the DAC of the first headphone to the primary
(usually line out) DAC.

BugLink: http://bugs.launchpad.net/bugs/845275
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
 sound/pci/hda/patch_sigmatel.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index dd977b6..1e0b338 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2972,8 +2972,9 @@ static int check_all_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
 static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid)
 {
 	struct sigmatel_spec *spec = codec->spec;
+	struct auto_pin_cfg *cfg = &spec->autocfg;
 	int j, conn_len;
-	hda_nid_t conn[HDA_MAX_CONNECTIONS];
+	hda_nid_t conn[HDA_MAX_CONNECTIONS], fallback_dac;
 	unsigned int wcaps, wtype;
 
 	conn_len = snd_hda_get_connections(codec, nid, conn,
@@ -3001,10 +3002,21 @@ static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid)
 			return conn[j];
 		}
 	}
-	/* if all DACs are already assigned, connect to the primary DAC */
+
+	/* if all DACs are already assigned, connect to the primary DAC,
+	   unless we're assigning a secondary headphone */
+	fallback_dac = spec->multiout.dac_nids[0];
+	if (spec->multiout.hp_nid) {
+		for (j = 0; j < cfg->hp_outs; j++)
+			if (cfg->hp_pins[j] == nid) {
+				fallback_dac = spec->multiout.hp_nid;
+				break;
+			}
+	}
+
 	if (conn_len > 1) {
 		for (j = 0; j < conn_len; j++) {
-			if (conn[j] == spec->multiout.dac_nids[0]) {
+			if (conn[j] == fallback_dac) {
 				snd_hda_codec_write_cache(codec, nid, 0,
 						  AC_VERB_SET_CONNECT_SEL, j);
 				break;
-- 
1.7.5.4


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: HDA: Fix DAC assignment for secondary headphone on Sigmatel/IDT
  2011-10-05  8:00 [PATCH] ALSA: HDA: Fix DAC assignment for secondary headphone on Sigmatel/IDT David Henningsson
@ 2011-10-05 10:58 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2011-10-05 10:58 UTC (permalink / raw)
  To: David Henningsson; +Cc: ALSA Development Mailing List

At Wed, 05 Oct 2011 10:00:18 +0200,
David Henningsson wrote:
> 
> This patch should be safe enough for 3.2, but do you think it is safe 
> enough for stable as well?
> 
> If we run out of DACs when trying to assign a DAC to a secondary
> headphone, prefer the DAC of the first headphone to the primary
> (usually line out) DAC.
> 
> BugLink: http://bugs.launchpad.net/bugs/845275 (there are codec info at 
> this link as well)

Looks good.  Applied now.
Thanks!


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-05 10:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-05  8:00 [PATCH] ALSA: HDA: Fix DAC assignment for secondary headphone on Sigmatel/IDT David Henningsson
2011-10-05 10:58 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.