summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/wm8994.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-11-22 15:44:32 +0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-03 11:34:12 +0400
commit63dd54521f1d143fbc6584ace66ef264a7f867f7 (patch)
treec7cc350894650771f79b95f6729b275b34d17de1 /sound/soc/codecs/wm8994.c
parent78b76dbec8da6437e30519e6bbe4fb44d798addf (diff)
downloadlinux-63dd54521f1d143fbc6584ace66ef264a7f867f7.tar.xz
ASoC: wm8994: Support custom accessory identification for WM1811A
Allow the user to override the accessory identification code with their own implementation if the system provides an alternative method. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm8994.c')
-rw-r--r--sound/soc/codecs/wm8994.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 4cd1b6cdb34f..1dcccdbbc8b6 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -3504,15 +3504,20 @@ static void wm1811_mic_work(struct work_struct *work)
dev_dbg(codec->dev, "Starting mic detection\n");
- /*
- * Start off measument of microphone impedence to find out
- * what's actually there.
- */
- wm8994->mic_detecting = true;
- wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_MIC);
+ /* Use a user-supplied callback if we have one */
+ if (wm8994->micd_cb) {
+ wm8994->micd_cb(wm8994->micd_cb_data);
+ } else {
+ /*
+ * Start off measument of microphone impedence to find out
+ * what's actually there.
+ */
+ wm8994->mic_detecting = true;
+ wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_MIC);
- snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
- WM8958_MICD_ENA, WM8958_MICD_ENA);
+ snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
+ WM8958_MICD_ENA, WM8958_MICD_ENA);
+ }
mutex_unlock(&wm8994->accdet_lock);
@@ -3624,7 +3629,7 @@ 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,
- wm8958_micdet_cb cb, void *cb_data)
+ wm1811_micdet_cb cb, void *cb_data)
{
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
struct wm8994 *control = wm8994->wm8994;
@@ -3639,17 +3644,18 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
}
if (jack) {
- /* No longer supported */
- if (cb)
- return -EINVAL;
-
snd_soc_dapm_force_enable_pin(&codec->dapm, "CLK_SYS");
snd_soc_dapm_sync(&codec->dapm);
wm8994->micdet[0].jack = jack;
- wm8994->mic_detecting = true;
- wm8994->jack_mic = false;
+ if (cb) {
+ wm8994->micd_cb = cb;
+ wm8994->micd_cb_data = cb_data;
+ } else {
+ wm8994->mic_detecting = true;
+ wm8994->jack_mic = false;
+ }
wm8958_micd_set_rate(codec);