summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarthikeyan Ramasubramanian <kramasub@chromium.org>2019-01-14 13:05:11 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2019-01-22 16:49:42 +0000
commite6c83ae0444afcf318ddbc3be5b3cc3927473570 (patch)
tree3d8705f58597dddd88f79b41e1bd5e1ab5ad2514
parent4a7c01f7a6da9910db3d4068096ec3f7d06f175a (diff)
downloadchrome-ec-e6c83ae0444afcf318ddbc3be5b3cc3927473570.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> Reviewed-on: https://chromium-review.googlesource.com/c/1426149 Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org> Trybot-Ready: Karthikeyan Ramasubramanian <kramasub@chromium.org>
-rw-r--r--board/bobba/board.c10
-rw-r--r--board/casta/board.c9
-rw-r--r--board/fleex/board.c10
-rw-r--r--board/meep/board.c10
-rw-r--r--board/phaser/board.c10
-rw-r--r--board/yorp/board.c10
6 files changed, 59 insertions, 0 deletions
diff --git a/board/bobba/board.c b/board/bobba/board.c
index 1b6ba2feec..9e20943afe 100644
--- a/board/bobba/board.c
+++ b/board/bobba/board.c
@@ -321,3 +321,13 @@ void lid_angle_peripheral_enable(int enable)
keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE);
}
#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);
+}
diff --git a/board/casta/board.c b/board/casta/board.c
index 2f3344aede..968f67d369 100644
--- a/board/casta/board.c
+++ b/board/casta/board.c
@@ -131,3 +131,12 @@ void i2c_end_xfer_notify(int port, int slave_addr)
battery_last_i2c_time = get_time();
}
+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);
+}
diff --git a/board/fleex/board.c b/board/fleex/board.c
index 71cd4a6625..eba235f85b 100644
--- a/board/fleex/board.c
+++ b/board/fleex/board.c
@@ -278,3 +278,13 @@ static void update_gpios_from_board_id(void)
}
DECLARE_HOOK(HOOK_INIT, update_gpios_from_board_id, HOOK_PRIO_INIT_I2C + 1);
+
+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);
+}
diff --git a/board/meep/board.c b/board/meep/board.c
index 1993c535d7..df754ac8dd 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);
+}
diff --git a/board/phaser/board.c b/board/phaser/board.c
index 6d9637acbe..1efa2c41cd 100644
--- a/board/phaser/board.c
+++ b/board/phaser/board.c
@@ -300,3 +300,13 @@ static void board_chipset_suspend(void)
sb_quick_charge_mode(1);
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
+
+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);
+}
diff --git a/board/yorp/board.c b/board/yorp/board.c
index 48c8ca8a07..7c3bc7adae 100644
--- a/board/yorp/board.c
+++ b/board/yorp/board.c
@@ -240,3 +240,13 @@ static void post_old_board_warning(void)
}
DECLARE_HOOK(HOOK_INIT, post_old_board_warning, HOOK_PRIO_INIT_I2C + 1);
#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);
+}