Commit 089adf33 authored by Trevor Wu's avatar Trevor Wu Committed by Mark Brown

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: default avatarTrevor Wu <trevor.wu@mediatek.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarYaochun Hung <yc.hung@mediatek.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20230601034939.15802-2-trevor.wu@mediatek.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8f4007e8
......@@ -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"
......@@ -473,6 +474,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",
......@@ -555,6 +576,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 */
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment