mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Daniel J Blueman" <daniel.blueman@gmail.com>
Cc: "Vegard Nossum" <vegard.nossum@gmail.com>,
	"Romano Giannetti" <romano@dea.icai.upcomillas.es>,
	"Linux Kernel" <linux-kernel@vger.kernel.org>
Subject: Re: ALC883 recording troubles...
Date: Sat, 16 Aug 2008 19:00:47 +0200	[thread overview]
Message-ID: <s5hod3s99og.wl%tiwai@suse.de> (raw)
In-Reply-To: <6278d2220808160637h1c096c1akdf929820f2cbd23d@mail.gmail.com>

At Sat, 16 Aug 2008 14:37:37 +0100,
Daniel J Blueman wrote:
> 
> This patch is first one you sent, except differing line numbers
> (rediffed against 2.6.27-rc3?).

Oops, I forgot to refresh it.  Below is the right one.

> You could try attaching the patch to the mail too, to avoid the line
> wrapping, silent whitespace conversion and any gmail/mailer 'hide
> quoted text' mangling...

On LKML, the patches should be inlined.
And, you can save a raw file even via gmail, too...


Takashi


[PATCH] ALSA: hda - Fix capture source widgets on ALC codecs

On some Realtek codecs like ALC882 or ALC883, the capture source is
no mux but sum widget.  We have to initialize all channels properly
for this type, otherwise noises may come in from the unused route.

The patch assures to mute unused routes, and unmute the currently
selected route.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index add4e87..b80e725 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -6437,6 +6437,39 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec)
 	}
 }
 
+static void alc882_auto_init_input_src(struct hda_codec *codec)
+{
+	struct alc_spec *spec = codec->spec;
+	const struct hda_input_mux *imux = spec->input_mux;
+	int c;
+
+	for (c = 0; c < spec->num_adc_nids; c++) {
+		hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
+		hda_nid_t nid = spec->capsrc_nids[c];
+		int conns, mute, idx, item;
+
+		conns = snd_hda_get_connections(codec, nid, conn_list,
+						ARRAY_SIZE(conn_list));
+		if (conns < 0)
+			continue;
+		for (idx = 0; idx < conns; idx++) {
+			/* if the current connection is the selected one,
+			 * unmute it as default - otherwise mute it
+			 */
+			mute = AMP_IN_MUTE(idx);
+			for (item = 0; item < imux->num_items; item++) {
+				if (imux->items[item].index == idx) {
+					if (spec->cur_mux[c] == item)
+						mute = AMP_IN_UNMUTE(idx);
+					break;
+				}
+			}
+			snd_hda_codec_write(codec, nid, 0,
+					    AC_VERB_SET_AMP_GAIN_MUTE, mute);
+		}
+	}
+}
+
 /* add mic boosts if needed */
 static int alc_auto_add_mic_boost(struct hda_codec *codec)
 {
@@ -6491,6 +6524,7 @@ static void alc882_auto_init(struct hda_codec *codec)
 	alc882_auto_init_multi_out(codec);
 	alc882_auto_init_hp_out(codec);
 	alc882_auto_init_analog_input(codec);
+	alc882_auto_init_input_src(codec);
 	if (spec->unsol_event)
 		alc_sku_automute(codec);
 }
@@ -8285,6 +8319,8 @@ static void alc883_auto_init_analog_input(struct hda_codec *codec)
 	}
 }
 
+#define alc883_auto_init_input_src	alc882_auto_init_input_src
+
 /* almost identical with ALC880 parser... */
 static int alc883_parse_auto_config(struct hda_codec *codec)
 {
@@ -8315,6 +8351,7 @@ static void alc883_auto_init(struct hda_codec *codec)
 	alc883_auto_init_multi_out(codec);
 	alc883_auto_init_hp_out(codec);
 	alc883_auto_init_analog_input(codec);
+	alc883_auto_init_input_src(codec);
 	if (spec->unsol_event)
 		alc_sku_automute(codec);
 }
@@ -9663,6 +9700,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
 #define alc262_auto_init_multi_out	alc882_auto_init_multi_out
 #define alc262_auto_init_hp_out		alc882_auto_init_hp_out
 #define alc262_auto_init_analog_input	alc882_auto_init_analog_input
+#define alc262_auto_init_input_src	alc882_auto_init_input_src
 
 
 /* init callback for auto-configuration model -- overriding the default init */
@@ -9672,6 +9710,7 @@ static void alc262_auto_init(struct hda_codec *codec)
 	alc262_auto_init_multi_out(codec);
 	alc262_auto_init_hp_out(codec);
 	alc262_auto_init_analog_input(codec);
+	alc262_auto_init_input_src(codec);
 	if (spec->unsol_event)
 		alc_sku_automute(codec);
 }
@@ -13330,6 +13369,8 @@ static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
 	}
 }
 
+#define alc861vd_auto_init_input_src	alc882_auto_init_input_src
+
 #define alc861vd_idx_to_mixer_vol(nid)		((nid) + 0x02)
 #define alc861vd_idx_to_mixer_switch(nid)	((nid) + 0x0c)
 
@@ -13512,6 +13553,7 @@ static void alc861vd_auto_init(struct hda_codec *codec)
 	alc861vd_auto_init_multi_out(codec);
 	alc861vd_auto_init_hp_out(codec);
 	alc861vd_auto_init_analog_input(codec);
+	alc861vd_auto_init_input_src(codec);
 	if (spec->unsol_event)
 		alc_sku_automute(codec);
 }
@@ -14677,6 +14719,8 @@ static void alc662_auto_init_analog_input(struct hda_codec *codec)
 	}
 }
 
+#define alc662_auto_init_input_src	alc882_auto_init_input_src
+
 static int alc662_parse_auto_config(struct hda_codec *codec)
 {
 	struct alc_spec *spec = codec->spec;
@@ -14733,6 +14777,7 @@ static void alc662_auto_init(struct hda_codec *codec)
 	alc662_auto_init_multi_out(codec);
 	alc662_auto_init_hp_out(codec);
 	alc662_auto_init_analog_input(codec);
+	alc662_auto_init_input_src(codec);
 	if (spec->unsol_event)
 		alc_sku_automute(codec);
 }

  reply	other threads:[~2008-08-16 17:00 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-09 19:59 Daniel J Blueman
2008-06-10  5:59 ` Takashi Iwai
2008-06-11 19:00   ` Daniel J Blueman
2008-06-11 21:37     ` Daniel J Blueman
2008-06-12 10:45       ` Takashi Iwai
2008-06-12 10:49     ` Takashi Iwai
2008-06-12 13:03       ` Vegard Nossum
2008-06-12 13:12         ` Takashi Iwai
2008-06-12 13:48           ` Vegard Nossum
2008-06-12 13:52             ` Takashi Iwai
2008-06-12 13:55               ` Vegard Nossum
2008-06-12 14:01                 ` Vegard Nossum
2008-06-12 14:13                   ` Takashi Iwai
2008-06-12 14:02                 ` Takashi Iwai
2008-06-12 14:18                   ` Vegard Nossum
2008-06-12 14:23                     ` Takashi Iwai
2008-06-12 14:58                       ` Daniel J Blueman
2008-06-12 15:18                         ` Takashi Iwai
2008-06-12 16:55                       ` Vegard Nossum
2008-06-12 17:29                         ` Vegard Nossum
2008-06-12 17:53                           ` Takashi Iwai
2008-06-12 18:31                             ` Vegard Nossum
2008-06-12 21:50       ` Daniel J Blueman
2008-06-13 10:38         ` Romano Giannetti
2008-06-28  0:05       ` Daniel J Blueman
     [not found]         ` <19f34abd0806280311s115062e6vc6d0f304cb744934@mail.gmail.com>
     [not found]           ` <6278d2220806280329j2f77c52dp8fbae78420c136c1@mail.gmail.com>
2008-06-28 12:29             ` Daniel J Blueman
2008-06-28 12:39               ` Vegard Nossum
2008-06-28 13:24                 ` Daniel J Blueman
2008-06-28 13:46                   ` Vegard Nossum
2008-06-29 17:29                   ` Romano Giannetti
2008-06-29 21:33                     ` Daniel J Blueman
2008-08-14 19:10             ` Daniel J Blueman
2008-08-15 14:42               ` Takashi Iwai
2008-08-15 22:01                 ` Daniel J Blueman
2008-08-16  8:38                   ` Takashi Iwai
2008-08-16 13:37                     ` Daniel J Blueman
2008-08-16 17:00                       ` Takashi Iwai [this message]
2008-08-16 17:33                         ` Daniel J Blueman
2008-08-17  8:04                           ` Takashi Iwai
2008-06-10 12:22 ` Romano Giannetti
2008-06-10 12:53   ` Vegard Nossum

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=s5hod3s99og.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=daniel.blueman@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=romano@dea.icai.upcomillas.es \
    --cc=vegard.nossum@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

all inboxes | Powered by JetHome®