diff options
author | Philip Chen <philipchen@google.com> | 2018-02-06 18:31:43 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-03-05 00:21:22 -0800 |
commit | 9896e428f72670562f73713456d5966ad3f2d491 (patch) | |
tree | d8a3439a1448a10d2a7a3d26ef0811a24f07f153 /common | |
parent | 29c2aa329489eca44490a6445ef591d6c661b74e (diff) | |
download | chrome-ec-9896e428f72670562f73713456d5966ad3f2d491.tar.gz |
Introduce CONFIG_USB_PD_5V_CHARGER_CTRL
Add a new config for the boards using charger (e.g. rt946x)
to report if VBUS source is enabled instead of using GPIO.
BUG=b:65446459
BRANCH=none
TEST=Charge Scarlet rev3 with SDP and DCP.
Change-Id: Id0a07945f0f888b6a36c422c596b56c5aa5065c0
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/905400
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usb_charger.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/common/usb_charger.c b/common/usb_charger.c index 3e7d52f646..c55f32bbd4 100644 --- a/common/usb_charger.c +++ b/common/usb_charger.c @@ -13,6 +13,7 @@ */ #include "charge_manager.h" +#include "charger.h" #include "common.h" #include "console.h" #include "gpio.h" @@ -39,15 +40,15 @@ static void update_vbus_supplier(int port, int vbus_level) } } -#ifndef CONFIG_USBC_PPC -#ifdef CONFIG_USB_PD_5V_EN_ACTIVE_LOW +#ifdef CONFIG_USBC_PPC +#define USB_5V_EN(port) ppc_is_sourcing_vbus(port) +#elif defined(CONFIG_USB_PD_5V_CHARGER_CTRL) +#define USB_5V_EN(port) charger_is_sourcing_otg_power(port) +#elif defined(CONFIG_USB_PD_5V_EN_ACTIVE_LOW) #define USB_5V_EN(port) !gpio_get_level(GPIO_USB_C##port##_5V_EN_L) #else #define USB_5V_EN(port) gpio_get_level(GPIO_USB_C##port##_5V_EN) #endif -#else /* defined(CONFIG_USBC_PPC) */ -#define USB_5V_EN(port) ppc_is_sourcing_vbus(port) -#endif /* !defined(CONFIG_USBC_PPC) */ int usb_charger_port_is_sourcing_vbus(int port) { |