[alsa-devel] How to use hda-verb to detect
![](https://secure.gravatar.com/avatar/effca2e1f31833f9f56452803478ca5e.jpg?s=120&d=mm&r=g)
Hi,
I'm playing with an HP DV6(which produces sound only when model=hp-dv5, will send a patch for it after further testing) on which HP automuting is not working. The laptop has apparently two HP outputs which seems to behave completely parallel.
One thing that I really don't get with hda-verb, is the last parameter. I used hda-emu for finding out an example call:
Front Playback Volume:0 MIN/MAX: 0/64, VAL: [39] [39] dB min/max: -48.00/0.00, [-18.-75dB] [-18.-75dB]
set 1 64 64
send: NID=0x10, VERB=0x3a0(set_amp_gain_mute,O:L#0), PARM=0x7f receive: 0x0 send: NID=0x10, VERB=0x390(set_amp_gain_mute,O:R#0), PARM=0x7f receive: 0x0
set 1 63 63
send: NID=0x10, VERB=0x3a0(set_amp_gain_mute,O:L#0), PARM=0x7e receive: 0x0 send: NID=0x10, VERB=0x390(set_amp_gain_mute,O:R#0), PARM=0x7e receive: 0x0
I can easily understand that I'm calling set_amp_gain_mute VERB for NID 0x10 with a level value 0x7f and 0x7e.
Now when I run hda-verb without parameter, it gives me a bunch of possible values for PARM:
VENDOR_ID, SUBSYSTEM_ID, REV_ID, NODE_COUNT, FUNCTION_TYPE AUDIO_FG_CAP, AUDIO_WIDGET_CAP, PCM, STREAM, PIN_CAP, AMP_IN_CAP CONNLIST_LEN, POWER_STATE, PROC_CAP, GPIO_CAP, AMP_OUT_CAP VOL_KNB_CA
I can't easily understand which one I have to choose for example to send the verb SET_UNSOLICITED_ENABLE or SET_PIN_SENSE.
I've found the widget below in HP DV6 (OUT HP Detect grabbed my attention and I've seen that the unsolicited events has something to do with HP sense/automute, just playling blindly),
Node 0x0a [Pin Complex] wcaps 0x400181: Stereo Pincap 0x0000001c: OUT HP Detect ** Pin Default 0x40f100f0: [N/A] Other at Ext N/A Conn = 1/8, Color = Unknown DefAssociation = 0xf, Sequence = 0x0 Pin-ctls: 0x00: Unsolicited: tag=0c, enabled=0 Connection: 3 0x10 0x11 0x17*
and say that I want to send SET_UNSOLICITED_ENABLE to 0x0a, which PARM should I choose?
I'm also attaching alsa-info output,
Thanks! Ozan
![](https://secure.gravatar.com/avatar/5b19e9d0e834ea10ef75803718ad564b.jpg?s=120&d=mm&r=g)
At Mon, 17 Aug 2009 12:23:42 +0300, Ozan Çağlayan wrote:
Hi,
I'm playing with an HP DV6(which produces sound only when model=hp-dv5, will send a patch for it after further testing) on which HP automuting is not working. The laptop has apparently two HP outputs which seems to behave completely parallel.
A question is whether two pins are assigned for both or one pin is shared. I guess the former case, so according to your alsa-info.sh output, BIOS gives utterly wrong pin setup...
One thing that I really don't get with hda-verb, is the last parameter. I used hda-emu for finding out an example call:
Front Playback Volume:0 MIN/MAX: 0/64, VAL: [39] [39] dB min/max: -48.00/0.00, [-18.-75dB] [-18.-75dB]
set 1 64 64
send: NID=0x10, VERB=0x3a0(set_amp_gain_mute,O:L#0), PARM=0x7f receive: 0x0 send: NID=0x10, VERB=0x390(set_amp_gain_mute,O:R#0), PARM=0x7f receive: 0x0
set 1 63 63
send: NID=0x10, VERB=0x3a0(set_amp_gain_mute,O:L#0), PARM=0x7e receive: 0x0 send: NID=0x10, VERB=0x390(set_amp_gain_mute,O:R#0), PARM=0x7e receive: 0x0
I can easily understand that I'm calling set_amp_gain_mute VERB for NID 0x10 with a level value 0x7f and 0x7e.
Now when I run hda-verb without parameter, it gives me a bunch of possible values for PARM:
VENDOR_ID, SUBSYSTEM_ID, REV_ID, NODE_COUNT, FUNCTION_TYPE AUDIO_FG_CAP, AUDIO_WIDGET_CAP, PCM, STREAM, PIN_CAP, AMP_IN_CAP CONNLIST_LEN, POWER_STATE, PROC_CAP, GPIO_CAP, AMP_OUT_CAP VOL_KNB_CA
These are for PARAMETERS verb, e.g.
% hda-verb /dev/... 0x0a PARAMETERS PIN_CAP
I can't easily understand which one I have to choose for example to send the verb SET_UNSOLICITED_ENABLE or SET_PIN_SENSE.
For normal verbs, just pass numbers. You can pass numbers to PARAMETERS verb, too, of course. Also, the verb itself can be a number.
I've found the widget below in HP DV6 (OUT HP Detect grabbed my attention and I've seen that the unsolicited events has something to do with HP sense/automute, just playling blindly),
Node 0x0a [Pin Complex] wcaps 0x400181: Stereo Pincap 0x0000001c: OUT HP Detect ** Pin Default 0x40f100f0: [N/A] Other at Ext N/A Conn = 1/8, Color = Unknown DefAssociation = 0xf, Sequence = 0x0 Pin-ctls: 0x00: Unsolicited: tag=0c, enabled=0 Connection: 3 0x10 0x11 0x17*
and say that I want to send SET_UNSOLICITED_ENABLE to 0x0a, which PARM should I choose?
For SET_UNSOLICITED_ENABLE verb, you need to a value (TAG | AC_USRSP_EN). in the case of above, suppose the tag to be 0x0c, pass 0x8c.
Takashi
![](https://secure.gravatar.com/avatar/effca2e1f31833f9f56452803478ca5e.jpg?s=120&d=mm&r=g)
Takashi Iwai wrote On 17-08-2009 12:34:
For SET_UNSOLICITED_ENABLE verb, you need to a value (TAG | AC_USRSP_EN). in the case of above, suppose the tag to be 0x0c, pass 0x8c.
Okay I've got the mechanism, thanks.
How can I help for fixing HP automuting? setting UNSOLICITED_ENABLE didn't help at all.
![](https://secure.gravatar.com/avatar/5b19e9d0e834ea10ef75803718ad564b.jpg?s=120&d=mm&r=g)
At Mon, 17 Aug 2009 12:41:39 +0300, Ozan Çağlayan wrote:
Takashi Iwai wrote On 17-08-2009 12:34:
For SET_UNSOLICITED_ENABLE verb, you need to a value (TAG | AC_USRSP_EN). in the case of above, suppose the tag to be 0x0c, pass 0x8c.
Okay I've got the mechanism, thanks.
How can I help for fixing HP automuting? setting UNSOLICITED_ENABLE didn't help at all.
The first thing is to identify which pin corresponds to which headphone. I guess each HP jack correspond to an individual pin like Dell machines.
Then you can give the correct pin cfg via sysfs or a setup file via "patch" module option.
Takashi
![](https://secure.gravatar.com/avatar/effca2e1f31833f9f56452803478ca5e.jpg?s=120&d=mm&r=g)
Takashi Iwai wrote On 17-08-2009 12:50:
At Mon, 17 Aug 2009 12:41:39 +0300, Ozan Çağlayan wrote:
Takashi Iwai wrote On 17-08-2009 12:34:
For SET_UNSOLICITED_ENABLE verb, you need to a value (TAG | AC_USRSP_EN). in the case of above, suppose the tag to be 0x0c, pass 0x8c.
Okay I've got the mechanism, thanks.
How can I help for fixing HP automuting? setting UNSOLICITED_ENABLE didn't help at all.
The first thing is to identify which pin corresponds to which headphone. I guess each HP jack correspond to an individual pin like Dell machines.
Then you can give the correct pin cfg via sysfs or a setup file via "patch" module option.
Seen that I'm not able to find out the matching between pins and jacks (decided to read the last chapter of HDA spec), I continued to play. With hp-dv5 I have to following situation:
- Both HP jacks are producing sound but no automuting, - Internal speaker can be controlled and muted using 'Speaker' mixer control, - HP jacks can be controlled and muted using 'Front' mixer control.
Then I tried model=dell-m4-1 : - Both HP jacks are producing sound, automuting works, - Internal speaker can be controlled and muted using 'Front' mixer control, - HP jacks can be controlled and muted using 'Front' mixer control, - 'Speaker' control is replaced by 'Headphone' control which is useless,
I took a diff of codec-files in both situations and found out the following: Analog Loopback: 0x00 Node 0x0a [Pin Complex] wcaps 0x400181: Stereo Pincap 0x0000001c: OUT HP Detect - Pin Default 0x0421101f: [Jack] HP Out at Ext Right - Conn = 1/8, Color = Black - DefAssociation = 0x1, Sequence = 0xf + Pin Default 0x40f100f0: [N/A] Other at Ext N/A + Conn = 1/8, Color = Unknown + DefAssociation = 0xf, Sequence = 0x0 Pin-ctls: 0x00: Unsolicited: tag=01, enabled=1 Connection: 3
I set 0x0a to 0x421101f in user_init_verbs and yes Speaker control disappears, a useless HP control appears, automuting works. I'm attaching the complete diff from dell-m4-1 to hp-dv5 model.
![](https://secure.gravatar.com/avatar/5b19e9d0e834ea10ef75803718ad564b.jpg?s=120&d=mm&r=g)
At Mon, 17 Aug 2009 15:34:18 +0300, Ozan Çağlayan wrote:
Takashi Iwai wrote On 17-08-2009 12:50:
At Mon, 17 Aug 2009 12:41:39 +0300, Ozan Çağlayan wrote:
Takashi Iwai wrote On 17-08-2009 12:34:
For SET_UNSOLICITED_ENABLE verb, you need to a value (TAG | AC_USRSP_EN). in the case of above, suppose the tag to be 0x0c, pass 0x8c.
Okay I've got the mechanism, thanks.
How can I help for fixing HP automuting? setting UNSOLICITED_ENABLE didn't help at all.
The first thing is to identify which pin corresponds to which headphone. I guess each HP jack correspond to an individual pin like Dell machines.
Then you can give the correct pin cfg via sysfs or a setup file via "patch" module option.
Seen that I'm not able to find out the matching between pins and jacks (decided to read the last chapter of HDA spec), I continued to play. With hp-dv5 I have to following situation:
- Both HP jacks are producing sound but no automuting,
This is because BIOS doesn't set HP pin configs.
- Internal speaker can be controlled and muted using 'Speaker' mixer
control,
- HP jacks can be controlled and muted using 'Front' mixer control.
The same reason...
Then I tried model=dell-m4-1 :
- Both HP jacks are producing sound, automuting works,
- Internal speaker can be controlled and muted using 'Front' mixer control,
- HP jacks can be controlled and muted using 'Front' mixer control,
- 'Speaker' control is replaced by 'Headphone' control which is useless,
I took a diff of codec-files in both situations and found out the following: Analog Loopback: 0x00 Node 0x0a [Pin Complex] wcaps 0x400181: Stereo Pincap 0x0000001c: OUT HP Detect
- Pin Default 0x0421101f: [Jack] HP Out at Ext Right
- Conn = 1/8, Color = Black
- DefAssociation = 0x1, Sequence = 0xf
- Pin Default 0x40f100f0: [N/A] Other at Ext N/A
- Conn = 1/8, Color = Unknown
- DefAssociation = 0xf, Sequence = 0x0 Pin-ctls: 0x00: Unsolicited: tag=01, enabled=1 Connection: 3
I set 0x0a to 0x421101f in user_init_verbs and yes Speaker control disappears, a useless HP control appears, automuting works. I'm attaching the complete diff from dell-m4-1 to hp-dv5 model.
It means that 0x0a corresponds to one HP. And, with this situation, do both HPs work (and also auto-muting)?
thanks,
Takashi
![](https://secure.gravatar.com/avatar/effca2e1f31833f9f56452803478ca5e.jpg?s=120&d=mm&r=g)
Takashi Iwai wrote On 17-08-2009 16:42:
It means that 0x0a corresponds to one HP. And, with this situation, do both HPs work (and also auto-muting)?
Yes both HP and auto-muting works (they always behaved exactly the same for every model I've tried) but 'Speaker' is gone so 'Front ' started to control both HPs and also internal speaker which is bad.
![](https://secure.gravatar.com/avatar/5b19e9d0e834ea10ef75803718ad564b.jpg?s=120&d=mm&r=g)
At Mon, 17 Aug 2009 17:01:31 +0300, Ozan Çağlayan wrote:
Takashi Iwai wrote On 17-08-2009 16:42:
It means that 0x0a corresponds to one HP. And, with this situation, do both HPs work (and also auto-muting)?
Yes both HP and auto-muting works (they always behaved exactly the same for every model I've tried) but 'Speaker' is gone so 'Front ' started to control both HPs and also internal speaker which is bad.
This is likely because you have another line-out jack definition at NID 0x0f. Does this play any role?
Takashi
participants (2)
-
Ozan Çağlayan
-
Takashi Iwai