diff options
author | Aseda Aboagye <aaboagye@google.com> | 2017-12-04 15:14:33 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-01-17 20:20:26 -0800 |
commit | b264288756ab77c2ef7950b19bcca99a15e2d5ce (patch) | |
tree | 3f00ada91c2adc40fc14709670950a08cec3286d /board/cheza | |
parent | 66d7782a7b20fd974b18baeefb5e79feae80fb40 (diff) | |
download | chrome-ec-b264288756ab77c2ef7950b19bcca99a15e2d5ce.tar.gz |
USB PD: PPC: Add overcurrent handling.
The Type-C Power Path Controllers provide overcurrent protection. This
commit adds support into the USB PD task for overcurrent events while we
are in source role. The USB PD 3.0 spec recommends that ports issue a
hard reset when an overcurrent condition occurs on a port.
Additionally, we'll allow a source port to overcurrent 3 times before
latching off VBUS from the port entirely. The source path will be
re-enabled after ~1s after each overcurrent event.
BUG=b:69935262,b:114680657
BRANCH=None
TEST=Boot to ChromeOS in grabbiter. No overcurrent events reported when
the sink is drawing <= 3.20 A. Overcurrent events are reported when the
sink is drawing > 3.25 A. After 3 reports, the port is latched off and
power delivery is stopped. The port is re-enabled only after the sink is
disconnected. Also when the sink is drawing current at 3.24 A, there is
one report of overcurrent. The port gets disabled in response to that
event. But the port is re-enabled after 1 second since overcurrent event
is reported only once. After the port is re-enabled, the sink is able to
draw the set current. When the overcurrent event is reported, I can see in
the kernel logs that the overcurrent condition is detected by the kernel.
EC Logs:
[3391.984462 C1: PPC detected Vbus overcurrent!]
[3391.984953 C1: overcurrent!]
[3392.044935 C1: PPC detected Vbus overcurrent!]
[3392.045425 C1: overcurrent!]
[3392.061404 C1: PPC detected Vbus overcurrent!]
[3392.061894 C1: overcurrent!]
[3392.062142 C1: OC event limit reached! Source path disabled until
physical disconnect.]
[3392.077226 C1: PPC detected Vbus overcurrent!]
[3392.077532 C1: overcurrent!]
[3392.077891 C1: OC event limit reached! Source path disabled until
physical disconnect.]
[3392.092660 C1: PPC detected Vbus overcurrent!]
[3392.092966 C1: overcurrent!]
[3392.093213 C1: OC event limit reached! Source path disabled until
physical disconnect.]
Kernel Logs:
[ 3356.560456] usb usb2-port1: over-current condition
[ 3356.768434] usb usb2-port2: over-current condition
[ 3356.976446] usb usb2-port4: over-current condition
[ 3357.184441] usb usb2-port5: over-current condition
[ 3357.392445] usb usb2-port6: over-current condition
Change-Id: Ib070f261e98264cd88725ebce7d10e0798267e3b
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/1286300
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Commit-Queue: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/807633
Commit-Ready: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/cheza')
-rw-r--r-- | board/cheza/board.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/board/cheza/board.c b/board/cheza/board.c index fffdedf707..66121fc3bb 100644 --- a/board/cheza/board.c +++ b/board/cheza/board.c @@ -129,7 +129,7 @@ static void ppc_interrupt(enum gpio_signal signal) static void usb1_oc_evt_deferred(void) { /* Only port-1 has overcurrent GPIO interrupt */ - board_overcurrent_event(0); + board_overcurrent_event(0, 1); } DECLARE_DEFERRED(usb1_oc_evt_deferred); @@ -509,7 +509,7 @@ int board_is_sourcing_vbus(int port) return EC_ERROR_INVAL; } -void board_overcurrent_event(int port) +void board_overcurrent_event(int port, int is_overcurrented) { /* TODO(b/120231371): Notify AP */ CPRINTS("p%d: overcurrent!", port); |