From 812df72a54034adec7f296b9af9a120e121ccfcd Mon Sep 17 00:00:00 2001 From: Trevor Wu Date: Tue, 22 Mar 2022 13:09:13 +0800 Subject: mb/google/cherry: support max98390 audio amp The Cherry follower projects may choose Max98390 for audio output so we have to add a new config CHERRY_USE_MAX98390. Also, the 'dojo' device is the first one to use it. BUG=b:204391159 BRANCH=cherry TEST=emerge-cherry coreboot TEST=Verify beep function through CLI in depthcharge successfully Signed-off-by: Trevor Wu Change-Id: I9b6bc5a5520292dd502b0389217f5062479b4490 Reviewed-on: https://review.coreboot.org/c/coreboot/+/63083 Reviewed-by: Rex-BC Chen Reviewed-by: Hung-Te Lin Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- src/mainboard/google/cherry/mainboard.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'src/mainboard/google/cherry/mainboard.c') diff --git a/src/mainboard/google/cherry/mainboard.c b/src/mainboard/google/cherry/mainboard.c index 92d8ee1dbe..3fb599b5c8 100644 --- a/src/mainboard/google/cherry/mainboard.c +++ b/src/mainboard/google/cherry/mainboard.c @@ -92,6 +92,27 @@ static bool configure_display(void) return true; } +static void configure_i2s(void) +{ + /* Audio PWR */ + mtcmos_audio_power_on(); + mtcmos_protect_audio_bus(); + + /* SoC I2S */ + gpio_set_mode(GPIO(GPIO_02), PAD_GPIO_02_FUNC_TDMIN_LRCK); + gpio_set_mode(GPIO(GPIO_03), PAD_GPIO_03_FUNC_TDMIN_BCK); + gpio_set_mode(GPIO(I2SO2_D0), PAD_I2SO2_D0_FUNC_I2SO2_D0); +} + +static void configure_audio(void) +{ + if (CONFIG(CHERRY_USE_RT1011) || CONFIG(CHERRY_USE_MAX98390)) + mtk_i2c_bus_init(I2C2, I2C_SPEED_FAST); + + if (CONFIG(CHERRY_USE_MAX98390)) + configure_i2s(); +} + static void mainboard_init(struct device *dev) { if (display_init_required()) @@ -103,9 +124,7 @@ static void mainboard_init(struct device *dev) mtk_msdc_configure_sdcard(); setup_usb_host(); - /* for audio usage */ - if (CONFIG(CHERRY_USE_RT1011)) - mtk_i2c_bus_init(I2C2, I2C_SPEED_FAST); + configure_audio(); if (dpm_init()) printk(BIOS_ERR, "dpm init failed, DVFS may not work\n"); -- cgit v1.2.3