Skip to content

Commit

Permalink
usb: core: hub: improve port over-current alert msg
Browse files Browse the repository at this point in the history
At the moment the port over-current message is
displayed only if the over-current condition is permanent.

But in case of permanent short-circuit or
over-current, some USB power-distribution switches
(such as the TPS20xx, etc.), after the over-current
detection and the consequent shutdown, return
in the normal state.

So, in these cases, the over-current error message
never appears.

To overcome this problem, the "over-current condition"
message is displayed even after some over-current events.

Signed-off-by: Flavio Suligoi <f.suligoi@asem.it>
  • Loading branch information
flavio-suligoi authored and intel-lab-lkp committed Oct 5, 2021
1 parent ae9a614 commit a1cd0a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions arch/arm64/boot/dts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ subdir-y += amlogic
subdir-y += apm
subdir-y += apple
subdir-y += arm
subdir-y += asem
subdir-y += bitmain
subdir-y += broadcom
subdir-y += cavium
Expand Down
5 changes: 3 additions & 2 deletions drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -5577,7 +5577,8 @@ static void port_event(struct usb_hub *hub, int port1)
msleep(100); /* Cool down */
hub_power_on(hub, true);
hub_port_status(hub, port1, &status, &unused);
if (status & USB_PORT_STAT_OVERCURRENT)
if ((status & USB_PORT_STAT_OVERCURRENT) ||
!(port_dev->over_current_count % 15))
dev_err(&port_dev->dev, "over-current condition\n");
}

Expand Down Expand Up @@ -5738,7 +5739,7 @@ static void hub_event(struct work_struct *work)
u16 status = 0;
u16 unused;

dev_dbg(hub_dev, "over-current change\n");
dev_info(hub_dev, "over-current change\n");
clear_hub_feature(hdev, C_HUB_OVER_CURRENT);
msleep(500); /* Cool down */
hub_power_on(hub, true);
Expand Down

0 comments on commit a1cd0a1

Please sign in to comment.