Attention is currently required from: Hung-Te Lin.
jason-ch chen has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/73412 )
Change subject: mb/google/geralt: Add MAX98390 support for Geralt ......................................................................
mb/google/geralt: Add MAX98390 support for Geralt
Add a config "USE_MAX98390" to enable MAX98390 support.
MAX98390 is an I2S smart amplifier used in Geralt. It is also the default speaker for Geralt reference board.
BUG=b:250459803 BRANCH=none TEST=Verify beep function through CLI in depthcharge successfully.
Change-Id: I814f440cc5ac2a13404d01fb3baafeec092b1e74 Signed-off-by: Trevor Wu trevor.wu@mediatek.com --- M src/mainboard/google/geralt/Kconfig M src/mainboard/google/geralt/chromeos.c M src/mainboard/google/geralt/gpio.h M src/mainboard/google/geralt/mainboard.c M src/soc/mediatek/mt8188/include/soc/addressmap.h 5 files changed, 75 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/12/73412/1
diff --git a/src/mainboard/google/geralt/Kconfig b/src/mainboard/google/geralt/Kconfig index 8de4fea..197ba48 100644 --- a/src/mainboard/google/geralt/Kconfig +++ b/src/mainboard/google/geralt/Kconfig @@ -60,4 +60,15 @@ config SDCARD_INIT bool default y + +choice + + prompt "Speaker AMP for Geralt" + default USE_MAX98390 if BOARD_GOOGLE_GERALT + +config USE_MAX98390 + bool "MAX98390" + +endchoice + endif diff --git a/src/mainboard/google/geralt/chromeos.c b/src/mainboard/google/geralt/chromeos.c index 266fc78..10fc9d3 100644 --- a/src/mainboard/google/geralt/chromeos.c +++ b/src/mainboard/google/geralt/chromeos.c @@ -18,6 +18,7 @@ /* Set up GPOs */ gpio_output(GPIO_AP_EC_WARM_RST_REQ, 0); gpio_output(GPIO_EN_SPKR, 0); + gpio_output(GPIO_RST_SPKR_L, 0); gpio_output(GPIO_XHCI_INIT_DONE, 0); }
@@ -39,6 +40,13 @@ }; lb_add_gpios(gpios, sd_card_gpios, ARRAY_SIZE(sd_card_gpios)); } + + if (CONFIG(USE_MAX98390)) { + struct lb_gpio max98390_gpios[] = { + {GPIO_RST_SPKR_L.id, ACTIVE_LOW, -1, "speaker reset"}, + }; + lb_add_gpios(gpios, max98390_gpios, ARRAY_SIZE(max98390_gpios)); + } }
int tis_plat_irq_status(void) diff --git a/src/mainboard/google/geralt/gpio.h b/src/mainboard/google/geralt/gpio.h index 36f488e..126cfe8 100644 --- a/src/mainboard/google/geralt/gpio.h +++ b/src/mainboard/google/geralt/gpio.h @@ -12,8 +12,13 @@ #define GPIO_EC_AP_INT_ODL GPIO(DPI_DE) #define GPIO_EN_SPKR GPIO(I2SIN_D2) #define GPIO_GSC_AP_INT_ODL GPIO(GPIO00) +#define GPIO_RST_SPKR_L GPIO(I2SO2_D1) #define GPIO_XHCI_INIT_DONE GPIO(DPI_CK)
+#define GPIO_I2SI1_LRCK GPIO(I2SO2_D2) +#define GPIO_I2SI1_BCK GPIO(I2SIN_D3) +#define GPIO_I2SO1_D0 GPIO(GPIO11) + #define GPIO_EDP_BL_PWM_1V8 GPIO(DISP_PWM1) #define GPIO_EDP_HPD_1V8 GPIO(GPIO17) #define GPIO_EN_PP3300_EDP_DISP_X GPIO(DSI1_LCM_RST) diff --git a/src/mainboard/google/geralt/mainboard.c b/src/mainboard/google/geralt/mainboard.c index ee8b005..1422398 100644 --- a/src/mainboard/google/geralt/mainboard.c +++ b/src/mainboard/google/geralt/mainboard.c @@ -3,13 +3,42 @@ #include <bootmode.h> #include <device/device.h> #include <soc/bl31.h> +#include <soc/i2c.h> #include <soc/msdc.h> #include <soc/mt6359p.h> +#include <soc/mtcmos.h> #include <soc/usb.h>
#include "display.h" #include "gpio.h"
+#define AFE_SE_SECURE_CON (AUDIO_BASE + 0x17a8) + +static void configure_i2s(void) +{ + /* Audio PWR */ + mtcmos_audio_power_on(); + mtcmos_protect_audio_bus(); + + /* Switch to normal mode */ + write32p(AFE_SE_SECURE_CON, 0x0); + + /* SoC I2S */ + gpio_set_mode(GPIO_I2SI1_LRCK, PAD_I2SO2_D2_FUNC_TDMIN_LRCK); + gpio_set_mode(GPIO_I2SI1_BCK, PAD_I2SIN_D3_FUNC_TDMIN_BCK); + gpio_set_mode(GPIO_I2SO1_D0, PAD_GPIO11_FUNC_I2SO1_D0); +} + +static void configure_audio(void) +{ + if (CONFIG(USE_MAX98390)) { + printk(BIOS_DEBUG, "Configure MAX98390 audio\n"); + + mtk_i2c_bus_init(I2C0, I2C_SPEED_FAST); + configure_i2s(); + } +} + static void mainboard_init(struct device *dev) { mt6359p_init_pmif_arb(); @@ -23,6 +52,8 @@
mtk_msdc_configure_emmc(true);
+ configure_audio(); + if (CONFIG(SDCARD_INIT)) mtk_msdc_configure_sdcard();
diff --git a/src/soc/mediatek/mt8188/include/soc/addressmap.h b/src/soc/mediatek/mt8188/include/soc/addressmap.h index a5a3c00..63f0596 100644 --- a/src/soc/mediatek/mt8188/include/soc/addressmap.h +++ b/src/soc/mediatek/mt8188/include/soc/addressmap.h @@ -57,6 +57,7 @@ DPM_PM_SRAM_BASE2 = IO_PHYS + 0x00A00000, DPM_DM_SRAM_BASE2 = IO_PHYS + 0x00A20000, DPM_CFG_BASE2 = IO_PHYS + 0x00A40000, + AUDIO_BASE = IO_PHYS + 0x00B10000, UART0_BASE = IO_PHYS + 0x01001100, UART1_BASE = IO_PHYS + 0x01001200, UART2_BASE = IO_PHYS + 0x01001300,