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 12/21] media: rkisp1: Move debugfs code to a separate file
Date: Mon, 25 Apr 2022 12:54:18 +0200	[thread overview]
Message-ID: <YmZ92gNFXvczsCjL@gmail.com> (raw)
In-Reply-To: <20220421234240.1694-13-laurent.pinchart@ideasonboard.com>

Laurent Pinchart wrote:

> To avoid cluttering the main rkisp1-dev.c driver file, move debugfs code
> to a separate source file. This prepares for extensions to the debugfs
> infrastructure.
> 
> While at it, add a missing forward declaration for struct dentry in
> rkisp1-common.h to avoid depending on indirect includes.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>  .../media/platform/rockchip/rkisp1/Makefile   |  1 +
>  .../platform/rockchip/rkisp1/rkisp1-common.h  |  5 ++
>  .../platform/rockchip/rkisp1/rkisp1-debug.c   | 50 +++++++++++++++++++
>  .../platform/rockchip/rkisp1/rkisp1-dev.c     | 33 +-----------
>  4 files changed, 57 insertions(+), 32 deletions(-)
>  create mode 100644 drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c
> 
> diff --git a/drivers/media/platform/rockchip/rkisp1/Makefile b/drivers/media/platform/rockchip/rkisp1/Makefile
> index ab32a77db8f7..1a39bdcc608e 100644
> --- a/drivers/media/platform/rockchip/rkisp1/Makefile
> +++ b/drivers/media/platform/rockchip/rkisp1/Makefile
> @@ -3,6 +3,7 @@
>  obj-$(CONFIG_VIDEO_ROCKCHIP_ISP1) += rockchip-isp1.o
>  rockchip-isp1-objs += 	rkisp1-capture.o \
>  			rkisp1-common.o \
> +			rkisp1-debug.o \
>  			rkisp1-dev.o \
>  			rkisp1-isp.o \
>  			rkisp1-resizer.o \
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> index 3b36ab05ac34..07a92ed8bdc8 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> @@ -23,6 +23,8 @@
>  
>  #include "rkisp1-regs.h"
>  
> +struct dentry;
> +
>  /*
>   * flags on the 'direction' field in struct 'rkisp1_isp_mbus_info' that indicate
>   * on which pad the media bus format is supported
> @@ -516,4 +518,7 @@ void rkisp1_stats_unregister(struct rkisp1_device *rkisp1);
>  int rkisp1_params_register(struct rkisp1_device *rkisp1);
>  void rkisp1_params_unregister(struct rkisp1_device *rkisp1);
>  
> +void rkisp1_debug_init(struct rkisp1_device *rkisp1);
> +void rkisp1_debug_cleanup(struct rkisp1_device *rkisp1);
> +
>  #endif /* _RKISP1_COMMON_H */
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c
> new file mode 100644
> index 000000000000..64b33774cbdf
> --- /dev/null
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c
> @@ -0,0 +1,50 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Rockchip ISP1 Driver - Base driver
> + *
> + * Copyright (C) 2019 Collabora, Ltd.
> + *
> + * Based on Rockchip ISP1 driver by Rockchip Electronics Co., Ltd.
> + * Copyright (C) 2017 Rockchip Electronics Co., Ltd.
> + */
> +
> +#include <linux/debugfs.h>
> +#include <linux/device.h>
> +
> +#include "rkisp1-common.h"
> +
> +void rkisp1_debug_init(struct rkisp1_device *rkisp1)
> +{
> +	struct rkisp1_debug *debug = &rkisp1->debug;
> +
> +	debug->debugfs_dir = debugfs_create_dir(dev_name(rkisp1->dev), NULL);
> +
> +	debugfs_create_ulong("data_loss", 0444, debug->debugfs_dir,
> +			     &debug->data_loss);
> +	debugfs_create_ulong("outform_size_err", 0444,  debug->debugfs_dir,
> +			     &debug->outform_size_error);
> +	debugfs_create_ulong("img_stabilization_size_error", 0444,
> +			     debug->debugfs_dir,
> +			     &debug->img_stabilization_size_error);
> +	debugfs_create_ulong("inform_size_error", 0444,  debug->debugfs_dir,
> +			     &debug->inform_size_error);
> +	debugfs_create_ulong("irq_delay", 0444,  debug->debugfs_dir,
> +			     &debug->irq_delay);
> +	debugfs_create_ulong("mipi_error", 0444, debug->debugfs_dir,
> +			     &debug->mipi_error);
> +	debugfs_create_ulong("stats_error", 0444, debug->debugfs_dir,
> +			     &debug->stats_error);
> +	debugfs_create_ulong("mp_stop_timeout", 0444, debug->debugfs_dir,
> +			     &debug->stop_timeout[RKISP1_MAINPATH]);
> +	debugfs_create_ulong("sp_stop_timeout", 0444, debug->debugfs_dir,
> +			     &debug->stop_timeout[RKISP1_SELFPATH]);
> +	debugfs_create_ulong("mp_frame_drop", 0444, debug->debugfs_dir,
> +			     &debug->frame_drop[RKISP1_MAINPATH]);
> +	debugfs_create_ulong("sp_frame_drop", 0444, debug->debugfs_dir,
> +			     &debug->frame_drop[RKISP1_SELFPATH]);
> +}
> +
> +void rkisp1_debug_cleanup(struct rkisp1_device *rkisp1)
> +{
> +	debugfs_remove_recursive(rkisp1->debug.debugfs_dir);
> +}
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> index f8b2573aa9da..c7ad1986e67b 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> @@ -9,7 +9,6 @@
>   */
>  
>  #include <linux/clk.h>
> -#include <linux/debugfs.h>
>  #include <linux/interrupt.h>
>  #include <linux/module.h>
>  #include <linux/of.h>
> @@ -460,36 +459,6 @@ static const struct of_device_id rkisp1_of_match[] = {
>  };
>  MODULE_DEVICE_TABLE(of, rkisp1_of_match);
>  
> -static void rkisp1_debug_init(struct rkisp1_device *rkisp1)
> -{
> -	struct rkisp1_debug *debug = &rkisp1->debug;
> -
> -	debug->debugfs_dir = debugfs_create_dir(dev_name(rkisp1->dev), NULL);
> -	debugfs_create_ulong("data_loss", 0444, debug->debugfs_dir,
> -			     &debug->data_loss);
> -	debugfs_create_ulong("outform_size_err", 0444,  debug->debugfs_dir,
> -			     &debug->outform_size_error);
> -	debugfs_create_ulong("img_stabilization_size_error", 0444,
> -			     debug->debugfs_dir,
> -			     &debug->img_stabilization_size_error);
> -	debugfs_create_ulong("inform_size_error", 0444,  debug->debugfs_dir,
> -			     &debug->inform_size_error);
> -	debugfs_create_ulong("irq_delay", 0444,  debug->debugfs_dir,
> -			     &debug->irq_delay);
> -	debugfs_create_ulong("mipi_error", 0444, debug->debugfs_dir,
> -			     &debug->mipi_error);
> -	debugfs_create_ulong("stats_error", 0444, debug->debugfs_dir,
> -			     &debug->stats_error);
> -	debugfs_create_ulong("mp_stop_timeout", 0444, debug->debugfs_dir,
> -			     &debug->stop_timeout[RKISP1_MAINPATH]);
> -	debugfs_create_ulong("sp_stop_timeout", 0444, debug->debugfs_dir,
> -			     &debug->stop_timeout[RKISP1_SELFPATH]);
> -	debugfs_create_ulong("mp_frame_drop", 0444, debug->debugfs_dir,
> -			     &debug->frame_drop[RKISP1_MAINPATH]);
> -	debugfs_create_ulong("sp_frame_drop", 0444, debug->debugfs_dir,
> -			     &debug->frame_drop[RKISP1_SELFPATH]);
> -}
> -
>  static int rkisp1_probe(struct platform_device *pdev)
>  {
>  	const struct rkisp1_match_data *match_data;
> @@ -586,13 +555,13 @@ static int rkisp1_remove(struct platform_device *pdev)
>  	v4l2_async_nf_cleanup(&rkisp1->notifier);
>  
>  	rkisp1_entities_unregister(rkisp1);
> +	rkisp1_debug_cleanup(rkisp1);
>  
>  	media_device_unregister(&rkisp1->media_dev);
>  	v4l2_device_unregister(&rkisp1->v4l2_dev);
>  
>  	pm_runtime_disable(&pdev->dev);
>  
> -	debugfs_remove_recursive(rkisp1->debug.debugfs_dir);
>  	return 0;
>  }
>  
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> 

  reply	other threads:[~2022-04-25 10:55 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 [this message]
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
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=YmZ92gNFXvczsCjL@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