diff options
-rw-r--r-- | common/usb_port_power_smart.c | 11 | ||||
-rw-r--r-- | include/config.h | 6 |
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 |