diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-03 02:14:37 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-03 02:35:00 -0500 |
commit | 98869f68f2f68a9f238f5e96dbc3f838a0ff7136 (patch) | |
tree | 9a0106eb3566f381ec63073e1a4115cbe61069c0 /sound/soc/codecs/wm8994.c | |
parent | e874de436f6c7ddbcca1e1fb7edd4d05ad274048 (diff) |
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 fdef56c1320b..82411009d401 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) | |||
3432 | wm8994->btn_mask); | 3432 | wm8994->btn_mask); |
3433 | } | 3433 | } |
3434 | 3434 | ||
3435 | static void wm8958_mic_id(struct snd_soc_codec *codec, u16 status) | 3435 | static void wm8958_mic_id(void *data, u16 status) |
3436 | { | 3436 | { |
3437 | struct snd_soc_codec *codec = data; | ||
3437 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 3438 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
3438 | 3439 | ||
3439 | /* Either nothing present or just starting detection */ | 3440 | /* Either nothing present or just starting detection */ |
@@ -3629,7 +3630,8 @@ static void wm1811_jackdet_bootstrap(struct work_struct *work) | |||
3629 | * detection algorithm. | 3630 | * detection algorithm. |
3630 | */ | 3631 | */ |
3631 | int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | 3632 | int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, |
3632 | wm1811_micdet_cb cb, void *cb_data) | 3633 | wm1811_micdet_cb det_cb, void *det_cb_data, |
3634 | wm1811_mic_id_cb id_cb, void *id_cb_data) | ||
3633 | { | 3635 | { |
3634 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 3636 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
3635 | struct wm8994 *control = wm8994->wm8994; | 3637 | struct wm8994 *control = wm8994->wm8994; |
@@ -3649,14 +3651,22 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
3649 | 3651 | ||
3650 | wm8994->micdet[0].jack = jack; | 3652 | wm8994->micdet[0].jack = jack; |
3651 | 3653 | ||
3652 | if (cb) { | 3654 | if (det_cb) { |
3653 | wm8994->micd_cb = cb; | 3655 | wm8994->micd_cb = det_cb; |
3654 | wm8994->micd_cb_data = cb_data; | 3656 | wm8994->micd_cb_data = det_cb_data; |
3655 | } else { | 3657 | } else { |
3656 | wm8994->mic_detecting = true; | 3658 | wm8994->mic_detecting = true; |
3657 | wm8994->jack_mic = false; | 3659 | wm8994->jack_mic = false; |
3658 | } | 3660 | } |
3659 | 3661 | ||
3662 | if (id_cb) { | ||
3663 | wm8994->mic_id_cb = id_cb; | ||
3664 | wm8994->mic_id_cb_data = id_cb_data; | ||
3665 | } else { | ||
3666 | wm8994->mic_id_cb = wm8958_mic_id; | ||
3667 | wm8994->mic_id_cb_data = codec; | ||
3668 | } | ||
3669 | |||
3660 | wm8958_micd_set_rate(codec); | 3670 | wm8958_micd_set_rate(codec); |
3661 | 3671 | ||
3662 | /* Detect microphones and short circuits by default */ | 3672 | /* Detect microphones and short circuits by default */ |
@@ -3768,7 +3778,7 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data) | |||
3768 | } | 3778 | } |
3769 | 3779 | ||
3770 | if (wm8994->mic_detecting) | 3780 | if (wm8994->mic_detecting) |
3771 | wm8958_mic_id(codec, reg); | 3781 | wm8994->mic_id_cb(wm8994->mic_id_cb_data, reg); |
3772 | else | 3782 | else |
3773 | wm8958_button_det(codec, reg); | 3783 | wm8958_button_det(codec, reg); |
3774 | 3784 | ||