ASoC: codecs: msm8916-wcd-analog: use btn0 released detection
authorDamien Riegel <damien.riegel@savoirfairelinux.com>
Wed, 13 Sep 2017 20:43:55 +0000 (16:43 -0400)
committerMark Brown <broonie@kernel.org>
Thu, 28 Sep 2017 18:55:53 +0000 (11:55 -0700)
commitd430a7e3abbf98b4bcb16522cab8e4591775883e
tree1aa020d8226edefb3c2b2ee48590e4a4af49e949
parentf53ee247ad546183fc13739adafc5579b9f0ebc0
ASoC: codecs: msm8916-wcd-analog: use btn0 released detection

msm8916-wcd-analog uses button0 to differentiate between headphone and
headset. Under some circumstances, button pressed and released
interrupts are not fired as the driver expects it.

For instance, with some connectors, there are spurious button-pressed
interrupts when unplugging a headphone, without the corresponding
button-released interrupt. But the codec always alternates between
button pressed and released interrupts, it cannot fire two interrupts of
the same kind in a row. That means that when the headphone is plugged
back, only a button-released interrupt will be fired instead of pressed
then released. This causes the driver to report headphone as headset.

By changing the logic and relying on button 0 release interrupt, the
driver could be made more robust for connectors that differ from the one
used on the Dragonboard's audio mezzanine.

Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/msm8916-wcd-analog.c