From 9a32d3d69824f94a930d34eb066031c2aa6d259f Mon Sep 17 00:00:00 2001 From: Shinya Kuribayashi Date: Thu, 10 May 2012 13:02:38 +0900 Subject: [PATCH] --- yaml --- r: 303935 b: refs/heads/master c: e44694e858ed000ef11ee37861c7f7c86d8ddbda h: refs/heads/master i: 303933: 49d084139d5b90dcb7fda8254b5efe9c37121bd7 303931: ce95532e493454aa557fa66ac82409f8e2c130a1 303927: 55bcee36d8fdc4a2406be8ff08be1790362efd64 303919: 82e5a34f8c54276583d78dcd78e3d312688b0633 303903: a9834b12f239a7a6e418248942d48b3259705320 303871: b70ed04012198cddc7d8eda33b99570c9215a21f v: v3 --- [refs] | 2 +- trunk/drivers/usb/otg/gpio_vbus.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index e73d78323075..f29ebf585178 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a6dc9cf76b9c39ccffe083f09f995ce2502f5773 +refs/heads/master: e44694e858ed000ef11ee37861c7f7c86d8ddbda diff --git a/trunk/drivers/usb/otg/gpio_vbus.c b/trunk/drivers/usb/otg/gpio_vbus.c index ac962acfbb18..bd6e755dd3d8 100644 --- a/trunk/drivers/usb/otg/gpio_vbus.c +++ b/trunk/drivers/usb/otg/gpio_vbus.c @@ -38,6 +38,7 @@ struct gpio_vbus_data { int vbus_draw_enabled; unsigned mA; struct delayed_work work; + int vbus; }; @@ -96,18 +97,24 @@ static void gpio_vbus_work(struct work_struct *work) struct gpio_vbus_data *gpio_vbus = container_of(work, struct gpio_vbus_data, work.work); struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data; - int gpio, status; + int gpio, status, vbus; if (!gpio_vbus->phy.otg->gadget) return; + vbus = is_vbus_powered(pdata); + if ((vbus ^ gpio_vbus->vbus) == 0) + return; + gpio_vbus->vbus = vbus; + /* Peripheral controllers which manage the pullup themselves won't have * gpio_pullup configured here. If it's configured here, we'll do what * isp1301_omap::b_peripheral() does and enable the pullup here... although * that may complicate usb_gadget_{,dis}connect() support. */ gpio = pdata->gpio_pullup; - if (is_vbus_powered(pdata)) { + + if (vbus) { status = USB_EVENT_VBUS; gpio_vbus->phy.state = OTG_STATE_B_PERIPHERAL; gpio_vbus->phy.last_event = status; @@ -195,6 +202,7 @@ static int gpio_vbus_set_peripheral(struct usb_otg *otg, dev_dbg(&pdev->dev, "registered gadget '%s'\n", gadget->name); /* initialize connection state */ + gpio_vbus->vbus = 0; /* start with disconnected */ gpio_vbus_irq(irq, pdev); return 0; }