aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/isp1704_charger.c
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@nokia.com>2010-11-08 05:22:40 -0500
committerAnton Vorontsov <cbouatmailru@gmail.com>2010-11-18 08:56:21 -0500
commite1a85694e08d03efae9e08fdb292dfd4870837bc (patch)
tree5909033ce66fa7f3ce108cb87e16fb1eadbf1da3 /drivers/power/isp1704_charger.c
parenta4607d9f5cbae1aad7f86e8204b57d66c0e14e36 (diff)
isp1704_charger: Detect charger after probe
If the device is booted up with cable connected, or the module is loaded after plugging in the cable, the notification has come and gone, so not relying on it at probe time. Instead this checks the VBUS level manually after probe. Signed-off-by: Heikki Krogerus <heikki.krogerus@nokia.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power/isp1704_charger.c')
-rw-r--r--drivers/power/isp1704_charger.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/power/isp1704_charger.c b/drivers/power/isp1704_charger.c
index 77c11f1d72e2..2ad9b14a5ce3 100644
--- a/drivers/power/isp1704_charger.c
+++ b/drivers/power/isp1704_charger.c
@@ -422,6 +422,23 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev)
422 422
423 dev_info(isp->dev, "registered with product id %s\n", isp->model); 423 dev_info(isp->dev, "registered with product id %s\n", isp->model);
424 424
425 /*
426 * Taking over the D+ pullup.
427 *
428 * FIXME: The device will be disconnected if it was already
429 * enumerated. The charger driver should be always loaded before any
430 * gadget is loaded.
431 */
432 if (isp->otg->gadget)
433 usb_gadget_disconnect(isp->otg->gadget);
434
435 /* Detect charger if VBUS is valid (the cable was already plugged). */
436 ret = otg_io_read(isp->otg, ULPI_USB_INT_STS);
437 if ((ret & ULPI_INT_VBUS_VALID) && !isp->otg->default_a) {
438 isp->event = USB_EVENT_VBUS;
439 schedule_work(&isp->work);
440 }
441
425 return 0; 442 return 0;
426fail2: 443fail2:
427 power_supply_unregister(&isp->psy); 444 power_supply_unregister(&isp->psy);