summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.
*/