mfd: cpcap-whisper: Workaround for the enumeration issue
authorBenoit Goby <benoit@android.com>
Wed, 1 Sep 2010 00:40:25 +0000 (17:40 -0700)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:51:02 +0000 (16:51 -0700)
The Tegra root hub sometines does not enumarate the device when the OTG
cable is first inserted. Delaying the activation of vbus, to leave time
for the controller to initialize seems to fix the problem.

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

index 8fea1fa7525285435e5f1f5e75521f4eeea082a4..64c0bec0a7304bc78d758be871d7daf0153e59bc 100644 (file)
@@ -76,6 +76,7 @@ enum cpcap_det_state {
        IDENTIFY,
        IDENTIFY_WHISPER,
        USB,
+       USB_POWER,
        WHISPER,
        WHISPER_SMART,
 };
@@ -241,7 +242,6 @@ static int configure_hardware(struct cpcap_whisper_data *data,
        case CPCAP_ACCY_USB_HOST:
                retval |= cpcap_regacc_write(data->cpcap, CPCAP_REG_USBC1, 0,
                                             CPCAP_BIT_VBUSPD);
-               gpio_set_value(data->pdata->pwr_gpio, 1);
                gpio_set_value(data->pdata->data_gpio, 1);
                if (data->otg)
                        blocking_notifier_call_chain(&data->otg->notifier,
@@ -419,6 +419,9 @@ static void whisper_det_work(struct work_struct *work)
                        whisper_notify(data, CPCAP_ACCY_USB_HOST);
 
                        cpcap_irq_unmask(data->cpcap, CPCAP_IRQ_IDFLOAT);
+                       data->state = USB_POWER;
+                       schedule_delayed_work(&data->work,
+                                             msecs_to_jiffies(200));
                } else if ((data->sense == SENSE_WHISPER_SPD) ||
                           (data->sense == SENSE_WHISPER_PPD)) {
                        gpio_set_value(data->pdata->pwr_gpio, 1);
@@ -490,6 +493,11 @@ static void whisper_det_work(struct work_struct *work)
 
                break;
 
+       case USB_POWER:
+               gpio_set_value(data->pdata->pwr_gpio, 1);
+               data->state = CONFIG;
+               break;
+
        case WHISPER:
                get_sense(data);