hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/usb/common/usb-conn-gpio.c
....@@ -42,6 +42,7 @@
4242
4343 struct power_supply_desc desc;
4444 struct power_supply *charger;
45
+ bool initial_detection;
4546 };
4647
4748 /*
....@@ -86,10 +87,12 @@
8687 dev_dbg(info->dev, "role %d/%d, gpios: id %d, vbus %d\n",
8788 info->last_role, role, id, vbus);
8889
89
- if (info->last_role == role) {
90
+ if (!info->initial_detection && info->last_role == role) {
9091 dev_warn(info->dev, "repeated role: %d\n", role);
9192 return;
9293 }
94
+
95
+ info->initial_detection = false;
9396
9497 if (info->last_role == USB_ROLE_HOST && info->vbus)
9598 regulator_disable(info->vbus);
....@@ -278,6 +281,7 @@
278281 device_set_wakeup_capable(&pdev->dev, true);
279282
280283 /* Perform initial detection */
284
+ info->initial_detection = true;
281285 usb_conn_queue_dwork(info, 0);
282286
283287 return 0;