Skip to content

Commit cd1707a

Browse files
committed
ASoC: Add platform data for WM8958/WM1811 microphone detection rates
Allow systems to override the default microphone detection rates using platform data in case the settings are not suitable (eg, due to an unusually noisy jack). Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
1 parent 52ac7ab commit cd1707a

2 files changed

Lines changed: 24 additions & 8 deletions

File tree

‎include/linux/mfd/wm8994/pdata.h‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,23 @@ struct wm8958_enh_eq_cfg {
113113
u16 regs[WM8958_ENH_EQ_REGS];
114114
};
115115

116+
/**
117+
* Microphone detection rates, used to tune response rates and power
118+
* consumption for WM8958/WM1811 microphone detection.
119+
*
120+
* @sysclk: System clock rate to use this configuration for.
121+
* @idle: True if this configuration should use when no accessory is detected,
122+
* false otherwise.
123+
* @start: Value for MICD_BIAS_START_TIME register field (not shifted).
124+
* @rate: Value for MICD_RATE register field (not shifted).
125+
*/
126+
struct wm8958_micd_rate {
127+
int sysclk;
128+
bool idle;
129+
int start;
130+
int rate;
131+
};
132+
116133
struct wm8994_pdata {
117134
int gpio_base;
118135

@@ -144,6 +161,9 @@ struct wm8994_pdata {
144161
int num_enh_eq_cfgs;
145162
struct wm8958_enh_eq_cfg *enh_eq_cfgs;
146163

164+
int num_micd_rates;
165+
struct wm8958_micd_rate *micd_rates;
166+
147167
/* LINEOUT can be differential or single ended */
148168
unsigned int lineout1_diff:1;
149169
unsigned int lineout2_diff:1;

‎sound/soc/codecs/wm8994.c‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,6 @@ static int wm8994_retune_mobile_base[] = {
6060

6161
static void wm8958_default_micdet(u16 status, void *data);
6262

63-
struct wm8958_micd_rate {
64-
int sysclk;
65-
bool idle;
66-
int start;
67-
int rate;
68-
};
69-
7063
static const struct wm8958_micd_rate micdet_rates[] = {
7164
{ 32768, true, 1, 4 },
7265
{ 32768, false, 1, 1 },
@@ -100,7 +93,10 @@ static void wm8958_micd_set_rate(struct snd_soc_codec *codec)
10093
else
10194
sysclk = wm8994->aifclk[0];
10295

103-
if (wm8994->jackdet) {
96+
if (wm8994->pdata && wm8994->pdata->micd_rates) {
97+
rates = wm8994->pdata->micd_rates;
98+
num_rates = wm8994->pdata->num_micd_rates;
99+
} else if (wm8994->jackdet) {
104100
rates = jackdet_rates;
105101
num_rates = ARRAY_SIZE(jackdet_rates);
106102
} else {

0 commit comments

Comments
 (0)