[alsa-devel] First test of the hda-jack branch
Hi Takashi,
After having some troubles with the kernel scripts (on the Ubuntu side) I've managed to try out your test/hda-jack branch. I'm attaching a patch I had to apply to make the modules load properly.
After having applied the attached patch, I get stuck at an OOPS, which I don't have time to troubleshoot further today. I'm attaching the OOPS log as well (alsa-info for the system I'm testing on is the same as I sent you a few days ago).
At Fri, 11 Nov 2011 17:23:32 +0100, David Henningsson wrote:
Hi Takashi,
After having some troubles with the kernel scripts (on the Ubuntu side) I've managed to try out your test/hda-jack branch. I'm attaching a patch I had to apply to make the modules load properly.
After having applied the attached patch, I get stuck at an OOPS, which I don't have time to troubleshoot further today. I'm attaching the OOPS log as well (alsa-info for the system I'm testing on is the same as I sent you a few days ago).
Thanks for testing! I obviously didn't test the recent version :-< Try the patch below.
Takashi --- diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index 1389958..05489dc 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -193,6 +193,8 @@ void snd_hda_jack_report_sync(struct hda_codec *codec) for (i = 0; i < codec->jacktbl.used; i++, jack++) if (jack->nid) { jack_detect_update(codec, jack); + if (!jack->kctl) + continue; state = get_jack_plug_state(jack->pin_sense); snd_kctl_jack_report(codec->bus->card, jack->kctl, state); } @@ -341,6 +343,7 @@ int snd_hda_input_jack_add(struct hda_codec *codec, hda_nid_t nid, int type, err = snd_jack_new(codec->bus->card, name, type, &jack->jack); if (err < 0) return err; + jack->type = type; jack->jack->private_data = jack; jack->jack->private_free = hda_free_jack_priv; return 0; @@ -354,7 +357,7 @@ void snd_hda_input_jack_report(struct hda_codec *codec, hda_nid_t nid) unsigned int present; int type;
- if (!jack) + if (!jack || !jack->jack) return;
present = snd_hda_jack_detect(codec, nid);
On 11/11/2011 05:52 PM, Takashi Iwai wrote:
At Fri, 11 Nov 2011 17:23:32 +0100, David Henningsson wrote:
Hi Takashi,
After having some troubles with the kernel scripts (on the Ubuntu side) I've managed to try out your test/hda-jack branch. I'm attaching a patch I had to apply to make the modules load properly.
After having applied the attached patch, I get stuck at an OOPS, which I don't have time to troubleshoot further today. I'm attaching the OOPS log as well (alsa-info for the system I'm testing on is the same as I sent you a few days ago).
Thanks for testing! I obviously didn't test the recent version :-< Try the patch below.
Thanks for the quick reply! With the below patch the card starts successfully. I have now tested it on two machines and I'm using the "amixer contents" command to see the current jack status.
The jack state seems to be correct except in one occasion: at startup all jacks are "off", even though the machine was booted up with some jacks inserted. After having inserted or removed at runtime, the jack status is corrected.
In addition, I have a question about the second machine, which looks like this:
numid=45,iface=CARD,name='Front Headphone Jack' numid=47,iface=CARD,name='Front Mic Jack' numid=48,iface=CARD,name='Line Jack' numid=41,iface=CARD,name='Line-Out Jack' numid=42,iface=CARD,name='Line-Out Jack',index=1 numid=43,iface=CARD,name='Line-Out Jack',index=2 numid=44,iface=CARD,name='Line-Out Jack',index=3 numid=46,iface=CARD,name='Rear Mic Jack'
Would it be possible to name the Line-Out Jacks "Front Line-Out", "Surround Line-Out" etc, so one can tell which one is which? Or can you always tell that just from the order of them?
The alsa-info from that machine is attached.
At Fri, 11 Nov 2011 21:08:47 +0100, David Henningsson wrote:
On 11/11/2011 05:52 PM, Takashi Iwai wrote:
At Fri, 11 Nov 2011 17:23:32 +0100, David Henningsson wrote:
Hi Takashi,
After having some troubles with the kernel scripts (on the Ubuntu side) I've managed to try out your test/hda-jack branch. I'm attaching a patch I had to apply to make the modules load properly.
After having applied the attached patch, I get stuck at an OOPS, which I don't have time to troubleshoot further today. I'm attaching the OOPS log as well (alsa-info for the system I'm testing on is the same as I sent you a few days ago).
Thanks for testing! I obviously didn't test the recent version :-< Try the patch below.
Thanks for the quick reply! With the below patch the card starts successfully. I have now tested it on two machines and I'm using the "amixer contents" command to see the current jack status.
The jack state seems to be correct except in one occasion: at startup all jacks are "off", even though the machine was booted up with some jacks inserted. After having inserted or removed at runtime, the jack status is corrected.
Right, this was a missing initialization. The patch below should fix.
In addition, I have a question about the second machine, which looks like this:
numid=45,iface=CARD,name='Front Headphone Jack' numid=47,iface=CARD,name='Front Mic Jack' numid=48,iface=CARD,name='Line Jack' numid=41,iface=CARD,name='Line-Out Jack' numid=42,iface=CARD,name='Line-Out Jack',index=1 numid=43,iface=CARD,name='Line-Out Jack',index=2 numid=44,iface=CARD,name='Line-Out Jack',index=3 numid=46,iface=CARD,name='Rear Mic Jack'
Would it be possible to name the Line-Out Jacks "Front Line-Out", "Surround Line-Out" etc, so one can tell which one is which? Or can you always tell that just from the order of them?
I can assign more intuitive names for the output, certainly. I'll consider the implementation.
thanks,
Takashi
--- diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index 3bcf623..e014562 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -225,6 +225,8 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, if (snd_hda_ctl_add(codec, nid, kctl) < 0) return -ENOMEM; jack->kctl = kctl; + snd_kctl_jack_report(codec->bus->card, kctl, + snd_hda_jack_detect(codec, nid)); return 0; } EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctl);
Date 14.11.2011 10:32, Takashi Iwai wrote:
At Fri, 11 Nov 2011 21:08:47 +0100, David Henningsson wrote:
In addition, I have a question about the second machine, which looks like this:
numid=45,iface=CARD,name='Front Headphone Jack' numid=47,iface=CARD,name='Front Mic Jack' numid=48,iface=CARD,name='Line Jack' numid=41,iface=CARD,name='Line-Out Jack' numid=42,iface=CARD,name='Line-Out Jack',index=1 numid=43,iface=CARD,name='Line-Out Jack',index=2 numid=44,iface=CARD,name='Line-Out Jack',index=3 numid=46,iface=CARD,name='Rear Mic Jack'
Would it be possible to name the Line-Out Jacks "Front Line-Out", "Surround Line-Out" etc, so one can tell which one is which? Or can you always tell that just from the order of them?
I can assign more intuitive names for the output, certainly. I'll consider the implementation.
Perhaps, the jacks should be described (control name) using physical parameters (location, color, connector type). Many codecs support both directions and I saw some bug-reports that ALSA cannot reassign the direction of jacks - if we agree that next versions of ALSA driver might support this feature, naming using the logical purpose might be confusing (we might propagate the logical purpose information using TLV to user space as an extra info).
So something like "Ext Right 1/8 Black Jack". The lenghtest possibility "Ext Rear Panel Digital Unknown Jack" has 36 chars (including '\0') so it fits to 44 characters for the control name with reasonable amount of space for future extensions.
Can we handle the jack direction (playback, capture), too? This control element might be R/O or R/W (depending if hw/driver supports the jack direction control).
And for last, we might create an enum control to set the VREF / LR_SWAP / BALANCED behaviour from the user space.
Jaroslav
On 11/14/2011 05:24 PM, Jaroslav Kysela wrote:
Date 14.11.2011 10:32, Takashi Iwai wrote:
At Fri, 11 Nov 2011 21:08:47 +0100, David Henningsson wrote:
In addition, I have a question about the second machine, which looks like this:
numid=45,iface=CARD,name='Front Headphone Jack' numid=47,iface=CARD,name='Front Mic Jack' numid=48,iface=CARD,name='Line Jack' numid=41,iface=CARD,name='Line-Out Jack' numid=42,iface=CARD,name='Line-Out Jack',index=1 numid=43,iface=CARD,name='Line-Out Jack',index=2 numid=44,iface=CARD,name='Line-Out Jack',index=3 numid=46,iface=CARD,name='Rear Mic Jack'
Would it be possible to name the Line-Out Jacks "Front Line-Out", "Surround Line-Out" etc, so one can tell which one is which? Or can you always tell that just from the order of them?
I can assign more intuitive names for the output, certainly. I'll consider the implementation.
Perhaps, the jacks should be described (control name) using physical parameters (location, color, connector type). Many codecs support both directions and I saw some bug-reports that ALSA cannot reassign the direction of jacks -
We can essentially do that in snd-hda-intel with the reconfiguration feature. That will also recreate the jacks with the new name. This seems to be a reasonable way forward IMO.
if we agree that next versions of ALSA driver might support this feature, naming using the logical purpose might be confusing (we might propagate the logical purpose information using TLV to user space as an extra info).
So something like "Ext Right 1/8 Black Jack". The lenghtest possibility "Ext Rear Panel Digital Unknown Jack" has 36 chars (including '\0') so it fits to 44 characters for the control name with reasonable amount of space for future extensions.
Can we handle the jack direction (playback, capture), too? This control element might be R/O or R/W (depending if hw/driver supports the jack direction control).
And for last, we might create an enum control to set the VREF / LR_SWAP / BALANCED behaviour from the user space.
The problem is making something useful out of all this from userspace. If we ever end up creating and using the complete graph information in userspace, perhaps this would make more sense.
For now, having a consistent view is better as it easier to match the "Rear Mic" mixer control with "Rear Mic Jack", than it is to match "Rear Mic" with "Ext Right 1/8 Black Jack".
2011/11/15 David Henningsson david.henningsson@canonical.com:
On 11/14/2011 05:24 PM, Jaroslav Kysela wrote:
Date 14.11.2011 10:32, Takashi Iwai wrote:
At Fri, 11 Nov 2011 21:08:47 +0100, David Henningsson wrote:
In addition, I have a question about the second machine, which looks like this:
numid=45,iface=CARD,name='Front Headphone Jack' numid=47,iface=CARD,name='Front Mic Jack' numid=48,iface=CARD,name='Line Jack' numid=41,iface=CARD,name='Line-Out Jack' numid=42,iface=CARD,name='Line-Out Jack',index=1 numid=43,iface=CARD,name='Line-Out Jack',index=2 numid=44,iface=CARD,name='Line-Out Jack',index=3 numid=46,iface=CARD,name='Rear Mic Jack'
Would it be possible to name the Line-Out Jacks "Front Line-Out", "Surround Line-Out" etc, so one can tell which one is which? Or can you always tell that just from the order of them?
I can assign more intuitive names for the output, certainly. I'll consider the implementation.
How about those dell xps notebooks which have dual headphone jacks ?
Perhaps, the jacks should be described (control name) using physical parameters (location, color, connector type). Many codecs support both directions and I saw some bug-reports that ALSA cannot reassign the direction of jacks -
We can essentially do that in snd-hda-intel with the reconfiguration feature. That will also recreate the jacks with the new name. This seems to be a reasonable way forward IMO.
can you describe more detail about the reconfiguration since I try to solve the problem of asus M2N ad1988 with 3 audio jacks(green, blue and pink at rear panel) by the auto model instead of "3stack" model?
https://qa.mandriva.com/show_bug.cgi?id=63240
the current implementation of the "3stack" use 3stack_init_verb to retask the blue and pink jacks as output and the rear mic is not working
This is quite common for those MATX motherboard with 3 jacks at rear panel (e.g. hda-emu/codecs/alc662-intel-d945gclf2 )
when switch "channel mode" to 6, alc_hp_automute() does not mute the retasked blue and pink jacks
On 11/16/2011 10:50 AM, Raymond Yau wrote:
2011/11/15 David Henningssondavid.henningsson@canonical.com:
On 11/14/2011 05:24 PM, Jaroslav Kysela wrote:
Date 14.11.2011 10:32, Takashi Iwai wrote:
At Fri, 11 Nov 2011 21:08:47 +0100, David Henningsson wrote:
In addition, I have a question about the second machine, which looks like this:
numid=45,iface=CARD,name='Front Headphone Jack' numid=47,iface=CARD,name='Front Mic Jack' numid=48,iface=CARD,name='Line Jack' numid=41,iface=CARD,name='Line-Out Jack' numid=42,iface=CARD,name='Line-Out Jack',index=1 numid=43,iface=CARD,name='Line-Out Jack',index=2 numid=44,iface=CARD,name='Line-Out Jack',index=3 numid=46,iface=CARD,name='Rear Mic Jack'
Would it be possible to name the Line-Out Jacks "Front Line-Out", "Surround Line-Out" etc, so one can tell which one is which? Or can you always tell that just from the order of them?
I can assign more intuitive names for the output, certainly. I'll consider the implementation.
How about those dell xps notebooks which have dual headphone jacks ?
We'll have to find a good naming convention for them as well, IMO.
Perhaps, the jacks should be described (control name) using physical parameters (location, color, connector type). Many codecs support both directions and I saw some bug-reports that ALSA cannot reassign the direction of jacks -
We can essentially do that in snd-hda-intel with the reconfiguration feature. That will also recreate the jacks with the new name. This seems to be a reasonable way forward IMO.
can you describe more detail about the reconfiguration since I try to solve the problem of asus M2N ad1988 with 3 audio jacks(green, blue and pink at rear panel) by the auto model instead of "3stack" model?
The reconfiguration is described here: http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio.txt under the section "HD-Audio reconfiguration"
At Mon, 14 Nov 2011 10:32:07 +0100, Takashi Iwai wrote:
In addition, I have a question about the second machine, which looks like this:
numid=45,iface=CARD,name='Front Headphone Jack' numid=47,iface=CARD,name='Front Mic Jack' numid=48,iface=CARD,name='Line Jack' numid=41,iface=CARD,name='Line-Out Jack' numid=42,iface=CARD,name='Line-Out Jack',index=1 numid=43,iface=CARD,name='Line-Out Jack',index=2 numid=44,iface=CARD,name='Line-Out Jack',index=3 numid=46,iface=CARD,name='Rear Mic Jack'
Would it be possible to name the Line-Out Jacks "Front Line-Out", "Surround Line-Out" etc, so one can tell which one is which? Or can you always tell that just from the order of them?
I can assign more intuitive names for the output, certainly. I'll consider the implementation.
I added more commits there for a bit better control names. The function got messy and I'd need to rewrite sometime later, but would like to complete the feature at first.
Note that along with the development, I had to rebase this branch so that it can be merged easily to the latest tree. Please be careful when you pull to the existing branch.
thanks,
Takashi
On 11/17/2011 05:39 PM, Takashi Iwai wrote:
At Mon, 14 Nov 2011 10:32:07 +0100, Takashi Iwai wrote:
In addition, I have a question about the second machine, which looks like this:
numid=45,iface=CARD,name='Front Headphone Jack' numid=47,iface=CARD,name='Front Mic Jack' numid=48,iface=CARD,name='Line Jack' numid=41,iface=CARD,name='Line-Out Jack' numid=42,iface=CARD,name='Line-Out Jack',index=1 numid=43,iface=CARD,name='Line-Out Jack',index=2 numid=44,iface=CARD,name='Line-Out Jack',index=3 numid=46,iface=CARD,name='Rear Mic Jack'
Would it be possible to name the Line-Out Jacks "Front Line-Out", "Surround Line-Out" etc, so one can tell which one is which? Or can you always tell that just from the order of them?
I can assign more intuitive names for the output, certainly. I'll consider the implementation.
I added more commits there for a bit better control names. The function got messy and I'd need to rewrite sometime later, but would like to complete the feature at first.
Note that along with the development, I had to rebase this branch so that it can be merged easily to the latest tree. Please be careful when you pull to the existing branch.
Thanks! I've only had a quick look so far (no real test yet), I have some thoughts though:
1) I like the idea of having location prefix and channel mapping suffix! With this implementation we also seem to avoid things like "Front Line-Out Rear" and "Rear Line-Out Front" which could have been confusing, so well done :-)
2) I saw that headphones were not handled differently, for dual headphones, could they be called e g "Headphone Front Jack" and "Headphone Surround Jack" even they both play the front channel?
3) For HDMI I added a while ago something to make it possible to associate the HDMI Jack name with the correct PCM device. We must do the same for the kctl implementation, or it will not be possible to distinguish them correctly. I suggest we do like with the ELD control here, and set the "device" of the kcontrol to 3,7,8 or 9. Do you agree? (We can also add this number somewhere in the name, which might be simpler but maybe less elegant.)
4) "Surround" is misspelled in check_output_sfx.
Thanks,
At Mon, 21 Nov 2011 11:02:11 +0100, David Henningsson wrote:
On 11/17/2011 05:39 PM, Takashi Iwai wrote:
At Mon, 14 Nov 2011 10:32:07 +0100, Takashi Iwai wrote:
In addition, I have a question about the second machine, which looks like this:
numid=45,iface=CARD,name='Front Headphone Jack' numid=47,iface=CARD,name='Front Mic Jack' numid=48,iface=CARD,name='Line Jack' numid=41,iface=CARD,name='Line-Out Jack' numid=42,iface=CARD,name='Line-Out Jack',index=1 numid=43,iface=CARD,name='Line-Out Jack',index=2 numid=44,iface=CARD,name='Line-Out Jack',index=3 numid=46,iface=CARD,name='Rear Mic Jack'
Would it be possible to name the Line-Out Jacks "Front Line-Out", "Surround Line-Out" etc, so one can tell which one is which? Or can you always tell that just from the order of them?
I can assign more intuitive names for the output, certainly. I'll consider the implementation.
I added more commits there for a bit better control names. The function got messy and I'd need to rewrite sometime later, but would like to complete the feature at first.
Note that along with the development, I had to rebase this branch so that it can be merged easily to the latest tree. Please be careful when you pull to the existing branch.
Thanks! I've only had a quick look so far (no real test yet), I have some thoughts though:
- I like the idea of having location prefix and channel mapping suffix!
With this implementation we also seem to avoid things like "Front Line-Out Rear" and "Rear Line-Out Front" which could have been confusing, so well done :-)
- I saw that headphones were not handled differently, for dual
headphones, could they be called e g "Headphone Front Jack" and "Headphone Surround Jack" even they both play the front channel?
Good point. Fixed now.
This reminds me of the handling of two speaker pins. As far as I've seen, all hardware with two speaker pins are for a speaker + a bass-speaker. Thus, heuristically, we should assign "Speaker" and "Bass Speaker" or such.
- For HDMI I added a while ago something to make it possible to
associate the HDMI Jack name with the correct PCM device. We must do the same for the kctl implementation, or it will not be possible to distinguish them correctly. I suggest we do like with the ELD control here, and set the "device" of the kcontrol to 3,7,8 or 9. Do you agree? (We can also add this number somewhere in the name, which might be simpler but maybe less elegant.)
The consistency is important in this case, indeed.
- "Surround" is misspelled in check_output_sfx.
Thanks, fixed this now, too.
Takashi
participants (4)
-
David Henningsson
-
Jaroslav Kysela
-
Raymond Yau
-
Takashi Iwai