Kevin: Add support audio path with max98357a
authorXing Zheng <zhengxing@rock-chips.com>
Thu, 19 May 2016 07:04:25 +0000 (15:04 +0800)
committerchrome-bot <chrome-bot@chromium.org>
Thu, 26 May 2016 19:24:52 +0000 (12:24 -0700)
This patch add rockchip i2s route path via the speaker amp
max98357a.

BRANCH=none
BUG=chrome-os-partner:52172
TEST=boot kevin rev1, press ctrl+u and hear the beep voice.

Change-Id: I8cab7fa688f03d173ccdd82e7e30db7562b1472e
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/345745
Commit-Ready: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
board/kevin/defconfig
src/board/kevin/board.c

index dd6b2d1..3f59f55 100644 (file)
@@ -24,17 +24,20 @@ CONFIG_KERNEL_FIT=y
 CONFIG_KERNEL_FIT_FDT_ADDR=0x6400000
 
 # Drivers
+CONFIG_DRIVER_BUS_I2S_ROCKCHIP=y
+CONFIG_DRIVER_BUS_SPI_ROCKCHIP=y
 CONFIG_DRIVER_EC_CROS=y
 CONFIG_DRIVER_EC_CROS_SPI=y
 CONFIG_DRIVER_EC_CROS_SPI_WAKEUP_DELAY_US=100
-
-CONFIG_DRIVER_STORAGE_MMC=y
-CONFIG_DRIVER_STORAGE_DWMMC_RK3399=y
-CONFIG_DRIVER_SDHCI=y
 CONFIG_DRIVER_FLASH_SPI=y
-CONFIG_DRIVER_BUS_SPI_ROCKCHIP=y
 CONFIG_DRIVER_GPIO_RK3399=y
 CONFIG_DRIVER_INPUT_MKBP=y
 CONFIG_DRIVER_INPUT_MKBP_KEYMATRIX_STANDARD=y
 CONFIG_DRIVER_INPUT_USB=y
+CONFIG_DRIVER_SDHCI=y
+CONFIG_DRIVER_SOUND_I2S=y
+CONFIG_DRIVER_SOUND_MAX98357A=y
+CONFIG_DRIVER_SOUND_ROUTE=y
+CONFIG_DRIVER_STORAGE_DWMMC_RK3399=y
+CONFIG_DRIVER_STORAGE_MMC=y
 #CONFIG_DRIVER_TPM_SLB9635_I2C=y
index 849cf81..e80717e 100644 (file)
 #include "base/init_funcs.h"
 #include "boot/fit.h"
 #include "config.h"
+#include "drivers/bus/i2s/rockchip.h"
 #include "drivers/bus/spi/rockchip.h"
 #include "drivers/ec/cros/spi.h"
 #include "drivers/flash/spi.h"
 #include "drivers/flash/spi.h"
 #include "drivers/gpio/rockchip.h"
 #include "drivers/gpio/sysinfo.h"
+#include "drivers/sound/i2s.h"
+#include "drivers/sound/max98357a.h"
+#include "drivers/sound/route.h"
 #include "drivers/storage/dw_mmc.h"
 #include "drivers/storage/rk_dwmmc.h"
 #include "drivers/storage/sdhci.h"
@@ -65,6 +69,21 @@ static int board_setup(void)
        list_insert_after(&emmc->mmc_ctrlr.ctrlr.list_node,
                          &fixed_block_dev_controllers);
 
+       RockchipI2s *i2s0 = new_rockchip_i2s(0xff880000, 16, 2, 256);
+       I2sSource *i2s_source = new_i2s_source(&i2s0->ops, 48000, 2, 16000);
+       SoundRoute *sound_route = new_sound_route(&i2s_source->ops);
+
+       /* Speaker Amp codec MAX98357A */
+       GpioOps *sdmode_gpio = &new_rk_gpio_output(GPIO(1, A, 2))->ops;
+
+       max98357aCodec *speaker_amp =
+               new_max98357a_codec(sdmode_gpio);
+
+       list_insert_after(&speaker_amp->component.list_node,
+                         &sound_route->components);
+
+       sound_set_ops(&sound_route->ops);
+
        RkGpio *card_detect;
 
         /* SDMMC_DET_L is different on different board revisions. */