diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-03 16:14:37 +0900 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-03 16:35:00 +0900 |
commit | 98869f68f2f68a9f238f5e96dbc3f838a0ff7136 (patch) | |
tree | 9a0106eb3566f381ec63073e1a4115cbe61069c0 /sound/soc/codecs/wm8994.c | |
parent | e874de436f6c7ddbcca1e1fb7edd4d05ad274048 (diff) | |
download | op-kernel-dev-98869f68f2f68a9f238f5e96dbc3f838a0ff7136.zip op-kernel-dev-98869f68f2f68a9f238f5e96dbc3f838a0ff7136.tar.gz |
ASoC: wm8994: Allow microphone identification callback to be overridden
Allow custom accessory identification mechanisms to make use of the MICDET
support in the device.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm8994.c')
-rw-r--r-- | sound/soc/codecs/wm8994.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index fdef56c..8241100 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -3432,8 +3432,9 @@ static void wm8958_button_det(struct snd_soc_codec *codec, u16 status) wm8994->btn_mask); } -static void wm8958_mic_id(struct snd_soc_codec *codec, u16 status) +static void wm8958_mic_id(void *data, u16 status) { + struct snd_soc_codec *codec = data; struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); /* Either nothing present or just starting detection */ @@ -3629,7 +3630,8 @@ static void wm1811_jackdet_bootstrap(struct work_struct *work) * detection algorithm. */ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, - wm1811_micdet_cb cb, void *cb_data) + wm1811_micdet_cb det_cb, void *det_cb_data, + wm1811_mic_id_cb id_cb, void *id_cb_data) { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994 *control = wm8994->wm8994; @@ -3649,14 +3651,22 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, wm8994->micdet[0].jack = jack; - if (cb) { - wm8994->micd_cb = cb; - wm8994->micd_cb_data = cb_data; + if (det_cb) { + wm8994->micd_cb = det_cb; + wm8994->micd_cb_data = det_cb_data; } else { wm8994->mic_detecting = true; wm8994->jack_mic = false; } + if (id_cb) { + wm8994->mic_id_cb = id_cb; + wm8994->mic_id_cb_data = id_cb_data; + } else { + wm8994->mic_id_cb = wm8958_mic_id; + wm8994->mic_id_cb_data = codec; + } + wm8958_micd_set_rate(codec); /* Detect microphones and short circuits by default */ @@ -3768,7 +3778,7 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data) } if (wm8994->mic_detecting) - wm8958_mic_id(codec, reg); + wm8994->mic_id_cb(wm8994->mic_id_cb_data, reg); else wm8958_button_det(codec, reg); |