diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mainboard/google/geralt/Kconfig | 10 | ||||
-rw-r--r-- | src/mainboard/google/geralt/chromeos.c | 8 | ||||
-rw-r--r-- | src/mainboard/google/geralt/gpio.h | 5 | ||||
-rw-r--r-- | src/mainboard/google/geralt/mainboard.c | 31 | ||||
-rw-r--r-- | src/soc/mediatek/mt8188/include/soc/addressmap.h | 1 |
5 files changed, 55 insertions, 0 deletions
diff --git a/src/mainboard/google/geralt/Kconfig b/src/mainboard/google/geralt/Kconfig index 8de4fea931..af4d7e0d80 100644 --- a/src/mainboard/google/geralt/Kconfig +++ b/src/mainboard/google/geralt/Kconfig @@ -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 diff --git a/src/mainboard/google/geralt/chromeos.c b/src/mainboard/google/geralt/chromeos.c index 266fc78db1..10fc9d314f 100644 --- a/src/mainboard/google/geralt/chromeos.c +++ b/src/mainboard/google/geralt/chromeos.c @@ -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) diff --git a/src/mainboard/google/geralt/gpio.h b/src/mainboard/google/geralt/gpio.h index 36f488e7b8..126cfe8f3f 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 ee8b005d3e..1422398342 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 @@ static void mainboard_init(struct device *dev) 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 a5a3c00f65..63f059616f 100644 --- a/src/soc/mediatek/mt8188/include/soc/addressmap.h +++ b/src/soc/mediatek/mt8188/include/soc/addressmap.h @@ -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, |