aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/mfd/wm8994/pdata.h20
-rw-r--r--sound/soc/codecs/wm8994.c12
2 files changed, 24 insertions, 8 deletions
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index 195ade95af38..5256f1f41d7f 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -113,6 +113,23 @@ struct wm8958_enh_eq_cfg {
113 u16 regs[WM8958_ENH_EQ_REGS]; 113 u16 regs[WM8958_ENH_EQ_REGS];
114}; 114};
115 115
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 */
126struct wm8958_micd_rate {
127 int sysclk;
128 bool idle;
129 int start;
130 int rate;
131};
132
116struct wm8994_pdata { 133struct wm8994_pdata {
117 int gpio_base; 134 int gpio_base;
118 135
@@ -144,6 +161,9 @@ struct wm8994_pdata {
144 int num_enh_eq_cfgs; 161 int num_enh_eq_cfgs;
145 struct wm8958_enh_eq_cfg *enh_eq_cfgs; 162 struct wm8958_enh_eq_cfg *enh_eq_cfgs;
146 163
164 int num_micd_rates;
165 struct wm8958_micd_rate *micd_rates;
166
147 /* LINEOUT can be differential or single ended */ 167 /* LINEOUT can be differential or single ended */
148 unsigned int lineout1_diff:1; 168 unsigned int lineout1_diff:1;
149 unsigned int lineout2_diff:1; 169 unsigned int lineout2_diff:1;
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 91f3638ab33f..6bdf8137c7e8 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -60,13 +60,6 @@ static int wm8994_retune_mobile_base[] = {
60 60
61static void wm8958_default_micdet(u16 status, void *data); 61static void wm8958_default_micdet(u16 status, void *data);
62 62
63struct wm8958_micd_rate {
64 int sysclk;
65 bool idle;
66 int start;
67 int rate;
68};
69
70static const struct wm8958_micd_rate micdet_rates[] = { 63static const struct wm8958_micd_rate micdet_rates[] = {
71 { 32768, true, 1, 4 }, 64 { 32768, true, 1, 4 },
72 { 32768, false, 1, 1 }, 65 { 32768, false, 1, 1 },
@@ -100,7 +93,10 @@ static void wm8958_micd_set_rate(struct snd_soc_codec *codec)
100 else 93 else
101 sysclk = wm8994->aifclk[0]; 94 sysclk = wm8994->aifclk[0];
102 95
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) {
104 rates = jackdet_rates; 100 rates = jackdet_rates;
105 num_rates = ARRAY_SIZE(jackdet_rates); 101 num_rates = ARRAY_SIZE(jackdet_rates);
106 } else { 102 } else {