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>
Signed-off-by: jason-ch chen <Jason-ch.Chen@mediatek.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/73412
Reviewed-by: Yidi Lin <yidilin@google.com>
Reviewed-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
This commit is contained in:
Trevor Wu 2023-02-20 17:47:56 +08:00 committed by Martin L Roth
parent bc1fde310e
commit abe3c16df2
5 changed files with 55 additions and 0 deletions

View File

@ -60,4 +60,14 @@ config DRIVER_TPM_I2C_ADDR
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

View File

@ -18,6 +18,7 @@ void setup_chromeos_gpios(void)
/* 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 @@ void fill_lb_gpios(struct lb_gpios *gpios)
};
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)

View File

@ -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)

View File

@ -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 @@ static void mainboard_init(struct device *dev)
mtk_msdc_configure_emmc(true);
configure_audio();
if (CONFIG(SDCARD_INIT))
mtk_msdc_configure_sdcard();

View File

@ -57,6 +57,7 @@ enum {
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,