Skip to content

Commit dd26cd5

Browse files
wenliangwuplbossart
authored andcommitted
ASoC: SOF: mediatek: add adsp debug dump
Add mt8188 and mt8186 .dbg_dump callback to print some information when DSP panic occurs. Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
1 parent 65dbd20 commit dd26cd5

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

sound/soc/sof/mediatek/mt8186/mt8186.c

Lines changed: 22 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 "mt8186.h"
2829
#include "mt8186-clk.h"
2930

@@ -507,6 +508,26 @@ static snd_pcm_uframes_t mt8186_pcm_pointer(struct snd_sof_dev *sdev,
507508
return pos;
508509
}
509510

511+
static void mt8186_adsp_dump(struct snd_sof_dev *sdev, u32 flags)
512+
{
513+
u32 dbg_pc, dbg_data, dbg_inst, dbg_ls0stat, dbg_status, faultinfo;
514+
515+
/* dump debug registers */
516+
dbg_pc = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGPC);
517+
dbg_data = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGDATA);
518+
dbg_inst = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGINST);
519+
dbg_ls0stat = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGLS0STAT);
520+
dbg_status = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGSTATUS);
521+
faultinfo = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PFAULTINFO);
522+
523+
dev_info(sdev->dev, "adsp dump : pc %#x, data %#x, dbg_inst %#x,",
524+
dbg_pc, dbg_data, dbg_inst);
525+
dev_info(sdev->dev, "ls0stat %#x, status %#x, faultinfo %#x",
526+
dbg_ls0stat, dbg_status, faultinfo);
527+
528+
mtk_adsp_dump(sdev, flags);
529+
}
530+
510531
static struct snd_soc_dai_driver mt8186_dai[] = {
511532
{
512533
.name = "SOF_DL1",
@@ -589,6 +610,7 @@ static struct snd_sof_dsp_ops sof_mt8186_ops = {
589610
.num_drv = ARRAY_SIZE(mt8186_dai),
590611

591612
/* Debug information */
613+
.dbg_dump = mt8186_adsp_dump,
592614
.debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem,
593615

594616
/* PM */

sound/soc/sof/mediatek/mt8186/mt8186.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ struct snd_sof_dev;
3838
#define DSP_MBOX3_IRQ_EN BIT(3)
3939
#define DSP_MBOX4_IRQ_EN BIT(4)
4040
#define DSP_PDEBUGPC 0x013C
41+
#define DSP_PDEBUGDATA 0x0140
42+
#define DSP_PDEBUGINST 0x0144
43+
#define DSP_PDEBUGLS0STAT 0x0148
44+
#define DSP_PDEBUGSTATUS 0x014C
45+
#define DSP_PFAULTINFO 0x0150
4146
#define ADSP_CK_EN 0x1000
4247
#define CORE_CLK_EN BIT(0)
4348
#define COREDBG_EN BIT(1)

0 commit comments

Comments
 (0)