summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChromeOS Developer <dparker@chromium.org>2014-03-05 12:32:04 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-03-05 23:15:06 +0000
commit4c9c03a0e7f0f04c9e31f38af857b4e300449512 (patch)
tree51fe3bb14be3aed7b10033d59f8064b4eebef5bc
parent1186deb67fbd1dc1b4d4a704b0cc2ccb8e4b7534 (diff)
downloadchrome-ec-4c9c03a0e7f0f04c9e31f38af857b4e300449512.tar.gz
Peppy: Shutdown immediately if PP5000 rail goes bad in S0.
BUG=chrome-os-partner:25833 BRANCH=peppy TEST=Trip the PP5000 VR by over-volting the rail. Verify that system shuts down rather than the EC becoming unresponsive in a semi-hibernated state. Change-Id: I1fd6e9aa7f15385797188720222802266ce2a72c Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/188886 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--common/chipset_x86_common.c14
-rw-r--r--common/usb_port_power_dumb.c2
-rw-r--r--include/usb_charge.h5
3 files changed, 20 insertions, 1 deletions
diff --git a/common/chipset_x86_common.c b/common/chipset_x86_common.c
index 2704dd143c..1652564df4 100644
--- a/common/chipset_x86_common.c
+++ b/common/chipset_x86_common.c
@@ -15,6 +15,7 @@
#include "system.h"
#include "task.h"
#include "timer.h"
+#include "usb_charge.h"
#include "util.h"
/* Console output macros */
@@ -333,6 +334,19 @@ DECLARE_HOOK(HOOK_AC_CHANGE, x86_ac_change, HOOK_PRIO_DEFAULT);
void x86_interrupt(enum gpio_signal signal)
{
+#ifdef BOARD_peppy
+ /* Catch the PP5000 rail going down in S0 quicky as it is likely the
+ * PP3300_EC rail is going down with it. (http://crosbug.com/p/25833)
+ */
+ if (signal == GPIO_PP5000_PGOOD && (gpio_get_level(signal) == 0) &&
+ chipset_in_state(CHIPSET_STATE_ON)) {
+ usb_port_all_ports_off();
+ CPRINTF("[%T Disabled USB ports and triggering shutdown]\n");
+ chipset_force_shutdown();
+ return;
+ }
+#endif
+
/* Shadow signals and compare with our desired signal state. */
x86_update_signals();
diff --git a/common/usb_port_power_dumb.c b/common/usb_port_power_dumb.c
index 62ac0732f6..3a5efdcd03 100644
--- a/common/usb_port_power_dumb.c
+++ b/common/usb_port_power_dumb.c
@@ -44,7 +44,7 @@ static void usb_port_all_ports_on(void)
usb_port_set_enabled(1, 1);
}
-static void usb_port_all_ports_off(void)
+void usb_port_all_ports_off(void)
{
usb_port_set_enabled(0, 0);
usb_port_set_enabled(1, 0);
diff --git a/include/usb_charge.h b/include/usb_charge.h
index 66e6611985..72b89cf3b7 100644
--- a/include/usb_charge.h
+++ b/include/usb_charge.h
@@ -34,4 +34,9 @@ enum usb_charge_mode {
*/
int usb_charge_set_mode(int usb_port_id, enum usb_charge_mode mode);
+/**
+ * Disable power to external USB ports.
+ */
+void usb_port_all_ports_off(void);
+
#endif /* __CROS_EC_USB_CHARGE_H */