Mt8196/v0.3#10785
Open
mtkcyril wants to merge 6 commits into
Open
Conversation
Collaborator
|
Can one of the admins verify this patch?
|
Member
|
test this please |
lyakh
reviewed
May 19, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a Zephyr “native drivers” path for MediaTek (MT8196) by adding Zephyr-based DMA/DAI drivers for MTK AFE + host memory transfers and wiring them into the MTK Zephyr platform init/build.
Changes:
- Add MTK Zephyr-native DMA drivers (AFE MEMIF DMA + “host DMA” memcpy/cache driver) and a Zephyr DAI wrapper for MTK AFE.
- Switch MTK Zephyr build to select native vs legacy DMA/DAI sources and update platform init to use
sof_dma_*in native mode. - Extend Zephyr-native DAI/device enumeration and allow MTK host DMA for IPC3 host page-table transfers.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| zephyr/lib/dma.c | Adds new DT-based DMA entries for MTK AFE MEMIF and host DMA |
| zephyr/Kconfig | Adds Kconfig symbol for MTK SOF host DMA driver |
| zephyr/include/sof/lib/dma.h | Fixes #endif comment for native/legacy include |
| zephyr/CMakeLists.txt | Selects MTK native vs legacy DMA/DAI source sets |
| src/platform/mtk/platform.c | Uses sof_dma_get() in native mode; adds SOF-level DMA channel-array allocation |
| src/platform/mtk/dai.c | Gates legacy DAI/DMA info setup on non-native builds |
| src/platform/Kconfig | Avoids selecting SCHEDULE_DMA_MULTI_CHANNEL in native mode |
| src/lib/dai.c | Adds MediaTek AFE devices to Zephyr DAI device list and sets DMA dev mapping |
| src/ipc/ipc3/host-page-table.c | Allows MTK host DMA driver for page-table transfer in native mode |
| src/drivers/mediatek/afe/zephyr_mtk_host_dma.c | New MTK “software host DMA” driver (memcpy + cache mgmt) |
| src/drivers/mediatek/afe/zephyr_mtk_dai.c | New Zephyr DAI driver for MTK AFE that bridges to SOF AFE functions |
| src/drivers/mediatek/afe/zephyr_mtk_afe_memif.c | New Zephyr DMA driver for MTK AFE MEMIF |
| src/audio/dai-zephyr.c | Adds MediaTek AFE case to Zephyr DAI config translation |
| app/boards/mt8196_mt8196_adsp.conf | Enables Zephyr native drivers + DMA/DAI for MT8196 board config |
Comments suppressed due to low confidence (2)
src/drivers/mediatek/afe/zephyr_mtk_host_dma.c:163
mtk_host_dma_get_status()always returns success without populatingstruct dma_status. SOF's host Zephyr component relies ondma_get_status()fields likefree,pending_length,read_position, andwrite_positionto decide how many bytes to copy. Returning 0 with uninitialized status data can cause incorrect copy sizes or undefined behavior. Please either properly fillstat(and track positions/busy state) or return a clear error (e.g.-ENOTSUP) until implemented.
static int mtk_host_dma_get_status(const struct device *dev,
uint32_t chan_id, struct dma_status *stat)
{
return 0;
}
src/drivers/mediatek/afe/zephyr_mtk_host_dma.c:111
mtk_host_dma_config()dereferencesconfig->head_blockbefore validating it is non-NULL (e.g.config->head_block->source_address). If a caller passesblock_count == 1withhead_block == NULL, this will crash. Please checkconfigandconfig->head_blockfor NULL before any dereference, and validateblock_size/addresses afterward.
if (config->block_count != 1) {
LOG_ERR("invalid number of blocks: %d", config->block_count);
return -EINVAL;
}
if (!config->head_block->source_address) {
LOG_ERR("got NULL source address");
return -EINVAL;
}
if (!config->head_block->dest_address) {
LOG_ERR("got NULL destination address");
return -EINVAL;
}
added 6 commits
May 20, 2026 10:01
Specify the rimage signing schema for the mt8196 ADSP board so the firmware image is signed with the matching mt8196 manifest. Signed-off-by: Cyril Chao <cyril.chao@mediatek.corp-partner.google.com>
Map Zephyr DMA API operations to AFE MEMIF register accesses. Use chan_filter to enforce fixed channel-to-MEMIF-index mapping. Signed-off-by: Cyril Chao <cyril.chao@mediatek.corp-partner.google.com>
Software DMA using memcpy + cache ops to copy audio from host DRAM to DSP local SRAM. Transfer executes in config() so data is ready before the pipeline callback fires. Signed-off-by: Cyril Chao <cyril.chao@mediatek.corp-partner.google.com>
Expose each AFE MEMIF as a Zephyr DAI device via DEVICE_DT_INST_DEFINE. Hardware start/stop is handled by the MEMIF DMA driver; DAI trigger is a no-op. Signed-off-by: Cyril Chao <cyril.chao@mediatek.corp-partner.google.com>
Add SOF_DAI_MEDIATEK_AFE handling in dai_set_config() and dai_set_device_params(), and expose mediatek_afe devices to dai_get(). Signed-off-by: Cyril Chao <cyril.chao@mediatek.corp-partner.google.com>
Register sof_dma[] entries, allocate dma_chan_data[] arrays in platform_init(), add CONFIG_DMA_MTK_SOF_HOST_DMA Kconfig symbol, guard legacy-only code paths, and enable native drivers for MT8196. Signed-off-by: Cyril Chao <cyril.chao@mediatek.corp-partner.google.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.