summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew McRae <amcrae@google.com>2022-07-22 10:37:35 +1000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-07-23 00:03:38 +0000
commite11fd6375711c1d47037b576a8c6374c8eb54d34 (patch)
tree9b6008e23b6311f693042d362a2efade7efe30a1
parent4bc7c937169496cc816698cc7e14b70038723695 (diff)
downloadchrome-ec-e11fd6375711c1d47037b576a8c6374c8eb54d34.tar.gz
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 <amcrae@google.com> Change-Id: I98d0527da655653df62685fd61c49c22b2c43eaa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3782122 Reviewed-by: Sam Hurst <shurst@google.com>
-rw-r--r--zephyr/Kconfig.usba24
-rw-r--r--zephyr/shim/include/config_chip.h9
2 files changed, 33 insertions, 0 deletions
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