public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Ricardo Ribalda <ribalda@chromium.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org,
	Dafna Hirschfeld <dafna@fastmail.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Paul Elder <paul.elder@ideasonboard.com>,
	Tomasz Figa <tfiga@google.com>,
	linux-rockchip@lists.infradead.org
Subject: Re: [PATCH v4 15/21] media: rkisp1: debug: Add debugfs files to dump core and ISP registers
Date: Mon, 25 Apr 2022 13:13:49 +0200	[thread overview]
Message-ID: <YmaCbRhGF5sr/S1z@gmail.com> (raw)
In-Reply-To: <20220421234240.1694-16-laurent.pinchart@ideasonboard.com>

Laurent Pinchart wrote:

> It's useful to dumb the value of registers for debugging purpose. Add
not all the values are dumb :P
> two debugfs files to dump key core and ISP registers.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> Changes since v3:
> 
> - Fix pm_runtime_get_if_in_use() return value handling
> - Rename rkisp1_debug_register offset field to reg
> 
> Changes since v2:
> 
> - Handle runtime PM
> ---
>  .../platform/rockchip/rkisp1/rkisp1-debug.c   | 72 +++++++++++++++++++
>  1 file changed, 72 insertions(+)
> 
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c
> index 782a696ac587..63aa81553178 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c
> @@ -17,6 +17,70 @@
>  #include "rkisp1-common.h"
>  #include "rkisp1-regs.h"
>  
> +struct rkisp1_debug_register {
> +	u32 reg;
> +	const char * const name;
> +};
> +
> +#define RKISP1_DEBUG_REG(name)	{ RKISP1_CIF_##name, #name }
> +
> +static int rkisp1_debug_dump_regs(struct seq_file *m,
> +				  const struct rkisp1_debug_register *regs)
> +{
> +	struct rkisp1_device *rkisp1 = m->private;
> +	u32 val;
> +	int ret;
> +
> +	ret = pm_runtime_get_if_in_use(rkisp1->dev);
> +	if (ret <= 0)
> +		return ret ? : -ENODATA;
> +
> +	for ( ; regs->name; ++regs) {
> +		val = rkisp1_read(rkisp1, regs->reg);
> +		seq_printf(m, "%14s: 0x%08x\n", regs->name, val);
> +	}
> +
> +	pm_runtime_put(rkisp1->dev);
> +
> +	return 0;
> +}
> +
> +static int rkisp1_debug_dump_core_regs_show(struct seq_file *m, void *p)
> +{
> +	static const struct rkisp1_debug_register registers[] = {
> +		RKISP1_DEBUG_REG(VI_CCL),
> +		RKISP1_DEBUG_REG(VI_ICCL),
> +		RKISP1_DEBUG_REG(VI_IRCL),
> +		RKISP1_DEBUG_REG(VI_DPCL),
> +		RKISP1_DEBUG_REG(MI_CTRL),
> +		RKISP1_DEBUG_REG(MI_BYTE_CNT),
> +		RKISP1_DEBUG_REG(MI_CTRL_SHD),
> +		RKISP1_DEBUG_REG(MI_RIS),
> +		RKISP1_DEBUG_REG(MI_STATUS),
> +		RKISP1_DEBUG_REG(MI_DMA_CTRL),
> +		RKISP1_DEBUG_REG(MI_DMA_STATUS),
> +		{ /* Sentinel */ },
> +	};
> +
> +	return rkisp1_debug_dump_regs(m, registers);
> +}
> +DEFINE_SHOW_ATTRIBUTE(rkisp1_debug_dump_core_regs);
> +
> +static int rkisp1_debug_dump_isp_regs_show(struct seq_file *m, void *p)
> +{
> +	static const struct rkisp1_debug_register registers[] = {
> +		RKISP1_DEBUG_REG(ISP_CTRL),
> +		RKISP1_DEBUG_REG(ISP_ACQ_PROP),
> +		RKISP1_DEBUG_REG(ISP_FLAGS_SHD),
> +		RKISP1_DEBUG_REG(ISP_RIS),
> +		RKISP1_DEBUG_REG(ISP_ERR),
> +		{ /* Sentinel */ },
> +	};
> +
> +	return rkisp1_debug_dump_regs(m, registers);
> +}
> +DEFINE_SHOW_ATTRIBUTE(rkisp1_debug_dump_isp_regs);
> +
>  #define RKISP1_DEBUG_DATA_COUNT_BINS	32
>  #define RKISP1_DEBUG_DATA_COUNT_STEP	(4096 / RKISP1_DEBUG_DATA_COUNT_BINS)
>  
> @@ -68,6 +132,7 @@ DEFINE_SHOW_ATTRIBUTE(rkisp1_debug_input_status);
>  void rkisp1_debug_init(struct rkisp1_device *rkisp1)
>  {
>  	struct rkisp1_debug *debug = &rkisp1->debug;
> +	struct dentry *regs_dir;
>  
>  	debug->debugfs_dir = debugfs_create_dir(dev_name(rkisp1->dev), NULL);
>  
> @@ -96,6 +161,13 @@ void rkisp1_debug_init(struct rkisp1_device *rkisp1)
>  			     &debug->frame_drop[RKISP1_SELFPATH]);
>  	debugfs_create_file("input_status", 0444, debug->debugfs_dir, rkisp1,
>  			    &rkisp1_debug_input_status_fops);
> +
> +	regs_dir = debugfs_create_dir("regs", debug->debugfs_dir);
Is it worth to make a folder just for these two files?
> +
> +	debugfs_create_file("core", 0444, regs_dir, rkisp1,
> +			    &rkisp1_debug_dump_core_regs_fops);
> +	debugfs_create_file("isp", 0444, regs_dir, rkisp1,
> +			    &rkisp1_debug_dump_isp_regs_fops);
>  }
>  
>  void rkisp1_debug_cleanup(struct rkisp1_device *rkisp1)
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> 

  reply	other threads:[~2022-04-25 11:14 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 23:42 [PATCH v4 00/21] media: rkisp1: Misc bug fixes and cleanups Laurent Pinchart
2022-04-21 23:42 ` [PATCH v4 01/21] media: rkisp1: capture: Initialize entity before video device Laurent Pinchart
2022-04-25  7:52   ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 02/21] media: rkisp1: capture: Fix and simplify (un)registration Laurent Pinchart
2022-04-25  9:34   ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 03/21] media: rkisp1: isp: " Laurent Pinchart
2022-04-25  9:36   ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 04/21] media: rkisp1: resizer: " Laurent Pinchart
2022-04-25  9:37   ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 05/21] media: rkisp1: params: " Laurent Pinchart
2022-04-25  9:39   ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 06/21] media: rkisp1: stats: Simplify (un)registration Laurent Pinchart
2022-04-25  9:44   ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 07/21] media: rkisp1: Simplify rkisp1_entities_register() error path Laurent Pinchart
2022-04-25  9:45   ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 08/21] media: rkisp1: regs: Don't use BIT() macro for multi-bit register fields Laurent Pinchart
2022-04-25  9:50   ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 09/21] media: rkisp1: regs: Rename CCL, ICCL and IRCL registers with VI_ prefix Laurent Pinchart
2022-04-25  9:51   ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 10/21] media: rkisp1: Swap value and address arguments to rkisp1_write() Laurent Pinchart
2022-04-25  9:53   ` Ricardo Ribalda
2022-04-25 18:59     ` Laurent Pinchart
2022-04-21 23:42 ` [PATCH v4 11/21] media: rkisp1: resizer: Simplify register access Laurent Pinchart
2022-04-25  9:58   ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 12/21] media: rkisp1: Move debugfs code to a separate file Laurent Pinchart
2022-04-25 10:54   ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 13/21] media: rkisp1: Compile debugfs support conditionally Laurent Pinchart
2022-04-25 10:58   ` Ricardo Ribalda
2022-04-25 19:08     ` Laurent Pinchart
2022-04-26  7:33       ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 14/21] media: rkisp1: debug: Collect input status by sampling ISP_FLAGS_SHD Laurent Pinchart
2022-04-25 11:08   ` Ricardo Ribalda
2022-04-25 20:13     ` Laurent Pinchart
2022-04-21 23:42 ` [PATCH v4 15/21] media: rkisp1: debug: Add debugfs files to dump core and ISP registers Laurent Pinchart
2022-04-25 11:13   ` Ricardo Ribalda [this message]
2022-04-21 23:42 ` [PATCH v4 16/21] media: rkisp1: debug: Move resizer register dump to debugfs Laurent Pinchart
2022-04-25 11:16   ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 17/21] media: rkisp1: debug: Consolidate reg dumps for shadow registers Laurent Pinchart
2022-04-25 11:45   ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 18/21] media: rkisp1: debug: Compute max register length name dynamically Laurent Pinchart
2022-04-25 11:49   ` Ricardo Ribalda
2022-04-25 19:05     ` Laurent Pinchart
2022-04-25 21:01       ` [PATCH v4.1 18/21] media: rkisp1: debug: Update max register name length Laurent Pinchart
2022-04-26  7:39         ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 19/21] media: rkisp1: capture: Bypass the main device for handling querycap Laurent Pinchart
2022-04-25 11:51   ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 20/21] media: rkisp1: Align macro definitions Laurent Pinchart
2022-04-25 11:52   ` Ricardo Ribalda
2022-04-21 23:42 ` [PATCH v4 21/21] media: rkisp1: Drop parentheses and fix indentation in rkisp1_probe() Laurent Pinchart
2022-04-25  8:30   ` Ricardo Ribalda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YmaCbRhGF5sr/S1z@gmail.com \
    --to=ribalda@chromium.org \
    --cc=dafna@fastmail.com \
    --cc=heiko@sntech.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=paul.elder@ideasonboard.com \
    --cc=tfiga@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox