Rex-BC Chen has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/57157 )
Change subject: mb/google/cherry: Support audio codec RT1011 ......................................................................
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 --- M src/mainboard/google/cherry/Kconfig M src/mainboard/google/cherry/chromeos.c M src/mainboard/google/cherry/gpio.h M src/mainboard/google/cherry/mainboard.c 4 files changed, 34 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/57/57157/1
diff --git a/src/mainboard/google/cherry/Kconfig b/src/mainboard/google/cherry/Kconfig index 07a5781..09d820c 100644 --- a/src/mainboard/google/cherry/Kconfig +++ b/src/mainboard/google/cherry/Kconfig @@ -54,4 +54,13 @@ 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 db7db78..748e06e 100644 --- a/src/mainboard/google/cherry/chromeos.c +++ b/src/mainboard/google/cherry/chromeos.c @@ -12,12 +12,16 @@ 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 @@ 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 e5465ac..2c9c8e3 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 bb6dbac..7b9ba65 100644 --- a/src/mainboard/google/cherry/mainboard.c +++ b/src/mainboard/google/cherry/mainboard.c @@ -203,6 +203,10 @@ 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");