diff options
Diffstat (limited to 'src/ec')
-rw-r--r-- | src/ec/lenovo/h8/smm.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/ec/lenovo/h8/smm.c b/src/ec/lenovo/h8/smm.c index 31009a6926..6005c31033 100644 --- a/src/ec/lenovo/h8/smm.c +++ b/src/ec/lenovo/h8/smm.c @@ -18,18 +18,30 @@ #include "h8.h" +enum usb_always_on { + UAO_OFF = 0, + UAO_AC_AND_BATTERY, + UAO_AC_ONLY +}; + void h8_usb_always_on(void) { - u8 val; + enum usb_always_on val; u8 reg; if (get_option(&val, "usb_always_on") != CB_SUCCESS) - val = 0; + val = UAO_OFF; - if (val) { + if (val == UAO_AC_AND_BATTERY) { reg = ec_read(H8_USB_ALWAYS_ON); reg &= ~H8_USB_ALWAYS_ON_AC_ONLY; reg |= H8_USB_ALWAYS_ON_ENABLE; ec_write(H8_USB_ALWAYS_ON, reg); + } else if (val == UAO_AC_ONLY) { + reg = ec_read(H8_USB_ALWAYS_ON); + reg |= H8_USB_ALWAYS_ON_AC_ONLY; + reg |= H8_USB_ALWAYS_ON_ENABLE; + ec_write(H8_USB_ALWAYS_ON, reg); + ec_set_bit(0x2, 3); } } |