Skip to contentSkip to conversation

ASoC: SOF: mediatek: add debug dump

PATCH In review Pierre-Louis Bossart 2 participants 4 messages May 17, 2022 – May 20, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover ASoC: SOF: mediatek: add debug dump

YC Hung (2):
ASoC: SOF: mediatek: Add mediatek common debug dump
ASoC: SOF: mediatek: Add mt8195 debug dump

 sound/soc/sof/mediatek/Makefile          |  1 +
 sound/soc/sof/mediatek/mt8195/mt8195.c   | 29 ++++++++
 sound/soc/sof/mediatek/mtk-adsp-common.c | 84 ++++++++++++++++++++++++
 sound/soc/sof/mediatek/mtk-adsp-common.h | 10 +++
 4 files changed, 124 insertions(+)
 create mode 100644 sound/soc/sof/mediatek/mtk-adsp-common.c
 create mode 100644 sound/soc/sof/mediatek/mtk-adsp-common.h
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/2 ASoC: SOF: mediatek: Add mediatek common debug dump

From: YC Hung <[email protected]>

1.Add mtk-adsp-common.c file for mediatek platforms common usage. 2.Add mtk_adsp_dump implementation in mtk-adsp-common.c for general
debug dump.

---
 sound/soc/sof/mediatek/Makefile          |  1 +
 sound/soc/sof/mediatek/mtk-adsp-common.c | 84 ++++++++++++++++++++++++
 sound/soc/sof/mediatek/mtk-adsp-common.h | 10 +++
 3 files changed, 95 insertions(+)
 create mode 100644 sound/soc/sof/mediatek/mtk-adsp-common.c
 create mode 100644 sound/soc/sof/mediatek/mtk-adsp-common.h
sound/soc/sof/mediatek/Makefile +1 -0
index 6ca8b8201ed1a..29c5afb2f3d6f 100644
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
+obj-$(CONFIG_SND_SOC_SOF_MTK_COMMON) += mtk-adsp-common.o
 obj-$(CONFIG_SND_SOC_SOF_MT8195) += mt8195/
 obj-$(CONFIG_SND_SOC_SOF_MT8186) += mt8186/
sound/soc/sof/mediatek/mtk-adsp-common.c new file +84 -0

84 lines not on this page · raw message

sound/soc/sof/mediatek/mtk-adsp-common.h new file +10 -0
new file mode 100644
index 0000000000000..612cff1f38f70
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
+
+#ifndef __MEDIATEK_ADSP_COMMON_H__
+#define __MEDIATEK_ADSP_COMMON_H__
+
+#define EXCEPT_MAX_HDR_SIZE	0x400
+#define MTK_ADSP_STACK_DUMP_SIZE 32
+
+void mtk_adsp_dump(struct snd_sof_dev *sdev, u32 flags);
+#endif
Signature · 1 line
2.30.2
#2 lore raw

PATCH 2/2 ASoC: SOF: mediatek: Add mt8195 debug dump

In reply to Pierre-Louis Bossart

From: YC Hung <[email protected]>

Add mt8195_adsp_dump in mt8195.c for debug_dump callback to dump mt8195 debug registers and call mtk_adsp_dump.

---
 sound/soc/sof/mediatek/mt8195/mt8195.c | 29 ++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
sound/soc/sof/mediatek/mt8195/mt8195.c +29 -0
index f4b24afb6f751..756b59fb79be4 100644
@@ -25,6 +25,7 @@
 #include "../../sof-of-dev.h"
 #include "../../sof-audio.h"
 #include "../adsp_helper.h"
+#include "../mtk-adsp-common.h"
 #include "mt8195.h"
 #include "mt8195-clk.h"
 
@@ -486,6 +487,31 @@ static int mt8195_ipc_msg_data(struct snd_sof_dev *sdev,
 	return 0;
 }
 
+static void mt8195_adsp_dump(struct snd_sof_dev *sdev, u32 flags)
+{
+	u32 dbg_pc, dbg_data, dbg_bus0, dbg_bus1, dbg_inst;
+	u32 dbg_ls0stat, dbg_ls1stat, faultbus, faultinfo, swrest;
+
+	/* 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_bus0 = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGBUS0);
+	dbg_bus1 = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGBUS1);
+	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_ls1stat = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGLS1STAT);
+	faultbus = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PFAULTBUS);
+	faultinfo = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PFAULTINFO);
+	swrest = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_RESET_SW);
+
+	dev_info(sdev->dev, "adsp dump : pc %#x, data %#x, bus0 %#x, bus1 %#x, swrest %#x",
+		 dbg_pc, dbg_data, dbg_bus0, dbg_bus1, swrest);
+	dev_info(sdev->dev, "dbg_inst %#x, ls0stat %#x, ls1stat %#x, faultbus %#x, faultinfo %#x",
+		 dbg_inst, dbg_ls0stat, dbg_ls1stat, faultbus, faultinfo);
+
+	mtk_adsp_dump(sdev, flags);
+}
+
 static struct snd_soc_dai_driver mt8195_dai[] = {
 {
 	.name = "SOF_DL2",
@@ -553,6 +579,9 @@ static struct snd_sof_dsp_ops sof_mt8195_ops = {
 	/* Firmware ops */
 	.dsp_arch_ops = &sof_xtensa_arch_ops,
 
+	/* Debug information */
+	.dbg_dump = mt8195_adsp_dump,
+
 	/* DAI drivers */
 	.drv = mt8195_dai,
 	.num_drv = ARRAY_SIZE(mt8195_dai),
Signature · 1 line
2.30.2
maintainer
#3 lore raw
In reply to Pierre-Louis Bossart
Quoted 5 lines · Pierre-Louis Bossart

YC Hung (2):
ASoC: SOF: mediatek: Add mediatek common debug dump
ASoC: SOF: mediatek: Add mt8195 debug dump

sound/soc/sof/mediatek/Makefile | 1 +

Quoted 8 lines
 sound/soc/sof/mediatek/mt8195/mt8195.c   | 29 ++++++++
 sound/soc/sof/mediatek/mtk-adsp-common.c | 84 ++++++++++++++++++++++++
 sound/soc/sof/mediatek/mtk-adsp-common.h | 10 +++
 4 files changed, 124 insertions(+)
 create mode 100644 sound/soc/sof/mediatek/mtk-adsp-common.c
 create mode 100644 sound/soc/sof/mediatek/mtk-adsp-common.h

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: SOF: mediatek: Add mediatek common debug dump

      commit: 698c1e99a0a3b883a629159ae47fa41778209258
[2/2] ASoC: SOF: mediatek: Add mt8195 debug dump
      commit: 3a054f90e95500387cc871f5a04ad91def1664ed

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark