[alsa-devel] How to handle jack detection through gpios

Mark Brown broonie at kernel.org
Fri Nov 3 18:40:27 CET 2017


On Fri, Nov 03, 2017 at 01:09:37PM +0100, Hans de Goede wrote:
> On 03-11-17 12:24, Mark Brown wrote:

> > You can make a GPIO input device but obviously can't have anything
> > reporting through the sound card interface without a sound card.

> Ok, so I could make the driver generate evdev events
> of type EV_SW with code SW_HEADPHONE_INSERT. Does userspace
> do anything useful with this like automatically switching
> between headphones and speakers as a headphone-jack which
> is part of the sound card would do ?

Depends on your userspace, you can also do an extcon which Android
listens to IIRC.

> If not, then is there a way to get a list of registered
> soundcards from a driver, then pick one of the cards
> based on some heuristics and then do the snd_soc_card_jack_new,
> etc. on the picked card?

> I assume that the approach from:
> https://github.com/me176c-dev/kernel_asus_me176c/commit/498116d7e7b4718fa0655c4879e59a163b1dd85b

> Where the struct snd_soc_card byt_rt5640_card is made
> non-static and exported is not acceptable ?

Why not have the sound card claim the GPIO and provide the jack?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20171103/bfc685ca/attachment-0001.sig>


More information about the Alsa-devel mailing list