From 61488ffd57298b4a7882e1c5e12a502a0b2a5e6d Mon Sep 17 00:00:00 2001 From: Youwen Huang Date: Fri, 19 Sep 2025 20:29:09 +0800 Subject: [PATCH] mb/google/skywalker: Add CS35L51 support for beep sound for Padme Add the FW_CONFIG configuration for the Padme project of audio amp and set up I2S for CS35L51. BUG=b:422688421 TEST=emerge-jedi coreboot chromeos-bootimage BRANCH=Skywalker Change-Id: I3486561dcc8695d3d3585c4844654bb7c68a2979 Signed-off-by: Youwen Huang Reviewed-on: https://review.coreboot.org/c/coreboot/+/89273 Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) Reviewed-by: Yidi Lin --- src/mainboard/google/skywalker/chromeos.c | 5 ++++ src/mainboard/google/skywalker/devicetree.cb | 1 + src/mainboard/google/skywalker/mainboard.c | 24 ++++++++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/mainboard/google/skywalker/chromeos.c b/src/mainboard/google/skywalker/chromeos.c index 07341d9ee8..3a7510c5d0 100644 --- a/src/mainboard/google/skywalker/chromeos.c +++ b/src/mainboard/google/skywalker/chromeos.c @@ -81,6 +81,11 @@ void fill_lb_gpios(struct lb_gpios *gpios) {GPIO_EN_SPKR.id, ACTIVE_HIGH, -1, "alc5645_spk_en"}, }; lb_add_gpios(gpios, alc5645_gpios, ARRAY_SIZE(alc5645_gpios)); + } else if (fw_config_probe(FW_CONFIG(AUDIO_AMP, AMP_CS35L51))) { + struct lb_gpio cs35l51_gpios[] = { + {GPIO_RST_SPKR_L.id, ACTIVE_LOW, -1, "speaker reset"}, + }; + lb_add_gpios(gpios, cs35l51_gpios, ARRAY_SIZE(cs35l51_gpios)); } struct lb_gpio edp_pwm_backlight_gpios[] = { diff --git a/src/mainboard/google/skywalker/devicetree.cb b/src/mainboard/google/skywalker/devicetree.cb index 16f2a688ba..e2618d1f19 100644 --- a/src/mainboard/google/skywalker/devicetree.cb +++ b/src/mainboard/google/skywalker/devicetree.cb @@ -9,6 +9,7 @@ fw_config option AMP_RT9123 0 option AMP_RT1019 1 option AMP_ALC5645 3 + option AMP_CS35L51 4 end field STORAGE 30 31 diff --git a/src/mainboard/google/skywalker/mainboard.c b/src/mainboard/google/skywalker/mainboard.c index 9952bfc1ec..9a1b0adb89 100644 --- a/src/mainboard/google/skywalker/mainboard.c +++ b/src/mainboard/google/skywalker/mainboard.c @@ -22,13 +22,31 @@ #define AFE_SE_SECURE_CON1 (AUDIO_BASE + 0x5634) -static void configure_rt9123_rt1019(void) +static void setup_i2s_speaker(void) { - /* SoC I2S */ gpio_set_mode(GPIO_I2S_SPKR_BCK, GPIO_FUNC(DMIC0_DAT0, I2SOUT1_BCK)); gpio_set_mode(GPIO_I2S_SPKR_LRCK, GPIO_FUNC(DMIC1_CLK, I2SOUT1_LRCK)); gpio_set_mode(GPIO_I2S_SPKR_DO, GPIO_FUNC(DMIC1_DAT0, I2SOUT1_DO)); + printk(BIOS_INFO, "%s: I2S configuration done\n", __func__); +} + +static void configure_rt9123_rt1019(void) +{ + /* Set the SOC corresponding pin to I2S related function */ + setup_i2s_speaker(); + + printk(BIOS_INFO, "%s: AMP configuration done\n", __func__); +} + +static void configure_cs35l51(void) +{ + /* Set the SOC corresponding pin to I2S related function */ + setup_i2s_speaker(); + + /* Init I2C bus timing register for audio codecs */ + mtk_i2c_bus_init(I2C7, I2C_SPEED_STANDARD); + printk(BIOS_INFO, "%s: AMP configuration done\n", __func__); } @@ -59,6 +77,8 @@ static void configure_audio(void) configure_rt9123_rt1019(); else if (fw_config_probe(FW_CONFIG(AUDIO_AMP, AMP_ALC5645))) configure_alc5645(); + else if (fw_config_probe(FW_CONFIG(AUDIO_AMP, AMP_CS35L51))) + configure_cs35l51(); else printk(BIOS_WARNING, "Unknown amp\n"); }