[alsa-devel] Issues and/or possible bugs in alsa
Yomi Ogunwumi
abyomi0 at gmail.com
Mon May 11 16:22:48 CEST 2015
What exactly am I changing here?
switch(nid){
case 0x18:
val = snd_hda_codec_read(codec, 0x21, 0,
AC_VERB_GET_PIN_SENSE, 0);
break;
case 0x21
val = snd_hda_codec_read(codec, 0x18, 0,
AC_VERB_GET_PIN_SENSE, 0);
break;
default:
val = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_PIN_SENSE, 0);
break;
}
On Apr 13, 2015 9:36 PM, "Yomi Ogunwumi" <abyomi0 at gmail.com> wrote:
> I should have elaborated a bit more on the result of the last case.
>
> No, when I plug in the headphones into the Microphone jack, the headphones
> do not work at all. (which makes sense, because it's a mic jack...it would
> be expecting a mic, right?)
>
> While alsamixer will correctly raise the headphone output and mute the
> speakers (when I plugged the headphones into the mic jack) — no sound comes
> through the headphones.
>
> Just to avoid any possible confusion...
>
> Are those more changes I should make to the code?
>
> Headphones unplugged.
> Pin 0x18 (Black Mic, Right side): present = No
> Pin 0x21 (Black Headphone, Right side): present = No
>
> Headphones plugged into Headphone port.
> Pin 0x18 (Black Mic, Right side): present = Yes
> Pin 0x21 (Black Headphone, Right side): present = No
>
> Headphones plugged into Mic port.
> Pin 0x18 (Black Mic, Right side): present = Yes
> Pin 0x21 (Black Headphone, Right side): present = Yes
>
> On Mon, Apr 13, 2015 at 9:20 PM, Raymond Yau <superquad.vortex2 at gmail.com>
> wrote:
>
>> >
>> > Headphones unplugged.
>> > [11:10:44 | yomi at xana ~/software/alsa-tools/hdajacksensetest] » sudo
>> ./hdajacksensetest -c 1
>> > [sudo] password for yomi:
>> > Pin 0x18 (Black Mic, Right side): present = No
>> > Pin 0x21 (Black Headphone, Right side): present = No
>> >
>> > Headphones plugged in.
>> > [11:10:50 | yomi at xana ~/software/alsa-tools/hdajacksensetest] » sudo
>> ./hdajacksensetest -c 1
>> > Pin 0x18 (Black Mic, Right side): present = Yes
>> > Pin 0x21 (Black Headphone, Right side): present = No
>> >
>> > That's odd. It seems to detect my headphones as being plugged into the
>> Mic jack. It isn't. It is plugged into the headphone jack. I checked.
>> > Haha. If I plug my headphones into the Mic Jack...alsamixer correctly
>> mutes the speakers and raises the volume of the headphones output.
>> >
>> > Headphones plugged into Mic Jack.
>> > [11:11:08 | yomi at xana ~/software/alsa-tools/hdajacksensetest] » sudo
>> ./hdajacksensetest -c 1
>> > [sudo] password for yomi:
>> > Pin 0x18 (Black Mic, Right side): present = Yes
>> > Pin 0x21 (Black Headphone, Right side): present = Yes
>>
>> Do you mean headphone and mic work as expected only when both are plugged
>> and always fail when headphone or mic is plugged ?
>>
>> Look like jack sense circuit of hp and mic are swapped
>>
>>
>> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/sound/pci/hda/hda_jack.c
>>
>> The current implementation assume kctl return jack state of the
>> corresponding pin complex
>>
>> Can two pins use the other pin as the gated jack at same time ?
>> snd_hda_jack_set_gating_jack()
>>
>> ALSA: hda - Allow jack state to depend on another jack
>>
>>
>> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/hda_jack.c?id=0619ba8c17b121ef0273be181198659b17d84247
>>
>> your case seem not just need to swap the result return by
>> read_pin_sense()
>>
>> switch(nid){
>> case 0x18:
>> val = snd_hda_codec_read(codec, 0x21, 0,
>> AC_VERB_GET_PIN_SENSE, 0);
>> break;
>> case 0x21
>> val = snd_hda_codec_read(codec, 0x18, 0,
>> AC_VERB_GET_PIN_SENSE, 0);
>> break;
>> default:
>> val = snd_hda_codec_read(codec, nid, 0,
>> AC_VERB_GET_PIN_SENSE, 0);
>> break;
>> }
>>
>> but also swap the unsolicited event tag on those two pin complex since
>> the driver use jack->tag to determine pin complex
>>
>> snd_hda_codec_write_cache(codec, nid, 0,
>> AC_VERB_SET_UNSOLICITED_ENABLE,
>> AC_USRSP_EN | jack->tag);
>>
>> Node 0x18 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out
>> Control: name="Mic Boost Volume", index=0, device=0
>> ControlAmp: chs=3, dir=In, idx=0, ofs=0
>> Control: name="Mic Jack", index=0, device=0
>> Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x2f, mute=0
>> Amp-In vals: [0x01 0x01]
>> Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
>> Amp-Out vals: [0x80 0x80]
>> Pincap 0x00001734: IN OUT Detect
>> Vref caps: HIZ 50 GRD 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=02, enabled=1
>> Connection: 1
>> 0x0d
>>
>> Node 0x21 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out
>> Control: name="Headphone Playback Switch", index=0, device=0
>> ControlAmp: chs=3, dir=Out, idx=0, ofs=0
>> Control: name="Headphone Jack", index=0, device=0
>> Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
>> Amp-Out vals: [0x80 0x80]
>> Pincap 0x0000001c: OUT HP Detect
>> Pin Default 0x04211020: [Jack] HP Out at Ext Right
>> Conn = 1/8, Color = Black
>> DefAssociation = 0x2, Sequence = 0x0
>> Pin-ctls: 0xc0: OUT HP
>> Unsolicited: tag=01, enabled=1
>> Connection: 2
>> 0x0c* 0x0dp
>>
>
>
>
> --
> *Yomi*
>
More information about the Alsa-devel
mailing list