* [RFC] hda - is_jack_detectable()
@ 2011-10-25 3:02 Raymond Yau
2011-10-25 3:31 ` Raymond Yau
0 siblings, 1 reply; 16+ messages in thread
From: Raymond Yau @ 2011-10-25 3:02 UTC (permalink / raw)
To: ALSA Development Mailing List, Takashi Iwai
Refer to HDA Specification
7.3.3.31 Configuration Default
Misc[3:0] is a bit field used to indicate other information about the
jack. Currently, only bit 0 is defined.
If bit 0 is set, it indicates that the jack has no presence detect
capability, so even if a Pin
Complex indicates that the codec hardware supports the presence detect
functionality on the jack, the external circuitry is not capable of
supporting the functionality. The bit definitions for the Miscfield
are in Table 106.
Do we need to change is_jack_detectable() when user setup BIOS to use
AC97 Front Audio Panel which set AC_DEFCFG_MISC_NO_PRESENCE bit ?
+#define get_defcfg_misc(cfg) \
+ ((cfg & AC_DEFCFG_MISC) >> AC_DEFCFG_MISC_SHIFT)
static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid)
{
return (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT) &&
+ (!(get_defcfg_misc(codec,nid) & AC_DEFCFG_MISC_NO_PRESENCE)) &&
(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP);
}
or add another fuction is_defcfg_misc_no_presence() to indicate jack
has no presence detect capability ?
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [RFC] hda - is_jack_detectable() 2011-10-25 3:02 [RFC] hda - is_jack_detectable() Raymond Yau @ 2011-10-25 3:31 ` Raymond Yau 2011-10-25 11:31 ` Takashi Iwai 2011-11-01 21:03 ` David Henningsson 0 siblings, 2 replies; 16+ messages in thread From: Raymond Yau @ 2011-10-25 3:31 UTC (permalink / raw) To: ALSA Development Mailing List, Takashi Iwai sorry, it should be static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) { return (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT) && + !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) & AC_DEFCFG_MISC_NO_PRESENCE)) && (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP); } ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC] hda - is_jack_detectable() 2011-10-25 3:31 ` Raymond Yau @ 2011-10-25 11:31 ` Takashi Iwai 2011-11-01 21:03 ` David Henningsson 1 sibling, 0 replies; 16+ messages in thread From: Takashi Iwai @ 2011-10-25 11:31 UTC (permalink / raw) To: Raymond Yau; +Cc: ALSA Development Mailing List At Tue, 25 Oct 2011 11:31:23 +0800, Raymond Yau wrote: > > sorry, it should be > > static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) > { > return (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT) && > + !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) > & AC_DEFCFG_MISC_NO_PRESENCE)) && > (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP); > } The idea sounds good, but we may need testing via hda-emu. Anyway, could you post a proper patch with your sign-off, etc? thanks, Takashi ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC] hda - is_jack_detectable() 2011-10-25 3:31 ` Raymond Yau 2011-10-25 11:31 ` Takashi Iwai @ 2011-11-01 21:03 ` David Henningsson 2011-11-02 7:02 ` Takashi Iwai 2011-11-06 11:46 ` Raymond Yau 1 sibling, 2 replies; 16+ messages in thread From: David Henningsson @ 2011-11-01 21:03 UTC (permalink / raw) To: Raymond Yau; +Cc: Takashi Iwai, ALSA Development Mailing List 2011-10-24 23:31, Raymond Yau skrev: > sorry, it should be > > static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) > { > return (snd_hda_query_pin_caps(codec, nid)& AC_PINCAP_PRES_DETECT)&& > + !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) > & AC_DEFCFG_MISC_NO_PRESENCE))&& > (get_wcaps(codec, nid)& AC_WCAP_UNSOL_CAP); > } > I also think it is a good idea, in fact I thought it was this way already. Can we merge this patch? // David ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC] hda - is_jack_detectable() 2011-11-01 21:03 ` David Henningsson @ 2011-11-02 7:02 ` Takashi Iwai 2011-11-05 5:30 ` Raymond Yau 2011-11-06 11:46 ` Raymond Yau 1 sibling, 1 reply; 16+ messages in thread From: Takashi Iwai @ 2011-11-02 7:02 UTC (permalink / raw) To: David Henningsson; +Cc: Raymond Yau, ALSA Development Mailing List At Tue, 01 Nov 2011 17:03:29 -0400, David Henningsson wrote: > > 2011-10-24 23:31, Raymond Yau skrev: > > sorry, it should be > > > > static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) > > { > > return (snd_hda_query_pin_caps(codec, nid)& AC_PINCAP_PRES_DETECT)&& > > + !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) > > & AC_DEFCFG_MISC_NO_PRESENCE))&& > > (get_wcaps(codec, nid)& AC_WCAP_UNSOL_CAP); > > } > > > I also think it is a good idea, in fact I thought it was this way > already. Can we merge this patch? OK, I checked through alsa-info series and confirmed that this causes no harm, so I merged it now. thanks, Takashi ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC] hda - is_jack_detectable() 2011-11-02 7:02 ` Takashi Iwai @ 2011-11-05 5:30 ` Raymond Yau 2011-11-06 13:12 ` Takashi Iwai 0 siblings, 1 reply; 16+ messages in thread From: Raymond Yau @ 2011-11-05 5:30 UTC (permalink / raw) To: Takashi Iwai, ALSA Development Mailing List [-- Attachment #1: Type: text/plain, Size: 1014 bytes --] 2011/11/2 Takashi Iwai <tiwai@suse.de>: > At Tue, 01 Nov 2011 17:03:29 -0400, > David Henningsson wrote: >> >> 2011-10-24 23:31, Raymond Yau skrev: >> > sorry, it should be >> > >> > static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) >> > { >> > return (snd_hda_query_pin_caps(codec, nid)& AC_PINCAP_PRES_DETECT)&& >> > + !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) >> > & AC_DEFCFG_MISC_NO_PRESENCE))&& >> > (get_wcaps(codec, nid)& AC_WCAP_UNSOL_CAP); >> > } >> > >> I also think it is a good idea, in fact I thought it was this way >> already. Can we merge this patch? > > OK, I checked through alsa-info series and confirmed that this causes > no harm, so I merged it now. > > > thanks, > > Takashi > > Sorry the previous patch is wrong attach the patch and test cases (pins 0x11 and 0x14) front panel green and pink jacks when set Front Audio Panel to AC97 or HD in BIOS setup [-- Attachment #2: ad1988a_fp_hd.txt --] [-- Type: text/plain, Size: 17987 bytes --] Codec: Analog Devices AD1988 Address: 0 AFG Function Id: 0x1 (unsol 0) Vendor Id: 0x11d41988 Subsystem Id: 0x104381e1 Revision Id: 0x100400 No Modem Function Group found Default PCM: rates [0x7ff]: 8000 11025 16000 22050 32000 44100 48000 88200 96000 176400 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Default Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Default Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=0 GPIO: io=2, o=0, i=0, unsolicited=1, wake=0 IO[0]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0 IO[1]: enable=0, dir=0, wake=0, sticky=0, data=1, unsol=0 Node 0x02 [Audio Output] wcaps 0x30311: Stereo Digital Control: name="IEC958 Playback Con Mask", index=0, device=0 Control: name="IEC958 Playback Pro Mask", index=0, device=0 Control: name="IEC958 Playback Default", index=0, device=0 Control: name="IEC958 Playback Switch", index=0, device=0 Control: name="IEC958 Default PCM Playback Switch", index=0, device=0 Control: name="IEC958 Playback Source", index=0, device=0 Device: name="AD198x Digital", type="SPDIF", device=1 Converter: stream=0, channel=0 Digital: Digital category: 0x0 PCM: rates [0x7e0]: 44100 48000 88200 96000 176400 192000 bits [0xe]: 16 20 24 formats [0x5]: PCM AC3 Delay: 3 samples Connection: 1 0x1d Node 0x03 [Audio Output] wcaps 0x405: Stereo Amp-Out Control: name="Headphone Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Device: name="AD198x Headphone", type="Audio", device=2 Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=0 Amp-Out vals: [0x27 0x27] Converter: stream=0, channel=0 Power states: D0 D3 Power: setting=D0, actual=D0 Node 0x04 [Audio Output] wcaps 0x405: Stereo Amp-Out Control: name="Front Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Device: name="AD198x Analog", type="Audio", device=0 Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=0 Amp-Out vals: [0x21 0x21] Converter: stream=0, channel=0 Power states: D0 D3 Power: setting=D0, actual=D0 Node 0x05 [Audio Output] wcaps 0x405: Stereo Amp-Out Control: name="Center Playback Volume", index=0, device=0 ControlAmp: chs=1, dir=Out, idx=0, ofs=0 Control: name="LFE Playback Volume", index=0, device=0 ControlAmp: chs=2, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=0 Amp-Out vals: [0x1b 0x1c] Converter: stream=0, channel=0 Power states: D0 D3 Power: setting=D0, actual=D0 Node 0x06 [Audio Output] wcaps 0x405: Stereo Amp-Out Control: name="Surround Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=0 Amp-Out vals: [0x1d 0x1d] Converter: stream=0, channel=0 Power states: D0 D3 Power: setting=D0, actual=D0 Node 0x07 [Audio Input] wcaps 0x130391: Stereo Digital Converter: stream=0, channel=0 SDI-Select: 0 Digital: Digital category: 0x0 PCM: rates [0x7e0]: 44100 48000 88200 96000 176400 192000 bits [0xe]: 16 20 24 formats [0x5]: PCM AC3 Unsolicited: tag=00, enabled=0 Delay: 3 samples Connection: 1 0x1c Node 0x08 [Audio Input] wcaps 0x100501: Stereo Device: name="AD198x Analog", type="Audio", device=0 Converter: stream=0, channel=0 SDI-Select: 0 Power states: D0 D3 Power: setting=D0, actual=D0 Connection: 1 0x0c Node 0x09 [Audio Input] wcaps 0x100501: Stereo Converter: stream=0, channel=0 SDI-Select: 0 Power states: D0 D3 Power: setting=D0, actual=D0 Connection: 1 0x0d Node 0x0a [Audio Output] wcaps 0x405: Stereo Amp-Out Control: name="Side Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=0 Amp-Out vals: [0x1e 0x1e] Converter: stream=0, channel=0 Power states: D0 D3 Power: setting=D0, actual=D0 Node 0x0b [Audio Selector] wcaps 0x300301: Stereo Digital Connection: 3 0x08* 0x09 0x0f Node 0x0c [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Control: name="Capture Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Capture Switch", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Input Source", index=0, device=0 Amp-Out caps: ofs=0x27, nsteps=0x36, stepsize=0x05, mute=1 Amp-Out vals: [0x25 0x25] Connection: 10 0x38 0x39* 0x3a 0x3b 0x3c 0x18 0x24 0x25 0x3d 0x20 Node 0x0d [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Control: name="Capture Volume", index=1, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Capture Switch", index=1, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Input Source", index=1, device=0 Amp-Out caps: ofs=0x27, nsteps=0x36, stepsize=0x05, mute=1 Amp-Out vals: [0xa7 0xa7] Connection: 10 0x38 0x39* 0x3a 0x3b 0x3c 0x18 0x24 0x25 0x3d 0x20 Node 0x0e [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Control: name="Capture Volume", index=2, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Capture Switch", index=2, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Input Source", index=2, device=0 Amp-Out caps: ofs=0x27, nsteps=0x36, stepsize=0x05, mute=1 Amp-Out vals: [0xa7 0xa7] Connection: 10 0x38 0x39 0x3a* 0x3b 0x3c 0x18 0x24 0x25 0x3d 0x20 Node 0x0f [Audio Input] wcaps 0x100501: Stereo Converter: stream=0, channel=0 SDI-Select: 0 Power states: D0 D3 Power: setting=D0, actual=D0 Connection: 1 0x0e Node 0x10 [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=0x0f, nsteps=0x0f, stepsize=0x0b, mute=1 Amp-Out vals: [0x00] Node 0x11 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x0000373f: IN OUT HP Detect Trigger ImpSense Vref caps: HIZ 50 GRD 80 100 Pin Default 0x02214030: [Jack] HP Out at Ext Front Conn = 1/8, Color = Green DefAssociation = 0x3, Sequence = 0x0 Pin-ctls: 0xc0: OUT HP VREF_HIZ Unsolicited: tag=11, enabled=1 Connection: 1 0x22 Node 0x12 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x0000373f: IN OUT HP Detect Trigger ImpSense Vref caps: HIZ 50 GRD 80 100 Pin Default 0x01014010: [Jack] Line Out at Ext Rear Conn = 1/8, Color = Green DefAssociation = 0x1, Sequence = 0x0 Pin-ctls: 0x40: OUT VREF_HIZ Unsolicited: tag=12, enabled=1 Connection: 1 0x29 Node 0x13 [Pin Complex] wcaps 0x40010c: Mono Amp-Out Amp-Out caps: ofs=0x1f, nsteps=0x1f, stepsize=0x05, mute=1 Amp-Out vals: [0x00] Pincap 0x00000010: OUT Pin Default 0x511711f0: [N/A] Speaker at Int Rear Conn = Analog, Color = Black DefAssociation = 0xf, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x40: OUT Connection: 1 0x2d Node 0x14 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x0000373f: IN OUT HP Detect Trigger ImpSense Vref caps: HIZ 50 GRD 80 100 Pin Default 0x02a19022: [Jack] Mic at Ext Front Conn = 1/8, Color = Pink DefAssociation = 0x2, Sequence = 0x2 Pin-ctls: 0x24: IN VREF_80 Unsolicited: tag=14, enabled=1 Connection: 1 0x2b Node 0x15 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x00003737: IN OUT Detect Trigger ImpSense Vref caps: HIZ 50 GRD 80 100 Pin Default 0x01813021: [Jack] Line In at Ext Rear Conn = 1/8, Color = Blue DefAssociation = 0x2, Sequence = 0x1 Pin-ctls: 0x20: IN VREF_HIZ Unsolicited: tag=15, enabled=1 Connection: 1 0x2c Node 0x16 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x00003737: IN OUT Detect Trigger ImpSense Vref caps: HIZ 50 GRD 80 100 Pin Default 0x01011012: [Jack] Line Out at Ext Rear Conn = 1/8, Color = Black DefAssociation = 0x1, Sequence = 0x2 Pin-ctls: 0x40: OUT VREF_HIZ Unsolicited: tag=16, enabled=1 Connection: 1 0x2a Node 0x17 [Pin Complex] wcaps 0x40098d: Stereo Amp-Out R/L Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x00003737: IN OUT Detect Trigger ImpSense Vref caps: HIZ 50 GRD 80 100 Pin Default 0x01a19020: [Jack] Mic at Ext Rear Conn = 1/8, Color = Pink DefAssociation = 0x2, Sequence = 0x0 Pin-ctls: 0x24: IN VREF_80 Unsolicited: tag=17, enabled=1 Connection: 1 0x26 Node 0x18 [Pin Complex] wcaps 0x400001: Stereo Pincap 0x00000020: IN Pin Default 0x9933112e: [Fixed] CD at Int ATAPI Conn = ATAPI, Color = Black DefAssociation = 0x2, Sequence = 0xe Misc = NO_PRESENCE Pin-ctls: 0x20: IN Node 0x19 [Power Widget] wcaps 0x500500: Mono Power states: D0 D3 Power: setting=D0, actual=D0 Connection: 2 0x20 0x21 Node 0x1a [Pin Complex] wcaps 0x400000: Mono Pincap 0x00000020: IN Pin Default 0x99f301f0: [Fixed] Other at Int ATAPI Conn = ATAPI, Color = Unknown DefAssociation = 0xf, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x20: IN Node 0x1b [Pin Complex] wcaps 0x40030d: Stereo Digital Amp-Out Control: name="IEC958 Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="IEC958 Playback Source", index=0, device=0 Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x00000010: OUT Pin Default 0x0145f1f0: [Jack] SPDIF Out at Ext Rear Conn = Optical, Color = Other DefAssociation = 0xf, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x40: OUT Connection: 1 0x02 Node 0x1c [Pin Complex] wcaps 0x40020b: Stereo Digital Amp-In Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1 Amp-In vals: [0x97 0x97] Pincap 0x00000020: IN Pin Default 0x41c5f1f0: [N/A] SPDIF In at Ext Rear Conn = Optical, Color = Other DefAssociation = 0xf, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x20: IN Node 0x1d [Audio Mixer] wcaps 0x200303: Stereo Digital Amp-In Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x80 0x80] Connection: 2 0x01 0x0b Node 0x1e [Audio Mixer] wcaps 0x200103: Stereo Amp-In Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x80 0x80] [0x80 0x80] Connection: 2 0x36 0x21 Node 0x1f [Volume Knob Widget] wcaps 0x600080: Mono Volume-Knob: delta=1, steps=63, direct=0, val=0 Unsolicited: tag=00, enabled=0 Connection: 0 Node 0x20 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In Control: name="Front Mic Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=In, idx=0, ofs=0 Control: name="Front Mic Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=0, ofs=0 Control: name="Rear Mic Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=In, idx=4, ofs=0 Control: name="Rear Mic Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=4, ofs=0 Control: name="Line Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=In, idx=1, ofs=0 Control: name="Line Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=1, ofs=0 Control: name="CD Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=In, idx=6, ofs=0 Control: name="CD Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=6, ofs=0 Control: name="Analog Beep Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=In, idx=2, ofs=0 Control: name="Analog Beep Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=2, ofs=0 Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1 Amp-In vals: [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] Connection: 8 0x39 0x33 0x38 0x3d 0x34 0x3b 0x18 0x1a Node 0x21 [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Control: name="Analog Mix Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Analog Mix Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x1f, nsteps=0x1f, stepsize=0x05, mute=1 Amp-Out vals: [0x80 0x80] Connection: 1 0x20 Node 0x22 [Audio Mixer] wcaps 0x200103: Stereo Amp-In Control: name="Headphone Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=2, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Connection: 2 0x37 0x21 Node 0x23 [Vendor Defined Widget] wcaps 0xf00100: Mono Connection: 18 0x11* 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x24 0x25 0x38 0x39 0x3a 0x3b 0x3c 0x3d 0x20 0x21 Node 0x24 [Pin Complex] wcaps 0x40098d: Stereo Amp-Out R/L Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x00000037: IN OUT Detect Trigger ImpSense Pin Default 0x01016011: [Jack] Line Out at Ext Rear Conn = 1/8, Color = Orange DefAssociation = 0x1, Sequence = 0x1 Pin-ctls: 0x40: OUT Unsolicited: tag=24, enabled=1 Connection: 1 0x27 Node 0x25 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x00000037: IN OUT Detect Trigger ImpSense Pin Default 0x01012013: [Jack] Line Out at Ext Rear Conn = 1/8, Color = Grey DefAssociation = 0x1, Sequence = 0x3 Pin-ctls: 0x40: OUT Unsolicited: tag=25, enabled=1 Connection: 1 0x28 Node 0x26 [Audio Mixer] wcaps 0x200103: Stereo Amp-In Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x80 0x80] [0x80 0x80] Connection: 2 0x32 0x21 Node 0x27 [Audio Mixer] wcaps 0x200103: Stereo Amp-In Control: name="Center Playback Switch", index=0, device=0 ControlAmp: chs=1, dir=In, idx=2, ofs=0 Control: name="LFE Playback Switch", index=0, device=0 ControlAmp: chs=2, dir=In, idx=2, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Connection: 2 0x05 0x21 Node 0x28 [Audio Mixer] wcaps 0x200103: Stereo Amp-In Control: name="Side Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=2, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Connection: 2 0x0a 0x21 Node 0x29 [Audio Mixer] wcaps 0x200103: Stereo Amp-In Control: name="Front Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=2, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Connection: 2 0x04 0x21 Node 0x2a [Audio Mixer] wcaps 0x200103: Stereo Amp-In Control: name="Surround Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=2, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Connection: 2 0x06 0x21 Node 0x2b [Audio Mixer] wcaps 0x200103: Stereo Amp-In Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x80 0x80] [0x80 0x80] Connection: 2 0x30 0x21 Node 0x2c [Audio Mixer] wcaps 0x200103: Stereo Amp-In Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x80 0x80] [0x80 0x80] Connection: 2 0x31 0x21 Node 0x2d [Audio Mixer] wcaps 0x200100: Mono Connection: 1 0x1e Node 0x2e [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x2f [Vendor Defined Widget] wcaps 0xf00100: Mono Connection: 6 0x11* 0x12 0x14 0x15 0x16 0x17 Node 0x30 [Audio Selector] wcaps 0x300101: Stereo Connection: 3 0x03* 0x04 0x06 Node 0x31 [Audio Selector] wcaps 0x300101: Stereo Connection: 2 0x04* 0x0a Node 0x32 [Audio Selector] wcaps 0x300101: Stereo Connection: 2 0x05* 0x04 Node 0x33 [Audio Selector] wcaps 0x300101: Stereo Connection: 3 0x3a* 0x25 0x24 Node 0x34 [Audio Selector] wcaps 0x300101: Stereo Connection: 3 0x3c* 0x25 0x24 Node 0x35 [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x36 [Audio Selector] wcaps 0x300101: Stereo Connection: 3 0x03 0x04* 0x06 Node 0x37 [Audio Selector] wcaps 0x300101: Stereo Connection: 3 0x03* 0x04 0x06 Node 0x38 [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-Out vals: [0x00 0x00] Connection: 1 0x11 Node 0x39 [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Control: name="Front Mic Boost Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=1, ofs=0 Amp-Out caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-Out vals: [0x00 0x00] Connection: 1 0x14 Node 0x3a [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-Out vals: [0x00 0x00] Connection: 1 0x15 Node 0x3b [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-Out vals: [0x00 0x00] Connection: 1 0x16 Node 0x3c [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Control: name="Rear Mic Boost Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=4, ofs=0 Amp-Out caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-Out vals: [0x00 0x00] Connection: 1 0x17 Node 0x3d [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-Out vals: [0x00 0x00] Connection: 1 0x12 [-- Attachment #3: 0001-HDA-fix-is_jack_detectable.patch --] [-- Type: application/octet-stream, Size: 1036 bytes --] From fdfefb82c8edc43c964682a3277346a5dc049ada Mon Sep 17 00:00:00 2001 From: Raymond Yau <superquad.vortex2@gmail.com> Date: Sat, 5 Nov 2011 13:04:04 +0800 Subject: [PATCH] ALSA - HDA - fix is_jack_detectable - Fix is_jack_detectable which use Misc bit 0 to indicated that jack has no presence detect capability. Signed-off-by: Raymond Yau <superquad.vortex2@gmail.com> diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 79f49e2..d8617b7 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -511,8 +511,8 @@ int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid); static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) { return (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT) && - !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) & - AC_DEFCFG_MISC_NO_PRESENCE)) && + !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & + AC_DEFCFG_MISC_NO_PRESENCE) && (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP); } -- 1.6.0.6 [-- Attachment #4: ad1988a_fp_ac97.txt --] [-- Type: text/plain, Size: 18033 bytes --] Codec: Analog Devices AD1988 Address: 0 AFG Function Id: 0x1 (unsol 0) Vendor Id: 0x11d41988 Subsystem Id: 0x104381e1 Revision Id: 0x100400 No Modem Function Group found Default PCM: rates [0x7ff]: 8000 11025 16000 22050 32000 44100 48000 88200 96000 176400 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Default Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Default Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=0 GPIO: io=2, o=0, i=0, unsolicited=1, wake=0 IO[0]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0 IO[1]: enable=0, dir=0, wake=0, sticky=0, data=1, unsol=0 Node 0x02 [Audio Output] wcaps 0x30311: Stereo Digital Control: name="IEC958 Playback Con Mask", index=0, device=0 Control: name="IEC958 Playback Pro Mask", index=0, device=0 Control: name="IEC958 Playback Default", index=0, device=0 Control: name="IEC958 Playback Switch", index=0, device=0 Control: name="IEC958 Default PCM Playback Switch", index=0, device=0 Control: name="IEC958 Playback Source", index=0, device=0 Device: name="AD198x Digital", type="SPDIF", device=1 Converter: stream=0, channel=0 Digital: Digital category: 0x0 PCM: rates [0x7e0]: 44100 48000 88200 96000 176400 192000 bits [0xe]: 16 20 24 formats [0x5]: PCM AC3 Delay: 3 samples Connection: 1 0x1d Node 0x03 [Audio Output] wcaps 0x405: Stereo Amp-Out Control: name="Headphone Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Device: name="AD198x Headphone", type="Audio", device=2 Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=0 Amp-Out vals: [0x27 0x27] Converter: stream=0, channel=0 Power states: D0 D3 Power: setting=D0, actual=D0 Node 0x04 [Audio Output] wcaps 0x405: Stereo Amp-Out Control: name="Front Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Device: name="AD198x Analog", type="Audio", device=0 Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=0 Amp-Out vals: [0x21 0x21] Converter: stream=0, channel=0 Power states: D0 D3 Power: setting=D0, actual=D0 Node 0x05 [Audio Output] wcaps 0x405: Stereo Amp-Out Control: name="Center Playback Volume", index=0, device=0 ControlAmp: chs=1, dir=Out, idx=0, ofs=0 Control: name="LFE Playback Volume", index=0, device=0 ControlAmp: chs=2, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=0 Amp-Out vals: [0x1b 0x1c] Converter: stream=0, channel=0 Power states: D0 D3 Power: setting=D0, actual=D0 Node 0x06 [Audio Output] wcaps 0x405: Stereo Amp-Out Control: name="Surround Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=0 Amp-Out vals: [0x1d 0x1d] Converter: stream=0, channel=0 Power states: D0 D3 Power: setting=D0, actual=D0 Node 0x07 [Audio Input] wcaps 0x130391: Stereo Digital Converter: stream=0, channel=0 SDI-Select: 0 Digital: Digital category: 0x0 PCM: rates [0x7e0]: 44100 48000 88200 96000 176400 192000 bits [0xe]: 16 20 24 formats [0x5]: PCM AC3 Unsolicited: tag=00, enabled=0 Delay: 3 samples Connection: 1 0x1c Node 0x08 [Audio Input] wcaps 0x100501: Stereo Device: name="AD198x Analog", type="Audio", device=0 Converter: stream=0, channel=0 SDI-Select: 0 Power states: D0 D3 Power: setting=D0, actual=D0 Connection: 1 0x0c Node 0x09 [Audio Input] wcaps 0x100501: Stereo Converter: stream=0, channel=0 SDI-Select: 0 Power states: D0 D3 Power: setting=D0, actual=D0 Connection: 1 0x0d Node 0x0a [Audio Output] wcaps 0x405: Stereo Amp-Out Control: name="Side Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=0 Amp-Out vals: [0x1e 0x1e] Converter: stream=0, channel=0 Power states: D0 D3 Power: setting=D0, actual=D0 Node 0x0b [Audio Selector] wcaps 0x300301: Stereo Digital Connection: 3 0x08* 0x09 0x0f Node 0x0c [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Control: name="Capture Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Capture Switch", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Input Source", index=0, device=0 Amp-Out caps: ofs=0x27, nsteps=0x36, stepsize=0x05, mute=1 Amp-Out vals: [0x25 0x25] Connection: 10 0x38 0x39* 0x3a 0x3b 0x3c 0x18 0x24 0x25 0x3d 0x20 Node 0x0d [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Control: name="Capture Volume", index=1, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Capture Switch", index=1, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Input Source", index=1, device=0 Amp-Out caps: ofs=0x27, nsteps=0x36, stepsize=0x05, mute=1 Amp-Out vals: [0xa7 0xa7] Connection: 10 0x38 0x39* 0x3a 0x3b 0x3c 0x18 0x24 0x25 0x3d 0x20 Node 0x0e [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Control: name="Capture Volume", index=2, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Capture Switch", index=2, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Input Source", index=2, device=0 Amp-Out caps: ofs=0x27, nsteps=0x36, stepsize=0x05, mute=1 Amp-Out vals: [0xa7 0xa7] Connection: 10 0x38 0x39 0x3a* 0x3b 0x3c 0x18 0x24 0x25 0x3d 0x20 Node 0x0f [Audio Input] wcaps 0x100501: Stereo Converter: stream=0, channel=0 SDI-Select: 0 Power states: D0 D3 Power: setting=D0, actual=D0 Connection: 1 0x0e Node 0x10 [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=0x0f, nsteps=0x0f, stepsize=0x0b, mute=1 Amp-Out vals: [0x00] Node 0x11 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x0000373f: IN OUT HP Detect Trigger ImpSense Vref caps: HIZ 50 GRD 80 100 Pin Default 0x02214130: [Jack] HP Out at Ext Front Conn = 1/8, Color = Green DefAssociation = 0x3, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0xc0: OUT HP VREF_HIZ Unsolicited: tag=00, enabled=0 Connection: 1 0x22 Node 0x12 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x0000373f: IN OUT HP Detect Trigger ImpSense Vref caps: HIZ 50 GRD 80 100 Pin Default 0x01014010: [Jack] Line Out at Ext Rear Conn = 1/8, Color = Green DefAssociation = 0x1, Sequence = 0x0 Pin-ctls: 0x40: OUT VREF_HIZ Unsolicited: tag=12, enabled=1 Connection: 1 0x29 Node 0x13 [Pin Complex] wcaps 0x40010c: Mono Amp-Out Amp-Out caps: ofs=0x1f, nsteps=0x1f, stepsize=0x05, mute=1 Amp-Out vals: [0x00] Pincap 0x00000010: OUT Pin Default 0x511711f0: [N/A] Speaker at Int Rear Conn = Analog, Color = Black DefAssociation = 0xf, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x40: OUT Connection: 1 0x2d Node 0x14 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x0000373f: IN OUT HP Detect Trigger ImpSense Vref caps: HIZ 50 GRD 80 100 Pin Default 0x02a19122: [Jack] Mic at Ext Front Conn = 1/8, Color = Pink DefAssociation = 0x2, Sequence = 0x2 Misc = NO_PRESENCE Pin-ctls: 0x24: IN VREF_80 Unsolicited: tag=00, enabled=0 Connection: 1 0x2b Node 0x15 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x00003737: IN OUT Detect Trigger ImpSense Vref caps: HIZ 50 GRD 80 100 Pin Default 0x01813021: [Jack] Line In at Ext Rear Conn = 1/8, Color = Blue DefAssociation = 0x2, Sequence = 0x1 Pin-ctls: 0x20: IN VREF_HIZ Unsolicited: tag=15, enabled=1 Connection: 1 0x2c Node 0x16 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x00003737: IN OUT Detect Trigger ImpSense Vref caps: HIZ 50 GRD 80 100 Pin Default 0x01011012: [Jack] Line Out at Ext Rear Conn = 1/8, Color = Black DefAssociation = 0x1, Sequence = 0x2 Pin-ctls: 0x40: OUT VREF_HIZ Unsolicited: tag=16, enabled=1 Connection: 1 0x2a Node 0x17 [Pin Complex] wcaps 0x40098d: Stereo Amp-Out R/L Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x00003737: IN OUT Detect Trigger ImpSense Vref caps: HIZ 50 GRD 80 100 Pin Default 0x01a19020: [Jack] Mic at Ext Rear Conn = 1/8, Color = Pink DefAssociation = 0x2, Sequence = 0x0 Pin-ctls: 0x24: IN VREF_80 Unsolicited: tag=17, enabled=1 Connection: 1 0x26 Node 0x18 [Pin Complex] wcaps 0x400001: Stereo Pincap 0x00000020: IN Pin Default 0x9933112e: [Fixed] CD at Int ATAPI Conn = ATAPI, Color = Black DefAssociation = 0x2, Sequence = 0xe Misc = NO_PRESENCE Pin-ctls: 0x20: IN Node 0x19 [Power Widget] wcaps 0x500500: Mono Power states: D0 D3 Power: setting=D0, actual=D0 Connection: 2 0x20 0x21 Node 0x1a [Pin Complex] wcaps 0x400000: Mono Pincap 0x00000020: IN Pin Default 0x99f301f0: [Fixed] Other at Int ATAPI Conn = ATAPI, Color = Unknown DefAssociation = 0xf, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x20: IN Node 0x1b [Pin Complex] wcaps 0x40030d: Stereo Digital Amp-Out Control: name="IEC958 Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="IEC958 Playback Source", index=0, device=0 Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x00000010: OUT Pin Default 0x0145f1f0: [Jack] SPDIF Out at Ext Rear Conn = Optical, Color = Other DefAssociation = 0xf, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x40: OUT Connection: 1 0x02 Node 0x1c [Pin Complex] wcaps 0x40020b: Stereo Digital Amp-In Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1 Amp-In vals: [0x97 0x97] Pincap 0x00000020: IN Pin Default 0x41c5f1f0: [N/A] SPDIF In at Ext Rear Conn = Optical, Color = Other DefAssociation = 0xf, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x20: IN Node 0x1d [Audio Mixer] wcaps 0x200303: Stereo Digital Amp-In Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x80 0x80] Connection: 2 0x01 0x0b Node 0x1e [Audio Mixer] wcaps 0x200103: Stereo Amp-In Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x80 0x80] [0x80 0x80] Connection: 2 0x36 0x21 Node 0x1f [Volume Knob Widget] wcaps 0x600080: Mono Volume-Knob: delta=1, steps=63, direct=0, val=0 Unsolicited: tag=00, enabled=0 Connection: 0 Node 0x20 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In Control: name="Front Mic Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=In, idx=0, ofs=0 Control: name="Front Mic Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=0, ofs=0 Control: name="Rear Mic Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=In, idx=4, ofs=0 Control: name="Rear Mic Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=4, ofs=0 Control: name="Line Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=In, idx=1, ofs=0 Control: name="Line Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=1, ofs=0 Control: name="CD Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=In, idx=6, ofs=0 Control: name="CD Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=6, ofs=0 Control: name="Analog Beep Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=In, idx=2, ofs=0 Control: name="Analog Beep Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=2, ofs=0 Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1 Amp-In vals: [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] Connection: 8 0x39 0x33 0x38 0x3d 0x34 0x3b 0x18 0x1a Node 0x21 [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Control: name="Analog Mix Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Analog Mix Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x1f, nsteps=0x1f, stepsize=0x05, mute=1 Amp-Out vals: [0x80 0x80] Connection: 1 0x20 Node 0x22 [Audio Mixer] wcaps 0x200103: Stereo Amp-In Control: name="Headphone Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=2, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Connection: 2 0x37 0x21 Node 0x23 [Vendor Defined Widget] wcaps 0xf00100: Mono Connection: 18 0x11* 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x24 0x25 0x38 0x39 0x3a 0x3b 0x3c 0x3d 0x20 0x21 Node 0x24 [Pin Complex] wcaps 0x40098d: Stereo Amp-Out R/L Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x00000037: IN OUT Detect Trigger ImpSense Pin Default 0x01016011: [Jack] Line Out at Ext Rear Conn = 1/8, Color = Orange DefAssociation = 0x1, Sequence = 0x1 Pin-ctls: 0x40: OUT Unsolicited: tag=24, enabled=1 Connection: 1 0x27 Node 0x25 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x00000037: IN OUT Detect Trigger ImpSense Pin Default 0x01012013: [Jack] Line Out at Ext Rear Conn = 1/8, Color = Grey DefAssociation = 0x1, Sequence = 0x3 Pin-ctls: 0x40: OUT Unsolicited: tag=25, enabled=1 Connection: 1 0x28 Node 0x26 [Audio Mixer] wcaps 0x200103: Stereo Amp-In Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x80 0x80] [0x80 0x80] Connection: 2 0x32 0x21 Node 0x27 [Audio Mixer] wcaps 0x200103: Stereo Amp-In Control: name="Center Playback Switch", index=0, device=0 ControlAmp: chs=1, dir=In, idx=2, ofs=0 Control: name="LFE Playback Switch", index=0, device=0 ControlAmp: chs=2, dir=In, idx=2, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Connection: 2 0x05 0x21 Node 0x28 [Audio Mixer] wcaps 0x200103: Stereo Amp-In Control: name="Side Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=2, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Connection: 2 0x0a 0x21 Node 0x29 [Audio Mixer] wcaps 0x200103: Stereo Amp-In Control: name="Front Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=2, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Connection: 2 0x04 0x21 Node 0x2a [Audio Mixer] wcaps 0x200103: Stereo Amp-In Control: name="Surround Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=2, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Connection: 2 0x06 0x21 Node 0x2b [Audio Mixer] wcaps 0x200103: Stereo Amp-In Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x80 0x80] [0x80 0x80] Connection: 2 0x30 0x21 Node 0x2c [Audio Mixer] wcaps 0x200103: Stereo Amp-In Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x80 0x80] [0x80 0x80] Connection: 2 0x31 0x21 Node 0x2d [Audio Mixer] wcaps 0x200100: Mono Connection: 1 0x1e Node 0x2e [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x2f [Vendor Defined Widget] wcaps 0xf00100: Mono Connection: 6 0x11* 0x12 0x14 0x15 0x16 0x17 Node 0x30 [Audio Selector] wcaps 0x300101: Stereo Connection: 3 0x03* 0x04 0x06 Node 0x31 [Audio Selector] wcaps 0x300101: Stereo Connection: 2 0x04* 0x0a Node 0x32 [Audio Selector] wcaps 0x300101: Stereo Connection: 2 0x05* 0x04 Node 0x33 [Audio Selector] wcaps 0x300101: Stereo Connection: 3 0x3a* 0x25 0x24 Node 0x34 [Audio Selector] wcaps 0x300101: Stereo Connection: 3 0x3c* 0x25 0x24 Node 0x35 [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x36 [Audio Selector] wcaps 0x300101: Stereo Connection: 3 0x03 0x04* 0x06 Node 0x37 [Audio Selector] wcaps 0x300101: Stereo Connection: 3 0x03* 0x04 0x06 Node 0x38 [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-Out vals: [0x00 0x00] Connection: 1 0x11 Node 0x39 [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Control: name="Front Mic Boost Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=1, ofs=0 Amp-Out caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-Out vals: [0x00 0x00] Connection: 1 0x14 Node 0x3a [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-Out vals: [0x00 0x00] Connection: 1 0x15 Node 0x3b [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-Out vals: [0x00 0x00] Connection: 1 0x16 Node 0x3c [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Control: name="Rear Mic Boost Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=4, ofs=0 Amp-Out caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-Out vals: [0x00 0x00] Connection: 1 0x17 Node 0x3d [Audio Selector] wcaps 0x30010d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-Out vals: [0x00 0x00] Connection: 1 0x12 [-- Attachment #5: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [RFC] hda - is_jack_detectable() 2011-11-05 5:30 ` Raymond Yau @ 2011-11-06 13:12 ` Takashi Iwai 2011-11-09 4:06 ` Raymond Yau 0 siblings, 1 reply; 16+ messages in thread From: Takashi Iwai @ 2011-11-06 13:12 UTC (permalink / raw) To: Raymond Yau; +Cc: ALSA Development Mailing List At Sat, 5 Nov 2011 13:30:21 +0800, Raymond Yau wrote: > > 2011/11/2 Takashi Iwai <tiwai@suse.de>: > > At Tue, 01 Nov 2011 17:03:29 -0400, > > David Henningsson wrote: > >> > >> 2011-10-24 23:31, Raymond Yau skrev: > >> > sorry, it should be > >> > > >> > static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) > >> > { > >> > return (snd_hda_query_pin_caps(codec, nid)& AC_PINCAP_PRES_DETECT)&& > >> > + !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) > >> > & AC_DEFCFG_MISC_NO_PRESENCE))&& > >> > (get_wcaps(codec, nid)& AC_WCAP_UNSOL_CAP); > >> > } > >> > > >> I also think it is a good idea, in fact I thought it was this way > >> already. Can we merge this patch? > > > > OK, I checked through alsa-info series and confirmed that this causes > > no harm, so I merged it now. > > > > > > thanks, > > > > Takashi > > > > > > Sorry the previous patch is wrong Ugh, so actually changing it would may bring too many changes, and most likely regressions, too. I disabled the code for now for 3.2-rc1. Once when we cover all test cases and fix broken BIOS devices enough, we can re-enable it in near future. > attach the patch and test cases (pins 0x11 and 0x14) front panel > green and pink jacks when set Front Audio Panel to AC97 or HD in BIOS > setup OK, thanks, we can refer to this for more tests. Takashi _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC] hda - is_jack_detectable() 2011-11-06 13:12 ` Takashi Iwai @ 2011-11-09 4:06 ` Raymond Yau 2011-11-09 7:08 ` Takashi Iwai 0 siblings, 1 reply; 16+ messages in thread From: Raymond Yau @ 2011-11-09 4:06 UTC (permalink / raw) To: Takashi Iwai, ALSA Development Mailing List 2011/11/6 Takashi Iwai <tiwai@suse.de>: > At Sat, 5 Nov 2011 13:30:21 +0800, > Raymond Yau wrote: >> >> 2011/11/2 Takashi Iwai <tiwai@suse.de>: >> > At Tue, 01 Nov 2011 17:03:29 -0400, >> > David Henningsson wrote: >> >> >> >> 2011-10-24 23:31, Raymond Yau skrev: >> >> > sorry, it should be >> >> > >> >> > static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) >> >> > { >> >> > return (snd_hda_query_pin_caps(codec, nid)& AC_PINCAP_PRES_DETECT)&& >> >> > + !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) >> >> > & AC_DEFCFG_MISC_NO_PRESENCE))&& >> >> > (get_wcaps(codec, nid)& AC_WCAP_UNSOL_CAP); >> >> > } >> >> > >> >> I also think it is a good idea, in fact I thought it was this way >> >> already. Can we merge this patch? >> > >> > OK, I checked through alsa-info series and confirmed that this causes >> > no harm, so I merged it now. >> > >> > >> > thanks, >> > >> > Takashi >> > >> > >> >> Sorry the previous patch is wrong > > Ugh, so actually changing it would may bring too many changes, and > most likely regressions, too. I disabled the code for now for 3.2-rc1. > Once when we cover all test cases and fix broken BIOS devices enough, > we can re-enable it in near future. > >> attach the patch and test cases (pins 0x11 and 0x14) front panel >> green and pink jacks when set Front Audio Panel to AC97 or HD in BIOS >> setup > > OK, thanks, we can refer to this for more tests. > > > Takashi > If bit 0 is set, it indicates that the jack has no presence detect capability The Configuration Default register is defined as shown in Figure 66. 31:30 29:24 23:20 19:16 15:12 11:8 7:4 3:0 Port Location Default Connection Color Misc Default Sequence Connectivity Device Type Association Figure 66. Configuration Data Structure This mean that bit 0 of Misc is bit 8 of the Configuration Default register !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & AC_DEFCFG_MISC_NO_PRESENCE)&& Node 0x18 [Pin Complex] wcaps 0x400001: Stereo Pincap 0x00000020: IN Pin Default 0x9933112e: [Fixed] CD at Int ATAPI Conn = ATAPI, Color = Black DefAssociation = 0x2, Sequence = 0xe Misc = NO_PRESENCE Pin-ctls: 0x20: IN Node 0x1a [Pin Complex] wcaps 0x400000: Mono Pincap 0x00000020: IN Pin Default 0x99f301f0: [Fixed] Other at Int ATAPI Conn = ATAPI, Color = Unknown DefAssociation = 0xf, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x20: IN Node 0x1b [Pin Complex] wcaps 0x40030d: Stereo Digital Amp-Out Control: name="IEC958 Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="IEC958 Playback Source", index=0, device=0 Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x00000010: OUT Pin Default 0x0145f1f0: [Jack] SPDIF Out at Ext Rear Conn = Optical, Color = Other DefAssociation = 0xf, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x40: OUT Connection: 1 0x02 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC] hda - is_jack_detectable() 2011-11-09 4:06 ` Raymond Yau @ 2011-11-09 7:08 ` Takashi Iwai 2011-11-09 7:50 ` Takashi Iwai 0 siblings, 1 reply; 16+ messages in thread From: Takashi Iwai @ 2011-11-09 7:08 UTC (permalink / raw) To: Raymond Yau; +Cc: ALSA Development Mailing List At Wed, 9 Nov 2011 12:06:04 +0800, Raymond Yau wrote: > > 2011/11/6 Takashi Iwai <tiwai@suse.de>: > > At Sat, 5 Nov 2011 13:30:21 +0800, > > Raymond Yau wrote: > >> > >> 2011/11/2 Takashi Iwai <tiwai@suse.de>: > >> > At Tue, 01 Nov 2011 17:03:29 -0400, > >> > David Henningsson wrote: > >> >> > >> >> 2011-10-24 23:31, Raymond Yau skrev: > >> >> > sorry, it should be > >> >> > > >> >> > static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) > >> >> > { > >> >> > return (snd_hda_query_pin_caps(codec, nid)& AC_PINCAP_PRES_DETECT)&& > >> >> > + !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) > >> >> > & AC_DEFCFG_MISC_NO_PRESENCE))&& > >> >> > (get_wcaps(codec, nid)& AC_WCAP_UNSOL_CAP); > >> >> > } > >> >> > > >> >> I also think it is a good idea, in fact I thought it was this way > >> >> already. Can we merge this patch? > >> > > >> > OK, I checked through alsa-info series and confirmed that this causes > >> > no harm, so I merged it now. > >> > > >> > > >> > thanks, > >> > > >> > Takashi > >> > > >> > > >> > >> Sorry the previous patch is wrong > > > > Ugh, so actually changing it would may bring too many changes, and > > most likely regressions, too. I disabled the code for now for 3.2-rc1. > > Once when we cover all test cases and fix broken BIOS devices enough, > > we can re-enable it in near future. > > > >> attach the patch and test cases (pins 0x11 and 0x14) front panel > >> green and pink jacks when set Front Audio Panel to AC97 or HD in BIOS > >> setup > > > > OK, thanks, we can refer to this for more tests. > > > > > > Takashi > > > > If bit 0 is set, it indicates that the jack has no presence detect capability > > > The Configuration Default register is defined as shown in Figure 66. > 31:30 29:24 23:20 19:16 15:12 11:8 > 7:4 3:0 > Port Location Default Connection Color Misc > Default Sequence > Connectivity Device Type Association > Figure 66. Configuration Data Structure > > > This mean that bit 0 of Misc is bit 8 of the Configuration Default register > > > !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) > & AC_DEFCFG_MISC_NO_PRESENCE)&& > Yeah, I already tried it and it still gives too many false-positives. Many ASUS laptops (also mobo) set this bit to all pins no matter whether it's an obviously detectable jack or not. Some Toshiba laptops do so, too. That being said, checking this bit alone isn't reliable because of too many BIOS bugs. A bit more clever test is necessary. Takashi _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC] hda - is_jack_detectable() 2011-11-09 7:08 ` Takashi Iwai @ 2011-11-09 7:50 ` Takashi Iwai [not found] ` <CAN8ccibAoNQfDNWJ-zE_DGH6mc-ipmmdhBDQW+fjOMT8xHcD+Q@mail.gmail.com> 0 siblings, 1 reply; 16+ messages in thread From: Takashi Iwai @ 2011-11-09 7:50 UTC (permalink / raw) To: Raymond Yau; +Cc: ALSA Development Mailing List At Wed, 09 Nov 2011 08:08:17 +0100, Takashi Iwai wrote: > > At Wed, 9 Nov 2011 12:06:04 +0800, > Raymond Yau wrote: > > > > 2011/11/6 Takashi Iwai <tiwai@suse.de>: > > > At Sat, 5 Nov 2011 13:30:21 +0800, > > > Raymond Yau wrote: > > >> > > >> 2011/11/2 Takashi Iwai <tiwai@suse.de>: > > >> > At Tue, 01 Nov 2011 17:03:29 -0400, > > >> > David Henningsson wrote: > > >> >> > > >> >> 2011-10-24 23:31, Raymond Yau skrev: > > >> >> > sorry, it should be > > >> >> > > > >> >> > static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) > > >> >> > { > > >> >> > return (snd_hda_query_pin_caps(codec, nid)& AC_PINCAP_PRES_DETECT)&& > > >> >> > + !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) > > >> >> > & AC_DEFCFG_MISC_NO_PRESENCE))&& > > >> >> > (get_wcaps(codec, nid)& AC_WCAP_UNSOL_CAP); > > >> >> > } > > >> >> > > > >> >> I also think it is a good idea, in fact I thought it was this way > > >> >> already. Can we merge this patch? > > >> > > > >> > OK, I checked through alsa-info series and confirmed that this causes > > >> > no harm, so I merged it now. > > >> > > > >> > > > >> > thanks, > > >> > > > >> > Takashi > > >> > > > >> > > > >> > > >> Sorry the previous patch is wrong > > > > > > Ugh, so actually changing it would may bring too many changes, and > > > most likely regressions, too. I disabled the code for now for 3.2-rc1. > > > Once when we cover all test cases and fix broken BIOS devices enough, > > > we can re-enable it in near future. > > > > > >> attach the patch and test cases (pins 0x11 and 0x14) front panel > > >> green and pink jacks when set Front Audio Panel to AC97 or HD in BIOS > > >> setup > > > > > > OK, thanks, we can refer to this for more tests. > > > > > > > > > Takashi > > > > > > > If bit 0 is set, it indicates that the jack has no presence detect capability > > > > > > The Configuration Default register is defined as shown in Figure 66. > > 31:30 29:24 23:20 19:16 15:12 11:8 > > 7:4 3:0 > > Port Location Default Connection Color Misc > > Default Sequence > > Connectivity Device Type Association > > Figure 66. Configuration Data Structure > > > > > > This mean that bit 0 of Misc is bit 8 of the Configuration Default register > > > > > > !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) > > & AC_DEFCFG_MISC_NO_PRESENCE)&& > > > > Yeah, I already tried it and it still gives too many false-positives. > Many ASUS laptops (also mobo) set this bit to all pins no matter > whether it's an obviously detectable jack or not. Some Toshiba > laptops do so, too. > > That being said, checking this bit alone isn't reliable because of too > many BIOS bugs. A bit more clever test is necessary. It seems that a broken BIOS sets this bit on all pins in general. So, the patch below (against the latest sound git tree or 3.2-rc1 kernel) seems working well by filtering out such a brokenness. Let me know if this works. If it's OK, I'll try to merge it for 3.2-rc2. Takashi --- diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 916a186..2518299 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -4752,6 +4752,7 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, memset(sequences_hp, 0, sizeof(sequences_hp)); assoc_line_out = 0; + codec->ignore_misc_bit = true; end_nid = codec->start_nid + codec->num_nodes; for (nid = codec->start_nid; nid < end_nid; nid++) { unsigned int wid_caps = get_wcaps(codec, nid); @@ -4767,6 +4768,9 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, continue; def_conf = snd_hda_codec_get_pincfg(codec, nid); + if (!(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & + AC_DEFCFG_MISC_NO_PRESENCE)) + codec->ignore_misc_bit = false; conn = get_defcfg_connect(def_conf); if (conn == AC_JACK_PORT_NONE) continue; diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 755f2b0..5644711 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h @@ -854,6 +854,7 @@ struct hda_codec { unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */ unsigned int pins_shutup:1; /* pins are shut up */ unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ + unsigned int ignore_misc_bit:1; /* ignore MISC_NO_PRESENCE bit */ #ifdef CONFIG_SND_HDA_POWER_SAVE unsigned int power_on :1; /* current (global) power-state */ unsigned int power_transition :1; /* power-state in transition */ diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index dcbea0d..6579e0f 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -510,13 +510,15 @@ int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid); static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) { - return (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT) && - /* disable MISC_NO_PRESENCE check because it may break too - * many devices - */ - /*(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) & - AC_DEFCFG_MISC_NO_PRESENCE)) &&*/ - (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP); + if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT)) + return false; + if (!codec->ignore_misc_bit && + (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & + AC_DEFCFG_MISC_NO_PRESENCE)) + return false; + if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) + return false; + return true; } /* flags for hda_nid_item */ _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply related [flat|nested] 16+ messages in thread
[parent not found: <CAN8ccibAoNQfDNWJ-zE_DGH6mc-ipmmdhBDQW+fjOMT8xHcD+Q@mail.gmail.com>]
[parent not found: <s5h4ny76naa.wl%tiwai@suse.de>]
* Re: [RFC] hda - is_jack_detectable() [not found] ` <s5h4ny76naa.wl%tiwai@suse.de> @ 2011-11-16 7:14 ` Raymond Yau 2011-11-17 15:17 ` Takashi Iwai 0 siblings, 1 reply; 16+ messages in thread From: Raymond Yau @ 2011-11-16 7:14 UTC (permalink / raw) To: Takashi Iwai, ALSA Development Mailing List 2011/11/14 Takashi Iwai <tiwai@suse.de>: > At Sat, 12 Nov 2011 19:31:20 +0800, > Raymond Yau wrote: >> >> 2011/11/9 Takashi Iwai <tiwai@suse.de>: >> > At Wed, 09 Nov 2011 08:08:17 +0100, >> > Takashi Iwai wrote: >> >> >> >> At Wed, 9 Nov 2011 12:06:04 +0800, >> >> Raymond Yau wrote: >> >> > >> >> > 2011/11/6 Takashi Iwai <tiwai@suse.de>: >> >> > > At Sat, 5 Nov 2011 13:30:21 +0800, >> >> > > Raymond Yau wrote: >> >> > >> >> >> > >> 2011/11/2 Takashi Iwai <tiwai@suse.de>: >> >> > >> > At Tue, 01 Nov 2011 17:03:29 -0400, >> >> > >> > David Henningsson wrote: >> >> > >> >> >> >> > >> >> 2011-10-24 23:31, Raymond Yau skrev: >> >> > >> >> > sorry, it should be >> >> > >> >> > >> >> > >> >> > static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) >> >> > >> >> > { >> >> > >> >> > return (snd_hda_query_pin_caps(codec, nid)& AC_PINCAP_PRES_DETECT)&& >> >> > >> >> > + !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) >> >> > >> >> > & AC_DEFCFG_MISC_NO_PRESENCE))&& >> >> > >> >> > (get_wcaps(codec, nid)& AC_WCAP_UNSOL_CAP); >> >> > >> >> > } >> >> > >> >> > >> >> > >> >> I also think it is a good idea, in fact I thought it was this way >> >> > >> >> already. Can we merge this patch? >> >> > >> > >> >> > >> > OK, I checked through alsa-info series and confirmed that this causes >> >> > >> > no harm, so I merged it now. >> >> > >> > >> >> > >> > >> >> > >> > thanks, >> >> > >> > >> >> > >> > Takashi >> >> > >> > >> >> > >> > >> >> > >> >> >> > >> Sorry the previous patch is wrong >> >> > > >> >> > > Ugh, so actually changing it would may bring too many changes, and >> >> > > most likely regressions, too. I disabled the code for now for 3.2-rc1. >> >> > > Once when we cover all test cases and fix broken BIOS devices enough, >> >> > > we can re-enable it in near future. >> >> > > >> >> > >> attach the patch and test cases (pins 0x11 and 0x14) front panel >> >> > >> green and pink jacks when set Front Audio Panel to AC97 or HD in BIOS >> >> > >> setup >> >> > > >> >> > > OK, thanks, we can refer to this for more tests. >> >> > > >> >> > > >> >> > > Takashi >> >> > > >> >> > >> >> > If bit 0 is set, it indicates that the jack has no presence detect capability >> >> > >> >> > >> >> > The Configuration Default register is defined as shown in Figure 66. >> >> > 31:30 29:24 23:20 19:16 15:12 11:8 >> >> > 7:4 3:0 >> >> > Port Location Default Connection Color Misc >> >> > Default Sequence >> >> > Connectivity Device Type Association >> >> > Figure 66. Configuration Data Structure >> >> > >> >> > >> >> > This mean that bit 0 of Misc is bit 8 of the Configuration Default register >> >> > >> >> > >> >> > !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) >> >> > & AC_DEFCFG_MISC_NO_PRESENCE)&& >> >> > >> >> >> >> Yeah, I already tried it and it still gives too many false-positives. >> >> Many ASUS laptops (also mobo) set this bit to all pins no matter >> >> whether it's an obviously detectable jack or not. Some Toshiba >> >> laptops do so, too. >> >> >> >> That being said, checking this bit alone isn't reliable because of too >> >> many BIOS bugs. A bit more clever test is necessary. >> > >> > It seems that a broken BIOS sets this bit on all pins in general. >> > So, the patch below (against the latest sound git tree or 3.2-rc1 >> > kernel) seems working well by filtering out such a brokenness. >> > >> > Let me know if this works. If it's OK, I'll try to merge it for >> > 3.2-rc2. >> > >> >> The patch seem ok >> >> Need a hack to build the hda-jack branch >> >> It is quite simple to enable unsolicited event for all proper jacks by >> >> snd_hda_jack_add_kctrls(codec,(codec->spec->autocfg)); >> >> and >> >> static void ad1988_unsol_event(struct hda_codec *codec, unsigned int res) >> { >> struct ad198x_spec *spec = codec->spec; >> struct hda_jack_tbl *jack; >> u32 sense, caps; >> int pin; >> jack = snd_hda_jack_tbl_get_from_tag(codec, res >> 26); >> pin = jack->nid; >> caps = snd_hda_codec_get_pincfg(codec, pin); >> sense = snd_hda_codec_read(codec, pin, 0, AC_VERB_GET_PIN_SENSE, 0); >> if (sense & AC_PINSENSE_PRESENCE) >> snd_printdd("Pin 0x%x pd=1 imp=%d %s at %s %s %s\n", >> pin, >> sense & AC_PINSENSE_IMPEDANCE_MASK, >> snd_hda_get_jack_type(caps), >> snd_hda_get_jack_connectivity(caps), >> snd_hda_get_jack_location(caps), >> get_jack_color(caps)); >> else >> snd_printdd("Pin 0x%x pd=0 %s at %s %s %s\n", >> pin, >> snd_hda_get_jack_type(caps), >> snd_hda_get_jack_connectivity(caps), >> snd_hda_get_jack_location(caps), >> get_jack_color(caps)); >> >> if (pin == spec->autocfg.hp_pins[0] && !spec->independent_hp) >> ad198x_hp_automute(codec); >> if (pin == spec->ext_mic_pin) >> ad198x_mic_automute(codec); >> } >> >> >> However it seem that result is different in kctl >> >> >> amixer -c1 contents >> numid=5,iface=CARD,name='Front Headphone Jack' >> ; type=BOOLEAN,access=r-------,values=1 >> : values=off >> numid=6,iface=CARD,name='Front Mic Jack' >> ; type=BOOLEAN,access=r-------,values=1 >> : values=off >> numid=8,iface=CARD,name='Line Jack' >> ; type=BOOLEAN,access=r-------,values=1 >> : values=off >> numid=1,iface=CARD,name='Line-Out Jack' >> ; type=BOOLEAN,access=r-------,values=1 >> : values=off >> numid=2,iface=CARD,name='Line-Out Jack',index=1 >> ; type=BOOLEAN,access=r-------,values=1 >> : values=off >> numid=3,iface=CARD,name='Line-Out Jack',index=2 >> ; type=BOOLEAN,access=r-------,values=1 >> : values=off >> numid=4,iface=CARD,name='Line-Out Jack',index=3 >> ; type=BOOLEAN,access=r-------,values=1 >> : values=off >> numid=7,iface=CARD,name='Rear Mic Jack' >> ; type=BOOLEAN,access=r-------,values=1 >> : values=off >> >> >> >> >> ./hda-jack-sense-test.py -c1 >> Pin 0x11 Green HP Out (Ext Front): Present = NO >> Pin 0x12 Green Line Out (Ext Rear): Present = YES Impedance = 19 >> Pin 0x14 Pink Mic (Ext Front): Present = NO >> Pin 0x15 Blue Line In (Ext Rear): Present = NO >> Pin 0x16 Black Line Out (Ext Rear): Present = YES Impedance = 3200 >> Pin 0x17 Pink Mic (Ext Rear): Present = YES Impedance = 896 >> Pin 0x18 Black CD (Int ATAPI): No jack detect capability >> Pin 0x1a Other (Int ATAPI): No jack detect capability >> Pin 0x1b Other SPDIF Out (Ext Rear): No jack detect capability >> Pin 0x24 Orange Line Out (Ext Rear): Present = NO >> Pin 0x25 Grey Line Out (Ext Rear): Present = YES Impedance = 3200 >> >> >> It need "SET_PIN_SENSE" and some delay to get the correct impedance >> of the jacks during driver load >> >> >> int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid, >> unsigned char action) >> { >> + int ret; >> struct hda_jack_tbl *jack = snd_hda_jack_tbl_new(codec, nid); >> if (!jack) >> return -ENOMEM; >> if (jack->jack_detect) >> return 0; /* already registered */ >> jack->jack_detect = 1; >> if (action) >> jack->action = action; >> + ret = snd_hda_codec_write_cache(codec, nid, 0, >> + AC_VERB_SET_UNSOLICITED_ENABLE, >> + AC_USRSP_EN | jack->tag); >> + if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_IMP_SENSE) { >> snd_hda_codec_read(codec, nid, 0, >> AC_VERB_SET_PIN_SENSE, 0); >> + msleep(200); >> + } >> + return ret; > > The lack of the initial pin-state of kclts was fixed in a different > patch now. But, the need of 200ms delay worries me whether it's > needed generically at each pin-sense reading or it's just only for the > initial reading. > > Does the pin-sense reading work in general after loading the driver > stably? > > > Presence detect bit is alway correct, without the delay. the only issue is the impedance measurement of the plugged jacks at computer boot need a delay 200ms For the user application to know the impedance , it seem the client application have to issue 1) set_pin_sense 2) delay 3) get_pin_sense to get the correct impedance of the attached device just like my modified hda-jack-sense-test in previous email Can it measure the impedance of the jacks of your computer ? ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC] hda - is_jack_detectable() 2011-11-16 7:14 ` Raymond Yau @ 2011-11-17 15:17 ` Takashi Iwai 2011-12-23 2:37 ` Raymond Yau 0 siblings, 1 reply; 16+ messages in thread From: Takashi Iwai @ 2011-11-17 15:17 UTC (permalink / raw) To: Raymond Yau; +Cc: ALSA Development Mailing List At Wed, 16 Nov 2011 15:14:17 +0800, Raymond Yau wrote: > > 2011/11/14 Takashi Iwai <tiwai@suse.de>: > > At Sat, 12 Nov 2011 19:31:20 +0800, > > Raymond Yau wrote: > >> > >> 2011/11/9 Takashi Iwai <tiwai@suse.de>: > >> > At Wed, 09 Nov 2011 08:08:17 +0100, > >> > Takashi Iwai wrote: > >> >> > >> >> At Wed, 9 Nov 2011 12:06:04 +0800, > >> >> Raymond Yau wrote: > >> >> > > >> >> > 2011/11/6 Takashi Iwai <tiwai@suse.de>: > >> >> > > At Sat, 5 Nov 2011 13:30:21 +0800, > >> >> > > Raymond Yau wrote: > >> >> > >> > >> >> > >> 2011/11/2 Takashi Iwai <tiwai@suse.de>: > >> >> > >> > At Tue, 01 Nov 2011 17:03:29 -0400, > >> >> > >> > David Henningsson wrote: > >> >> > >> >> > >> >> > >> >> 2011-10-24 23:31, Raymond Yau skrev: > >> >> > >> >> > sorry, it should be > >> >> > >> >> > > >> >> > >> >> > static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) > >> >> > >> >> > { > >> >> > >> >> > return (snd_hda_query_pin_caps(codec, nid)& AC_PINCAP_PRES_DETECT)&& > >> >> > >> >> > + !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) > >> >> > >> >> > & AC_DEFCFG_MISC_NO_PRESENCE))&& > >> >> > >> >> > (get_wcaps(codec, nid)& AC_WCAP_UNSOL_CAP); > >> >> > >> >> > } > >> >> > >> >> > > >> >> > >> >> I also think it is a good idea, in fact I thought it was this way > >> >> > >> >> already. Can we merge this patch? > >> >> > >> > > >> >> > >> > OK, I checked through alsa-info series and confirmed that this causes > >> >> > >> > no harm, so I merged it now. > >> >> > >> > > >> >> > >> > > >> >> > >> > thanks, > >> >> > >> > > >> >> > >> > Takashi > >> >> > >> > > >> >> > >> > > >> >> > >> > >> >> > >> Sorry the previous patch is wrong > >> >> > > > >> >> > > Ugh, so actually changing it would may bring too many changes, and > >> >> > > most likely regressions, too. I disabled the code for now for 3.2-rc1. > >> >> > > Once when we cover all test cases and fix broken BIOS devices enough, > >> >> > > we can re-enable it in near future. > >> >> > > > >> >> > >> attach the patch and test cases (pins 0x11 and 0x14) front panel > >> >> > >> green and pink jacks when set Front Audio Panel to AC97 or HD in BIOS > >> >> > >> setup > >> >> > > > >> >> > > OK, thanks, we can refer to this for more tests. > >> >> > > > >> >> > > > >> >> > > Takashi > >> >> > > > >> >> > > >> >> > If bit 0 is set, it indicates that the jack has no presence detect capability > >> >> > > >> >> > > >> >> > The Configuration Default register is defined as shown in Figure 66. > >> >> > 31:30 29:24 23:20 19:16 15:12 11:8 > >> >> > 7:4 3:0 > >> >> > Port Location Default Connection Color Misc > >> >> > Default Sequence > >> >> > Connectivity Device Type Association > >> >> > Figure 66. Configuration Data Structure > >> >> > > >> >> > > >> >> > This mean that bit 0 of Misc is bit 8 of the Configuration Default register > >> >> > > >> >> > > >> >> > !(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) > >> >> > & AC_DEFCFG_MISC_NO_PRESENCE)&& > >> >> > > >> >> > >> >> Yeah, I already tried it and it still gives too many false-positives. > >> >> Many ASUS laptops (also mobo) set this bit to all pins no matter > >> >> whether it's an obviously detectable jack or not. Some Toshiba > >> >> laptops do so, too. > >> >> > >> >> That being said, checking this bit alone isn't reliable because of too > >> >> many BIOS bugs. A bit more clever test is necessary. > >> > > >> > It seems that a broken BIOS sets this bit on all pins in general. > >> > So, the patch below (against the latest sound git tree or 3.2-rc1 > >> > kernel) seems working well by filtering out such a brokenness. > >> > > >> > Let me know if this works. If it's OK, I'll try to merge it for > >> > 3.2-rc2. > >> > > >> > >> The patch seem ok > >> > >> Need a hack to build the hda-jack branch > >> > >> It is quite simple to enable unsolicited event for all proper jacks by > >> > >> snd_hda_jack_add_kctrls(codec,(codec->spec->autocfg)); > >> > >> and > >> > >> static void ad1988_unsol_event(struct hda_codec *codec, unsigned int res) > >> { > >> struct ad198x_spec *spec = codec->spec; > >> struct hda_jack_tbl *jack; > >> u32 sense, caps; > >> int pin; > >> jack = snd_hda_jack_tbl_get_from_tag(codec, res >> 26); > >> pin = jack->nid; > >> caps = snd_hda_codec_get_pincfg(codec, pin); > >> sense = snd_hda_codec_read(codec, pin, 0, AC_VERB_GET_PIN_SENSE, 0); > >> if (sense & AC_PINSENSE_PRESENCE) > >> snd_printdd("Pin 0x%x pd=1 imp=%d %s at %s %s %s\n", > >> pin, > >> sense & AC_PINSENSE_IMPEDANCE_MASK, > >> snd_hda_get_jack_type(caps), > >> snd_hda_get_jack_connectivity(caps), > >> snd_hda_get_jack_location(caps), > >> get_jack_color(caps)); > >> else > >> snd_printdd("Pin 0x%x pd=0 %s at %s %s %s\n", > >> pin, > >> snd_hda_get_jack_type(caps), > >> snd_hda_get_jack_connectivity(caps), > >> snd_hda_get_jack_location(caps), > >> get_jack_color(caps)); > >> > >> if (pin == spec->autocfg.hp_pins[0] && !spec->independent_hp) > >> ad198x_hp_automute(codec); > >> if (pin == spec->ext_mic_pin) > >> ad198x_mic_automute(codec); > >> } > >> > >> > >> However it seem that result is different in kctl > >> > >> > >> amixer -c1 contents > >> numid=5,iface=CARD,name='Front Headphone Jack' > >> ; type=BOOLEAN,access=r-------,values=1 > >> : values=off > >> numid=6,iface=CARD,name='Front Mic Jack' > >> ; type=BOOLEAN,access=r-------,values=1 > >> : values=off > >> numid=8,iface=CARD,name='Line Jack' > >> ; type=BOOLEAN,access=r-------,values=1 > >> : values=off > >> numid=1,iface=CARD,name='Line-Out Jack' > >> ; type=BOOLEAN,access=r-------,values=1 > >> : values=off > >> numid=2,iface=CARD,name='Line-Out Jack',index=1 > >> ; type=BOOLEAN,access=r-------,values=1 > >> : values=off > >> numid=3,iface=CARD,name='Line-Out Jack',index=2 > >> ; type=BOOLEAN,access=r-------,values=1 > >> : values=off > >> numid=4,iface=CARD,name='Line-Out Jack',index=3 > >> ; type=BOOLEAN,access=r-------,values=1 > >> : values=off > >> numid=7,iface=CARD,name='Rear Mic Jack' > >> ; type=BOOLEAN,access=r-------,values=1 > >> : values=off > >> > >> > >> > >> > >> ./hda-jack-sense-test.py -c1 > >> Pin 0x11 Green HP Out (Ext Front): Present = NO > >> Pin 0x12 Green Line Out (Ext Rear): Present = YES Impedance = 19 > >> Pin 0x14 Pink Mic (Ext Front): Present = NO > >> Pin 0x15 Blue Line In (Ext Rear): Present = NO > >> Pin 0x16 Black Line Out (Ext Rear): Present = YES Impedance = 3200 > >> Pin 0x17 Pink Mic (Ext Rear): Present = YES Impedance = 896 > >> Pin 0x18 Black CD (Int ATAPI): No jack detect capability > >> Pin 0x1a Other (Int ATAPI): No jack detect capability > >> Pin 0x1b Other SPDIF Out (Ext Rear): No jack detect capability > >> Pin 0x24 Orange Line Out (Ext Rear): Present = NO > >> Pin 0x25 Grey Line Out (Ext Rear): Present = YES Impedance = 3200 > >> > >> > >> It need "SET_PIN_SENSE" and some delay to get the correct impedance > >> of the jacks during driver load > >> > >> > >> int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid, > >> unsigned char action) > >> { > >> + int ret; > >> struct hda_jack_tbl *jack = snd_hda_jack_tbl_new(codec, nid); > >> if (!jack) > >> return -ENOMEM; > >> if (jack->jack_detect) > >> return 0; /* already registered */ > >> jack->jack_detect = 1; > >> if (action) > >> jack->action = action; > >> + ret = snd_hda_codec_write_cache(codec, nid, 0, > >> + AC_VERB_SET_UNSOLICITED_ENABLE, > >> + AC_USRSP_EN | jack->tag); > >> + if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_IMP_SENSE) { > >> snd_hda_codec_read(codec, nid, 0, > >> AC_VERB_SET_PIN_SENSE, 0); > >> + msleep(200); > >> + } > >> + return ret; > > > > The lack of the initial pin-state of kclts was fixed in a different > > patch now. But, the need of 200ms delay worries me whether it's > > needed generically at each pin-sense reading or it's just only for the > > initial reading. > > > > Does the pin-sense reading work in general after loading the driver > > stably? > > > > > > > > Presence detect bit is alway correct, without the delay. > > the only issue is the impedance measurement of the plugged jacks at > computer boot need a delay 200ms > > For the user application to know the impedance , > it seem the client application have to issue > 1) set_pin_sense > 2) delay > 3) get_pin_sense to get the correct impedance of the attached device > > just like my modified hda-jack-sense-test in previous email > > Can it measure the impedance of the jacks of your computer ? It seems that this doesn't work machines here with Realtek codecs. So, this must be pretty depending on the codec chip. Anyway, currently there is no use of impedance, and the jack presence can be detected immediately without delay, we can keep the code as is now. thanks, Takashi _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC] hda - is_jack_detectable() 2011-11-17 15:17 ` Takashi Iwai @ 2011-12-23 2:37 ` Raymond Yau 2011-12-23 9:26 ` Takashi Iwai 0 siblings, 1 reply; 16+ messages in thread From: Raymond Yau @ 2011-12-23 2:37 UTC (permalink / raw) To: Takashi Iwai; +Cc: ALSA Development Mailing List 2011/11/17, Takashi Iwai <tiwai@suse.de>: > At Wed, 16 Nov 2011 15:14:17 +0800, > Raymond Yau wrote: >> >> 2011/11/14 Takashi Iwai <tiwai@suse.de>: > >> > >> > The lack of the initial pin-state of kclts was fixed in a different >> > patch now. But, the need of 200ms delay worries me whether it's >> > needed generically at each pin-sense reading or it's just only for the >> > initial reading. >> > >> > Does the pin-sense reading work in general after loading the driver >> > stably? >> > >> > >> > >> >> Presence detect bit is alway correct, without the delay. >> >> the only issue is the impedance measurement of the plugged jacks at >> computer boot need a delay 200ms >> >> For the user application to know the impedance , >> it seem the client application have to issue >> 1) set_pin_sense >> 2) delay >> 3) get_pin_sense to get the correct impedance of the attached device >> >> just like my modified hda-jack-sense-test in previous email >> >> Can it measure the impedance of the jacks of your computer ? > > It seems that this doesn't work machines here with Realtek codecs. > So, this must be pretty depending on the codec chip. > > Anyway, currently there is no use of impedance, and the jack presence > can be detected immediately without delay, we can keep the code as > is now. > How can I add the new hda-jack detect to patch_analog.c ? Only ad1988 use snd_hda_parse_pin_def_config() to parse the pin, other ad198x codecs are used model since snd_hda_jack_add_ctls() require those pin info from autocfg The auto model of ad1988 use init_verbs ad1988_6stack_init which cannot handle those 3 stack motherboard asus m2n What is the reason to call snd_hda_jack_report_sync() at the end of unsol event handler ? ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC] hda - is_jack_detectable() 2011-12-23 2:37 ` Raymond Yau @ 2011-12-23 9:26 ` Takashi Iwai 2011-12-27 1:45 ` Raymond Yau 0 siblings, 1 reply; 16+ messages in thread From: Takashi Iwai @ 2011-12-23 9:26 UTC (permalink / raw) To: Raymond Yau; +Cc: ALSA Development Mailing List At Fri, 23 Dec 2011 10:37:15 +0800, Raymond Yau wrote: > > 2011/11/17, Takashi Iwai <tiwai@suse.de>: > > At Wed, 16 Nov 2011 15:14:17 +0800, > > Raymond Yau wrote: > >> > >> 2011/11/14 Takashi Iwai <tiwai@suse.de>: > > > >> > > >> > The lack of the initial pin-state of kclts was fixed in a different > >> > patch now. But, the need of 200ms delay worries me whether it's > >> > needed generically at each pin-sense reading or it's just only for the > >> > initial reading. > >> > > >> > Does the pin-sense reading work in general after loading the driver > >> > stably? > >> > > >> > > >> > > >> > >> Presence detect bit is alway correct, without the delay. > >> > >> the only issue is the impedance measurement of the plugged jacks at > >> computer boot need a delay 200ms > >> > >> For the user application to know the impedance , > >> it seem the client application have to issue > >> 1) set_pin_sense > >> 2) delay > >> 3) get_pin_sense to get the correct impedance of the attached device > >> > >> just like my modified hda-jack-sense-test in previous email > >> > >> Can it measure the impedance of the jacks of your computer ? > > > > It seems that this doesn't work machines here with Realtek codecs. > > So, this must be pretty depending on the codec chip. > > > > Anyway, currently there is no use of impedance, and the jack presence > > can be detected immediately without delay, we can keep the code as > > is now. > > > > How can I add the new hda-jack detect to patch_analog.c ? > > Only ad1988 use snd_hda_parse_pin_def_config() to parse the pin, > other ad198x codecs are used model since snd_hda_jack_add_ctls() > require those pin info from autocfg Not necessarily. You can call snd_hda_jack_add_kctl() and enable the pin-detection via snd_hda_jack_detect_enable() directly. > The auto model of ad1988 use init_verbs ad1988_6stack_init which > cannot handle those 3 stack motherboard asus m2n > > What is the reason to call snd_hda_jack_report_sync() at the end of > unsol event handler ? To notify the jack-detection. Takashi ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC] hda - is_jack_detectable() 2011-12-23 9:26 ` Takashi Iwai @ 2011-12-27 1:45 ` Raymond Yau 0 siblings, 0 replies; 16+ messages in thread From: Raymond Yau @ 2011-12-27 1:45 UTC (permalink / raw) To: ALSA Development Mailing List 2011/12/23, Takashi Iwai <tiwai@suse.de>: > At Fri, 23 Dec 2011 10:37:15 +0800, > Raymond Yau wrote: >> >> >> How can I add the new hda-jack detect to patch_analog.c ? >> >> Only ad1988 use snd_hda_parse_pin_def_config() to parse the pin, >> other ad198x codecs are used model since snd_hda_jack_add_ctls() >> require those pin info from autocfg > > Not necessarily. You can call snd_hda_jack_add_kctl() and enable the > pin-detection via snd_hda_jack_detect_enable() directly. > >> The auto model of ad1988 use init_verbs ad1988_6stack_init which >> cannot handle those 3 stack motherboard asus m2n >> >> What is the reason to call snd_hda_jack_report_sync() at the end of >> unsol event handler ? > > To notify the jack-detection. > It seem that I need to add jack->dirty = 1 in ad1988_unsol_event to force snd_hda_jack_detect() to call read_pin_sense() since jack->jack_detect is set when calling snd_hda_jack_detect_enable() Using snd_hda_jack_detect_enable(codec, pin, pin) instead of snd_hda_jack_detect_enable(codec, pin, HP_EVENT) simiar to hdmi so that all the detectable pins are assigned different tag +static void ad1988_hp_automute(struct hda_codec *codec) +{ + int i, present; + struct ad198x_spec *spec = codec->spec; + + present = snd_hda_jack_detect(codec, 0x11); + if (spec->independent_hp) + return; + for (i=0; i < spec->multiout.num_dacs; i++) + snd_hda_codec_write(codec, spec->autocfg.line_out_pins[i], + 0, AC_VERB_SET_AMP_GAIN_MUTE, + present ? AMP_OUT_MUTE : AMP_OUT_UNMUTE); + + if (spec->autocfg.mono_out_pin) + snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, + 0, AC_VERB_SET_AMP_GAIN_MUTE, + present ? AMP_OUT_MUTE : AMP_OUT_UNMUTE); + + for (i=0; i < spec->autocfg.speaker_outs; i++) { + snd_hda_codec_write(codec, spec->autocfg.speaker_pins[i], + 0, AC_VERB_SET_AMP_GAIN_MUTE, + present ? AMP_OUT_MUTE : AMP_OUT_UNMUTE); + } +} + +static void ad1988_unsol_event(struct hda_codec *codec, unsigned int res) +{ + struct hda_jack_tbl *jack = snd_hda_jack_tbl_get_from_tag(codec, res >> 26); + struct ad198x_spec *spec = codec->spec; + jack->jack_dirty = 1; + if (jack->nid == spec->autocfg.hp_pins[0]) + ad1988_hp_automute(codec); + snd_hda_jack_report_sync(codec); +} + +#define check_jack_detect(c, p) if (is_jack_detectable(c, p)) snd_hda_jack_detect_enable(c, p, p) + +void ad1988_auto_init_unsol_event(struct hda_codec *codec) +{ + int i; + struct ad198x_spec *spec = codec->spec; + check_jack_detect(codec, spec->autocfg.hp_pins[0]); + for (i=0; i<spec->autocfg.line_outs; i++) + check_jack_detect(codec, spec->autocfg.line_out_pins[0]); + for (i=0; i<spec->autocfg.num_inputs; i++) + check_jack_detect(codec, spec->autocfg.inputs[i].pin); + snd_hda_jack_add_kctls(codec, &spec->autocfg); + snd_hda_jack_report_sync(codec); +} static int ad1988_auto_init(struct hda_codec *codec) { ad198x_init(codec); ad1988_auto_init_multi_out(codec); ad1988_auto_init_extra_out(codec); ad1988_auto_init_analog_input(codec); + ad1988_auto_init_unsol_event(codec); return 0; } codec->patch_ops = ad198x_patch_ops; switch (board_config) { case AD1988_AUTO: codec->patch_ops.init = ad1988_auto_init; + codec->patch_ops.unsol_event = ad1988_unsol_event; break; ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC] hda - is_jack_detectable() 2011-11-01 21:03 ` David Henningsson 2011-11-02 7:02 ` Takashi Iwai @ 2011-11-06 11:46 ` Raymond Yau 1 sibling, 0 replies; 16+ messages in thread From: Raymond Yau @ 2011-11-06 11:46 UTC (permalink / raw) To: ALSA Development Mailing List, Maciej Rutecki, akashi Iwai [-- Attachment #1: Type: text/plain, Size: 1249 bytes --] 2011/11/2 David Henningsson <david.henningsson@canonical.com>: > 2011-10-24 23:31, Raymond Yau skrev: >> > I also think it is a good idea, in fact I thought it was this way already. > Can we merge this patch? > > // David > commit 729d55ba972348234759f8e40abf8de020f0d505 ALSA: hda - Disable tigger at pin-sensing on AD codecs It is possible to measure the impedance of the jack with modification of hda-jack-sense-test.py with ad1988 The headphone was plugged into grey jack since my computer chassis only have AC97 front audio panel The result seem close to my headset specification Pin 0x11 Green HP Out (Ext Front): No jack detect capability Pin 0x12 Green Line Out (Ext Rear): present = YES impedance = 3776 Pin 0x14 Pink Mic (Ext Front): No jack detect capability Pin 0x15 Blue Line In (Ext Rear): present = No Pin 0x16 Black Line Out (Ext Rear): present = YES impedance = 6080 Pin 0x17 Pink Mic (Ext Rear): present = YES impedance = 1008 Pin 0x18 Black CD (Int ATAPI): No jack detect capability Pin 0x1a Other (Int ATAPI): No jack detect capability Pin 0x1b Other SPDIF Out (Ext Rear): No jack detect capability Pin 0x24 Orange Line Out (Ext Rear): present = No Pin 0x25 Grey Line Out (Ext Rear): present = YES impedance = 25 [-- Attachment #2: hda-jack-sense-test.py --] [-- Type: application/octet-stream, Size: 1880 bytes --] #!/usr/bin/env python # # Written by David Henningsson, Copyright 2011 Canonical Ltd. # Licensed under GPLv2+ # the hda_codec.py file comes from Jaroslav Kysela's hda_analyzer program. from hda_codec import * import time def parseoptions(): from optparse import OptionParser parser = OptionParser() parser.add_option("-c", "--card", dest="cardindex", default=0, metavar="CARD", help="card index (as can be seen in /proc/asound/cards)") parser.add_option("-i", "--codec", dest="codecindex", default=0, metavar="CODEC", help="codec index (as can be seen in /proc/asound/cardX/codecY)") (options, args) = parser.parse_args() return int(options.cardindex), int(options.codecindex) def get_simplecaps(node): if node.jack_color_name == 'Unknown': return "%s (%s %s)" % (node.jack_type_name, node.jack_location_name, node.jack_location2_name) return "%s %s (%s %s)" % (node.jack_color_name, node.jack_type_name, node.jack_location_name, node.jack_location2_name) cardindex, codecindex = parseoptions() codec = HDACodec(cardindex, codecindex) codec.analyze() for nid in codec.nodes: node = codec.get_node(nid) if WIDGET_TYPE_IDS[node.wtype] == 'PIN': if ((node.defcfg_pincaps >> 30) & 0x03) != 1: if (node.pincaps & 1): codec.rw(nid, VERBS['SET_PIN_SENSE'], 0) time.sleep(0.01) sense = codec.rw(nid, VERBS['GET_PIN_SENSE'], 0) if node.defcfg_pincaps & (1 << 8): print "Pin 0x%.2x %s: No jack detect capability" % (nid, get_simplecaps(node)) else: if sense & 0x80000000: print "Pin 0x%.2x %s: present = YES impedance = %d" % (nid, get_simplecaps(node), sense - 0x80000000) else: print "Pin 0x%.2x %s: present = No" % (nid, get_simplecaps(node)) [-- Attachment #3: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2011-12-27 1:45 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-25 3:02 [RFC] hda - is_jack_detectable() Raymond Yau
2011-10-25 3:31 ` Raymond Yau
2011-10-25 11:31 ` Takashi Iwai
2011-11-01 21:03 ` David Henningsson
2011-11-02 7:02 ` Takashi Iwai
2011-11-05 5:30 ` Raymond Yau
2011-11-06 13:12 ` Takashi Iwai
2011-11-09 4:06 ` Raymond Yau
2011-11-09 7:08 ` Takashi Iwai
2011-11-09 7:50 ` Takashi Iwai
[not found] ` <CAN8ccibAoNQfDNWJ-zE_DGH6mc-ipmmdhBDQW+fjOMT8xHcD+Q@mail.gmail.com>
[not found] ` <s5h4ny76naa.wl%tiwai@suse.de>
2011-11-16 7:14 ` Raymond Yau
2011-11-17 15:17 ` Takashi Iwai
2011-12-23 2:37 ` Raymond Yau
2011-12-23 9:26 ` Takashi Iwai
2011-12-27 1:45 ` Raymond Yau
2011-11-06 11:46 ` Raymond Yau
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).