Skip to contentSkip to conversation

CX20724 headset button detect

DISCUSSION David Woodhouse 2 participants 5 messages Apr 4, 2018

lore
Share & tools
lore
#0 lore raw

I have an HP EliteBook 850 G3 with CX20724:

 hdaudioC0D0: CX20724: BIOS auto-probing.
 hdaudioC0D0: action: 0 gpio_led: 0
 hdaudioC0D0: autoconfig for CX20724: line_outs=1 (0x16/0x0/0x0/0x0/0x0) type:line hdaudioC0D0:    speaker_outs=1 (0x17/0x0/0x0/0x0/0x0)
 hdaudioC0D0:    hp_outs=1 (0x1d/0x0/0x0/0x0/0x0)
 hdaudioC0D0:    mono: mono_out=0x0
 hdaudioC0D0:    inputs:
 hdaudioC0D0:      Mic=0x19
 hdaudioC0D0:      Internal Mic=0x1a
 hdaudioC0D0:      Line=0x18
 hdaudioC0D0: Enable sync_write for stable communication
 hdaudioC0D0: action: 1 gpio_led: 0
 hdaudioC0D0: action: 2 gpio_led: 0
 ...
 input: HDA Intel PCH Mic as /devices/pci0000:00/0000:00:1f.3/sound/card0/input21

The CX20724 datasheet¹ suggests that it supports headset button events — at least 'Function A' when the mic pin is shorted to ground, if not the other functions.

But it isn't working. Only the jack insertion is reported through the corresponding input device, not the button press. I added a printk into snd_hda_jack_unsol_event(), and it isn't even being invoked at all for the button presses; only insertion/removal.

How do we make this work?

¹ https://www.tonymacx86.com/attachments/datasheet_cx20724-pdf.203615/

#1 lore raw
Quoted 23 lines · David Woodhouse

I have an HP EliteBook 850 G3 with CX20724:

 hdaudioC0D0: CX20724: BIOS auto-probing.
 hdaudioC0D0: action: 0 gpio_led: 0
 hdaudioC0D0: autoconfig for CX20724: line_outs=1 (0x16/0x0/0x0/0x0/0x0) type:line hdaudioC0D0:    speaker_outs=1 (0x17/0x0/0x0/0x0/0x0)
 hdaudioC0D0:    hp_outs=1 (0x1d/0x0/0x0/0x0/0x0)
 hdaudioC0D0:    mono: mono_out=0x0
 hdaudioC0D0:    inputs:
 hdaudioC0D0:      Mic=0x19
 hdaudioC0D0:      Internal Mic=0x1a
 hdaudioC0D0:      Line=0x18
 hdaudioC0D0: Enable sync_write for stable communication
 hdaudioC0D0: action: 1 gpio_led: 0
 hdaudioC0D0: action: 2 gpio_led: 0
 ...
 input: HDA Intel PCH Mic as /devices/pci0000:00/0000:00:1f.3/sound/card0/input21

The CX20724 datasheet¹ suggests that it supports headset button events — at least 'Function A' when the mic pin is shorted to ground, if not the other functions.

Quoted 6 lines

But it isn't working. Only the jack insertion is reported through the corresponding input device, not the button press. I added a printk into snd_hda_jack_unsol_event(), and it isn't even being invoked at all for the button presses; only insertion/removal.

How do we make this work?

Unfortunately, there is no standard definition for the headset button handling in HD-audio spec, and each vendor implements in own way without disclosure.
For example, the datasheet you gave also doesn't shed any light how it's triggered (the headset button widget NID is empty and no more information).

So at this moment, only Conexant people can answer to this question properly, sorry.

Maybe you can try to enable the GPIO unsolicited event and see whether any unsolicited event is generated. Though, the datasheet says it's something else individual, but who knows.

thanks,

Takashi

Quoted 9 lines

¹ https://www.tonymacx86.com/attachments/datasheet_cx20724-pdf.203615/
[1.2 smime.p7s <application/x-pkcs7-signature (base64)>]

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw
Quoted 43 lines · Takashi Iwai
Quoted 24 lines · David Woodhouse

I have an HP EliteBook 850 G3 with CX20724:

 hdaudioC0D0: CX20724: BIOS auto-probing.
 hdaudioC0D0: action: 0 gpio_led: 0
 hdaudioC0D0: autoconfig for CX20724: line_outs=1 (0x16/0x0/0x0/0x0/0x0) type:line hdaudioC0D0:    speaker_outs=1 (0x17/0x0/0x0/0x0/0x0)
 hdaudioC0D0:    hp_outs=1 (0x1d/0x0/0x0/0x0/0x0)
 hdaudioC0D0:    mono: mono_out=0x0
 hdaudioC0D0:    inputs:
 hdaudioC0D0:      Mic=0x19
 hdaudioC0D0:      Internal Mic=0x1a
 hdaudioC0D0:      Line=0x18
 hdaudioC0D0: Enable sync_write for stable communication
 hdaudioC0D0: action: 1 gpio_led: 0
 hdaudioC0D0: action: 2 gpio_led: 0
 ...
 input: HDA Intel PCH Mic as /devices/pci0000:00/0000:00:1f.3/sound/card0/input21

The CX20724 datasheet¹ suggests that it supports headset button events — at least 'Function A' when the mic pin is shorted to ground, if not the other functions.

Quoted 8 lines

But it isn't working. Only the jack insertion is reported through the corresponding input device, not the button press. I added a printk into snd_hda_jack_unsol_event(), and it isn't even being invoked at all for the button presses; only insertion/removal.

How do we make this work?

¹ https://www.tonymacx86.com/attachments/datasheet_cx20724-pdf.203615/

Unfortunately, there is no standard definition for the headset button handling in HD-audio spec, and each vendor implements in own way without disclosure.
For example, the datasheet you gave also doesn't shed any light how it's triggered (the headset button widget NID is empty and no more information).

Quoted 2 lines

So at this moment, only Conexant people can answer to this question properly, sorry.

Thanks. I think that would be "Synaptics people" now... Andrew, is there any chance you could find a better datasheet for this part please? I see mention of a 'BIOS guide' in what we have so far.

Alternatively… David, in https://bugs.launchpad.net/ubuntu/+bug/1198030
you added code which touches registers in the vendor-specific 0x1C NID. Do you have access to something I haven't been able to find, and does it say anything about headset button detection?

Quoted 3 lines

Maybe you can try to enable the GPIO unsolicited event and see whether any unsolicited event is generated.  Though, the datasheet says it's something else individual, but who knows.

Hm... forgive my ignorance; how do I do that? FWIW here's the content of /proc/asound/card0/codec#0:

Codec: Conexant CX20724
Address: 0
AFG Function Id: 0x1 (unsol 1)
Vendor Id: 0x14f150f4
Subsystem Id: 0x103c814d
Revision Id: 0x100109
No Modem Function Group found
Default PCM:
    rates [0x140]: 48000 96000
    bits [0xa]: 16 24
    formats [0x1]: PCM
Default Amp-In caps: N/A
Default Amp-Out caps: N/A
State of AFG node 0x01:
  Power states:  D0 D1 D2 D3 D3cold S3D3cold CLKSTOP EPSS
  Power: setting=D0, actual=D0
GPIO: io=7, o=0, i=0, unsolicited=1, wake=1
  IO[0]: enable=1, dir=1, wake=0, sticky=0, data=0, unsol=0
  IO[1]: enable=1, dir=1, wake=0, sticky=0, data=0, unsol=0
  IO[2]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
  IO[3]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
  IO[4]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
  IO[5]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
  IO[6]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
Node 0x10 [Audio Output] wcaps 0xc1d: Stereo Amp-Out R/L
  Control: name="Speaker+LO Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Control: name="Speaker+LO Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Device: name="CX20724 Analog", type="Audio", device=0
  Amp-Out caps: ofs=0x4a, nsteps=0x4a, stepsize=0x03, mute=1
  Amp-Out vals:  [0x80 0x80]
  Converter: stream=1, channel=0
  PCM:
    rates [0x540]: 48000 96000 192000
    bits [0xa]: 16 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x11 [Audio Output] wcaps 0xc1d: Stereo Amp-Out R/L
  Control: name="Headphone Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Control: name="Headphone Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x4a, nsteps=0x4a, stepsize=0x03, mute=1
  Amp-Out vals:  [0x3d 0x3d]
  Converter: stream=1, channel=0
  PCM:
    rates [0x540]: 48000 96000 192000
    bits [0xa]: 16 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x12 [Beep Generator Widget] wcaps 0x70000c: Mono Amp-Out
  Control: name="Beep Playback Volume", index=0, device=0
    ControlAmp: chs=1, dir=Out, idx=0, ofs=0
  Control: name="Beep Playback Switch", index=0, device=0
    ControlAmp: chs=1, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x07, nsteps=0x07, stepsize=0x0f, mute=0
  Amp-Out vals:  [0x03]
Node 0x13 [Audio Input] wcaps 0x100d1b: Stereo Amp-In R/L
  Control: name="Capture Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Control: name="Capture Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Device: name="CX20724 Analog", type="Audio", device=0
  Amp-In caps: ofs=0x4a, nsteps=0x50, stepsize=0x03, mute=1
  Amp-In vals:  [0x50 0x50] [0x50 0x50] [0x50 0x50] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80]
  Converter: stream=1, channel=0
  SDI-Select: 0
  PCM:
    rates [0x140]: 48000 96000
    bits [0xa]: 16 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 7
     0x18 0x19* 0x1a 0x15 0x1d 0x1e 0x1f
Node 0x14 [Audio Input] wcaps 0x100d1b: Stereo Amp-In R/L
  Amp-In caps: ofs=0x4a, nsteps=0x50, stepsize=0x03, mute=1
  Amp-In vals:  [0x4a 0x4a] [0x4a 0x4a] [0x4a 0x4a]
  Converter: stream=0, channel=0
  SDI-Select: 0
  PCM:
    rates [0x140]: 48000 96000
    bits [0xa]: 16 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 3
     0x1a* 0x15 0x1f
Node 0x15 [Vendor Defined Widget] wcaps 0xf0050b: Stereo Amp-In
  Amp-In caps: ofs=0x4a, nsteps=0x4a, stepsize=0x03, mute=1
  Amp-In vals:  [0x4a 0x4a] [0x4a 0x4a]
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 2
     0x10* 0x11
Node 0x16 [Pin Complex] wcaps 0x400581: Stereo
  Pincap 0x0001001c: OUT HP EAPD Detect
  EAPD 0x0:
  Pin Default 0x40f001f0: [N/A] Other at Ext N/A
    Conn = Unknown, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=02, enabled=1
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 2
     0x10* 0x11
Node 0x17 [Pin Complex] wcaps 0x400501: Stereo
  Pincap 0x00010010: OUT EAPD
  EAPD 0x0:
  Pin Default 0x91170110: [Fixed] Speaker at Int Rear
    Conn = Analog, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 2
     0x10* 0x11
Node 0x18 [Pin Complex] wcaps 0x40048b: Stereo Amp-In
  Control: name="Line Boost Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0
  Amp-In vals:  [0x00 0x00]
  Pincap 0x00001324: IN Detect
    Vref caps: HIZ 50 80
  Pin Default 0x40f001f0: [N/A] Other at Ext N/A
    Conn = Unknown, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x20: IN VREF_HIZ
  Unsolicited: tag=05, enabled=1
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x19 [Pin Complex] wcaps 0x40048b: Stereo Amp-In
  Control: name="Mic Boost Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0
  Amp-In vals:  [0x03 0x03]
  Pincap 0x00001324: IN Detect
    Vref caps: HIZ 50 80
  Pin Default 0x04a11030: [Jack] Mic at Ext Right
    Conn = 1/8, Color = Black
    DefAssociation = 0x3, Sequence = 0x0
  Pin-ctls: 0x24: IN VREF_80
  Unsolicited: tag=03, enabled=1
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x1a [Pin Complex] wcaps 0x40040b: Stereo Amp-In
  Control: name="Internal Mic Boost Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0
  Amp-In vals:  [0x00 0x00]
  Pincap 0x00000020: IN
  Pin Default 0x95a60120: [Fixed] Mic at Int Top
    Conn = Digital, Color = Unknown
    DefAssociation = 0x2, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x20: IN
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x1b [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x1c [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x1d [Pin Complex] wcaps 0x40058b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0
  Amp-In vals:  [0x00 0x00]
  Pincap 0x0001133c: IN OUT HP EAPD Detect
    Vref caps: HIZ 50 80
  EAPD 0x0:
  Pin Default 0x04211040: [Jack] HP Out at Ext Right
    Conn = 1/8, Color = Black
    DefAssociation = 0x4, Sequence = 0x0
  Pin-ctls: 0xc0: OUT HP VREF_HIZ
  Unsolicited: tag=01, enabled=1
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 2
     0x10 0x11*
Node 0x1e [Pin Complex] wcaps 0x40048b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0
  Amp-In vals:  [0x00 0x00]
  Pincap 0x00000024: IN Detect
  Pin Default 0x40f001f0: [N/A] Other at Ext N/A
    Conn = Unknown, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x1f [Pin Complex] wcaps 0x40040b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0
  Amp-In vals:  [0x00 0x00]
  Pincap 0x00000020: IN
  Pin Default 0x40f001f0: [N/A] Other at Ext N/A
    Conn = Unknown, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x00:
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x20 [Audio Output] wcaps 0x611: Stereo Digital
  Converter: stream=0, channel=0
  Digital:
  Digital category: 0x0
  IEC Coding Type: 0x0
  PCM:
    rates [0x540]: 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x5]: PCM AC3
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x21 [Pin Complex] wcaps 0x400701: Stereo Digital
  Pincap 0x00000010: OUT
  Pin Default 0x40f001f0: [N/A] Other at Ext N/A
    Conn = Unknown, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x00:
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x20
Node 0x22 [Pin Complex] wcaps 0x400501: Stereo
  Pincap 0x00010010: OUT EAPD
  EAPD 0x0:
  Pin Default 0x40f001f0: [N/A] Other at Ext N/A
    Conn = Unknown, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x00:
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 2
     0x10* 0x11

#3 lore raw
Quoted 6 lines · David Woodhouse
Quoted 4 lines

Maybe you can try to enable the GPIO unsolicited event and see whether any unsolicited event is generated.  Though, the datasheet says it's something else individual, but who knows.

Hm... forgive my ignorance; how do I do that?

If you have hda-verb program installed (included in alsa-tools), it can be enabled dynamically like

hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_UNSOLICITED_RSP_MASK, XXX

where XXX is the GPIO pin bit to enable the unsolicited event, 0x01, 0x02, 0x04, etc. You codec has 7 GPIO pins, so up to 0x40. Some of them might be already used for the existing purposes (or shared) like an amp control.

Then watch the tracing output after

    # echo 1 > /sys/kernel/debug/tracing/events/hda/enable

Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#4 lore raw
In reply to Takashi Iwai
Quoted 4 lines · Takashi Iwai

Maybe you can try to enable the GPIO unsolicited event and see whether any unsolicited event is generated.  Though, the datasheet says it's something else individual, but who knows.

/sys/class/sound/card0/hwC0D0# cat init_verbs
0x1e 0x708 0x0086
0x1b 0x708 0x0087
0x1c 0x708 0x0088

Kill pulseaudio and echo 1 > reconfig, and now I don't even have the jack insertion events... :)