diff options
Diffstat (limited to 'common/usb_charge.c')
-rw-r--r-- | common/usb_charge.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/common/usb_charge.c b/common/usb_charge.c index 883bae5039..f14cfe393d 100644 --- a/common/usb_charge.c +++ b/common/usb_charge.c @@ -5,11 +5,12 @@ /* USB charging control module for Chrome EC */ -#include "usb_charge.h" #include "board.h" +#include "console.h" #include "gpio.h" +#include "hooks.h" #include "uart.h" -#include "console.h" +#include "usb_charge.h" #include "util.h" static void usb_charge_set_control_mode(int port_id, int mode) @@ -26,6 +27,7 @@ static void usb_charge_set_control_mode(int port_id, int mode) } } + static void usb_charge_set_enabled(int port_id, int en) { if (port_id == 0) @@ -34,6 +36,7 @@ static void usb_charge_set_enabled(int port_id, int en) gpio_set_level(GPIO_USB2_ENABLE, en); } + static void usb_charge_set_ilim(int port_id, int sel) { if (port_id == 0) @@ -42,6 +45,7 @@ static void usb_charge_set_ilim(int port_id, int sel) gpio_set_level(GPIO_USB2_ILIM_SEL, sel); } + int usb_charge_set_mode(int port_id, enum usb_charge_mode mode) { if (port_id >= USB_CHARGE_PORT_COUNT) @@ -77,7 +81,6 @@ int usb_charge_set_mode(int port_id, enum usb_charge_mode mode) return EC_SUCCESS; } - /*****************************************************************************/ /* Console commands */ @@ -114,11 +117,10 @@ static int command_set_mode(int argc, char **argv) } DECLARE_CONSOLE_COMMAND(usbchargemode, command_set_mode); - /*****************************************************************************/ /* Initialization */ -int usb_charge_init(void) +static int usb_charge_init(void) { int i; @@ -127,3 +129,4 @@ int usb_charge_init(void) return EC_SUCCESS; } +DECLARE_HOOK(HOOK_INIT, usb_charge_init, HOOK_PRIO_DEFAULT); |