.. | .. |
---|
42 | 42 | |
---|
43 | 43 | struct power_supply_desc desc; |
---|
44 | 44 | struct power_supply *charger; |
---|
| 45 | + bool initial_detection; |
---|
45 | 46 | }; |
---|
46 | 47 | |
---|
47 | 48 | /* |
---|
.. | .. |
---|
86 | 87 | dev_dbg(info->dev, "role %d/%d, gpios: id %d, vbus %d\n", |
---|
87 | 88 | info->last_role, role, id, vbus); |
---|
88 | 89 | |
---|
89 | | - if (info->last_role == role) { |
---|
| 90 | + if (!info->initial_detection && info->last_role == role) { |
---|
90 | 91 | dev_warn(info->dev, "repeated role: %d\n", role); |
---|
91 | 92 | return; |
---|
92 | 93 | } |
---|
| 94 | + |
---|
| 95 | + info->initial_detection = false; |
---|
93 | 96 | |
---|
94 | 97 | if (info->last_role == USB_ROLE_HOST && info->vbus) |
---|
95 | 98 | regulator_disable(info->vbus); |
---|
.. | .. |
---|
278 | 281 | device_set_wakeup_capable(&pdev->dev, true); |
---|
279 | 282 | |
---|
280 | 283 | /* Perform initial detection */ |
---|
| 284 | + info->initial_detection = true; |
---|
281 | 285 | usb_conn_queue_dwork(info, 0); |
---|
282 | 286 | |
---|
283 | 287 | return 0; |
---|