Lenovo X60/T60: add first_battery setting
authorSven Schnelle <svens@stackframe.org>
Wed, 7 Dec 2011 22:30:58 +0000 (14:30 -0800)
committerPeter Stuge <peter@stuge.se>
Wed, 14 Dec 2011 08:41:46 +0000 (09:41 +0100)
The EC allows to select the order in which batteries are (dis)charged.
Make this setting available to the user.

Change-Id: Id2a98192565419dbb53f3a7cf0b2c46b672a3ed8
Signed-off-by: Sven Schnelle <svens@stackframe.org>
Reviewed-on: http://review.coreboot.org/475
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Peter Stuge <peter@stuge.se>
src/ec/lenovo/h8/h8.c
src/mainboard/lenovo/t60/cmos.layout
src/mainboard/lenovo/x60/cmos.layout

index f81a39cb24357078d589869bd00e602e9e92fd53..f20cd389dc8c8a145d3d281d4c7e56bbe1bfa112 100644 (file)
@@ -104,7 +104,7 @@ int h8_ultrabay_device_present(void)
 static void h8_enable(device_t dev)
 {
        struct ec_lenovo_h8_config *conf = dev->chip_info;
-       u8 val;
+       u8 val, tmp;
 
        h8_log_ec_version();
 
@@ -142,6 +142,13 @@ static void h8_enable(device_t dev)
        if (!get_option(&val, "volume"))
                ec_write(H8_VOLUME_CONTROL, val);
 
+
+       if (!get_option(&val, "first_battery")) {
+               tmp = ec_read(H8_CONFIG3);
+               tmp &= ~(1 << 4);
+               tmp |= (val & 1)<< 4;
+               ec_write(H8_CONFIG3, tmp);
+       }
        h8_set_audio_mute(0);
 }
 
index a946b4b120118232198dfbab9feefecb0a60fcf3..8d9dce49bb1a272dd827a4a0c6da2f91f596f522 100644 (file)
@@ -109,6 +109,7 @@ entries
 
 1060         1       e       1        touchpad
 1064         8       h       0        volume
+1072         1       e       9        first_battery
 # -----------------------------------------------------------------
 
 enumerations
@@ -142,7 +143,8 @@ enumerations
 7     2     Keep
 8     0     No
 8     1     Yes
-
+9     0            Secondary
+9     1            Primary
 # -----------------------------------------------------------------
 checksums
 
index a1575137c7e5f305f22216a8c2f05cccb603a250..cae70cb91e1d7ee3d2d4e7ad581bea09583bd015 100644 (file)
@@ -109,6 +109,7 @@ entries
 
 1064         8       h       0        volume
 1072         8       h       0        tft_brightness
+1080         1       e       9        first_battery
 # -----------------------------------------------------------------
 
 enumerations
@@ -142,6 +143,8 @@ enumerations
 7     2     Keep
 8     0     No
 8     1     Yes
+9     0            Secondary
+9     1            Primary
 
 # -----------------------------------------------------------------
 checksums