ASoC: sn95031: Add headset detection code in new soc dirver
authorbingx.deng <bingx.deng@intel.com>
Thu, 6 Oct 2011 15:18:23 +0000 (16:18 +0100)
committermgross <mark.gross@intel.com>
Wed, 9 Nov 2011 21:16:25 +0000 (13:16 -0800)
It use switch driver to report headset insert/remove event.

Change-Id: I482da8d5982acf0c822e99c983e1437140f350d4
Signed-off-by: bingx.deng <bingx.deng@intel.com>
sound/soc/codecs/sn95031.c
sound/soc/codecs/sn95031.h

index a74a807..dbdebd7 100644 (file)
@@ -1090,6 +1090,16 @@ void sn95031_jack_detection(struct mfld_jack_data *jack_data)
        }
 
        snd_soc_jack_report(jack_data->mfld_jack, status, mask);
+#ifdef CONFIG_SWITCH_MID
+       if (status) {
+               if (status == SND_JACK_HEADPHONE)
+                       mid_headset_report((1<<1));
+               else if (status == SND_JACK_HEADSET)
+                       mid_headset_report(1);
+       } else {
+                       mid_headset_report(0);
+       }
+#endif
        /*button pressed and released so we send explicit button release */
        if ((status & SND_JACK_BTN_0) | (status & SND_JACK_BTN_1))
                snd_soc_jack_report(jack_data->mfld_jack,
index 3e2195e..a17718c 100644 (file)
@@ -136,5 +136,8 @@ struct mfld_jack_data {
 };
 
 extern void sn95031_jack_detection(struct mfld_jack_data *jack_data);
+#ifdef CONFIG_SWITCH_MID
+extern void mid_headset_report(int state);
+#endif
 
 #endif