alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: "Manolo Díaz" <diaz.manolo@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: HD-audio generic parser merged to linux-next
Date: Wed, 23 Jan 2013 17:35:37 +0100	[thread overview]
Message-ID: <20130123173537.55dc8a7c@gmail.com> (raw)
In-Reply-To: <s5hsj5revot.wl%tiwai@suse.de>

El mié, 23 ene 2013 a las 17:00 horas
Takashi Iwai escribió:

>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@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);

I've done a quick test because I must leave now: recording through the
rear-mic and monitoring with HP. It _is fixed_ now. Later on I'll do a
more extensive test. Thanks a lot. 

Regards,

-- 
Manolo Díaz
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2013-01-23 16:35 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-23  8:30 HD-audio generic parser merged to linux-next Takashi Iwai
2013-01-23  8:55 ` Raymond Yau
2013-01-23  9:09   ` Takashi Iwai
2013-01-24  3:26     ` Raymond Yau
2013-01-24  6:31       ` Takashi Iwai
2013-01-23 13:49 ` Manolo Díaz
2013-01-23 13:54   ` Takashi Iwai
     [not found]     ` <20130123150143.6fe19b53@gmail.com>
2013-01-23 14:20       ` Takashi Iwai
2013-01-23 14:55         ` Takashi Iwai
2013-01-23 15:09           ` Takashi Iwai
2013-01-23 15:12           ` Manolo Díaz
2013-01-23 15:09         ` Manolo Díaz
2013-01-23 15:12           ` Takashi Iwai
2013-01-23 15:30             ` Manolo Díaz
2013-01-23 15:40               ` Manolo Díaz
2013-01-23 16:00               ` Takashi Iwai
2013-01-23 16:35                 ` Manolo Díaz [this message]
2013-01-23 16:54                   ` Takashi Iwai
2013-02-11 14:20 ` Raymond Yau
2013-02-11 14:27   ` Takashi Iwai
2013-02-11 15:12     ` Raymond Yau
2013-02-11 15:17       ` Takashi Iwai
2013-02-13 12:16         ` Raymond Yau
2013-02-13 13:02           ` Takashi Iwai
2013-02-13 13:17             ` Takashi Iwai
2013-02-13 13:48               ` Takashi Iwai

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=20130123173537.55dc8a7c@gmail.com \
    --to=diaz.manolo@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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).