summaryrefslogtreecommitdiff
path: root/src/ec
diff options
context:
space:
mode:
authorPatrick Rudolph <siro@das-labor.org>2017-07-01 17:37:06 +0200
committerMartin Roth <martinroth@google.com>2017-07-07 17:19:09 +0000
commitb21f5d708afe417cef8894a58c162ff50f987822 (patch)
treeb4578388ec545b39584b8217359a8359862941c8 /src/ec
parentf8574bf4a7627228b9cdd14aa77589ac5b355c08 (diff)
ec/lenovo/h8/smm: Support USB always on AC only
Add support for UAO AC only mode. Needs tests on all platforms. Change-Id: Ib52aab427ff687b00129024cde65b78060d21e32 Signed-off-by: Patrick Rudolph <siro@das-labor.org> Reviewed-on: https://review.coreboot.org/20450 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Diffstat (limited to 'src/ec')
-rw-r--r--src/ec/lenovo/h8/smm.c18
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);
}
}