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>
This commit is contained in:
Trevor Wu 2021-08-17 15:58:11 +08:00 committed by Felix Held
parent 52889c9c9f
commit 1d19432e1e
4 changed files with 34 additions and 2 deletions

View File

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

View File

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

View File

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

View File

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