summaryrefslogtreecommitdiff
path: root/src/ec/lenovo/h8
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2019-07-31 21:01:52 +0800
committerPatrick Georgi <pgeorgi@google.com>2019-08-21 09:26:17 +0000
commit7e8eb6bdbe83c31d961e76ac2be6118de5831070 (patch)
treeb18669443af8e7ee5ca0ac69318586e0902e1213 /src/ec/lenovo/h8
parent63c95d2e87faf4fd40ec181a14da4680cc898ac2 (diff)
ec/lenovo/h8: Add option to set F1-F12 as primary function
Tested on Lenovo ThinkPad T440p. Change-Id: I83dc2c19341475abeeacd374a1b6cf152ec9b497 Signed-off-by: Iru Cai <mytbk920423@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/34639 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Diffstat (limited to 'src/ec/lenovo/h8')
-rw-r--r--src/ec/lenovo/h8/Kconfig4
-rw-r--r--src/ec/lenovo/h8/h8.c14
2 files changed, 18 insertions, 0 deletions
diff --git a/src/ec/lenovo/h8/Kconfig b/src/ec/lenovo/h8/Kconfig
index d874975428..f3df56a6c5 100644
--- a/src/ec/lenovo/h8/Kconfig
+++ b/src/ec/lenovo/h8/Kconfig
@@ -40,6 +40,10 @@ config H8_FN_KEY_AS_VBOOT_RECOVERY_SW
If VBOOT is enabled, press Fn-Key at power on to force a recovery mode
boot instead of regular FW_MAIN_x boot.
+config H8_HAS_PRIMARY_FN_KEYS
+ bool
+ default n
+
endif
config H8_DOCK_EARLY_INIT
diff --git a/src/ec/lenovo/h8/h8.c b/src/ec/lenovo/h8/h8.c
index 2b959ceea1..3a99b52dd8 100644
--- a/src/ec/lenovo/h8/h8.c
+++ b/src/ec/lenovo/h8/h8.c
@@ -86,6 +86,14 @@ static void h8_sticky_fn(int on)
ec_clr_bit(0x0, 3);
}
+static void f1_to_f12_as_primary(int on)
+{
+ if (on)
+ ec_set_bit(0x3b, 3);
+ else
+ ec_clr_bit(0x3b, 3);
+}
+
static void h8_log_ec_version(void)
{
char ecfw[17];
@@ -334,6 +342,12 @@ static void h8_enable(struct device *dev)
val = 0;
h8_sticky_fn(val);
+ if (CONFIG(H8_HAS_PRIMARY_FN_KEYS)) {
+ if (get_option(&val, "f1_to_f12_as_primary") != CB_SUCCESS)
+ val = 1;
+ f1_to_f12_as_primary(val);
+ }
+
if (get_option(&val, "first_battery") != CB_SUCCESS)
val = PRIMARY_BATTERY;
h8_charge_priority(val);