Rui Zhou has uploaded this change for review.

View Change

mb/google/geralt: support TAS2563 audio amp

Add FW_CONFIG to enable TAS2563 support.

BUG=b:345629159
BRANCH=none
TEST=emerge-GERALT coreboot & Verify beep function through deply in depthcharge successfully.

Change-Id: Ie9f0cbc30dd950b85581fc1924fa351efe1e0aab
Signed-off-by: Rui Zhou <zhourui@huaqin.corp-partner.google.com>
---
M src/mainboard/google/geralt/chromeos.c
M src/mainboard/google/geralt/devicetree.cb
M src/mainboard/google/geralt/mainboard.c
3 files changed, 21 insertions(+), 4 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/83287/1
diff --git a/src/mainboard/google/geralt/chromeos.c b/src/mainboard/google/geralt/chromeos.c
index d66b7d5..b208605 100644
--- a/src/mainboard/google/geralt/chromeos.c
+++ b/src/mainboard/google/geralt/chromeos.c
@@ -4,7 +4,7 @@
#include <boot/coreboot_tables.h>
#include <drivers/tpm/cr50.h>
#include <gpio.h>
-
+#include <fw_config.h>
#include "gpio.h"
#include "panel.h"

@@ -53,11 +53,16 @@
lb_add_gpios(gpios, sd_card_gpios, ARRAY_SIZE(sd_card_gpios));
}

- if (CONFIG(GERALT_USE_MAX98390)) {
+ if (fw_config_probe(FW_CONFIG(AUDIO_AMP, AMP_MAX98390))) {
struct lb_gpio max98390_gpios[] = {
{GPIO_RST_SPKR_L.id, ACTIVE_LOW, -1, "speaker reset"},
};
lb_add_gpios(gpios, max98390_gpios, ARRAY_SIZE(max98390_gpios));
+ } else if (fw_config_probe(FW_CONFIG(AUDIO_AMP, AMP_TAS2563))) {
+ struct lb_gpio tas2563_gpios[] = {
+ {GPIO_RST_SPKR_L.id, ACTIVE_LOW, -1, "tas2563 enable"},
+ };
+ lb_add_gpios(gpios, tas2563_gpios, ARRAY_SIZE(tas2563_gpios));
} else if (CONFIG(GERALT_USE_NAU8318)) {
struct lb_gpio nau8318_gpios[] = {
{GPIO_EN_SPKR.id, ACTIVE_HIGH, -1, "speaker enable"},
diff --git a/src/mainboard/google/geralt/devicetree.cb b/src/mainboard/google/geralt/devicetree.cb
index 3e6bec8a..439ee62 100644
--- a/src/mainboard/google/geralt/devicetree.cb
+++ b/src/mainboard/google/geralt/devicetree.cb
@@ -1,5 +1,12 @@
## SPDX-License-Identifier: GPL-2.0-only

+fw_config
+ field AUDIO_AMP 28 29
+ option AMP_MAX98390 0
+ option AMP_TAS2563 1
+ end
+end
+
chip soc/mediatek/mt8188
device cpu_cluster 0 on end
end
diff --git a/src/mainboard/google/geralt/mainboard.c b/src/mainboard/google/geralt/mainboard.c
index 3f9ab5d..3343fe7 100644
--- a/src/mainboard/google/geralt/mainboard.c
+++ b/src/mainboard/google/geralt/mainboard.c
@@ -9,7 +9,7 @@
#include <soc/mt6359p.h>
#include <soc/mtcmos.h>
#include <soc/usb.h>
-
+#include <fw_config.h>
#include "gpio.h"

#define AFE_SE_SECURE_CON (AUDIO_BASE + 0x17a8)
@@ -31,12 +31,17 @@

static void configure_audio(void)
{
- if (CONFIG(GERALT_USE_MAX98390)) {
+ if (fw_config_probe(FW_CONFIG(AUDIO_AMP, AMP_MAX98390))) {
printk(BIOS_DEBUG, "Configure MAX98390 audio\n");

mtk_i2c_bus_init(I2C0, I2C_SPEED_FAST);
configure_i2s();
}
+ else if (fw_config_probe(FW_CONFIG(AUDIO_AMP, AMP_TAS2563))) {
+ printk(BIOS_DEBUG, "Configure TAS2563 audio\n");
+ mtk_i2c_bus_init(I2C0, I2C_SPEED_FAST);
+ configure_i2s();
+ }
}

static void mainboard_init(struct device *dev)

To view, visit change 83287. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: Ie9f0cbc30dd950b85581fc1924fa351efe1e0aab
Gerrit-Change-Number: 83287
Gerrit-PatchSet: 1
Gerrit-Owner: Rui Zhou <zhourui@huaqin.corp-partner.google.com>