This patch changes the logic used for jack gpio state inversion to utilize gpiolib inversion.
Previously the gpio active state would not correspond to the plugged-in state of the jack. Since the active state of a gpio is usually defined by its purpose in a specific application I'd expect the active state to represent the jacks plug status.
However, judging by the users [1], [2] of snd_soc_jack_add_gpiods the ACPI tables of some devices seem to indicate the "wrong" polarity for their jack detect gpios. I'm not entirely sure how to deal with those devices. At the moment I'd vote for inverting the gpio active level again (via gpiod_toggle_active_low) inside snd_soc_jack_add_gpios if gpio->gpiod_dev != NULL and gpio->invert is set.
I'm not entirely sure about [3] either. In my opinion removing invert = 1 from ams_delta_hook_switch_gpios and adding GPIO_ACTIVE_LOW to the flags of hook_switch in [4] would be the right move here.
What are your thoughts on this?
Best regards,
Tobias
[1] /sound/soc/intel/boards/byt-max98090.c [2] /sound/soc/intel/boards/cht_bsw_max98090_ti.c [3] /sound/soc/ti/ams-delta.c [4] /arch/arm/mach-omap1/board-ams-delta.c
Tobias Schramm (1): ASoC: jack: use gpiolib inversion flag for inverted gpios
sound/soc/soc-jack.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)