From 9bbc5077eb14b72039f0bdd395f57e4460cbe466 Mon Sep 17 00:00:00 2001 From: Allen-KH Cheng Date: Thu, 9 Sep 2021 14:32:24 +0800 Subject: [PATCH 1/4] drivers: mtk: remove superfluous variable for mt8195 For GCC compile error, error: variable 'ret' set but not use Signed-off-by: YC Hung Signed-off-by: Allen-KH Cheng --- src/drivers/mediatek/mt8195/afe-memif.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/drivers/mediatek/mt8195/afe-memif.c b/src/drivers/mediatek/mt8195/afe-memif.c index feaf80563bed..0a97304908d2 100644 --- a/src/drivers/mediatek/mt8195/afe-memif.c +++ b/src/drivers/mediatek/mt8195/afe-memif.c @@ -465,7 +465,6 @@ static int memif_status(struct dma_chan_data *channel, struct dma_chan_status *s static int memif_set_config(struct dma_chan_data *channel, struct dma_sg_config *config) { struct afe_memif_dma *memif = dma_chan_get_data(channel); - int ret; int dai_id; int irq_id; unsigned int dma_addr; @@ -482,19 +481,17 @@ static int memif_set_config(struct dma_chan_data *channel, struct dma_sg_config switch (config->direction) { case DMA_DIR_MEM_TO_DEV: - if (direction != MEM_DIR_PLAYBACK) { - ret = -EINVAL; - break; - } + if (direction != MEM_DIR_PLAYBACK) + return -EINVAL; + dai_id = (int)AFE_HS_GET_DAI(config->dest_dev); irq_id = (int)AFE_HS_GET_IRQ(config->dest_dev); dma_addr = (int)config->elem_array.elems[0].src; break; case DMA_DIR_DEV_TO_MEM: - if (direction != MEM_DIR_CAPTURE) { - ret = -EINVAL; - break; - } + if (direction != MEM_DIR_CAPTURE) + return -EINVAL; + dai_id = (int)AFE_HS_GET_DAI(config->src_dev); irq_id = (int)AFE_HS_GET_IRQ(config->src_dev); dma_addr = (int)config->elem_array.elems[0].dest; From 34c0c599b765b4b7a360866b3a233412ee65b0c7 Mon Sep 17 00:00:00 2001 From: Allen-KH Cheng Date: Thu, 9 Sep 2021 19:23:26 +0800 Subject: [PATCH 2/4] build: remove unused files from build system Removes the files added to build system by mistake. Signed-off-by: YC Hung Signed-off-by: Allen-KH Cheng --- src/drivers/mediatek/mt8195/CMakeLists.txt | 2 +- src/platform/mt8195/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/mediatek/mt8195/CMakeLists.txt b/src/drivers/mediatek/mt8195/CMakeLists.txt index a0b748083088..ac18de862e22 100644 --- a/src/drivers/mediatek/mt8195/CMakeLists.txt +++ b/src/drivers/mediatek/mt8195/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause add_local_sources(sof ipc.c timer.c - interrupt.c uart.c afe-memif.c afe-dai.c afe-drv.c + interrupt.c afe-memif.c afe-dai.c afe-drv.c ) diff --git a/src/platform/mt8195/CMakeLists.txt b/src/platform/mt8195/CMakeLists.txt index 1452f7ec44a5..b5b1e06e9e10 100644 --- a/src/platform/mt8195/CMakeLists.txt +++ b/src/platform/mt8195/CMakeLists.txt @@ -2,5 +2,5 @@ add_subdirectory(lib) -add_local_sources(sof platform.c printf.c afe-platform.c) +add_local_sources(sof platform.c afe-platform.c) target_include_directories(sof_options INTERFACE ${PROJECT_SOURCE_DIR}/src/platform/mt8195/include/platform) From e4be4c279a96dfee3d51a5c9b7bbb8d8181f2f34 Mon Sep 17 00:00:00 2001 From: Allen-KH Cheng Date: Thu, 9 Sep 2021 19:22:10 +0800 Subject: [PATCH 3/4] Kconfig: add mt8195 to Kconfig add mt8195 to Kconfig add mediatek config for mtk platform Signed-off-by: YC Hung Signed-off-by: Allen-KH Cheng --- src/arch/xtensa/CMakeLists.txt | 2 ++ src/platform/Kconfig | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/arch/xtensa/CMakeLists.txt b/src/arch/xtensa/CMakeLists.txt index a2ba820be6ae..0f24518c4567 100644 --- a/src/arch/xtensa/CMakeLists.txt +++ b/src/arch/xtensa/CMakeLists.txt @@ -31,6 +31,8 @@ elseif(CONFIG_IMX8M) set(platform_folder imx8m) elseif(CONFIG_IMX8ULP) set(platform_folder imx8ulp) +elseif(CONFIG_MT8195) + set(platform_folder mt8195) endif() if(CONFIG_CAVS) diff --git a/src/platform/Kconfig b/src/platform/Kconfig index 7ed63698e555..233d54d2e46a 100644 --- a/src/platform/Kconfig +++ b/src/platform/Kconfig @@ -245,6 +245,19 @@ config RENOIR help Select if your target platform is renoir-compatible +config MT8195 + bool "Build for MTK MT8195" + select XT_INTERRUPT_LEVEL_1 + select XT_INTERRUPT_LEVEL_2 + select XT_INTERRUPT_LEVEL_3 + select DUMMY_DMA + select HOST_PTABLE + select XT_WAITI_DELAY + select MEDIATEK + select SCHEDULE_DMA_MULTI_CHANNEL + help + Select if your target platform is mt8195-compatible + endchoice config MAX_CORE_COUNT @@ -291,6 +304,13 @@ config IMX This has to be selected for every i.MX NXP platform. It enables NXP platforms-specific features. +config MEDIATEK + bool + default n + help + This has to be selected for every Mediatek platform. + It enables Mediatek platforms-specific features. + config CAVS bool default n @@ -427,6 +447,7 @@ config RIMAGE_SIGNING_SCHEMA default "imx8m" if IMX8M default "imx8ulp" if IMX8ULP default "rn" if RENOIR + default "mt8195" if MT8195 default "" help Signing schema name used by rimage to decide how to build final binary From dc945bbb06a3fce1e3c893ac9d7e0d3f455bf451 Mon Sep 17 00:00:00 2001 From: Allen-KH Cheng Date: Thu, 9 Sep 2021 19:20:27 +0800 Subject: [PATCH 4/4] scripts: Add mt8195 to build script Add mt8195 to build script. Signed-off-by: YC Hung Signed-off-by: Allen-KH Cheng --- scripts/xtensa-build-all.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/xtensa-build-all.sh b/scripts/xtensa-build-all.sh index b3e34ce82aa0..2df924e86c53 100755 --- a/scripts/xtensa-build-all.sh +++ b/scripts/xtensa-build-all.sh @@ -6,7 +6,7 @@ set -e SUPPORTED_PLATFORMS=(byt cht bdw hsw apl skl kbl cnl sue icl jsl \ - imx8 imx8x imx8m imx8ulp tgl tgl-h rn) + imx8 imx8x imx8m imx8ulp tgl tgl-h rn mt8195) BUILD_ROM=no BUILD_DEBUG=no BUILD_FORCE_UP=no @@ -329,6 +329,12 @@ do HOST="xtensa-rn-elf" XTENSA_TOOLS_VERSION="RF-2016.4-linux" ;; + mt8195) + PLATFORM="mt8195" + XTENSA_CORE="hifi4_8195_PROD" + HOST="xtensa-mt8195-elf" + XTENSA_TOOLS_VERSION="RI-2019.1-linux" + ;; esac