Skip to content

Commit a80343f

Browse files
yaochunhungplbossart
authored andcommitted
ASoC: SOF: mediatek: Add mt8195 debug dump
Add mt8195_adsp_dump in mt8195.c for debug_dump callback to dump mt8195 debug registers and call mtk_adsp_dump. Signed-off-by: YC Hung <yc.hung@mediatek.com>
1 parent f5df273 commit a80343f

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

sound/soc/sof/mediatek/mt8195/mt8195.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "../../sof-of-dev.h"
2525
#include "../../sof-audio.h"
2626
#include "../adsp_helper.h"
27+
#include "../mtk-adsp-common.h"
2728
#include "mt8195.h"
2829
#include "mt8195-clk.h"
2930

@@ -361,6 +362,31 @@ static int mt8195_get_bar_index(struct snd_sof_dev *sdev, u32 type)
361362
return type;
362363
}
363364

365+
static void mt8195_adsp_dump(struct snd_sof_dev *sdev, u32 flags)
366+
{
367+
u32 dbg_pc, dbg_data, dbg_bus0, dbg_bus1, dbg_inst;
368+
u32 dbg_ls0stat, dbg_ls1stat, faultbus, faultinfo, swrest;
369+
370+
/* dump debug registers */
371+
dbg_pc = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGPC);
372+
dbg_data = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGDATA);
373+
dbg_bus0 = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGBUS0);
374+
dbg_bus1 = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGBUS1);
375+
dbg_inst = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGINST);
376+
dbg_ls0stat = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGLS0STAT);
377+
dbg_ls1stat = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGLS1STAT);
378+
faultbus = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PFAULTBUS);
379+
faultinfo = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PFAULTINFO);
380+
swrest = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_RESET_SW);
381+
382+
dev_info(sdev->dev, "adsp dump : pc %#x, data %#x, bus0 %#x, bus1 %#x, swrest %#x",
383+
dbg_pc, dbg_data, dbg_bus0, dbg_bus1, swrest);
384+
dev_info(sdev->dev, "dbg_inst %#x, ls0stat %#x, ls1stat %#x, faultbus %#x, faultinfo %#x",
385+
dbg_inst, dbg_ls0stat, dbg_ls1stat, faultbus, faultinfo);
386+
387+
mtk_adsp_dump(sdev, flags);
388+
}
389+
364390
static struct snd_soc_dai_driver mt8195_dai[] = {
365391
{
366392
.name = "SOF_DL2",
@@ -421,6 +447,9 @@ static struct snd_sof_dsp_ops sof_mt8195_ops = {
421447
/* Firmware ops */
422448
.dsp_arch_ops = &sof_xtensa_arch_ops,
423449

450+
/* Debug information */
451+
.dbg_dump = mt8195_adsp_dump,
452+
424453
/* DAI drivers */
425454
.drv = mt8195_dai,
426455
.num_drv = ARRAY_SIZE(mt8195_dai),

0 commit comments

Comments
 (0)