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/grunt | |
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/grunt')
-rw-r--r-- | board/grunt/board.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/board/grunt/board.c b/board/grunt/board.c index f60e3be18a..13e062589a 100644 --- a/board/grunt/board.c +++ b/board/grunt/board.c @@ -124,12 +124,14 @@ void board_update_sensor_config_from_sku(void) gpio_enable_interrupt(GPIO_6AXIS_INT_L); } -void board_overcurrent_event(int port) +void board_overcurrent_event(int port, int is_overcurrented) { enum gpio_signal signal = (port == 0) ? GPIO_USB_C0_OC_L : GPIO_USB_C1_OC_L; + /* Note that the levels are inverted because the pin is active low. */ + int lvl = is_overcurrented ? 0 : 1; - gpio_set_level(signal, 0); + gpio_set_level(signal, lvl); CPRINTS("p%d: overcurrent!", port); } |