diff options
author | Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com> | 2012-05-09 21:31:21 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-05-14 12:01:50 -0400 |
commit | 934ccec4da14dc0586dfe08b36166364bdd2181b (patch) | |
tree | 4e1bf55b1f58924e587cbb170d0927fd677cf9be /drivers/usb | |
parent | 0d13eebcab76ff8f2b5e479747f66ffbf6c78b57 (diff) |
USB: gpio_vbus: provide an appropriate debounce interval
In commit c2344f13b59e007d782a3e591ebc551bc583a8b7 (USB: gpio_vbus:
add delayed vbus_session calls, 2009-01-24), usb_gadget_vbus_connect()
and ...disconnect() were extracted from the interrupt handler, so to
allow vbus_session handlers to deal with msleep() calls.
This patch takes the approach one step further.
USB2.0 specification (7.1.7.3 Connect and Disconnect Signaling) says
that the USB system software (shall) provide a debounce interval with
a minimum duration of 100 ms, which ensures that the electrical and
mechanical connection is stable before software attempts to reset
the attached device.
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/otg/gpio_vbus.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c index 5a13657ef077..66af743ec598 100644 --- a/drivers/usb/otg/gpio_vbus.c +++ b/drivers/usb/otg/gpio_vbus.c | |||
@@ -37,7 +37,7 @@ struct gpio_vbus_data { | |||
37 | struct regulator *vbus_draw; | 37 | struct regulator *vbus_draw; |
38 | int vbus_draw_enabled; | 38 | int vbus_draw_enabled; |
39 | unsigned mA; | 39 | unsigned mA; |
40 | struct work_struct work; | 40 | struct delayed_work work; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | 43 | ||
@@ -94,7 +94,7 @@ static int is_vbus_powered(struct gpio_vbus_mach_info *pdata) | |||
94 | static void gpio_vbus_work(struct work_struct *work) | 94 | static void gpio_vbus_work(struct work_struct *work) |
95 | { | 95 | { |
96 | struct gpio_vbus_data *gpio_vbus = | 96 | struct gpio_vbus_data *gpio_vbus = |
97 | container_of(work, struct gpio_vbus_data, work); | 97 | container_of(work, struct gpio_vbus_data, work.work); |
98 | struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data; | 98 | struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data; |
99 | int gpio, status; | 99 | int gpio, status; |
100 | 100 | ||
@@ -152,7 +152,7 @@ static irqreturn_t gpio_vbus_irq(int irq, void *data) | |||
152 | otg->gadget ? otg->gadget->name : "none"); | 152 | otg->gadget ? otg->gadget->name : "none"); |
153 | 153 | ||
154 | if (otg->gadget) | 154 | if (otg->gadget) |
155 | schedule_work(&gpio_vbus->work); | 155 | schedule_delayed_work(&gpio_vbus->work, msecs_to_jiffies(100)); |
156 | 156 | ||
157 | return IRQ_HANDLED; | 157 | return IRQ_HANDLED; |
158 | } | 158 | } |
@@ -300,7 +300,7 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) | |||
300 | 300 | ||
301 | ATOMIC_INIT_NOTIFIER_HEAD(&gpio_vbus->phy.notifier); | 301 | ATOMIC_INIT_NOTIFIER_HEAD(&gpio_vbus->phy.notifier); |
302 | 302 | ||
303 | INIT_WORK(&gpio_vbus->work, gpio_vbus_work); | 303 | INIT_DELAYED_WORK(&gpio_vbus->work, gpio_vbus_work); |
304 | 304 | ||
305 | gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); | 305 | gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); |
306 | if (IS_ERR(gpio_vbus->vbus_draw)) { | 306 | if (IS_ERR(gpio_vbus->vbus_draw)) { |