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/498116d7e7b4718fa065...
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?