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>
This commit is contained in:
Kevin Chang 2021-07-06 14:37:44 +08:00 committed by Martin Roth
parent 75f927601e
commit c775abba98
4 changed files with 84 additions and 0 deletions

View File

@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
subdirs-y += ./spd
ramstage-y += audio.c

View File

@ -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;
}
}

View File

@ -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)"

View File

@ -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,
};