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 <dparker@chromium.org>
Origianl-Change-Id: I4a65d8b6ad14ff3d1f12b644960bbf401027f8df
Reviewed-on: https://chromium-review.googlesource.com/205812
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/208162
This commit is contained in:
Dave Parker
2014-06-20 09:51:00 -07:00
committed by chrome-internal-fetch
parent 9ab780d295
commit 950894b27e
2 changed files with 12 additions and 2 deletions

View File

@@ -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)

View File

@@ -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.