[PATCH 4/6] ASoC: Intel: bytcr_rt5640: Add support for a second headphones output

Hans de Goede hdegoede at redhat.com
Mon Aug 2 17:02:20 CEST 2021


Hi,

On 8/2/21 4:35 PM, Pierre-Louis Bossart wrote:
> 
> 
>> I've also figured out how jack-detect works, since the codec's GPIO1 is used for the external-hp-amp enable, the jack-detect signals are directly connected to the Bay Trail SoC's GPIOs:
>>
>>   -gpioget 'INT33FC:02' 14 && gpioget 'INT33FC:00' 0 && gpioget 'INT33FC:00' 3
>>    Nothing inserted: 1 1 0
>>    Headset  in dock: 0 1 0
>>    Headphon in dock: 0 1 1
>>    Headset  in tabl: 1 0 0
>>    Headphon in tabl: 1 0 0
>>    Conclusion:
>>    GPO2 pin 14: !jack in dock
>>    GPO0 pin  0: !jack in tablet
>>    GPO0 pin  3: 1 when jack in dock with no mic
> 
> I am a bit confused about the logic. Could you have a case with 1 1 1
> (separate headphones in tablet and dock jacks)?

1 1 1 is not possible since 1 in column 0 + 1 means nothing inserted, iow
the jack-detect is active-low; and when nothing is inserted then the last
column is always 0.

With that said yes headphones in the dock + something in the tablet-jack should
be detectable as a new combination not in the table, this should give us
"0 0 x" (I did not test that yet, but the 2 jacks should be fully independent).
IOW we will end up with 2 separate snd_soc_jack-s which together register
4 pins. E.g. the declaration for the pins will look like this:

static struct snd_soc_jack_pin rt5640_pins[] = {
        {
                .pin    = "Headphone",
                .mask   = SND_JACK_HEADPHONE,
        },
        {
                .pin    = "Headset Mic",
                .mask   = SND_JACK_MICROPHONE,
        },
};

static struct snd_soc_jack_pin rt5640_pins2[] = {
        {
                .pin    = "Headphone 2",
                .mask   = SND_JACK_HEADPHONE,
        },
        {
                .pin    = "Headset Mic 2",
                .mask   = SND_JACK_MICROPHONE,
        },
};

And there will be 2 snd_soc_jack_add_gpio calls each using
1 of the set of pins (assuming I can use bias over-current
detect to differentiate between headphones/headset on the
jack on the tablet).

As you said in your other email "this is an interesting hardware setup"
I hope I won't hit any userspace issues when I have the kernel code
ready to register 2 jacks.

Regards,

Hans



More information about the Alsa-devel mailing list