[coreboot-gerrit] Change in coreboot[master]: google/snappy: Override Keyboard Backlight by SKU ID

Kevin Chiu (Code Review) gerrit at coreboot.org
Fri Sep 1 13:23:32 CEST 2017


Kevin Chiu has uploaded this change for review. ( https://review.coreboot.org/21319


Change subject: google/snappy: Override Keyboard Backlight by SKU ID
......................................................................

google/snappy: Override Keyboard Backlight by SKU ID

Since Snappy will have specific SKU to support keyboard backlight.
we will need to report whether ACPI device exists or not by SKU ID
to prevent keyboard backlight OSD on non supported system.

BUG=none
BRANCH=reef
TEST=emerge-snappy coreboot
Change-Id: I7c963bfd932df9297ee18a62617e48acead7b68a
Signed-off-by: Kevin Chiu <Kevin.Chiu at quantatw.com>
---
M src/arch/x86/smbios.c
M src/mainboard/google/reef/dsdt.asl
A src/mainboard/google/reef/variants/snappy/include/variant/acpi/keyboard_backlight.asl
M src/mainboard/google/reef/variants/snappy/include/variant/ec.h
M src/vendorcode/google/chromeos/acpi/gnvs.asl
M src/vendorcode/google/chromeos/gnvs.h
6 files changed, 65 insertions(+), 3 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/19/21319/1

diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c
index 89951a1..a46a887 100644
--- a/src/arch/x86/smbios.c
+++ b/src/arch/x86/smbios.c
@@ -372,6 +372,7 @@
 {
 	struct smbios_type1 *t = (struct smbios_type1 *)*current;
 	int len = sizeof(struct smbios_type1);
+	char skuid[7];
 
 	memset(t, 0, sizeof(struct smbios_type1));
 	t->type = SMBIOS_SYSTEM_INFORMATION;
@@ -388,6 +389,11 @@
 #ifdef CONFIG_MAINBOARD_FAMILY
 	t->family = smbios_add_string(t->eos, smbios_mainboard_family());
 #endif
+
+#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
+	strcpy(skuid, smbios_mainboard_sku());
+	vboot_data->skuid = skuid[3] - '0';
+#endif
 	smbios_mainboard_set_uuid(t->uuid);
 	len = t->length + smbios_string_table_len(t->eos);
 	*current += len;
diff --git a/src/mainboard/google/reef/dsdt.asl b/src/mainboard/google/reef/dsdt.asl
index dc63436..a1f40be 100644
--- a/src/mainboard/google/reef/dsdt.asl
+++ b/src/mainboard/google/reef/dsdt.asl
@@ -65,4 +65,8 @@
 		/* Include common dptf ASL files */
 		#include <soc/intel/common/acpi/dptf/dptf.asl>
 	}
+
+	#ifdef BOARD_EC_ENABLE_KEYBOARD_BACKLIGHT
+	#include <variant/acpi/keyboard_backlight.asl>
+	#endif
 }
diff --git a/src/mainboard/google/reef/variants/snappy/include/variant/acpi/keyboard_backlight.asl b/src/mainboard/google/reef/variants/snappy/include/variant/acpi/keyboard_backlight.asl
new file mode 100644
index 0000000..706dc8b
--- /dev/null
+++ b/src/mainboard/google/reef/variants/snappy/include/variant/acpi/keyboard_backlight.asl
@@ -0,0 +1,50 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Google Inc.
+ *
+ * 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.
+ */
+
+Scope (\_SB)
+{
+	/*
+	 * Chrome EC Keyboard Backlight interface
+	 */
+	Device (KBLT)
+	{
+		Name (_HID, "GOOG0002")
+		Name (_UID, 1)
+
+		/* Read current backlight value */
+		Method (KBQC, 0, NotSerialized)
+		{
+			Return (\_SB.PCI0.LPCB.EC0.KBLV)
+		}
+
+		/* Write new backlight value */
+		Method (KBCM, 1, NotSerialized)
+		{
+			Store (Arg0, \_SB.PCI0.LPCB.EC0.KBLV)
+		}
+
+		Method (_STA)
+		{
+			/* SKU2 supports Keyboard Backlight */
+			If (LEqual(\SKID,2))
+			{
+				Return (0xF)
+			}
+			Else {
+				Return (0)
+			}
+		}
+	}
+}
diff --git a/src/mainboard/google/reef/variants/snappy/include/variant/ec.h b/src/mainboard/google/reef/variants/snappy/include/variant/ec.h
index 4f5051b..8b0a96d 100644
--- a/src/mainboard/google/reef/variants/snappy/include/variant/ec.h
+++ b/src/mainboard/google/reef/variants/snappy/include/variant/ec.h
@@ -19,6 +19,6 @@
 #include <baseboard/ec.h>
 
 /* Enable EC backed Keyboard Backlight in ACPI */
-#define EC_ENABLE_KEYBOARD_BACKLIGHT
+#define BOARD_EC_ENABLE_KEYBOARD_BACKLIGHT
 
 #endif
diff --git a/src/vendorcode/google/chromeos/acpi/gnvs.asl b/src/vendorcode/google/chromeos/acpi/gnvs.asl
index 52d3a0d..8901d7e 100644
--- a/src/vendorcode/google/chromeos/acpi/gnvs.asl
+++ b/src/vendorcode/google/chromeos/acpi/gnvs.asl
@@ -32,4 +32,5 @@
 MEHH,  256,	// 0xd9e - Management Engine Hash
 RMOB,   32,	// 0xdbe - RAM oops base address
 RMOL,   32,	// 0xdc2 - RAM oops length
-		// 0xdc6
+SKID,    8,	// 0xdc6 - SKU ID
+		// 0xdc7-0xeff
diff --git a/src/vendorcode/google/chromeos/gnvs.h b/src/vendorcode/google/chromeos/gnvs.h
index 82cd409..0fe767a 100644
--- a/src/vendorcode/google/chromeos/gnvs.h
+++ b/src/vendorcode/google/chromeos/gnvs.h
@@ -58,7 +58,8 @@
 	u32	mehh[8];	// d9e management engine hash
 	u32	ramoops_base;	// dbe ramoops base address
 	u32	ramoops_len;	// dc2 ramoops length
-	u8	pad[314];	// dc6-eff
+	u8	skuid;		// dc6 sku id
+	u8	pad[313];	// dc7-eff
 } __packed chromeos_acpi_t;
 
 extern chromeos_acpi_t *vboot_data;

-- 
To view, visit https://review.coreboot.org/21319
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c963bfd932df9297ee18a62617e48acead7b68a
Gerrit-Change-Number: 21319
Gerrit-PatchSet: 1
Gerrit-Owner: Kevin Chiu <Kevin.Chiu at quantatw.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170901/fae91832/attachment.html>


More information about the coreboot-gerrit mailing list