aboutsummaryrefslogtreecommitdiff
path: root/src/mainboard
diff options
context:
space:
mode:
authorKevin Chang <kevin.chang@lcfc.corp-partner.google.com>2021-07-06 14:37:44 +0800
committerMartin Roth <martinroth@google.com>2021-07-19 21:55:23 +0000
commitc775abba986c92e75545783e08cc7d338a680282 (patch)
tree5a26cf8bb4b636f843d9af9b195fc048f2b3e49c /src/mainboard
parent75f927601e8683e2d93ada26f9e2b21b496d7e93 (diff)
grunt/treeya: add Realtek ALC5682 codec support
Replace audio codec from DA7219 to Realtek ALC5682. Add Realtek ALC5682 support. BUG=b:185972050 BRANCH=master TEST=check on treeya system ALC5682 audio codec is working normally. Signed-off-by: Kevin Chang <kevin.chang@lcfc.corp-partner.google.com> Change-Id: I49c673fd944b2c2a79c4283eee941a16596ba7fa Reviewed-on: https://review.coreboot.org/c/coreboot/+/56100 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/mainboard')
-rw-r--r--src/mainboard/google/kahlee/variants/treeya/Makefile.inc2
-rw-r--r--src/mainboard/google/kahlee/variants/treeya/audio.c59
-rw-r--r--src/mainboard/google/kahlee/variants/treeya/devicetree.cb15
-rw-r--r--src/mainboard/google/kahlee/variants/treeya/include/variant/sku.h8
4 files changed, 84 insertions, 0 deletions
diff --git a/src/mainboard/google/kahlee/variants/treeya/Makefile.inc b/src/mainboard/google/kahlee/variants/treeya/Makefile.inc
index 21b0276a72..525e76c875 100644
--- a/src/mainboard/google/kahlee/variants/treeya/Makefile.inc
+++ b/src/mainboard/google/kahlee/variants/treeya/Makefile.inc
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
subdirs-y += ./spd
+
+ramstage-y += audio.c
diff --git a/src/mainboard/google/kahlee/variants/treeya/audio.c b/src/mainboard/google/kahlee/variants/treeya/audio.c
new file mode 100644
index 0000000000..8265298fab
--- /dev/null
+++ b/src/mainboard/google/kahlee/variants/treeya/audio.c
@@ -0,0 +1,59 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <console/console.h>
+#include <ec/google/chromeec/ec.h>
+#include <baseboard/variants.h>
+#include <variant/sku.h>
+#include <string.h>
+#include <drivers/i2c/hid/chip.h>
+
+#define RT58_I2C_ADDRESS 0x1a
+
+extern struct chip_operations drivers_i2c_generic_ops;
+extern struct chip_operations drivers_i2c_da7219_ops;
+
+void variant_devtree_update(void)
+{
+ struct device *mmio_dev = NULL, *child = NULL;
+ struct device *alc_dev = NULL, *da7219_dev = NULL;
+
+ do {
+ mmio_dev = dev_find_path(mmio_dev, DEVICE_PATH_MMIO);
+ if (!mmio_dev) {
+ printk(BIOS_INFO, "Checking audio codec\n");
+ return;
+ }
+ } while (mmio_dev->path.mmio.addr != I2C_BASE_ADDRESS);
+
+ while ((child = dev_bus_each_child(mmio_dev->link_list, child)) != NULL) {
+ if (child->path.type != DEVICE_PATH_I2C)
+ continue;
+ if (child->path.i2c.device != RT58_I2C_ADDRESS)
+ continue;
+ if (child->chip_ops == &drivers_i2c_generic_ops) {
+ struct drivers_i2c_generic_config *config = child->chip_info;
+ if (!strcmp(config->hid, "10EC5682"))
+ alc_dev = child;
+ } else if (child->chip_ops == &drivers_i2c_da7219_ops) {
+ da7219_dev = child;
+ }
+ }
+
+ switch (google_chromeec_get_sku_id()) {
+ case SKU_TREEYA_ALC5682_AE:
+ case SKU_TREEYA_ALC5682_AF:
+ /* alc5682 only */
+ if (da7219_dev)
+ da7219_dev->enabled = 0;
+ if (alc_dev)
+ alc_dev->enabled = 1;
+ break;
+ default:
+ /* da7219 only */
+ if (da7219_dev)
+ da7219_dev->enabled = 1;
+ if (alc_dev)
+ alc_dev->enabled = 0;
+ break;
+ }
+}
diff --git a/src/mainboard/google/kahlee/variants/treeya/devicetree.cb b/src/mainboard/google/kahlee/variants/treeya/devicetree.cb
index 183e3ddacd..0050d80fea 100644
--- a/src/mainboard/google/kahlee/variants/treeya/devicetree.cb
+++ b/src/mainboard/google/kahlee/variants/treeya/devicetree.cb
@@ -110,6 +110,21 @@ chip soc/amd/stoneyridge
register "mclk_name" = ""oscout1""
device i2c 1a on end
end
+ chip drivers/i2c/generic
+ register "hid" = ""10EC5682""
+ register "name" = ""RT58""
+ register "uid" = "1"
+ register "desc" = ""Realtek RT5682""
+ register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPIO_14)"
+ register "property_count" = "2"
+ register "property_list[0].type" = "ACPI_DP_TYPE_INTEGER"
+ register "property_list[0].name" = ""realtek,jd-src""
+ register "property_list[0].integer" = "1"
+ register "property_list[1].type" = "ACPI_DP_TYPE_STRING"
+ register "property_list[1].name" = ""realtek,mclk-name""
+ register "property_list[1].string" = ""oscout1""
+ device i2c 1a on end
+ end
chip drivers/generic/max98357a
register "hid" = ""MX98357A""
register "sdmode_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPIO_119)"
diff --git a/src/mainboard/google/kahlee/variants/treeya/include/variant/sku.h b/src/mainboard/google/kahlee/variants/treeya/include/variant/sku.h
new file mode 100644
index 0000000000..ff2b0867d2
--- /dev/null
+++ b/src/mainboard/google/kahlee/variants/treeya/include/variant/sku.h
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+/* SKU ID enumeration */
+enum treeya_sku {
+ SKU_UNKNOWN = -1,
+ SKU_TREEYA_ALC5682_AE = 174,
+ SKU_TREEYA_ALC5682_AF = 175,
+};