From 823f95e8a39bb81e3a35dbf454063a0b119d1a0d Mon Sep 17 00:00:00 2001 From: wuyang5 Date: Thu, 2 Nov 2023 09:33:01 +0800 Subject: [PATCH] mb/google/corsola: Configure I2C and I2S interface for ALC5650 Configure I2S1 and I2C5 for ALC5650 to support beep sound in depthcharge. BRANCH=corsola BUG=b:305828247 TEST=Verify devbeep in depthcharge console Change-Id: Ibd098adb8d5568ad338bbfece0edfd0c38cbf854 Signed-off-by: Yang Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/79064 Reviewed-by: Yidi Lin Tested-by: build bot (Jenkins) Reviewed-by: Ruihai Zhou Reviewed-by: Yu-Ping Wu --- src/mainboard/google/corsola/mainboard.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/mainboard/google/corsola/mainboard.c b/src/mainboard/google/corsola/mainboard.c index b2c65eb411..69e72d7d13 100644 --- a/src/mainboard/google/corsola/mainboard.c +++ b/src/mainboard/google/corsola/mainboard.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -12,7 +13,7 @@ #include "display.h" #include "gpio.h" -static void configure_audio(void) +static void configure_alc1019(void) { mtcmos_audio_power_on(); @@ -23,6 +24,20 @@ static void configure_audio(void) gpio_set_mode(GPIO(EINT4), PAD_EINT4_FUNC_I2S3_DO); } +static void configure_alc5645(void) +{ + mtcmos_audio_power_on(); + + /* Set up I2S */ + gpio_set_mode(GPIO(I2S1_MCK), PAD_I2S1_MCK_FUNC_I2S1_MCK); + gpio_set_mode(GPIO(I2S1_BCK), PAD_I2S1_BCK_FUNC_I2S1_BCK); + gpio_set_mode(GPIO(I2S1_LRCK), PAD_I2S1_LRCK_FUNC_I2S1_LRCK); + gpio_set_mode(GPIO(I2S1_DO), PAD_I2S1_DO_FUNC_I2S1_DO); + + /* Init I2C bus timing register for audio codecs */ + mtk_i2c_bus_init(I2C5, I2C_SPEED_STANDARD); +} + static void mainboard_init(struct device *dev) { mtk_msdc_configure_emmc(true); @@ -36,7 +51,10 @@ static void mainboard_init(struct device *dev) setup_usb_host(); - configure_audio(); + if (CONFIG(BOARD_GOOGLE_CHINCHOU)) + configure_alc5645(); + else + configure_alc1019(); if (spm_init()) printk(BIOS_ERR, "spm init failed, system suspend may not work\n");