summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2020-03-17 23:40:08 -0600
committerCommit Bot <commit-bot@chromium.org>2020-03-20 18:14:16 +0000
commit9f17f26d0ac487ea4092809f23fe7c38cfb7e866 (patch)
tree5f25cc06e6490aaadc6d0385592d963f3cc4653d /include
parent0c7bcb0bdba243127dbb6592f94961bd39e48a97 (diff)
downloadchrome-ec-9f17f26d0ac487ea4092809f23fe7c38cfb7e866.tar.gz
usb_port_power: Add CONFIG_USB_PORT_ENABLE_DYNAMIC
BUG=b:150349225 BRANCH=none TEST=none Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I06c2ceee818499eabf3a240d27151dbd1ff88653 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2108333 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Paul Ma <magf@bitland.corp-partner.google.com> Tested-by: Paul Ma <magf@bitland.corp-partner.google.com>
Diffstat (limited to 'include')
-rw-r--r--include/config.h5
-rw-r--r--include/usb_charge.h14
2 files changed, 16 insertions, 3 deletions
diff --git a/include/config.h b/include/config.h
index ffe9b64eb2..2edfc0c7a6 100644
--- a/include/config.h
+++ b/include/config.h
@@ -4161,6 +4161,11 @@
#undef CONFIG_USB_PORT_POWER_SMART
/*
+ * GPIOs to enable USB port power have non-const configuration.
+ */
+#undef CONFIG_USB_PORT_ENABLE_DYNAMIC
+
+/*
* Support smart power control to the device's USB ports, however only CDP and
* SDP are supported. Usually this is the case if all the control lines to the
* charging port controller are hard-wired.
diff --git a/include/usb_charge.h b/include/usb_charge.h
index 7445e7b0ab..35aecb5f4a 100644
--- a/include/usb_charge.h
+++ b/include/usb_charge.h
@@ -19,12 +19,20 @@
#define USB_SYSJUMP_TAG 0x5550 /* "UP" - Usb Port */
#define USB_HOOK_VERSION 1
-/* GPIOs to enable/disable USB ports. Board specific. */
#ifdef CONFIG_USB_PORT_POWER_SMART
-extern const int usb_port_enable[CONFIG_USB_PORT_POWER_SMART_PORT_COUNT];
+#define USB_PORT_ENABLE_COUNT CONFIG_USB_PORT_POWER_SMART_PORT_COUNT
#elif defined(CONFIG_USB_PORT_POWER_DUMB)
-extern const int usb_port_enable[USB_PORT_COUNT];
+#define USB_PORT_ENABLE_COUNT USB_PORT_COUNT
+#endif
+
+/* GPIOs to enable/disable USB ports. Board specific. */
+#ifdef USB_PORT_ENABLE_COUNT
+#ifdef CONFIG_USB_PORT_ENABLE_DYNAMIC
+extern int usb_port_enable[USB_PORT_ENABLE_COUNT];
+#else
+extern const int usb_port_enable[USB_PORT_ENABLE_COUNT];
#endif
+#endif /* USB_PORT_ENABLE_COUNT */
/**
* Set USB charge mode for the port.