Skip to content

Instantly share code, notes, and snippets.

@Simon-L
Created March 22, 2024 16:36
Show Gist options
  • Save Simon-L/858c3ad29179f9726eb4bc3aa91b61b5 to your computer and use it in GitHub Desktop.
Save Simon-L/858c3ad29179f9726eb4bc3aa91b61b5 to your computer and use it in GitHub Desktop.
[ 56.815142] dwc2 ff300000.usb: bound driver g_serial
[ 56.815153] dwc2 ff300000.usb: dwc2_hsotg_pullup: is_on: 1 op_state: 9
[ 56.815164] dwc2 ff300000.usb: --- SIMONL --- in host mode, return early from dwc2_hsotg_pullup
---
op_state: 9 -> OTG_STATE_A_HOST
static int dwc2_hsotg_pullup(struct usb_gadget *gadget, int is_on)
{
struct dwc2_hsotg *hsotg = to_hsotg(gadget);
unsigned long flags;
dev_dbg(hsotg->dev, "%s: is_on: %d op_state: %d\n", __func__, is_on,
hsotg->op_state);
/* Don't modify pullup state while in host mode */
if (hsotg->op_state != OTG_STATE_B_PERIPHERAL) {
dev_dbg(hsotg->dev, " --- SIMONL --- in host mode, return early from dwc2_hsotg_pullup \n");
hsotg->enabled = is_on;
return 0;
}
spin_lock_irqsave(&hsotg->lock, flags);
if (is_on) {
hsotg->enabled = 1;
dwc2_hsotg_core_init_disconnected(hsotg, false);
/* Enable ACG feature in device mode,if supported */
dwc2_enable_acg(hsotg);
dwc2_hsotg_core_connect(hsotg);
} else {
dwc2_hsotg_core_disconnect(hsotg);
dwc2_hsotg_disconnect(hsotg);
hsotg->enabled = 0;
}
hsotg->gadget.speed = USB_SPEED_UNKNOWN;
spin_unlock_irqrestore(&hsotg->lock, flags);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment