mb/google/skywalker: Add ALC5645 support for beep sound

Derive the audio amplifier from FW_CONFIG, and set up I2C and I2S
for ALC5645. Also pass the corresponding GPIO to the payload.

BUG=b:359705470
BRANCH=none
TEST=build ok and test audio cmd ok
AUDIO CMD=audio 500 100 1

Signed-off-by: Cyril Chao <cyril.chao@mediatek.corp-partner.google.com>
Change-Id: Ib53175f559eecb3d8b5104b12dabfd4793f65d08
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87886
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yidi Lin <yidilin@google.com>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
This commit is contained in:
Cyril Chao 2025-03-29 14:21:25 +08:00 committed by Yidi Lin
commit 4caf5131b9
4 changed files with 27 additions and 0 deletions

View file

@ -56,6 +56,11 @@ void fill_lb_gpios(struct lb_gpios *gpios)
{GPIO_EN_SPKR.id, ACTIVE_HIGH, -1, "rt9123_spk_en"},
};
lb_add_gpios(gpios, rt9123_gpios, ARRAY_SIZE(rt9123_gpios));
} else if (fw_config_probe(FW_CONFIG(AUDIO_AMP, AMP_ALC5645))) {
struct lb_gpio alc5645_gpios[] = {
{GPIO_EN_SPKR.id, ACTIVE_HIGH, -1, "alc5645_spk_en"},
};
lb_add_gpios(gpios, alc5645_gpios, ARRAY_SIZE(alc5645_gpios));
}
}

View file

@ -7,5 +7,6 @@ end
fw_config
field AUDIO_AMP 25 27
option AMP_RT9123 0
option AMP_ALC5645 3
end
end

View file

@ -31,6 +31,10 @@
#define GPIO_I2SOUT1_BCK GPIO(DMIC0_DAT0)
#define GPIO_I2SOUT1_LRCK GPIO(DMIC1_CLK)
#define GPIO_I2SOUT1_DOUT GPIO(DMIC1_DAT0)
#define GPIO_I2SOUT0_MCK GPIO(I2SOUT0_MCK)
#define GPIO_I2SOUT0_BCK GPIO(I2SOUT0_BCK)
#define GPIO_I2SOUT0_LRCK GPIO(I2SOUT0_LRCK)
#define GPIO_I2SOUT0_DOUT GPIO(I2SOUT0_DO)
void setup_chromeos_gpios(void);

View file

@ -6,6 +6,7 @@
#include <gpio.h>
#include <soc/bl31.h>
#include <soc/dpm_v2.h>
#include <soc/i2c.h>
#include <soc/msdc.h>
#include <soc/mt6359p.h>
#include <soc/mtcmos.h>
@ -26,6 +27,20 @@ static void configure_rt9123(void)
printk(BIOS_INFO, "%s: AMP configuration done\n", __func__);
}
static void configure_alc5645(void)
{
/* SoC I2S */
gpio_set_mode(GPIO_I2SOUT0_MCK, GPIO_FUNC(I2SOUT0_MCK, I2SOUT0_MCK));
gpio_set_mode(GPIO_I2SOUT0_BCK, GPIO_FUNC(I2SOUT0_BCK, I2SOUT0_BCK));
gpio_set_mode(GPIO_I2SOUT0_LRCK, GPIO_FUNC(I2SOUT0_LRCK, I2SOUT0_LRCK));
gpio_set_mode(GPIO_I2SOUT0_DOUT, GPIO_FUNC(I2SOUT0_DO, I2SOUT0_DO));
/* Init I2C bus timing register for audio codecs */
mtk_i2c_bus_init(I2C2, I2C_SPEED_STANDARD);
printk(BIOS_INFO, "%s: AMP configuration done\n", __func__);
}
static void configure_audio(void)
{
mtcmos_audio_power_on();
@ -36,6 +51,8 @@ static void configure_audio(void)
if (fw_config_probe(FW_CONFIG(AUDIO_AMP, AMP_RT9123)))
configure_rt9123();
else if (fw_config_probe(FW_CONFIG(AUDIO_AMP, AMP_ALC5645)))
configure_alc5645();
else
printk(BIOS_WARNING, "Unknown amp\n");
}