summaryrefslogtreecommitdiff
path: root/src/mainboard/lenovo/x220
diff options
context:
space:
mode:
authorNicola Corna <nicola@corna.info>2016-11-05 16:06:59 +0100
committerNico Huber <nico.h@gmx.de>2016-11-18 18:14:42 +0100
commitf1395d825be59663913f88ddaf01cbfa6c46afa7 (patch)
treea3c2c2e0fbce8563797d0a7695e4e578e7d5666c /src/mainboard/lenovo/x220
parentcd2afc0df034670a83479aded514b22b99124cf5 (diff)
ec/lenovo/h8: Add USB Always On
USB AO is the internal name for the dedicated charging port on ThinkPads when in S3 or lower. AOEN (bit 0) is internal name for enabling this feature while AOCF (bits 2 and 3) is the configuration field. According to Peter Stuge, AOCF can be configured in this way: 00 => AC S3 S4 S4 USB on, battery S3 USB on, battery S4 S5 off 11 => AC S3 S4 S4 USB on, battery S3 S4 S5 USB off 10, 01 => equivalent to 00 This commit also adds a new configuration field in the CMOS of the X220 and the X201 to activate this feature. It probably can be also added to all the ThinkPads that support this functionality. With this functionality USB devices are able to negotiate full power from the dedicated port (usually the yellow one) even in S3. Tested on a X201 and X220 with an Android smartphone: with this feature enabled it shows "Charging" when connected during S3, without it it shows "Charging slowly" (or it doesn't charge at all on the X201). For some reasons the "AC only" mode doesn't work, so it has been disabled. Change-Id: Ie1269a4357e2fbd608ad8b7b8262275914730f6e Signed-off-by: Nicola Corna <nicola@corna.info> Reviewed-on: https://review.coreboot.org/17252 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/mainboard/lenovo/x220')
-rw-r--r--src/mainboard/lenovo/x220/cmos.default1
-rw-r--r--src/mainboard/lenovo/x220/cmos.layout5
-rw-r--r--src/mainboard/lenovo/x220/smihandler.c2
3 files changed, 7 insertions, 1 deletions
diff --git a/src/mainboard/lenovo/x220/cmos.default b/src/mainboard/lenovo/x220/cmos.default
index 1b8e212894..91331ab22e 100644
--- a/src/mainboard/lenovo/x220/cmos.default
+++ b/src/mainboard/lenovo/x220/cmos.default
@@ -10,6 +10,7 @@ wwan=Enable
wlan=Enable
touchpad=Enable
sata_mode=AHCI
+usb_always_on=Disable
fn_ctrl_swap=Disable
sticky_fn=Disable
trackpoint=Enable
diff --git a/src/mainboard/lenovo/x220/cmos.layout b/src/mainboard/lenovo/x220/cmos.layout
index 143ee807cd..0f57058ca2 100644
--- a/src/mainboard/lenovo/x220/cmos.layout
+++ b/src/mainboard/lenovo/x220/cmos.layout
@@ -69,7 +69,8 @@ entries
418 1 e 1 sticky_fn
419 1 e 1 power_management_beeps
421 1 e 9 sata_mode
-#422 2 r 1 unused
+422 1 e 12 usb_always_on
+#423 1 r 1 unused
# coreboot config options: cpu
424 1 e 2 hyper_threading
@@ -134,6 +135,8 @@ enumerations
11 4 160M
11 5 192M
11 6 224M
+12 0 Disable
+12 1 AC and battery
# -----------------------------------------------------------------
checksums
diff --git a/src/mainboard/lenovo/x220/smihandler.c b/src/mainboard/lenovo/x220/smihandler.c
index 08554c93ec..e1bb37698f 100644
--- a/src/mainboard/lenovo/x220/smihandler.c
+++ b/src/mainboard/lenovo/x220/smihandler.c
@@ -133,6 +133,8 @@ int mainboard_smi_apmc(u8 data)
void mainboard_smi_sleep(u8 slp_typ)
{
+ h8_usb_always_on();
+
if (slp_typ == 3) {
u8 ec_wake = ec_read(0x32);
/* If EC wake events are enabled, enable wake on EC WAKE GPE. */