From 950894b27e7c97af15738e56e0ecd2fd8abd4874 Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Fri, 20 Jun 2014 09:51:00 -0700 Subject: [PATCH] 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. Change-Id: I0d572df726c4bb42d0ff5f40c06d8ea73e406283 Signed-off-by: Dave Parker Origianl-Change-Id: I4a65d8b6ad14ff3d1f12b644960bbf401027f8df Reviewed-on: https://chromium-review.googlesource.com/205812 Reviewed-by: Vic Yang Reviewed-on: https://chromium-review.googlesource.com/208162 --- common/usb_port_power_smart.c | 8 ++++++-- include/config.h | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common/usb_port_power_smart.c b/common/usb_port_power_smart.c index 76990fa8da..71390f45ab 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 1d546f7fff..08f937f669 100644 --- a/include/config.h +++ b/include/config.h @@ -913,6 +913,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.