summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parker <dparker@chromium.org>2014-06-20 09:51:00 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-07-07 17:29:10 +0000
commit6906f9650de40198ae4eefe9caf96d8d16ee427b (patch)
tree6abfde31162de6ecd05f84190eae5e4922b43c80
parentf27fddb2f4559ddf7ee39e1344bcff5c4954134f (diff)
downloadchrome-ec-6906f9650de40198ae4eefe9caf96d8d16ee427b.tar.gz
USB Power: Add config option to set default charge mode
BUG=chrome-os-partner:29053 BRANCH=ToT TEST=Set a default change mode other than SDP2 in a board config. Verify the 'usbchargemode' console command indicates the ports are operating in that mode. Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: I4a65d8b6ad14ff3d1f12b644960bbf401027f8df Reviewed-on: https://chromium-review.googlesource.com/205812 Reviewed-by: Vic Yang <victoryang@chromium.org>
-rw-r--r--common/usb_port_power_smart.c8
-rw-r--r--include/config.h6
2 files changed, 12 insertions, 2 deletions
diff --git a/common/usb_port_power_smart.c b/common/usb_port_power_smart.c
index 46de8661c7..f70d284492 100644
--- a/common/usb_port_power_smart.c
+++ b/common/usb_port_power_smart.c
@@ -23,6 +23,10 @@
#define USB_CHARGE_PORT_COUNT 2
+#ifndef CONFIG_USB_PORT_POWER_SMART_DEFAULT_MODE
+#define CONFIG_USB_PORT_POWER_SMART_DEFAULT_MODE USB_CHARGE_MODE_SDP2
+#endif
+
/* The previous USB port state before sys jump */
struct usb_state {
uint8_t port_mode[USB_CHARGE_PORT_COUNT];
@@ -75,8 +79,8 @@ static void usb_charge_set_ilim(int port_id, int sel)
static void usb_charge_all_ports_on(void)
{
- usb_charge_set_mode(0, USB_CHARGE_MODE_SDP2);
- usb_charge_set_mode(1, USB_CHARGE_MODE_SDP2);
+ usb_charge_set_mode(0, CONFIG_USB_PORT_POWER_SMART_DEFAULT_MODE);
+ usb_charge_set_mode(1, CONFIG_USB_PORT_POWER_SMART_DEFAULT_MODE);
}
static void usb_charge_all_ports_off(void)
diff --git a/include/config.h b/include/config.h
index a299978e1e..d2d5216313 100644
--- a/include/config.h
+++ b/include/config.h
@@ -807,6 +807,12 @@
#undef CONFIG_USB_PORT_POWER_SMART
/*
+ * Override the default charging mode for USB smart power control.
+ * Value is selected from usb_charge_mode in include/usb_charge.h
+ */
+#undef CONFIG_USB_PORT_POWER_SMART_DEFAULT_MODE
+
+/*
* Smart USB power control can use a full set of control signals to the USB
* port power chip, or a reduced set. If this is defined, use the reduced set.
*/