Yidi Lin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/87886?usp=email ) Change subject: mb/google/skywalker: Add ALC5645 support for beep sound ...................................................................... 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> --- M src/mainboard/google/skywalker/chromeos.c M src/mainboard/google/skywalker/devicetree.cb M src/mainboard/google/skywalker/gpio.h M src/mainboard/google/skywalker/mainboard.c 4 files changed, 27 insertions(+), 0 deletions(-) Approvals: build bot (Jenkins): Verified Yu-Ping Wu: Looks good to me, approved Yidi Lin: Looks good to me, approved diff --git a/src/mainboard/google/skywalker/chromeos.c b/src/mainboard/google/skywalker/chromeos.c index 9b5a9c0..36be542 100644 --- a/src/mainboard/google/skywalker/chromeos.c +++ b/src/mainboard/google/skywalker/chromeos.c @@ -56,6 +56,11 @@ {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)); } } diff --git a/src/mainboard/google/skywalker/devicetree.cb b/src/mainboard/google/skywalker/devicetree.cb index 6ec4e25..bb54417 100644 --- a/src/mainboard/google/skywalker/devicetree.cb +++ b/src/mainboard/google/skywalker/devicetree.cb @@ -7,5 +7,6 @@ fw_config field AUDIO_AMP 25 27 option AMP_RT9123 0 + option AMP_ALC5645 3 end end diff --git a/src/mainboard/google/skywalker/gpio.h b/src/mainboard/google/skywalker/gpio.h index 208a3d9..4398a6c 100644 --- a/src/mainboard/google/skywalker/gpio.h +++ b/src/mainboard/google/skywalker/gpio.h @@ -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); diff --git a/src/mainboard/google/skywalker/mainboard.c b/src/mainboard/google/skywalker/mainboard.c index f6dc5ca..bd18299 100644 --- a/src/mainboard/google/skywalker/mainboard.c +++ b/src/mainboard/google/skywalker/mainboard.c @@ -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 @@ 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 @@ 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"); } -- To view, visit https://review.coreboot.org/c/coreboot/+/87886?usp=email To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: coreboot Gerrit-Branch: main Gerrit-Change-Id: Ib53175f559eecb3d8b5104b12dabfd4793f65d08 Gerrit-Change-Number: 87886 Gerrit-PatchSet: 6 Gerrit-Owner: Vince Liu <vince-wl.liu@mediatek.com> Gerrit-Reviewer: Hung-Te Lin <hungte@chromium.org> Gerrit-Reviewer: Yidi Lin <yidilin@google.com> Gerrit-Reviewer: Yu-Ping Wu <yupingso@google.com> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Paul Menzel <paulepanter@mailbox.org>