diff --git a/linux-5.10/hi3516dv300_patch/hi3516dv300.patch b/linux-5.10/hi3516dv300_patch/hi3516dv300.patch old mode 100644 new mode 100755 index 89b6ba05503a5151a355f324ff7a90c0ef3426e1..fea871666a7d71a4150af59b2f71d98e28bee35c --- a/linux-5.10/hi3516dv300_patch/hi3516dv300.patch +++ b/linux-5.10/hi3516dv300_patch/hi3516dv300.patch @@ -943,7 +943,7 @@ index 000000000..85a6c5c14 + interrupts = <0 27 4>; + interrupt-names = "peripheral"; + maximum-speed = "high-speed"; -+ dr_mode = "peripheral"; ++ dr_mode = "otg"; + }; +#endif + gpio_chip0: gpio_chip@120d0000 { @@ -53700,6 +53700,22 @@ index 95a9bae72..ad951a1a1 100644 message = "hub doesn't have any ports!"; ret = -ENODEV; goto fail; +diff --git a/drivers/usb/core/notify.c b/drivers/usb/core/notify.c +index e6143663778f..b507a25ce115 100644 +--- a/drivers/usb/core/notify.c ++++ b/drivers/usb/core/notify.c +@@ -66,3 +66,11 @@ void usb_notify_remove_bus(struct usb_bus *ubus) + { + blocking_notifier_call_chain(&usb_notifier_list, USB_BUS_REMOVE, ubus); + } ++void usb_notify_online_status(bool online) ++{ ++ if (online) { ++ blocking_notifier_call_chain(&usb_notifier_list, USB_GADGET_ADD, NULL); ++ } else { ++ blocking_notifier_call_chain(&usb_notifier_list, USB_GADGET_REMOVE, NULL); ++ } ++} diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile index ae86da0dc..9abca9a8a 100644 --- a/drivers/usb/dwc3/Makefile @@ -54794,7 +54810,28 @@ index b75fe568096f..c0f71fd32c77 for (epnum = 0; epnum < total; epnum++) { int ret; -@@ -3892,6 +4017,7 @@ int dwc3_gadget_init(struct dwc3 *dwc) +@@ -3640,6 +3765,7 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc, + break; + case DWC3_DEVICE_EVENT_CONNECT_DONE: + dwc3_gadget_conndone_interrupt(dwc); ++ usb_notify_online_status(true); + break; + case DWC3_DEVICE_EVENT_WAKEUP: + dwc3_gadget_wakeup_interrupt(dwc); +@@ -3661,9 +3787,11 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc, + * Ignore suspend event until the gadget enters into + * USB_STATE_CONFIGURED state. + */ +- if (dwc->gadget->state >= USB_STATE_CONFIGURED) ++ if (dwc->gadget->state >= USB_STATE_CONFIGURED) { + dwc3_gadget_suspend_interrupt(dwc, + event->event_info); ++ usb_notify_online_status(false); ++ } + } + break; + case DWC3_DEVICE_EVENT_SOF: +@@ -3892,6 +4020,7 @@ int dwc3_gadget_init(struct dwc3 *dwc) goto err3; } @@ -58524,6 +58561,22 @@ index a14797760..2c35430e2 100644 + #endif /* __ASSEMBLY__ */ #endif /* _LINUX_TYPES_H */ +diff --git a/include/linux/usb.h b/include/linux/usb.h +index d6a41841b93e..de3232ee5bf2 100644 +--- a/include/linux/usb.h ++++ b/include/linux/usb.h +@@ -2019,8 +2019,11 @@ static inline int usb_translate_errors(int error_code) + #define USB_DEVICE_REMOVE 0x0002 + #define USB_BUS_ADD 0x0003 + #define USB_BUS_REMOVE 0x0004 ++#define USB_GADGET_ADD 0x0005 ++#define USB_GADGET_REMOVE 0x0006 + extern void usb_register_notify(struct notifier_block *nb); + extern void usb_unregister_notify(struct notifier_block *nb); ++extern void usb_notify_online_status(bool online); + + /* debugfs stuff */ + extern struct dentry *usb_debug_root; diff --git a/include/uapi/linux/i2c-dev.h b/include/uapi/linux/i2c-dev.h index 85f8047af..3f50287f3 100644 --- a/include/uapi/linux/i2c-dev.h