diff options
author | Nathaniel Roach <nroach44@gmail.com> | 2018-11-10 08:34:44 +0800 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2018-12-06 11:59:22 +0000 |
commit | 4f4322dd68575402e099e2dfda057687388f064e (patch) | |
tree | 0d5539c721bb5f6015c3ac86bf81222d676ab3c6 /src/ec/lenovo/h8/smm.c | |
parent | d88cf5f0372aacc94db2b528fc33cf9ac12ebbc0 (diff) | |
download | coreboot-4f4322dd68575402e099e2dfda057687388f064e.tar.xz |
lenovo/h8,thinkpads: Re-do USB Always On
Re-write the UAO handling code as it had stopped working (#171)
(the flag was not getting read from the RTC properly in SMM)
Remove the SMM code as it's not needed (but EC flag won't be set
upon entering S3 now)
Set the EC flags on boot the same way other flags are set
Document bitwise operators for clarity
Propagate changes to other Thinkpads
(updated X201 to have 2 bits for the flag as it only had 1)
Per Nicola Corna's previous commits, 0x0d is set for "AC only"
"AC only" does exhibit different behaviour - the USB port is
turned on a few seconds after entering S3, rather than < 1 sec,
regardless of AC status
Tested on X220
Change-Id: If812cd1ef8fb1a24d7fadbe834f574b40cbcd56a
Signed-off-by: Nathaniel Roach <nroach44@gmail.com>
Reviewed-on: https://review.coreboot.org/c/29565
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Diffstat (limited to 'src/ec/lenovo/h8/smm.c')
-rw-r--r-- | src/ec/lenovo/h8/smm.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/ec/lenovo/h8/smm.c b/src/ec/lenovo/h8/smm.c deleted file mode 100644 index 6005c31033..0000000000 --- a/src/ec/lenovo/h8/smm.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2016 Nicola Corna <nicola@corna.info> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include <ec/acpi/ec.h> -#include <pc80/mc146818rtc.h> - -#include "h8.h" - -enum usb_always_on { - UAO_OFF = 0, - UAO_AC_AND_BATTERY, - UAO_AC_ONLY -}; - -void h8_usb_always_on(void) -{ - enum usb_always_on val; - u8 reg; - - if (get_option(&val, "usb_always_on") != CB_SUCCESS) - val = UAO_OFF; - - 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); - } -} |