summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrevor Wu <trevor.wu@mediatek.com>2021-08-17 15:58:11 +0800
committerFelix Held <felix-coreboot@felixheld.de>2021-08-27 02:54:22 +0000
commit1d19432e1e50dc507af2759bf83c74d5c32c6e4c (patch)
tree87dbcc35effa19fc83865d0d0e04ce033a1ae2f7
parent52889c9c9f6d634f580c003b77889301916ef5e5 (diff)
mb/google/cherry: Support audio codec RT1011
Add GPIO "rt1011 reset" and i2c2 initialization for RT1011. Add CHERRY_USE_RT1011 and CHERRY_USE_RT1019 to Kconfig, so we can spearate code for the specific codec by config. Signed-off-by: Trevor Wu <trevor.wu@mediatek.com> Change-Id: I18939a2a2caae0444ce17f4712764647975121ad Reviewed-on: https://review.coreboot.org/c/coreboot/+/57157 Reviewed-by: Yu-Ping Wu <yupingso@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/mainboard/google/cherry/Kconfig9
-rw-r--r--src/mainboard/google/cherry/chromeos.c22
-rw-r--r--src/mainboard/google/cherry/gpio.h1
-rw-r--r--src/mainboard/google/cherry/mainboard.c4
4 files changed, 34 insertions, 2 deletions
diff --git a/src/mainboard/google/cherry/Kconfig b/src/mainboard/google/cherry/Kconfig
index 07a5781105..09d820c2b7 100644
--- a/src/mainboard/google/cherry/Kconfig
+++ b/src/mainboard/google/cherry/Kconfig
@@ -54,4 +54,13 @@ config BOOT_DEVICE_SPI_FLASH_BUS
config EC_GOOGLE_CHROMEEC_SPI_BUS
hex
default 0x0
+
+config CHERRY_USE_RT1011
+ bool
+ default n
+
+config CHERRY_USE_RT1019
+ bool
+ default y if BOARD_GOOGLE_CHERRY || BOARD_GOOGLE_TOMATO
+ default n
endif
diff --git a/src/mainboard/google/cherry/chromeos.c b/src/mainboard/google/cherry/chromeos.c
index db7db782a8..748e06e28d 100644
--- a/src/mainboard/google/cherry/chromeos.c
+++ b/src/mainboard/google/cherry/chromeos.c
@@ -12,12 +12,16 @@ void setup_chromeos_gpios(void)
gpio_input(GPIO_WP);
gpio_input_pullup(GPIO_EC_AP_INT);
gpio_input_pullup(GPIO_SD_CD);
- gpio_output(GPIO_BEEP_ON, 0);
gpio_input_pullup(GPIO_EC_IN_RW);
gpio_input_pullup(GPIO_GSC_AP_INT);
gpio_output(GPIO_EN_SPK, 0);
gpio_output(GPIO_RESET, 0);
gpio_output(GPIO_XHCI_DONE, 0);
+ if (CONFIG(CHERRY_USE_RT1019))
+ gpio_output(GPIO_BEEP_ON, 0);
+ else if (CONFIG(CHERRY_USE_RT1011))
+ gpio_output(GPIO_RST_RT1011, 0);
+
}
void fill_lb_gpios(struct lb_gpios *gpios)
@@ -25,16 +29,30 @@ void fill_lb_gpios(struct lb_gpios *gpios)
struct lb_gpio chromeos_gpios[] = {
{GPIO_EC_AP_INT.id, ACTIVE_LOW, -1, "EC interrupt"},
{GPIO_SD_CD.id, ACTIVE_LOW, -1, "SD card detect"},
- {GPIO_BEEP_ON.id, ACTIVE_HIGH, -1, "beep enable"},
{GPIO_EC_IN_RW.id, ACTIVE_LOW, -1, "EC in RW"},
/*
* The GPIO_GSC_AP_INT itself is active low, but the payloads will
* create the IRQ using its eint driver, which is active high.
*/
{GPIO_GSC_AP_INT.id, ACTIVE_HIGH, -1, "TPM interrupt"},
+ };
+
+ struct lb_gpio rt1019_gpios[] = {
+ {GPIO_BEEP_ON.id, ACTIVE_HIGH, -1, "beep enable"},
{GPIO_EN_SPK.id, ACTIVE_HIGH, -1, "speaker enable"},
};
+
+ struct lb_gpio rt1011_gpios[] = {
+ {GPIO_RST_RT1011.id, ACTIVE_HIGH, -1, "rt1011 reset"},
+ {GPIO_EN_SPK.id, ACTIVE_HIGH, -1, "speaker enable"},
+ };
+
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
+
+ if (CONFIG(CHERRY_USE_RT1019))
+ lb_add_gpios(gpios, rt1019_gpios, ARRAY_SIZE(rt1019_gpios));
+ else if (CONFIG(CHERRY_USE_RT1011))
+ lb_add_gpios(gpios, rt1011_gpios, ARRAY_SIZE(rt1011_gpios));
}
int tis_plat_irq_status(void)
diff --git a/src/mainboard/google/cherry/gpio.h b/src/mainboard/google/cherry/gpio.h
index e5465ac147..2c9c8e3bf8 100644
--- a/src/mainboard/google/cherry/gpio.h
+++ b/src/mainboard/google/cherry/gpio.h
@@ -12,6 +12,7 @@
#define GPIO_XHCI_DONE GPIO(DGI_D4)
#define GPIO_EC_IN_RW GPIO(DGI_D10)
#define GPIO_GSC_AP_INT GPIO(DGI_D11)
+#define GPIO_RST_RT1011 GPIO(DGI_VSYNC)
#define GPIO_EN_SPK GPIO(UART1_RTS)
#define GPIO_RESET GPIO(UART1_CTS)
diff --git a/src/mainboard/google/cherry/mainboard.c b/src/mainboard/google/cherry/mainboard.c
index bb6dbac8ab..7b9ba658d1 100644
--- a/src/mainboard/google/cherry/mainboard.c
+++ b/src/mainboard/google/cherry/mainboard.c
@@ -203,6 +203,10 @@ static void mainboard_init(struct device *dev)
configure_sdcard();
setup_usb_host();
+ /* for audio usage */
+ if (CONFIG(CHERRY_USE_RT1011))
+ mtk_i2c_bus_init(I2C2);
+
if (dpm_init())
printk(BIOS_ERR, "dpm init failed, DVFS may not work\n");