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
83 changes: 82 additions & 1 deletion sound/soc/sof/mediatek/mt8186/mt8186.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "../../sof-of-dev.h"
#include "../../sof-audio.h"
#include "../adsp_helper.h"
#include "../mtk-adsp-common.h"
#include "mt8186.h"
#include "mt8186-clk.h"

Expand Down Expand Up @@ -507,6 +508,26 @@ static snd_pcm_uframes_t mt8186_pcm_pointer(struct snd_sof_dev *sdev,
return pos;
}

static void mt8186_adsp_dump(struct snd_sof_dev *sdev, u32 flags)
{
u32 dbg_pc, dbg_data, dbg_inst, dbg_ls0stat, dbg_status, faultinfo;

/* dump debug registers */
dbg_pc = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGPC);
dbg_data = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGDATA);
dbg_inst = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGINST);
dbg_ls0stat = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGLS0STAT);
dbg_status = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGSTATUS);
faultinfo = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PFAULTINFO);

dev_info(sdev->dev, "adsp dump : pc %#x, data %#x, dbg_inst %#x,",
dbg_pc, dbg_data, dbg_inst);
dev_info(sdev->dev, "ls0stat %#x, status %#x, faultinfo %#x",
dbg_ls0stat, dbg_status, faultinfo);

mtk_adsp_dump(sdev, flags);
}

static struct snd_soc_dai_driver mt8186_dai[] = {
{
.name = "SOF_DL1",
Expand Down Expand Up @@ -589,6 +610,7 @@ static struct snd_sof_dsp_ops sof_mt8186_ops = {
.num_drv = ARRAY_SIZE(mt8186_dai),

/* Debug information */
.dbg_dump = mt8186_adsp_dump,
.debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem,

/* PM */
Expand Down Expand Up @@ -628,7 +650,65 @@ static const struct sof_dev_desc sof_of_mt8186_desc = {
.ops = &sof_mt8186_ops,
};

/*
* DL2, DL3, UL4, UL5 are registered as SOF FE, so creating the corresponding
* SOF BE to complete the pipeline.
*/
static struct snd_soc_dai_driver mt8188_dai[] = {
{
.name = "SOF_DL2",
.playback = {
.channels_min = 1,
.channels_max = 2,
},
},
{
.name = "SOF_DL3",
.playback = {
.channels_min = 1,
.channels_max = 2,
},
},
{
.name = "SOF_UL4",
.capture = {
.channels_min = 1,
.channels_max = 2,
},
},
{
.name = "SOF_UL5",
.capture = {
.channels_min = 1,
.channels_max = 2,
},
},
};

/* mt8188 ops */
static struct snd_sof_dsp_ops sof_mt8188_ops;

static int sof_mt8188_ops_init(struct snd_sof_dev *sdev)
{
/* common defaults */
memcpy(&sof_mt8188_ops, &sof_mt8186_ops, sizeof(struct snd_sof_dsp_ops));

sof_mt8188_ops.drv = mt8188_dai;
sof_mt8186_ops.num_drv = ARRAY_SIZE(mt8188_dai);

return 0;
}

static struct snd_sof_of_mach sof_mt8188_machs[] = {
{
.compatible = "mediatek,mt8188",
.sof_tplg_filename = "sof-mt8188.tplg",
},
{}
};

static const struct sof_dev_desc sof_of_mt8188_desc = {
.of_machines = sof_mt8188_machs,
.ipc_supported_mask = BIT(SOF_IPC),
.ipc_default = SOF_IPC,
.default_fw_path = {
Expand All @@ -641,7 +721,8 @@ static const struct sof_dev_desc sof_of_mt8188_desc = {
[SOF_IPC] = "sof-mt8188.ri",
},
.nocodec_tplg_filename = "sof-mt8188-nocodec.tplg",
.ops = &sof_mt8186_ops,
.ops = &sof_mt8188_ops,
.ops_init = sof_mt8188_ops_init,
};

static const struct of_device_id sof_of_mt8186_ids[] = {
Expand Down
5 changes: 5 additions & 0 deletions sound/soc/sof/mediatek/mt8186/mt8186.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ struct snd_sof_dev;
#define DSP_MBOX3_IRQ_EN BIT(3)
#define DSP_MBOX4_IRQ_EN BIT(4)
#define DSP_PDEBUGPC 0x013C
#define DSP_PDEBUGDATA 0x0140
#define DSP_PDEBUGINST 0x0144
#define DSP_PDEBUGLS0STAT 0x0148
#define DSP_PDEBUGSTATUS 0x014C
#define DSP_PFAULTINFO 0x0150
#define ADSP_CK_EN 0x1000
#define CORE_CLK_EN BIT(0)
#define COREDBG_EN BIT(1)
Expand Down