mfd: cpcap-whisper: Ignore the SE1 bit to detect host mode
authorBenoit Goby <benoit@android.com>
Wed, 11 Aug 2010 23:53:42 +0000 (16:53 -0700)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:33:41 +0000 (16:33 -0700)
The Nexus One data pins are in the SE1 state until vbus is powered.
Ignore the SE1 bit to fix host mode detection when a Nexus One is
attached.

Change-Id: Ia2314b26acdb1d20fa0a43812f88c232c919cba3
Signed-off-by: Benoit Goby <benoit@android.com>
drivers/mfd/cpcap-whisper.c

index f8225cf994c7a773e6ef9f86a063afa848157a00..22456bf5c7c81ebe8559001373a22a33709d45ea 100644 (file)
@@ -42,6 +42,7 @@
                             CPCAP_BIT_SESSVLD_S)
 
 #define SENSE_USB_HOST      (CPCAP_BIT_ID_GROUND_S)
+#define SENSE_USB_HOST_MASK (~CPCAP_BIT_SE1_S)
 
 #define SENSE_FACTORY       (CPCAP_BIT_ID_FLOAT_S  | \
                             CPCAP_BIT_ID_GROUND_S | \
@@ -403,7 +404,7 @@ static void whisper_det_work(struct work_struct *work)
 
                        /* Special handling of USB undetect. */
                        data->state = USB;
-               } else if (data->sense == SENSE_USB_HOST) {
+               } else if ((data->sense & SENSE_USB_HOST_MASK) == SENSE_USB_HOST) {
                        whisper_notify(data, CPCAP_ACCY_USB_HOST);
 
                        cpcap_irq_unmask(data->cpcap, CPCAP_IRQ_IDFLOAT);