Commit af6b6fe4 authored by Mark Brown's avatar Mark Brown

ASoC: Implement support for WM1811A jack detection

The WM1811A features an advanced low power accessory detection subsystem
which allows the device to be maintained in a very low power state while
the system is idle without sacrificing any accessory detection features.

Implement software support for this, automatically managing the power
configuration of the device depending on the detected accessory.
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 157a75e6
...@@ -242,6 +242,7 @@ ...@@ -242,6 +242,7 @@
#define WM8994_GPIO_4 0x703 #define WM8994_GPIO_4 0x703
#define WM8994_GPIO_5 0x704 #define WM8994_GPIO_5 0x704
#define WM8994_GPIO_6 0x705 #define WM8994_GPIO_6 0x705
#define WM1811_JACKDET_CTRL 0x705
#define WM8994_GPIO_7 0x706 #define WM8994_GPIO_7 0x706
#define WM8994_GPIO_8 0x707 #define WM8994_GPIO_8 0x707
#define WM8994_GPIO_9 0x708 #define WM8994_GPIO_9 0x708
...@@ -1852,6 +1853,9 @@ ...@@ -1852,6 +1853,9 @@
/* /*
* R57 (0x39) - AntiPOP (2) * R57 (0x39) - AntiPOP (2)
*/ */
#define WM1811_JACKDET_MODE_MASK 0x0180 /* JACKDET_MODE - [8:7] */
#define WM1811_JACKDET_MODE_SHIFT 7 /* JACKDET_MODE - [8:7] */
#define WM1811_JACKDET_MODE_WIDTH 2 /* JACKDET_MODE - [8:7] */
#define WM8994_MICB2_DISCH 0x0100 /* MICB2_DISCH */ #define WM8994_MICB2_DISCH 0x0100 /* MICB2_DISCH */
#define WM8994_MICB2_DISCH_MASK 0x0100 /* MICB2_DISCH */ #define WM8994_MICB2_DISCH_MASK 0x0100 /* MICB2_DISCH */
#define WM8994_MICB2_DISCH_SHIFT 8 /* MICB2_DISCH */ #define WM8994_MICB2_DISCH_SHIFT 8 /* MICB2_DISCH */
...@@ -4186,6 +4190,18 @@ ...@@ -4186,6 +4190,18 @@
#define WM8994_STL_SEL_SHIFT 0 /* STL_SEL */ #define WM8994_STL_SEL_SHIFT 0 /* STL_SEL */
#define WM8994_STL_SEL_WIDTH 1 /* STL_SEL */ #define WM8994_STL_SEL_WIDTH 1 /* STL_SEL */
/*
* R1797 (0x705) - JACKDET Ctrl
*/
#define WM1811_JACKDET_DB 0x0100 /* JACKDET_DB */
#define WM1811_JACKDET_DB_MASK 0x0100 /* JACKDET_DB */
#define WM1811_JACKDET_DB_SHIFT 8 /* JACKDET_DB */
#define WM1811_JACKDET_DB_WIDTH 1 /* JACKDET_DB */
#define WM1811_JACKDET_LVL 0x0040 /* JACKDET_LVL */
#define WM1811_JACKDET_LVL_MASK 0x0040 /* JACKDET_LVL */
#define WM1811_JACKDET_LVL_SHIFT 6 /* JACKDET_LVL */
#define WM1811_JACKDET_LVL_WIDTH 1 /* JACKDET_LVL */
/* /*
* R1824 (0x720) - Pull Control (1) * R1824 (0x720) - Pull Control (1)
*/ */
......
This diff is collapsed.
...@@ -85,6 +85,7 @@ struct wm8994_priv { ...@@ -85,6 +85,7 @@ struct wm8994_priv {
bool fll_locked_irq; bool fll_locked_irq;
int vmid_refcount; int vmid_refcount;
int active_refcount;
int dac_rates[2]; int dac_rates[2];
int lrclk_shared[2]; int lrclk_shared[2];
...@@ -126,10 +127,12 @@ struct wm8994_priv { ...@@ -126,10 +127,12 @@ struct wm8994_priv {
const char **enh_eq_texts; const char **enh_eq_texts;
struct soc_enum enh_eq_enum; struct soc_enum enh_eq_enum;
struct mutex accdet_lock;
struct wm8994_micdet micdet[2]; struct wm8994_micdet micdet[2];
bool mic_detecting; bool mic_detecting;
bool jack_mic; bool jack_mic;
int btn_mask; int btn_mask;
bool jackdet;
wm8958_micdet_cb jack_cb; wm8958_micdet_cb jack_cb;
void *jack_cb_data; void *jack_cb_data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment