aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/codecs/wm8994.c22
-rw-r--r--sound/soc/codecs/wm8994.h6
-rw-r--r--sound/soc/samsung/littlemill.c2
3 files changed, 22 insertions, 8 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
3435static void wm8958_mic_id(struct snd_soc_codec *codec, u16 status) 3435static 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 */
3631int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, 3632int 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
diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h
index 1a6bb4ed08f8..46a7bdb7d255 100644
--- a/sound/soc/codecs/wm8994.h
+++ b/sound/soc/codecs/wm8994.h
@@ -40,11 +40,13 @@ enum wm8994_vmid_mode {
40}; 40};
41 41
42typedef void (*wm1811_micdet_cb)(void *data); 42typedef void (*wm1811_micdet_cb)(void *data);
43typedef void (*wm1811_mic_id_cb)(void *data, u16 status);
43 44
44int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, 45int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
45 int micbias); 46 int micbias);
46int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, 47int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
47 wm1811_micdet_cb cb, void *cb_data); 48 wm1811_micdet_cb cb, void *det_cb_data,
49 wm1811_mic_id_cb id_cb, void *id_cb_data);
48 50
49int wm8994_vmid_mode(struct snd_soc_codec *codec, enum wm8994_vmid_mode mode); 51int wm8994_vmid_mode(struct snd_soc_codec *codec, enum wm8994_vmid_mode mode);
50 52
@@ -140,6 +142,8 @@ struct wm8994_priv {
140 int micdet_irq; 142 int micdet_irq;
141 wm1811_micdet_cb micd_cb; 143 wm1811_micdet_cb micd_cb;
142 void *micd_cb_data; 144 void *micd_cb_data;
145 wm1811_mic_id_cb mic_id_cb;
146 void *mic_id_cb_data;
143 147
144 int revision; 148 int revision;
145 149
diff --git a/sound/soc/samsung/littlemill.c b/sound/soc/samsung/littlemill.c
index ee52c8a00779..7beb6d9b57a8 100644
--- a/sound/soc/samsung/littlemill.c
+++ b/sound/soc/samsung/littlemill.c
@@ -270,7 +270,7 @@ static int littlemill_late_probe(struct snd_soc_card *card)
270 return ret; 270 return ret;
271 271
272 /* This will check device compatibility itself */ 272 /* This will check device compatibility itself */
273 wm8958_mic_detect(codec, &littlemill_headset, NULL, NULL); 273 wm8958_mic_detect(codec, &littlemill_headset, NULL, NULL, NULL, NULL);
274 274
275 /* As will this */ 275 /* As will this */
276 wm8994_mic_detect(codec, &littlemill_headset, 1); 276 wm8994_mic_detect(codec, &littlemill_headset, 1);