alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Raymond Yau <superquad.vortex2@gmail.com>
Cc: ALSA Development Mailing List <alsa-devel@alsa-project.org>
Subject: Re: [PATCH ALSA HDA 1/1] Fix alc662_dac_nid and change 6stack-dig to 5stack-dig
Date: Wed, 06 Apr 2011 15:19:55 +0200	[thread overview]
Message-ID: <s5hliznms90.wl%tiwai@suse.de> (raw)
In-Reply-To: <s5hpqozmstm.wl%tiwai@suse.de>

At Wed, 06 Apr 2011 15:07:33 +0200,
Takashi Iwai wrote:
> 
> At Wed, 6 Apr 2011 20:59:58 +0800,
> Raymond Yau wrote:
> > 
> > 2011/4/6 Takashi Iwai <tiwai@suse.de>
> > 
> > > At Wed, 6 Apr 2011 16:29:56 +0800,
> > > Raymond Yau wrote:
> > > >
> > > > 2011/4/6 Takashi Iwai <tiwai@suse.de>
> > > >
> > > > > At Wed, 6 Apr 2011 15:35:16 +0800,
> > > > > Raymond Yau wrote:
> > > > > >
> > > > > > 2011/4/6 Takashi Iwai <tiwai@suse.de>
> > > > > >
> > > > > > > At Tue, 5 Apr 2011 22:59:29 +0800,
> > > > > > > Raymond Yau wrote:
> > > > > > > >
> > > > > > > > Fix alc662_dac_nid and change "6stack-dig" to "5stack-dig"
> > > > > > > >
> > > > > > > > alc662 series only have 3 stereo DAC , so it can only support
> > > > > 5stack-dig
> > > > > > > > instead of 6stack-dig
> > > > > > >
> > > > > > > Applied now.  Thanks.
> > > > > > >
> > > > > > >
> > > > > > > Takashi
> > > > > > >
> > > > > >
> > > > > > The other problem is this patch
> > > > > >
> > > > > >    { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
> > > > > >
> > > > > >
> > > > >
> > > http://git.alsa-project.org/?p=alsa-kernel.git;a=commit;h=274693f37090ada2cadd09944ab883f05ea6ebe6
> > > > > >
> > > > > > ALC892 provides ten DAC channels that simultaneously support 7.1
> > > channel
> > > > > > sound playback, plus 2 channels of independent stereo sound output
> > > > > (multiple
> > > > > > streaming) through the front panel stereo outputs.
> > > > > >
> > > > > > It seem  that there is no specific code to distinguish a 10 channels
> > > > > alc892
> > > > > > from those 6 channels alc6xx
> > > > >
> > > > > Yeah, but there is no quirks specific to alc892.
> > > > >
> > > > > Remember that the final goal is to remove all model-quirks from the
> > > > > driver.
> > > > >
> > > > >
> > > > > Takashi
> > > > >
> > > >
> > > > My patch reduce the size of alc662_dac_nid may be wrong if the driver
> > > intend
> > > > to use  alc662_auto_fill_dac_nids()  to handle 6, 8 , 10 channels
> > >
> > > Don't worry, alc662_dac_nids is used only for the fixed quirks.
> > > The auto-parser doesn't use these fixed defined pin arrays.
> > >
> > >
> > > Takashi
> > >
> > 
> > The bug for 10 channels alc892 is in alc662_mix_to_dac, it should return
> > [Audio Output ]0x5 for [Audiomixer 0x0f] -- side channel if model=auto is
> > used for 6stack
> 
> OK, but it's irrelevant with your patch :)
> I'll fix it later.

The fix patch is below.


Takashi

---
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] ALSA: hda - Fix mix->DAC deduction for ALC892

The current alc662 parser doesn't set the DAC for the mixer 0x0f
properly for ALC892, which has 4 DACs while ALC662 has 3.
Fixed by implementing alc662_mix_to_dac() more genericly with the
dynamic widget list.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_realtek.c |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index e62fe7f..d566eac 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -19105,16 +19105,17 @@ static struct alc_config_preset alc662_presets[] = {
  */
 
 /* convert from MIX nid to DAC */
-static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
-{
-	if (nid == 0x0f)
-		return 0x02;
-	else if (nid >= 0x0c && nid <= 0x0e)
-		return nid - 0x0c + 0x02;
-	else if (nid == 0x26) /* ALC887-VD has this DAC too */
-		return 0x25;
-	else
-		return 0;
+static hda_nid_t alc662_mix_to_dac(struct hda_codec *codec, hda_nid_t nid)
+{
+	hda_nid_t list[4];
+	int i, num;
+
+	num = snd_hda_get_connections(codec, nid, list, ARRAY_SIZE(list));
+	for (i = 0; i < num; i++) {
+		if (get_wcaps_type(get_wcaps(codec, list[i])) == AC_WID_AUD_OUT)
+			return list[i];
+	}
+	return 0;
 }
 
 /* get MIX nid connected to the given pin targeted to DAC */
@@ -19126,7 +19127,7 @@ static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
 
 	num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
 	for (i = 0; i < num; i++) {
-		if (alc662_mix_to_dac(mix[i]) == dac)
+		if (alc662_mix_to_dac(codec, mix[i]) == dac)
 			return mix[i];
 	}
 	return 0;
@@ -19143,7 +19144,7 @@ static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
 	if (num < 0)
 		return 0;
 	for (i = 0; i < num; i++) {
-		hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
+		hda_nid_t nid = alc662_mix_to_dac(codec, srcs[i]);
 		if (!nid)
 			continue;
 		for (j = 0; j < spec->multiout.num_dacs; j++)
@@ -19297,7 +19298,7 @@ static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
 	if (num <= 1)
 		return;
 	for (i = 0; i < num; i++) {
-		if (alc662_mix_to_dac(srcs[i]) != dac)
+		if (alc662_mix_to_dac(codec, srcs[i]) != dac)
 			continue;
 		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
 		return;
-- 
1.7.4.2

  reply	other threads:[~2011-04-06 13:20 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-05 14:59 [PATCH ALSA HDA 1/1] Fix alc662_dac_nid and change 6stack-dig to 5stack-dig Raymond Yau
2011-04-06  6:19 ` Takashi Iwai
2011-04-06  7:35   ` Raymond Yau
2011-04-06  7:41     ` Takashi Iwai
2011-04-06  8:29       ` Raymond Yau
2011-04-06  9:29         ` Takashi Iwai
2011-04-06 10:49           ` Valerio tesei
2011-04-07  1:53             ` Raymond Yau
2011-04-07 12:59               ` Valerio tesei
2011-04-07 13:13                 ` Raymond Yau
2011-04-07 13:55                   ` Valerio tesei
2011-04-07 19:44                   ` Valerio Tesei
2011-04-08  0:48                     ` Raymond Yau
2011-04-06 12:59           ` Raymond Yau
2011-04-06 13:07             ` Takashi Iwai
2011-04-06 13:19               ` Takashi Iwai [this message]
2011-04-08  2:06           ` Raymond Yau
2011-04-08  8:38             ` Valerio tesei
2011-04-08  9:28               ` OT: applying patches (was: [PATCH ALSA HDA 1/1] Fix alc662_dac_nid and change 6stack-dig to 5stack-dig) Paul Menzel
2011-04-08  9:47                 ` Valerio tesei
2011-04-08 10:27                   ` snd-hda-intel and parameter `patch` (was: OT: applying patches) Paul Menzel
2011-04-08 14:44                     ` snd-hda-intel and parameter `patch` David Henningsson
2011-04-10  1:21               ` [PATCH ALSA HDA 1/1] Fix alc662_dac_nid and change 6stack-dig to 5stack-dig Raymond Yau
2011-04-11  8:21                 ` Valerio tesei
2011-04-11 19:28                   ` Valerio Tesei
2011-04-13  8:52                     ` Raymond Yau
2011-04-13 11:08                       ` Valerio tesei
2011-04-13 19:12                         ` Valerio Tesei
2011-04-14 11:11                         ` Raymond Yau
2011-04-18 19:53                           ` Valerio Tesei

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=s5hliznms90.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=superquad.vortex2@gmail.com \
    /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).