From e11fd6375711c1d47037b576a8c6374c8eb54d34 Mon Sep 17 00:00:00 2001 From: Andrew McRae Date: Fri, 22 Jul 2022 10:37:35 +1000 Subject: zephyr: usba: Allow setting of USBA default charge mode Add Kconfig options to allow USB-A port power charging mode default to be configured. BUG=b:239874346 TEST=zmake testall; zmake build nivviks BRANCH=none Signed-off-by: Andrew McRae Change-Id: I98d0527da655653df62685fd61c49c22b2c43eaa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3782122 Reviewed-by: Sam Hurst --- zephyr/Kconfig.usba | 24 ++++++++++++++++++++++++ zephyr/shim/include/config_chip.h | 9 +++++++++ 2 files changed, 33 insertions(+) diff --git a/zephyr/Kconfig.usba b/zephyr/Kconfig.usba index 380d277d2c..eba0eb1e37 100644 --- a/zephyr/Kconfig.usba +++ b/zephyr/Kconfig.usba @@ -81,6 +81,30 @@ config PLATFORM_EC_USB_PORT_POWER_SMART_INVERTED is inverted, meaning a low value indicates a high current limit and a high value requests a low current limit. +choice PLATFORM_EC_USBA_PORT_POWER_SMART_DEFAULT_MODE + prompt "Port power smart charging default mode" + default PLATFORM_EC_USB_PORT_POWER_SMART_DEFAULT_SDP + +config PLATFORM_EC_USB_PORT_POWER_SMART_DEFAULT_DISABLED + bool "Disabled" + help + USB-A ports charging mode default set to disabled. + If set, the USB-A charging mode is disabled. + +config PLATFORM_EC_USB_PORT_POWER_SMART_DEFAULT_SDP + bool "SDP" + help + USB-A ports charging mode default set to Standard Downstream + Port, USB 2.0 mode. + +config PLATFORM_EC_USB_PORT_POWER_SMART_DEFAULT_CDP + bool "CDP" + help + USB-A ports charging mode default set to Charging Downstream + Port, BC 1.2. + +endchoice + endif # PLATFORM_EC_USB_PORT_POWER_SMART endif # PLATFORM_EC_USBA diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h index f2864dddb3..3a6f7de6f8 100644 --- a/zephyr/shim/include/config_chip.h +++ b/zephyr/shim/include/config_chip.h @@ -1142,6 +1142,15 @@ extern struct jump_data mock_jump_data; #define CONFIG_USB_PORT_POWER_SMART_SIMPLE #endif +#undef CONFIG_USB_PORT_POWER_SMART_DEFAULT_MODE +#ifdef CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART_DEFAULT_DISABLED +#define CONFIG_USB_PORT_POWER_SMART_DEFAULT_MODE USB_CHARGE_MODE_DISABLED +#elif defined(CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART_DEFAULT_SDP) +#define CONFIG_USB_PORT_POWER_SMART_DEFAULT_MODE USB_CHARGE_MODE_SDP2 +#elif defined(CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART_DEFAULT_CDP) +#define CONFIG_USB_PORT_POWER_SMART_DEFAULT_MODE USB_CHARGE_MODE_CDP +#endif + #undef CONFIG_USB_PORT_POWER_SMART_INVERTED #ifdef CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART_INVERTED #define CONFIG_USB_PORT_POWER_SMART_INVERTED -- cgit v1.2.1