diff options
author | Arnaud Ferraris <arnaud.ferraris@collabora.com> | 2024-03-02 15:00:38 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2024-03-25 00:32:32 +0000 |
commit | 21fa98f4197bb3365dda1417708b318f403c13c1 (patch) | |
tree | fe6f41fde8b55d97990b1515bbdd48f70a5e64bd /sound/aoa/core | |
parent | d5961e43b28668088087befbf4f7a043bd0ae65c (diff) |
ASoC: sun8i-codec: Implement jack and accessory detection
Add support for the jack detection functionality in the A64 variant,
which uses a pair of IRQs; and microphone accessory (button) detection,
which uses an ADC with an IRQ trigger.
IRQs will only be triggered if the JACKDETEN, HMICBIASEN, and MICADCEN
bits are set appropriately in the analog codec component
(sun50i-codec-analog), but there is no direct software dependency
between the two components.
Setup ADC so that it samples with period of 16ms, disable smoothing
and enable MDATA threshold (should be below idle voltage/HMIC_DATA
value). Also enable HMIC_N, which makes sure we get HMIC_N samples
after HMIC_DATA crosses the threshold.
This allows us to perform steady state detection of HMIC_DATA, by
comparing current and previous ADC samples, to detect end of the
transient when the user de-presses the button. Otherwise ADC could
sample anywhere within the transient, and the driver may mis-issue
key-press events for other buttons attached to the resistor ladder.
[Ondrej: Almost complete rewrite of the patch, change to use set_jack
API. Better de-bounce, fix mic button handling, better interrupt
processing.]
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
[Samuel: Decouple from analog codec, fixes]
Co-developed-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Co-developed-by: Ondrej Jirman <megi@xff.cz>
Signed-off-by: Ondrej Jirman <megi@xff.cz>
Link: https://msgid.link/r/20240302140042.1990256-5-megi@xff.cz
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/aoa/core')
0 files changed, 0 insertions, 0 deletions