Hi Takashi, I am still finding this recording +ve saturation on my ALC883 Intel HDA sound device with 2.6.27-rc3 (ie ALSA 1.0.17 drivers) and ALSA 1.0.16-1 libraries on Ubuntu Intrepid. The previous workaround still 'gets us out of jail': # ./hda-verb /dev/snd/hwC0D0 0x23 SET_AMP_GAIN_MUTE 0x7180 nid = 0x23, verb = 0x300, param = 0x7180 value = 0x0 Note, we see this message "hda_codec: Unknown model for ALC883, trying auto-probe from BIOS..." as before on this Asus P5E-VM HDMI motherboard with current BIOS. How can we improve the situation, as out the box, the front/rear mic inputs are (still) useless? Many thanks, Daniel On Sat, Jun 28, 2008 at 11:29 AM, Daniel J Blueman -- Daniel J Blueman --
At Thu, 14 Aug 2008 20:10:03 +0100,
Could you try the patch below? With this patch, unused connections
will be disabled. Let me know if it really works so that I can merge
it to git tree.
Takashi
---
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9473abb..6f0485a 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -6442,6 +6442,40 @@ 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[10];
+ 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;
+ mute = HDA_AMP_MUTE;
+ for (idx = 0; idx < conns; idx++) {
+ /* if the current connection is the selected one,
+ * unmute it as default - otherwise mute it
+ */
+ for (item = 0; item < imux->num_items; item++) {
+ if (imux->items[item].index == idx) {
+ if (spec->cur_mux[c] == item)
+ mute = 0;
+ break;
+ }
+ }
+ snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
+ idx, HDA_AMP_MUTE, mute);
+ }
+
+ }
+}
+
/* add mic boosts if needed */
static int alc_auto_add_mic_boost(struct hda_codec *codec)
{
@@ -6496,6 +6530,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);
}
@@ -8290,6 +8325,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 ...Hi Takashi, There were a couple of issues: getting the mute logic right from moving the assignment and increasing the number of inputs beyond the 11 required here to avoid the 'Too many connections' message and fixing the last input being skipped. With the updated patch, the problem is fully addressed; no resulting DC offset, so recording quality is great. This seems logically safe and a hopeful for 2.6.27-rc4... The updated patch is against 2.6.27-rc3. Thanks once again, Daniel Signed-off-by: Daniel J Blueman <daniel.blueman@gmail.com> -- Daniel J Blueman
At Fri, 15 Aug 2008 23:01:42 +0100,
Thanks. There is another problem in the current patch.
It should use snd_hda_codec_write() without caching. Otherwise
it breaks the suspend/resume.
The revised patch is below. Please test and report back if it works
so that I can push it to the upstream.
thanks,
Takashi
===
commit 340c6e7d8bc26354313fe8bacc636ca18f71995e
Author: Takashi Iwai <tiwai@suse.de>
Date: Fri Aug 15 16:46:42 2008 +0200
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..56d899f 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -6437,6 +6437,40 @@ 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[10];
+ 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;
+ mute = HDA_AMP_MUTE;
+ for (idx = 0; idx < conns; idx++) {
+ /* if the current connection is the selected one,
+ * unmute it as default - otherwise mute it
+ */
+ for (item = 0; item < imux->num_items; item++) {
+ if (imux->items[item].index == idx) {
+ if (spec->cur_mux[c] == item)
+ mute = 0;
+ break;
+ }
+ }
+ snd_hda_codec_amp_stereo(codec, nid, ...Hi Takashi and thanks, This patch is first one you sent, except differing line numbers (rediffed against 2.6.27-rc3?). 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... Thanks, Daniel -- Daniel J Blueman --
At Sat, 16 Aug 2008 14:37:37 +0100,
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);
...Hi Takashi, The updated patch validates fully also. Checking everything with codecgraph and varying both capture inputs looks as expected, so thanks again! Tested-by: Daniel J Blueman <daniel.blueman@gmail.com> Daniel -- Daniel J Blueman --
At Sat, 16 Aug 2008 18:33:33 +0100, Great, thanks for your quick tests! I merged it to my tree and will send a pull request. Takashi --
