summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown2011-12-01 14:44:25 +0100
committerMark Brown2011-12-01 15:22:01 +0100
commitcd1707a99a2cb43cd8ab0c1952b455b218f15884 (patch)
treebff5dbc48acb806834ce224f5e09c52ee4ca70e6
parentASoC: Ensure we reconfigure WM8958 microphone detection on rate changes (diff)
downloadkernel-qcow2-linux-cd1707a99a2cb43cd8ab0c1952b455b218f15884.tar.gz
kernel-qcow2-linux-cd1707a99a2cb43cd8ab0c1952b455b218f15884.tar.xz
kernel-qcow2-linux-cd1707a99a2cb43cd8ab0c1952b455b218f15884.zip
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>
-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 {
u16 regs[WM8958_ENH_EQ_REGS];
};
+/**
+ * Microphone detection rates, used to tune response rates and power
+ * consumption for WM8958/WM1811 microphone detection.
+ *
+ * @sysclk: System clock rate to use this configuration for.
+ * @idle: True if this configuration should use when no accessory is detected,
+ * false otherwise.
+ * @start: Value for MICD_BIAS_START_TIME register field (not shifted).
+ * @rate: Value for MICD_RATE register field (not shifted).
+ */
+struct wm8958_micd_rate {
+ int sysclk;
+ bool idle;
+ int start;
+ int rate;
+};
+
struct wm8994_pdata {
int gpio_base;
@@ -144,6 +161,9 @@ struct wm8994_pdata {
int num_enh_eq_cfgs;
struct wm8958_enh_eq_cfg *enh_eq_cfgs;
+ int num_micd_rates;
+ struct wm8958_micd_rate *micd_rates;
+
/* LINEOUT can be differential or single ended */
unsigned int lineout1_diff:1;
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[] = {
static void wm8958_default_micdet(u16 status, void *data);
-struct wm8958_micd_rate {
- int sysclk;
- bool idle;
- int start;
- int rate;
-};
-
static const struct wm8958_micd_rate micdet_rates[] = {
{ 32768, true, 1, 4 },
{ 32768, false, 1, 1 },
@@ -100,7 +93,10 @@ static void wm8958_micd_set_rate(struct snd_soc_codec *codec)
else
sysclk = wm8994->aifclk[0];
- if (wm8994->jackdet) {
+ if (wm8994->pdata && wm8994->pdata->micd_rates) {
+ rates = wm8994->pdata->micd_rates;
+ num_rates = wm8994->pdata->num_micd_rates;
+ } else if (wm8994->jackdet) {
rates = jackdet_rates;
num_rates = ARRAY_SIZE(jackdet_rates);
} else {