diff options
author | Karthikeyan Ramasubramanian <kramasub@chromium.org> | 2019-01-14 13:05:11 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-01-17 20:20:26 -0800 |
commit | 82dbe746f3e0da4b5000d6ff0934137338da2db2 (patch) | |
tree | 43ea3c498ef62fa0321eb5f63b33ce97ebba4f90 /board/meep | |
parent | b264288756ab77c2ef7950b19bcca99a15e2d5ce (diff) | |
download | chrome-ec-82dbe746f3e0da4b5000d6ff0934137338da2db2.tar.gz |
board/octopus: Notify SoC about USB overcurrent
Add board_overcurrent_event function to notify SoC about USB-C
overcurrent events.
BUG=b:115475862
BRANCH=octopus
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: I69fdc473a3489922517dc91fc1ea149aabca01cb
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1410142
Commit-Ready: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'board/meep')
-rw-r--r-- | board/meep/board.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/board/meep/board.c b/board/meep/board.c index 85831cd85e..591e8758b9 100644 --- a/board/meep/board.c +++ b/board/meep/board.c @@ -330,3 +330,13 @@ const int keyboard_factory_scan_pins[][2] = { const int keyboard_factory_scan_pins_used = ARRAY_SIZE(keyboard_factory_scan_pins); #endif + +void board_overcurrent_event(int port, int is_overcurrented) +{ + /* Sanity check the port. */ + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_COUNT)) + return; + + /* Note that the level is inverted because the pin is active low. */ + gpio_set_level(GPIO_USB_C_OC, !is_overcurrented); +} |