usb: otg: TWL6030 Save the last event in otg_transceiver
authorHema HK <hemahk@ti.com>
Thu, 17 Feb 2011 06:36:09 +0000 (12:06 +0530)
committerFelipe Balbi <balbi@ti.com>
Fri, 18 Feb 2011 12:05:52 +0000 (14:05 +0200)
Save the last event in the otg_transceiver so that it can used in the
musb driver and gadget driver to configure the musb and enable the
vbus for host mode and OTG mode, if the device is connected during boot.

Signed-off-by: Hema HK <hemahk@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/otg/twl6030-usb.c
include/linux/usb/otg.h

index b4eda02..05f17b7 100644 (file)
@@ -262,11 +262,13 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
                        twl->otg.default_a = false;
                        twl->otg.state = OTG_STATE_B_IDLE;
                        twl->linkstat = status;
+                       twl->otg.last_event = status;
                        blocking_notifier_call_chain(&twl->otg.notifier,
                                                status, twl->otg.gadget);
                } else {
                        status = USB_EVENT_NONE;
                        twl->linkstat = status;
+                       twl->otg.last_event = status;
                        blocking_notifier_call_chain(&twl->otg.notifier,
                                                status, twl->otg.gadget);
                        if (twl->asleep) {
@@ -299,6 +301,7 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
                twl->otg.default_a = true;
                twl->otg.state = OTG_STATE_A_IDLE;
                twl->linkstat = status;
+               twl->otg.last_event = status;
                blocking_notifier_call_chain(&twl->otg.notifier, status,
                                                        twl->otg.gadget);
        } else  {
index a1a1e7a..da511ee 100644 (file)
@@ -66,6 +66,7 @@ struct otg_transceiver {
 
        u8                      default_a;
        enum usb_otg_state      state;
+       enum usb_xceiv_events   last_event;
 
        struct usb_bus          *host;
        struct usb_gadget       *gadget;