[coreboot-gerrit] Change in coreboot[master]: mb/google/fizz: Provide nhlt variant API

David Wu (Code Review) gerrit at coreboot.org
Mon Oct 8 07:42:01 CEST 2018


David Wu has uploaded this change for review. ( https://review.coreboot.org/28965


Change subject: mb/google/fizz: Provide nhlt variant API
......................................................................

mb/google/fizz: Provide nhlt variant API

Move current NHLT configuration implementation to baseboard so that
variants can leverage it or provide their own configuration.

BUG=b:117066935
BRANCH=Fizz
TEST=emerge-fizz coreboot

Change-Id: I30d93babb6fc09e8642b3740f1f7638fa33f0ade
Signed-off-by: David Wu <david_wu at quanta.corp-partner.google.com>
---
M src/mainboard/google/fizz/mainboard.c
M src/mainboard/google/fizz/variants/baseboard/Makefile.inc
M src/mainboard/google/fizz/variants/baseboard/include/baseboard/variants.h
A src/mainboard/google/fizz/variants/baseboard/nhlt.c
4 files changed, 47 insertions(+), 7 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/28965/1

diff --git a/src/mainboard/google/fizz/mainboard.c b/src/mainboard/google/fizz/mainboard.c
index 9865f40..e9d9aef 100644
--- a/src/mainboard/google/fizz/mainboard.c
+++ b/src/mainboard/google/fizz/mainboard.c
@@ -14,7 +14,7 @@
  */
 
 #include <arch/acpi.h>
-#include <console/console.h>
+#include <baseboard/variants.h>
 #include <chip.h>
 #include <device/device.h>
 #include <ec/ec.h>
@@ -194,8 +194,9 @@
 static unsigned long mainboard_write_acpi_tables(
 	struct device *device, unsigned long current, acpi_rsdp_t *rsdp)
 {
-	const char *oem_id = "GOOGLE";
-	const char *oem_table_id = "FIZZ";
+	const char *oem_id = "NULL";
+	const char *oem_table_id = "NULL";
+	uint32_t oem_revision = 0;
 	uintptr_t start_addr;
 	uintptr_t end_addr;
 	struct nhlt *nhlt;
@@ -206,12 +207,11 @@
 	if (!nhlt)
 		return start_addr;
 
-	/* RT5663 Headset codec */
-	if (nhlt_soc_add_rt5663(nhlt, AUDIO_LINK_SSP1))
-		printk(BIOS_ERR, "Couldn't add headset codec.\n");
+	variant_nhlt_init(nhlt);
+	variant_nhlt_oem_overrides(&oem_id, &oem_table_id, &oem_revision);
 
 	end_addr = nhlt_soc_serialize_oem_overrides(nhlt, start_addr,
-				oem_id, oem_table_id, 0);
+				oem_id, oem_table_id, oem_revision);
 
 	if (end_addr != start_addr)
 		acpi_add_table(rsdp, (void *)start_addr);
diff --git a/src/mainboard/google/fizz/variants/baseboard/Makefile.inc b/src/mainboard/google/fizz/variants/baseboard/Makefile.inc
index 9fb63f5..0ad298b 100644
--- a/src/mainboard/google/fizz/variants/baseboard/Makefile.inc
+++ b/src/mainboard/google/fizz/variants/baseboard/Makefile.inc
@@ -1,3 +1,4 @@
 bootblock-y += gpio.c
 
 ramstage-y += gpio.c
+ramstage-y += nhlt.c
diff --git a/src/mainboard/google/fizz/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/fizz/variants/baseboard/include/baseboard/variants.h
index 52615be..db5be5f 100644
--- a/src/mainboard/google/fizz/variants/baseboard/include/baseboard/variants.h
+++ b/src/mainboard/google/fizz/variants/baseboard/include/baseboard/variants.h
@@ -32,4 +32,9 @@
 
 const struct cros_gpio *variant_cros_gpios(size_t *num);
 
+struct nhlt;
+void variant_nhlt_init(struct nhlt *nhlt);
+void variant_nhlt_oem_overrides(const char **oem_id, const char **oem_table_id,
+				uint32_t *oem_revision);
+
 #endif /* __BASEBOARD_VARIANTS_H__ */
diff --git a/src/mainboard/google/fizz/variants/baseboard/nhlt.c b/src/mainboard/google/fizz/variants/baseboard/nhlt.c
new file mode 100644
index 0000000..b443bb5
--- /dev/null
+++ b/src/mainboard/google/fizz/variants/baseboard/nhlt.c
@@ -0,0 +1,34 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2017 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.
+ */
+#include <baseboard/variants.h>
+#include <console/console.h>
+#include <nhlt.h>
+#include <soc/nhlt.h>
+void __attribute__((weak)) variant_nhlt_init(struct nhlt *nhlt)
+{
+
+	/* RT5663 Headset codec */
+	if (nhlt_soc_add_rt5663(nhlt, AUDIO_LINK_SSP1))
+		printk(BIOS_ERR, "Couldn't add headset codec.\n");
+
+}
+void __attribute__((weak)) variant_nhlt_oem_overrides(const char **oem_id,
+						const char **oem_table_id,
+						uint32_t *oem_revision)
+{
+	*oem_id = "GOOGLE";
+	*oem_table_id = "FIZZ";
+	*oem_revision = 0;
+}

-- 
To view, visit https://review.coreboot.org/28965
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I30d93babb6fc09e8642b3740f1f7638fa33f0ade
Gerrit-Change-Number: 28965
Gerrit-PatchSet: 1
Gerrit-Owner: David Wu <david_wu at quanta.corp-partner.google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181008/e8c6fa02/attachment-0001.html>


More information about the coreboot-gerrit mailing list