int usb_event_enable(maxusb_event_t event, int (*func)(maxusb_event_t, void *), void *cbdata) { if ( (event >= MAXUSB_NUM_EVENTS) || (func == NULL) ) { return -1; } callback[event].func = func; callback[event].cbdata = cbdata; usb_irq_enable(event); return 0; }
static void twl4030_phy_resume(void) { struct twl4030_usb *twl = the_transceiver; if (!twl->asleep) return; /* enable falling edge interrupt to detect cable detach */ usb_irq_enable(0, 1); twl4030_phy_power(twl, 1); twl4030_i2c_access(1); twl4030_usb_set_mode(twl, twl->usb_mode); if (twl->usb_mode == T2_USB_MODE_ULPI) twl4030_i2c_access(0); twl->asleep = 0; return; }
static void twl4030_phy_suspend(int controller_off) { struct twl4030_usb *twl = the_transceiver; if (controller_off) usb_irq_disable(); if (twl->asleep) return; if (!controller_off) /* enable rising edge interrupt to detect cable attach */ usb_irq_enable(1, 0); twl4030_phy_power(twl, 0); twl->asleep = 1; return; }