Commit 7bb4fdc6 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde Committed by Felipe Balbi

USB: ci13xxx_udc: make suspend and resume in gadget driver optional

Some gadget drivers don't implement suspend and/or resume functions.
Instead of changing the gadget drivers, make suspend and resume in
ci13xxx_udc (following other udc drivers) optional.
Tested-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent dc47ce90
...@@ -2563,9 +2563,7 @@ static int ci13xxx_start(struct usb_gadget_driver *driver, ...@@ -2563,9 +2563,7 @@ static int ci13xxx_start(struct usb_gadget_driver *driver,
if (driver == NULL || if (driver == NULL ||
bind == NULL || bind == NULL ||
driver->setup == NULL || driver->setup == NULL ||
driver->disconnect == NULL || driver->disconnect == NULL)
driver->suspend == NULL ||
driver->resume == NULL)
return -EINVAL; return -EINVAL;
else if (udc == NULL) else if (udc == NULL)
return -ENODEV; return -ENODEV;
...@@ -2693,8 +2691,6 @@ static int ci13xxx_stop(struct usb_gadget_driver *driver) ...@@ -2693,8 +2691,6 @@ static int ci13xxx_stop(struct usb_gadget_driver *driver)
driver->unbind == NULL || driver->unbind == NULL ||
driver->setup == NULL || driver->setup == NULL ||
driver->disconnect == NULL || driver->disconnect == NULL ||
driver->suspend == NULL ||
driver->resume == NULL ||
driver != udc->driver) driver != udc->driver)
return -EINVAL; return -EINVAL;
...@@ -2793,7 +2789,7 @@ static irqreturn_t udc_irq(void) ...@@ -2793,7 +2789,7 @@ static irqreturn_t udc_irq(void)
isr_statistics.pci++; isr_statistics.pci++;
udc->gadget.speed = hw_port_is_high_speed() ? udc->gadget.speed = hw_port_is_high_speed() ?
USB_SPEED_HIGH : USB_SPEED_FULL; USB_SPEED_HIGH : USB_SPEED_FULL;
if (udc->suspended) { if (udc->suspended && udc->driver->resume) {
spin_unlock(udc->lock); spin_unlock(udc->lock);
udc->driver->resume(&udc->gadget); udc->driver->resume(&udc->gadget);
spin_lock(udc->lock); spin_lock(udc->lock);
...@@ -2807,7 +2803,8 @@ static irqreturn_t udc_irq(void) ...@@ -2807,7 +2803,8 @@ static irqreturn_t udc_irq(void)
isr_tr_complete_handler(udc); isr_tr_complete_handler(udc);
} }
if (USBi_SLI & intr) { if (USBi_SLI & intr) {
if (udc->gadget.speed != USB_SPEED_UNKNOWN) { if (udc->gadget.speed != USB_SPEED_UNKNOWN &&
udc->driver->suspend) {
udc->suspended = 1; udc->suspended = 1;
spin_unlock(udc->lock); spin_unlock(udc->lock);
udc->driver->suspend(&udc->gadget); udc->driver->suspend(&udc->gadget);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment