Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/platform: Add "mtk" Zephyr platform for MediaTek DSPs #9755

Merged
merged 6 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/boards/mt8186_mt8186_adsp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Boilerplate. Because the "Platform" is a kconfig "choice" (of which
# "MTK" is an member), it can't be selected automatically from other
andyross marked this conversation as resolved.
Show resolved Hide resolved
# kconfigs, nor expressed as a default. Don't put anything else here.
# Board-level config goes in Zephyr (and ideally in DTS). App-level
# config goes in prj.conf.
CONFIG_MTK=y
6 changes: 6 additions & 0 deletions app/boards/mt8188_mt8188_adsp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Boilerplate. Because the "Platform" is a kconfig "choice" (of which
# "MTK" is an member), it can't be selected automatically from other
# kconfigs, nor expressed as a default. Don't put anything else here.
# Board-level config goes in Zephyr (and ideally in DTS). App-level
# config goes in prj.conf.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note it is accepted practise use to put vendor specific app settings in these board files. E.g. Intel example #9609 . I do agree anything that can be put in Zephyr board files/DTS or the app prj.conf, should not be put here.

CONFIG_MTK=y
6 changes: 6 additions & 0 deletions app/boards/mt8195_mt8195_adsp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Boilerplate. Because the "Platform" is a kconfig "choice" (of which
# "MTK" is an member), it can't be selected automatically from other
# kconfigs, nor expressed as a default. Don't put anything else here.
# Board-level config goes in Zephyr (and ideally in DTS). App-level
# config goes in prj.conf.
CONFIG_MTK=y
6 changes: 6 additions & 0 deletions app/boards/mt8196_mt8196_adsp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Boilerplate. Because the "Platform" is a kconfig "choice" (of which
# "MTK" is an member), it can't be selected automatically from other
# kconfigs, nor expressed as a default. Don't put anything else here.
# Board-level config goes in Zephyr (and ideally in DTS). App-level
# config goes in prj.conf.
CONFIG_MTK=y
24 changes: 23 additions & 1 deletion scripts/xtensa-build-zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,28 @@ class PlatformConfig:
"rmb_LX7_HiFi5_PROD",
RIMAGE_KEY = "key param ignored by acp_6_0"
),
# MediaTek platforms
# (move to platform_configs_all on next Zephyr SDK release after 0.17.0)
"mt8195" : PlatformConfig(
"mtk", "mt8195/mt8195/adsp",
f"RJ-2024.3{xtensa_tools_version_postfix}",
"hifi4_8195_PROD",
),
"mt8186" : PlatformConfig(
"mtk", "mt8186/mt8186/adsp",
f"RJ-2024.3{xtensa_tools_version_postfix}",
"hifi5_7stg_I64D128",
),
"mt8188" : PlatformConfig(
"mtk", "mt8188/mt8188/adsp",
f"RJ-2024.3{xtensa_tools_version_postfix}",
"hifi5_7stg_I64D128",
),
"mt8196" : PlatformConfig(
"mtk", "mt8196/mt8196/adsp",
f"RJ-2024.3{xtensa_tools_version_postfix}",
"HiFi5_MPU_lock_2023_11",
),
}

# These can all be built out of the box. --all builds all these.
Expand Down Expand Up @@ -1173,7 +1195,7 @@ def gzip_compress(fname, gzdst=None):

RI_INFO_UNSUPPORTED += ['imx8', 'imx8x', 'imx8m', 'imx8ulp', 'imx95']
RI_INFO_UNSUPPORTED += ['rn', 'acp_6_0']
RI_INFO_UNSUPPORTED += ['mt8186', 'mt8195']
RI_INFO_UNSUPPORTED += ['mt8186', 'mt8188', 'mt8195', 'mt8196']
andyross marked this conversation as resolved.
Show resolved Hide resolved

# For temporary workarounds. Unlike _UNSUPPORTED above, the platforms below will print a warning.
RI_INFO_FIXME = [ ]
Expand Down
1 change: 1 addition & 0 deletions src/drivers/mediatek/afe/afe-dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
SOF_DEFINE_REG_UUID(afe_dai);

DECLARE_TR_CTX(afe_dai_tr, SOF_UUID(afe_dai_uuid), LOG_LEVEL_INFO);
LOG_MODULE_DECLARE(mtk_afe, CONFIG_SOF_LOG_LEVEL);

static int afe_dai_drv_trigger(struct dai *dai, int cmd, int direction)
{
Expand Down
1 change: 1 addition & 0 deletions src/drivers/mediatek/afe/afe-drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ static struct mtk_base_afe mtk_afe;
SOF_DEFINE_REG_UUID(afedrv);

DECLARE_TR_CTX(afedrv_tr, SOF_UUID(afedrv_uuid), LOG_LEVEL_INFO);
LOG_MODULE_DECLARE(mtk_afe, CONFIG_SOF_LOG_LEVEL);

static inline void afe_reg_read(struct mtk_base_afe *afe, uint32_t reg, uint32_t *value)
{
Expand Down
1 change: 1 addition & 0 deletions src/drivers/mediatek/afe/afe-memif.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
SOF_DEFINE_REG_UUID(memif);

DECLARE_TR_CTX(memif_tr, SOF_UUID(memif_uuid), LOG_LEVEL_INFO);
LOG_MODULE_REGISTER(mtk_afe, CONFIG_SOF_LOG_LEVEL);

struct afe_memif_dma {
int direction; /* 1 downlink, 0 uplink */
Expand Down
16 changes: 13 additions & 3 deletions src/platform/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ config ACP_7_0
Select if your target platform is acp_7_0-compatible

config MT8186
bool "Build for MTK MT8186"
bool "Build for MTK MT8186 (XTOS)"
select XT_INTERRUPT_LEVEL_1
select XT_INTERRUPT_LEVEL_2
select XT_INTERRUPT_LEVEL_3
Expand All @@ -244,9 +244,10 @@ config MT8186
select SCHEDULE_DMA_MULTI_CHANNEL
help
Select if your target platform is mt8186-compatible
Builds legacy/xtos firmware

config MT8188
bool "Build for MTK MT8188"
bool "Build for MTK MT8188 (XTOS)"
select XT_INTERRUPT_LEVEL_1
select XT_INTERRUPT_LEVEL_2
select XT_INTERRUPT_LEVEL_3
Expand All @@ -259,9 +260,10 @@ config MT8188
select SCHEDULE_DMA_MULTI_CHANNEL
help
Select if your target platform is mt8188-compatible.
Builds legacy/xtos firmware

config MT8195
bool "Build for MTK MT8195"
bool "Build for MTK MT8195 (XTOS)"
select XT_INTERRUPT_LEVEL_1
select XT_INTERRUPT_LEVEL_2
select XT_INTERRUPT_LEVEL_3
Expand All @@ -272,6 +274,14 @@ config MT8195
select SCHEDULE_DMA_MULTI_CHANNEL
help
Select if your target platform is mt8195-compatible
Builds legacy/xtos firmware

config MTK
bool "Build for Mediatek (Zephyr)"
select SCHEDULE_DMA_MULTI_CHANNEL
select HOST_PTABLE
help
Select if your target is a Mediatek DSP. Builds Zephyr firmware.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will likely conflict with #9758 . Not a big issue, just need one to go first and then rebase...


endchoice

Expand Down
Loading
Loading