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>
This commit is contained in:
Duncan Laurie
2014-08-22 10:34:49 -07:00
committed by chrome-internal-fetch
parent 2e0de3c50f
commit 9e79ca7949
2 changed files with 15 additions and 2 deletions

View File

@@ -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

View File

@@ -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