[coreboot-gerrit] New patch to review for coreboot: 926cf5a ec/lenovo/h8: Allow control of low-battery beep.

Vladimir Serbinenko (phcoder@gmail.com) gerrit at coreboot.org
Sat Jan 11 13:34:08 CET 2014


Vladimir Serbinenko (phcoder at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4663

-gerrit

commit 926cf5aaaffce10c3011177993a1955239d6d1f6
Author: Vladimir Serbinenko <phcoder at gmail.com>
Date:   Sat Jan 11 13:02:49 2014 +0100

    ec/lenovo/h8: Allow control of low-battery beep.
    
    Change-Id: I2f422e83f2afcf0cc3f3ecbace01a8f4f39e87d4
    Signed-off-by: Vladimir Serbinenko <phcoder at gmail.com>
---
 src/ec/lenovo/h8/h8.c                  | 24 ++++++++++++++++++------
 src/mainboard/lenovo/t60/cmos.layout   |  1 +
 src/mainboard/lenovo/x201/cmos.default |  1 +
 src/mainboard/lenovo/x201/cmos.layout  |  3 ++-
 src/mainboard/lenovo/x60/cmos.default  |  1 +
 src/mainboard/lenovo/x60/cmos.layout   |  1 +
 6 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/src/ec/lenovo/h8/h8.c b/src/ec/lenovo/h8/h8.c
index d6a07e7..956ba30 100644
--- a/src/ec/lenovo/h8/h8.c
+++ b/src/ec/lenovo/h8/h8.c
@@ -160,6 +160,7 @@ static void h8_enable(device_t dev)
 {
 	struct ec_lenovo_h8_config *conf = dev->chip_info;
 	u8 val, tmp;
+	u8 beepmask0, beepmask1;
 
 	h8_log_ec_version();
 
@@ -168,16 +169,27 @@ static void h8_enable(device_t dev)
 	ec_write(H8_CONFIG2, conf->config2);
 	ec_write(H8_CONFIG3, conf->config3);
 
+	beepmask0 = conf->beepmask0;
+	beepmask1 = conf->beepmask1;
+
 	if (get_option(&val, "power_management_beeps") != CB_SUCCESS)
 		val = 1;
 
-	if (val) {
-		ec_write(H8_SOUND_ENABLE0, conf->beepmask0);
-		ec_write(H8_SOUND_ENABLE1, conf->beepmask1);
-	} else  {
-		ec_write(H8_SOUND_ENABLE0, 0x00);
-		ec_write(H8_SOUND_ENABLE1, 0x00);
+	if (!val) {
+		beepmask0 = 0;
+		beepmask1 = 0;
 	}
+
+	if (get_option(&val, "low_battery_beep") != CB_SUCCESS)
+		val = 1;
+	if (val)
+		beepmask0 |= 2;
+	else
+		beepmask0 &= ~2;
+
+	ec_write(H8_SOUND_ENABLE0, beepmask0);
+	ec_write(H8_SOUND_ENABLE1, beepmask1);
+
 	ec_write(H8_SOUND_REPEAT, 0x00);
 
 	ec_write(0x10, conf->event0_enable);
diff --git a/src/mainboard/lenovo/t60/cmos.layout b/src/mainboard/lenovo/t60/cmos.layout
index 94358a2..cba2605 100644
--- a/src/mainboard/lenovo/t60/cmos.layout
+++ b/src/mainboard/lenovo/t60/cmos.layout
@@ -115,6 +115,7 @@ entries
 1074         1       e       1        fn_ctrl_swap
 1075         1       e       1        locking_fn
 1076         1       e       1        power_management_beeps
+1077         1       e       1        low_battery_beep
 # -----------------------------------------------------------------
 
 enumerations
diff --git a/src/mainboard/lenovo/x201/cmos.default b/src/mainboard/lenovo/x201/cmos.default
index d133d98..ba3e66e 100644
--- a/src/mainboard/lenovo/x201/cmos.default
+++ b/src/mainboard/lenovo/x201/cmos.default
@@ -12,3 +12,4 @@ touchpad=Enable
 fn_ctrl_swap=Disable
 locking_fn=Disable
 power_management_beeps=Enable
+low_battery_beep=Enable
diff --git a/src/mainboard/lenovo/x201/cmos.layout b/src/mainboard/lenovo/x201/cmos.layout
index 5252fa2..43911e2 100644
--- a/src/mainboard/lenovo/x201/cmos.layout
+++ b/src/mainboard/lenovo/x201/cmos.layout
@@ -93,7 +93,8 @@ entries
 417         1       e       1        fn_ctrl_swap
 418         1       e       1        locking_fn
 419         1       e       1        power_management_beeps
-#420        564     r       0        unused
+420         1       e       1        low_battery_beep
+#421        563     r       0        unused
 
 # coreboot config options: check sums
 984         16       h       0        check_sum
diff --git a/src/mainboard/lenovo/x60/cmos.default b/src/mainboard/lenovo/x60/cmos.default
index 2992c53..59552d9 100644
--- a/src/mainboard/lenovo/x60/cmos.default
+++ b/src/mainboard/lenovo/x60/cmos.default
@@ -15,3 +15,4 @@ bluetooth=Enable
 fn_ctrl_swap=Disable
 locking_fn=Disable
 power_management_beeps=Enable
+low_battery_beep=Enable
diff --git a/src/mainboard/lenovo/x60/cmos.layout b/src/mainboard/lenovo/x60/cmos.layout
index b5d0993..1f3d889 100644
--- a/src/mainboard/lenovo/x60/cmos.layout
+++ b/src/mainboard/lenovo/x60/cmos.layout
@@ -115,6 +115,7 @@ entries
 1085         1       e       1        fn_ctrl_swap
 1086         1       e       1        locking_fn
 1087         1       e       1        power_management_beeps
+1088         1       e       1        low_battery_beep
 # -----------------------------------------------------------------
 
 enumerations



More information about the coreboot-gerrit mailing list