[alsa-devel] HD-audio generic parser merged to linux-next

Takashi Iwai tiwai at suse.de
Wed Jan 23 17:00:18 CET 2013


At Wed, 23 Jan 2013 16:30:13 +0100,
Manolo Díaz wrote:
> 
> El mié, 23 ene 2013 a las 16:12 horas
> Takashi Iwai escribió:
> 
> >At Wed, 23 Jan 2013 16:09:22 +0100,
> >Manolo Díaz wrote:
> >> 
> >> El mié, 23 ene 2013 a las 15:20 horas
> >> Takashi Iwai escribió:
> >> 
> >> >At Wed, 23 Jan 2013 15:01:43 +0100,
> >> >Manolo Díaz wrote:
> >> >> 
> >> >> El mié, 23 ene 2013 a las 14:54 horas
> >> >> Takashi Iwai escribió:
> >> >> 
> >> >> >At Wed, 23 Jan 2013 14:49:32 +0100,
> >> >> >Manolo Díaz wrote:
> >> >> >> 
> >> >> >> El mié, 23 ene 2013 a las 9:30 horas
> >> >> >> Takashi Iwai escribió:
> >> >> >> 
> >> >> >> >Hi,
> >> >> >> >
> >> >> >> >as most of feedbacks about the new generic parser migration were
> >> >> >> >positive, I decided to take a risk: now all commit that have been in
> >> >> >> >test/hda-migrate branch in sound-unstable git tree are merged to
> >> >> >> >for-next branch of sound git tree for better test coverage.
> >> >> >> >It means that all changes are merged to linux-next, i.e. will be
> >> >> >> >included in 3.9 kernel.
> >> >> >> >
> >> >> >> >For the early adapter people, I'm going to keep test/hda-migrate
> >> >> >> >branch of sound-unstable git tree updated for a while, but the branch
> >> >> >> >will be abandoned some time later.
> >> >> >> >
> >> >> >> >If you encounter any regression by the recent update, please let me
> >> >> >> >know.
> >> >> >> >
> >> >> >> >
> >> >> >> >thanks,
> >> >> >> >
> >> >> >> >Takashi
> >> >> >> >_______________________________________________
> >> >> >> >Alsa-devel mailing list
> >> >> >> >Alsa-devel at alsa-project.org
> >> >> >> >http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> >> >> >> 
> >> >> >> Hi,
> >> >> >> 
> >> >> >> Recording and (multi stream) playing seem to work fine, but auto-mute
> >> >> >> doesn't. For example, front speakers may remain muted after
> >> >> >> disconnecting the HP.
> >> >> >> 
> >> >> >> cat /sys/kernel/debug/tracing/trace
> >> >> >> # tracer: nop
> >> >> >> #
> >> >> >> # entries-in-buffer/entries-written: 0/0   #P:2
> >> >> >> #
> >> >> >> #                              _-----=> irqs-off
> >> >> >> #                             / _----=> need-resched
> >> >> >> #                            | / _---=> hardirq/softirq
> >> >> >> #                            || / _--=> preempt-depth
> >> >> >> #                            ||| /     delay
> >> >> >> #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
> >> >> >> #              | |       |   ||||       |         |
> >> >> >> 
> >> >> >> I've connected and disconnected the HP jack several times before.
> >> >> >
> >> >> >If nothing appears in the tracing (suppose you enabled the events
> >> >> >properly via /sys/kernel/debug/tracing/events/hda/enable), it's rather
> >> >> >a hardware issue.
> >> >> 
> >> >> Sorry, I've forgotten this step. 
> >> >> 
> >> >> >Did the auto-mute work reliably before the code change?
> >> >> >
> >> >> >
> >> >> >Takashi
> >> >> 
> >> >> Yes, it did.
> >> >
> >> >Did you mean when it worked?  Was it before moving to the generic
> >> >parser, or after it but before upgrading to the latest tree?
> >> >In the latter case, try git bisection to figure out the culprit.
> >> >
> >> >But, it's anyway better to update the git branch.  You are testing the
> >> >too old version (there have been already 75 commits after your testing
> >> >one).
> >> >
> >> >
> >> >> New try, this time with hda events enabled.
> >> >> 
> >> >> cat /sys/kernel/debug/tracing/trace
> >> >> # tracer: nop
> >> >> #
> >> >> # entries-in-buffer/entries-written: 871/871   #P:2
> >> >> #
> >> >> #                              _-----=> irqs-off
> >> >> #                             / _----=> need-resched
> >> >> #                            | / _---=> hardirq/softirq
> >> >> #                            || / _--=> preempt-depth
> >> >> #                            ||| /     delay
> >> >> #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
> >> >> #              | |       |   ||||       |         |
> >> >>           <idle>-0     [001] d.h.  4509.450172: hda_unsol_event: [0] res=4000000, res_ex=10
> >> >>           <idle>-0     [001] d.h.  4513.991711: hda_unsol_event: [0] res=4000000, res_ex=10
> >> >
> >> >OK, so the unsol event is generated properly.
> >> >
> >> >Is the alsa-info.sh output you attached previously at the state after
> >> >unplugging?  If so, I see no problem in the code register.  The path
> >> >0x04 -> 0x29 -> 0x12 looks fine, all unmuted, power D0 and the pin set
> >> >properly.
> >> >
> >> >If something doesn't work as expected, we need two alsa-info outputs
> >> >for comparison: the working one and non-working one.
> >> >
> >> >
> >> >Takashi
> >> 
> >> commit 28ebfa08e2945b38e08c537faf7f749125780cbe
> >> branch: test/hda-migrate
> >> 
> >> Now everything's working fine (only tested 2 channels analog). Btw,
> >> I can't hear what I'm recording, unlike the latest stable kernel. Is
> >> that intentional?
> >
> >In the latest version, you should have "Line", "Front Mic" and "Rear
> >Mic" playback volumes/switches.  They are the analog-loopback things.
> >
> >
> >Takashi
> 
> Yes, I have them. But I can't hear what I'm recording, either through
> headphones or through speakers, no matters if HP independent is enabled
> or disabled. Attached is the alsa-info.sh output after the last test:
> recording through the rear-mic and trying to hear through the HP with
> HP independent disbled, all related switches on and high volume level.

OK, confirmed that it's a missing path between the mixer widget and
the actual outputs.  There is another mixer widget in the case of
AD1988 and AD1882.

Since these are specific to AD codecs, I did a band-aid fix now.
Try the patch below.


Takashi

---
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 758dcc1..06e203d 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -688,7 +688,7 @@ static void activate_amp_in(struct hda_codec *codec, struct nid_path *path,
 	 * when aa-mixer is available, we need to enable the path as well
 	 */
 	for (n = 0; n < nums; n++) {
-		if (n != idx && (!add_aamix || conn[n] != spec->mixer_nid))
+		if (n != idx && (!add_aamix || conn[n] != spec->mixer_merge_nid))
 			continue;
 		activate_amp(codec, nid, HDA_INPUT, n, idx, enable);
 	}
@@ -2492,6 +2492,19 @@ static int new_analog_input(struct hda_codec *codec, int input_idx,
 
 	path->active = true;
 	add_loopback_list(spec, mix_nid, idx);
+
+	if (spec->mixer_nid != spec->mixer_merge_nid &&
+	    !spec->loopback_merge_path) {
+		path = snd_hda_add_new_path(codec, spec->mixer_nid,
+					    spec->mixer_merge_nid, 0);
+		if (path) {
+			print_nid_path("loopback-merge", path);
+			path->active = true;
+			spec->loopback_merge_path =
+				snd_hda_get_path_idx(codec, path);
+		}
+	}
+
 	return 0;
 }
 
@@ -3847,6 +3860,9 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec,
 
 	parse_user_hints(codec);
 
+	if (spec->mixer_nid && !spec->mixer_merge_nid)
+		spec->mixer_merge_nid = spec->mixer_nid;
+
 	if (cfg != &spec->autocfg) {
 		spec->autocfg = *cfg;
 		cfg = &spec->autocfg;
@@ -4673,6 +4689,11 @@ static void init_analog_input(struct hda_codec *codec)
 			if (path)
 				snd_hda_activate_path(codec, path,
 						      path->active, false);
+			path = snd_hda_get_path_from_idx(codec,
+							 spec->loopback_merge_path);
+			if (path)
+				snd_hda_activate_path(codec, path, path->active,
+						      false);
 		}
 	}
 }
diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h
index 980707f..d226856 100644
--- a/sound/pci/hda/hda_generic.h
+++ b/sound/pci/hda/hda_generic.h
@@ -107,6 +107,7 @@ struct hda_gen_spec {
 	hda_nid_t adc_nids[AUTO_CFG_MAX_INS];
 	hda_nid_t dig_in_nid;		/* digital-in NID; optional */
 	hda_nid_t mixer_nid;		/* analog-mixer NID */
+	hda_nid_t mixer_merge_nid;	/* aamix merge-point NID (optional) */
 	const char *input_labels[HDA_MAX_NUM_INPUTS];
 	int input_label_idxs[HDA_MAX_NUM_INPUTS];
 
@@ -163,6 +164,7 @@ struct hda_gen_spec {
 	int digout_paths[AUTO_CFG_MAX_OUTS];
 	int input_paths[HDA_MAX_NUM_INPUTS][AUTO_CFG_MAX_INS];
 	int loopback_paths[HDA_MAX_NUM_INPUTS];
+	int loopback_merge_path;
 	int digin_path;
 
 	/* auto-mic stuff */
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 9d82aab..df8014b 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -3235,6 +3235,7 @@ static int ad1988_parse_auto_config(struct hda_codec *codec)
 	spec = codec->spec;
 
 	spec->gen.mixer_nid = 0x20;
+	spec->gen.mixer_merge_nid = 0x21;
 	spec->beep_dev_nid = 0x10;
 	set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
 	err = ad198x_parse_auto_config(codec);
@@ -5153,6 +5154,7 @@ static int ad1882_parse_auto_config(struct hda_codec *codec)
 	spec = codec->spec;
 
 	spec->gen.mixer_nid = 0x20;
+	spec->gen.mixer_merge_nid = 0x21;
 	spec->beep_dev_nid = 0x10;
 	set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
 	err = ad198x_parse_auto_config(codec);


More information about the Alsa-devel mailing list