summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2014-08-22 10:34:49 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-08-23 02:42:21 +0000
commit9e79ca794904953cda23df3285579ea1a11c53ce (patch)
tree32b1c4906c84a12839c6f383847013d25eb6baca
parent2e0de3c50f0106264303d2b8b55ec6253d9eda55 (diff)
downloadchrome-ec-9e79ca794904953cda23df3285579ea1a11c53ce.tar.gz
Support inverted ILIM_SEL for smart USB port power
Some platforms may have active low ILIM_SEL that is per-port and the output needs to be inverted. BUG=chrome-os-partner:31549 BRANCH=samus TEST=emerge-samus chromeos-ec, not used until EVT Change-Id: I1e164d9aa46df119467113eb175e7deec4fd8a21 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/213743 Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r--common/usb_port_power_smart.c11
-rw-r--r--include/config.h6
2 files changed, 15 insertions, 2 deletions
diff --git a/common/usb_port_power_smart.c b/common/usb_port_power_smart.c
index 71390f45ab..9a8d3c7d75 100644
--- a/common/usb_port_power_smart.c
+++ b/common/usb_port_power_smart.c
@@ -66,10 +66,17 @@ static void usb_charge_set_enabled(int port_id, int en)
static void usb_charge_set_ilim(int port_id, int sel)
{
-#ifdef CONFIG_USB_PORT_POWER_SMART_SIMPLE
+#if defined(CONFIG_USB_PORT_POWER_SMART_SIMPLE)
/* ILIM_SEL signal is shared and inverted */
- gpio_set_level(GPIO_USB_ILIM_SEL, sel ? 0 : 1);
+ gpio_set_level(GPIO_USB_ILIM_SEL, !sel);
+#elif defined(CONFIG_USB_PORT_POWER_SMART_INVERTED)
+ /* ILIM_SEL signal is per-port and active low */
+ if (port_id == 0)
+ gpio_set_level(GPIO_USB1_ILIM_SEL_L, !sel);
+ else
+ gpio_set_level(GPIO_USB2_ILIM_SEL_L, !sel);
#else
+ /* ILIM_SEL is per-port and active high */
if (port_id == 0)
gpio_set_level(GPIO_USB1_ILIM_SEL, sel);
else
diff --git a/include/config.h b/include/config.h
index 2a5b6d6999..97a08aeb36 100644
--- a/include/config.h
+++ b/include/config.h
@@ -987,6 +987,12 @@
*/
#undef CONFIG_USB_PORT_POWER_SMART_SIMPLE
+/*
+ * Smart USB power control current limit pins may be inverted. In this case
+ * they are active low and the GPIO names will be GPIO_USBn_ILIM_SEL_L.
+ */
+#undef CONFIG_USB_PORT_POWER_SMART_INVERTED
+
/* Support the TSU6721 I2C smart switch */
#undef CONFIG_USB_SWITCH_TSU6721