From c610b5a8e22a5a312a9f431716cdd630be4e0e6f Mon Sep 17 00:00:00 2001 From: Jean-Christophe Trotin Date: Tue, 31 Jan 2017 08:37:57 -0200 Subject: [media] st-hva: add debug file system This patch creates 4 static debugfs entries to dump: - the device-related information ("st-hva/device") - the list of registered encoders ("st-hva/encoders") - the current values of the hva registers ("st-hva/regs") - the information about the last closed instance ("st-hva/last") It also creates dynamically a debugfs entry for each opened instance, ("st-hva/") to dump: - the information about the frame (format, resolution) - the information about the stream (format, profile, level, resolution) - the control parameters (bitrate mode, framerate, GOP size...) - the potential (system, encoding...) errors - the performance information about the encoding (HW processing duration, average bitrate, average framerate...) Each time a running instance is closed, its context (including the debug information) is saved to feed, on demand, the last closed instance debugfs entry. Signed-off-by: Yannick Fertre Acked-by: Hans Verkuil Signed-off-by: Jean-Christophe Trotin Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/sti/hva/hva-hw.c | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'drivers/media/platform/sti/hva/hva-hw.c') diff --git a/drivers/media/platform/sti/hva/hva-hw.c b/drivers/media/platform/sti/hva/hva-hw.c index 5104068caf32..ec25bdcfa3d1 100644 --- a/drivers/media/platform/sti/hva/hva-hw.c +++ b/drivers/media/platform/sti/hva/hva-hw.c @@ -9,6 +9,9 @@ #include #include #include +#ifdef CONFIG_VIDEO_STI_HVA_DEBUGFS +#include +#endif #include "hva.h" #include "hva-hw.h" @@ -541,3 +544,43 @@ out: return ret; } + +#ifdef CONFIG_VIDEO_STI_HVA_DEBUGFS +#define DUMP(reg) seq_printf(s, "%-30s: 0x%08X\n",\ + #reg, readl_relaxed(hva->regs + reg)) + +void hva_hw_dump_regs(struct hva_dev *hva, struct seq_file *s) +{ + struct device *dev = hva_to_dev(hva); + + mutex_lock(&hva->protect_mutex); + + if (pm_runtime_get_sync(dev) < 0) { + seq_puts(s, "Cannot wake up IP\n"); + mutex_unlock(&hva->protect_mutex); + return; + } + + seq_printf(s, "Registers:\nReg @ = 0x%p\n", hva->regs); + + DUMP(HVA_HIF_REG_RST); + DUMP(HVA_HIF_REG_RST_ACK); + DUMP(HVA_HIF_REG_MIF_CFG); + DUMP(HVA_HIF_REG_HEC_MIF_CFG); + DUMP(HVA_HIF_REG_CFL); + DUMP(HVA_HIF_REG_SFL); + DUMP(HVA_HIF_REG_LMI_ERR); + DUMP(HVA_HIF_REG_EMI_ERR); + DUMP(HVA_HIF_REG_HEC_MIF_ERR); + DUMP(HVA_HIF_REG_HEC_STS); + DUMP(HVA_HIF_REG_HVC_STS); + DUMP(HVA_HIF_REG_HJE_STS); + DUMP(HVA_HIF_REG_CNT); + DUMP(HVA_HIF_REG_HEC_CHKSYN_DIS); + DUMP(HVA_HIF_REG_CLK_GATING); + DUMP(HVA_HIF_REG_VERSION); + + pm_runtime_put_autosuspend(dev); + mutex_unlock(&hva->protect_mutex); +} +#endif -- cgit