From 2360d7c2771536b785dbcb435f135c5eff713a46 Mon Sep 17 00:00:00 2001 From: Srinivasa Rao Mandadapu Date: Fri, 27 Aug 2021 19:31:34 +0530 Subject: mb/google/herobrine: Add support for audio Add GPIO configuration for target specific i2s ports. BUG=b:182963902 TEST=Validated on qualcomm sc7280 development board Boot on herobrine board (no speakers to test yet) Signed-off-by: Srinivasa Rao Mandadapu Change-Id: I2ce95332f892d5d4acb2755307df84d37feb8002 Reviewed-on: https://review.coreboot.org/c/coreboot/+/57449 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- src/mainboard/google/herobrine/board.h | 5 +++++ src/mainboard/google/herobrine/chromeos.c | 3 +++ src/mainboard/google/herobrine/mainboard.c | 13 +++++++++++++ 3 files changed, 21 insertions(+) diff --git a/src/mainboard/google/herobrine/board.h b/src/mainboard/google/herobrine/board.h index 0f396bc816..d336bce0ad 100644 --- a/src/mainboard/google/herobrine/board.h +++ b/src/mainboard/google/herobrine/board.h @@ -31,6 +31,11 @@ #define USB_HUB_LDO_EN GPIO(157) #endif +#define GPIO_AMP_ENABLE GPIO(63) +#define GPIO_MI2S1_SCK GPIO(106) +#define GPIO_MI2S1_DATA0 GPIO(107) +#define GPIO_MI2S1_WS GPIO(108) + #define QCOM_SC7280_SKU1 0x0 #define QCOM_SC7280_SKU2 0x1 diff --git a/src/mainboard/google/herobrine/chromeos.c b/src/mainboard/google/herobrine/chromeos.c index 4c37ef129c..b5631fc8b2 100644 --- a/src/mainboard/google/herobrine/chromeos.c +++ b/src/mainboard/google/herobrine/chromeos.c @@ -21,6 +21,7 @@ void setup_chromeos_gpios(void) gpio_output(GPIO_FP_RST_L, 0); gpio_output(GPIO_EN_FP_RAILS, 0); } + gpio_output(GPIO_AMP_ENABLE, 0); } void fill_lb_gpios(struct lb_gpios *gpios) @@ -28,6 +29,8 @@ void fill_lb_gpios(struct lb_gpios *gpios) const struct lb_gpio chromeos_gpios[] = { {GPIO_SD_CD_L.addr, ACTIVE_LOW, gpio_get(GPIO_SD_CD_L), "SD card detect"}, + {GPIO_AMP_ENABLE.addr, ACTIVE_HIGH, gpio_get(GPIO_AMP_ENABLE), + "speaker enable"}, #if CONFIG(EC_GOOGLE_CHROMEEC) {GPIO_EC_IN_RW.addr, ACTIVE_LOW, gpio_get(GPIO_EC_IN_RW), "EC in RW"}, diff --git a/src/mainboard/google/herobrine/mainboard.c b/src/mainboard/google/herobrine/mainboard.c index a97f97ef56..e929ec9365 100644 --- a/src/mainboard/google/herobrine/mainboard.c +++ b/src/mainboard/google/herobrine/mainboard.c @@ -36,6 +36,18 @@ static void configure_sdhci(void) write32((void *)SDC2_TLMM_CFG_ADDR, 0x1FE4); } +static void qi2s_configure_gpios(void) +{ + gpio_configure(GPIO_MI2S1_SCK, GPIO106_FUNC_MI2S1_SCK, + GPIO_NO_PULL, GPIO_16MA, GPIO_OUTPUT); + + gpio_configure(GPIO_MI2S1_WS, GPIO108_FUNC_MI2S1_WS, + GPIO_NO_PULL, GPIO_16MA, GPIO_OUTPUT); + + gpio_configure(GPIO_MI2S1_DATA0, GPIO107_FUNC_MI2S1_DATA0, + GPIO_NO_PULL, GPIO_16MA, GPIO_OUTPUT); +} + static void mainboard_init(struct device *dev) { /* Configure clock for eMMC */ @@ -90,6 +102,7 @@ static void mainboard_init(struct device *dev) gpio_output(GPIO_FP_RST_L, 1); setup_usb(); + qi2s_configure_gpios(); } static void mainboard_enable(struct device *dev) -- cgit v1.2.3