ASoC: rt5651: Add button press support

Enable button press detection for headsets by using the ovcd IRQ to get
notified of button presses.

This is modelled after (almost exactly copied from) the button press code
for the rt5640 which has identical ovcd hardware.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Hans de Goede
2018-07-05 00:59:33 +02:00
committed by Mark Brown
parent 34c906ddac
commit df1569f200
2 changed files with 159 additions and 7 deletions

View File

@@ -2071,8 +2071,16 @@ struct rt5651_pll_code {
struct rt5651_priv {
struct snd_soc_component *component;
struct regmap *regmap;
/* Jack and button detect data */
struct snd_soc_jack *hp_jack;
struct work_struct jack_detect_work;
struct delayed_work bp_work;
bool ovcd_irq_enabled;
bool pressed;
bool press_reported;
int press_count;
int release_count;
int poll_count;
unsigned int jd_src;
unsigned int ovcd_th;
unsigned int ovcd_sf;