summaryrefslogtreecommitdiff
path: root/src/mainboard/google
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainboard/google')
-rw-r--r--src/mainboard/google/cherry/Kconfig17
-rw-r--r--src/mainboard/google/cherry/chromeos.c6
-rw-r--r--src/mainboard/google/cherry/mainboard.c25
3 files changed, 40 insertions, 8 deletions
diff --git a/src/mainboard/google/cherry/Kconfig b/src/mainboard/google/cherry/Kconfig
index e45b259333..51ad029db3 100644
--- a/src/mainboard/google/cherry/Kconfig
+++ b/src/mainboard/google/cherry/Kconfig
@@ -57,11 +57,18 @@ config EC_GOOGLE_CHROMEEC_SPI_BUS
hex
default 0x0
-config CHERRY_USE_RT1011
- bool
- default n
+choice
+ prompt "Speaker AMP for Cherry"
+ default CHERRY_USE_RT1019 if BOARD_GOOGLE_CHERRY || BOARD_GOOGLE_TOMATO
+ default CHERRY_USE_MAX98390 if BOARD_GOOGLE_DOJO
+config CHERRY_USE_RT1011
+ bool "RT1011"
config CHERRY_USE_RT1019
- bool
- default y
+ bool "RT1019"
+config CHERRY_USE_MAX98390
+ bool "MAX98390"
+
+endchoice
+
endif
diff --git a/src/mainboard/google/cherry/chromeos.c b/src/mainboard/google/cherry/chromeos.c
index 13b673cf07..301a0bc1c7 100644
--- a/src/mainboard/google/cherry/chromeos.c
+++ b/src/mainboard/google/cherry/chromeos.c
@@ -47,12 +47,18 @@ void fill_lb_gpios(struct lb_gpios *gpios)
{GPIO_EN_SPK.id, ACTIVE_HIGH, -1, "speaker enable"},
};
+ struct lb_gpio spk_gpios[] = {
+ {GPIO_EN_SPK.id, ACTIVE_HIGH, -1, "speaker enable"},
+ };
+
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
if (CONFIG(CHERRY_USE_RT1019))
lb_add_gpios(gpios, rt1019_gpios, ARRAY_SIZE(rt1019_gpios));
else if (CONFIG(CHERRY_USE_RT1011))
lb_add_gpios(gpios, rt1011_gpios, ARRAY_SIZE(rt1011_gpios));
+ else if (CONFIG(CHERRY_USE_MAX98390))
+ lb_add_gpios(gpios, spk_gpios, ARRAY_SIZE(spk_gpios));
}
int tis_plat_irq_status(void)
diff --git a/src/mainboard/google/cherry/mainboard.c b/src/mainboard/google/cherry/mainboard.c
index 92d8ee1dbe..3fb599b5c8 100644
--- a/src/mainboard/google/cherry/mainboard.c
+++ b/src/mainboard/google/cherry/mainboard.c
@@ -92,6 +92,27 @@ static bool configure_display(void)
return true;
}
+static void configure_i2s(void)
+{
+ /* Audio PWR */
+ mtcmos_audio_power_on();
+ mtcmos_protect_audio_bus();
+
+ /* SoC I2S */
+ gpio_set_mode(GPIO(GPIO_02), PAD_GPIO_02_FUNC_TDMIN_LRCK);
+ gpio_set_mode(GPIO(GPIO_03), PAD_GPIO_03_FUNC_TDMIN_BCK);
+ gpio_set_mode(GPIO(I2SO2_D0), PAD_I2SO2_D0_FUNC_I2SO2_D0);
+}
+
+static void configure_audio(void)
+{
+ if (CONFIG(CHERRY_USE_RT1011) || CONFIG(CHERRY_USE_MAX98390))
+ mtk_i2c_bus_init(I2C2, I2C_SPEED_FAST);
+
+ if (CONFIG(CHERRY_USE_MAX98390))
+ configure_i2s();
+}
+
static void mainboard_init(struct device *dev)
{
if (display_init_required())
@@ -103,9 +124,7 @@ static void mainboard_init(struct device *dev)
mtk_msdc_configure_sdcard();
setup_usb_host();
- /* for audio usage */
- if (CONFIG(CHERRY_USE_RT1011))
- mtk_i2c_bus_init(I2C2, I2C_SPEED_FAST);
+ configure_audio();
if (dpm_init())
printk(BIOS_ERR, "dpm init failed, DVFS may not work\n");