Skip to content
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
17 changes: 17 additions & 0 deletions src/arch/xtensa/configs/mt8195_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CONFIG_MT8195=y
CONFIG_CORE_COUNT=1
CONFIG_XT_VIRTUAL_OPS=1
CONFIG_COMP_VOLUME=y
CONFIG_COMP_SRC=n
CONFIG_COMP_FIR=n
CONFIG_COMP_IIR=n
CONFIG_COMP_DCBLOCK=n
CONFIG_COMP_TDFB=n
CONFIG_COMP_TONE=n
CONFIG_COMP_MIXER=n
CONFIG_COMP_MUX=n
CONFIG_COMP_SWITCH=n
CONFIG_COMP_KPB=n
CONFIG_COMP_SEL=n
CONFIG_COMP_ASRC=n

4 changes: 4 additions & 0 deletions src/drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ if(CONFIG_RENOIR)
add_subdirectory(amd)
endif()

if(CONFIG_MEDIATEK)
add_subdirectory(mediatek)
endif()

if(CONFIG_LIBRARY)
add_subdirectory(host)
return()
Expand Down
5 changes: 5 additions & 0 deletions src/drivers/mediatek/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: BSD-3-Clause

if(CONFIG_MT8195)
add_subdirectory(mt8195)
endif()
6 changes: 6 additions & 0 deletions src/drivers/mediatek/mt8195/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +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
)

116 changes: 116 additions & 0 deletions src/drivers/mediatek/mt8195/afe-dai.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2021 Mediatek
//
// Author: Bo Pan <bo.pan@mediatek.com>
// YC Hung <yc.hung@mediatek.com>

#include <sof/audio/component.h>
#include <sof/drivers/afe-drv.h>
#include <sof/drivers/timer.h>
#include <sof/lib/alloc.h>
#include <sof/lib/dai.h>
#include <sof/lib/dma.h>
#include <sof/lib/io.h>
#include <sof/lib/notifier.h>
#include <sof/lib/uuid.h>
#include <sof/math/numbers.h>
#include <sof/platform.h>
#include <ipc/dai.h>
#include <errno.h>
#include <stddef.h>
#include <stdint.h>

/* 30290c76-6a05-4784-8464-c21f09cee87e */
DECLARE_SOF_UUID("afe-dai", afe_dai_uuid, 0x30290c76, 0x6a05, 0x4784,
0x84, 0x64, 0xc2, 0x1f, 0x09, 0xce, 0xe8, 0x7e);

DECLARE_TR_CTX(afe_dai_tr, SOF_UUID(afe_dai_uuid), LOG_LEVEL_INFO);

static int afe_dai_drv_trigger(struct dai *dai, int cmd, int direction)
{
return 0;
}

static int afe_dai_drv_set_config(struct dai *dai, struct ipc_config_dai *common_config,
void *spec_config)
{
struct sof_ipc_dai_config *config = spec_config;
struct mtk_base_afe *afe = dai_get_drvdata(dai);

afe_dai_set_config(afe,
dai->index,
config->afe.dai_channels,
config->afe.dai_rate,
config->afe.dai_format);
return 0;
}

/* get HDA hw params */
static int afe_dai_drv_get_hw_params(struct dai *dai, struct sof_ipc_stream_params *params, int dir)
{
struct mtk_base_afe *afe = dai_get_drvdata(dai);
unsigned int channel, rate, format;

afe_dai_get_config(afe, dai->index, &channel, &rate, &format);
params->rate = rate;
params->channels = channel;
params->buffer_fmt = format;
params->frame_fmt = format;

return 0;
}

static int afe_dai_drv_probe(struct dai *dai)
{
struct mtk_base_afe *afe = afe_get();

dai_info(dai, "afe_dai_probe()");

if (dai_get_drvdata(dai))
return -EEXIST;

dai_set_drvdata(dai, afe);

return 0;
}

static int afe_dai_drv_remove(struct dai *dai)
{
dai_info(dai, "afe_dai_remove()");

return 0;
}

static int afe_dai_drv_dummy(struct dai *dai)
{
return 0;
}

static int afe_dai_drv_get_handshake(struct dai *dai, int direction, int stream_id)
{
return (int)dai->plat_data.fifo[0].handshake;
}

static int afe_dai_drv_get_fifo(struct dai *dai, int direction, int stream_id)
{
return 0;
}

const struct dai_driver afe_dai_driver = {
.type = SOF_DAI_MEDIATEK_AFE,
.uid = SOF_UUID(afe_dai_uuid),
.tctx = &afe_dai_tr,
.dma_dev = DMA_DEV_AFE_MEMIF,
.ops = {
.trigger = afe_dai_drv_trigger,
.set_config = afe_dai_drv_set_config,
.pm_context_store = afe_dai_drv_dummy,
.pm_context_restore = afe_dai_drv_dummy,
.get_hw_params = afe_dai_drv_get_hw_params,
.get_handshake = afe_dai_drv_get_handshake,
.get_fifo = afe_dai_drv_get_fifo,
.probe = afe_dai_drv_probe,
.remove = afe_dai_drv_remove,
},
};
Loading