Linux-Rockchip Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Detlev Casanova <detlev.casanova@collabora.com>,
	 linux-kernel@vger.kernel.org
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Ezequiel Garcia	 <ezequiel@vanguardiasur.com.ar>,
	Heiko Stuebner <heiko@sntech.de>,
	Ricardo Ribalda <ribalda@chromium.org>,
	Hans Verkuil <hverkuil@kernel.org>,
	Hans de Goede <hansg@kernel.org>,  Yunke Cao <yunkec@google.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Laurent Pinchart	 <laurent.pinchart@ideasonboard.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	 James Cowgill <james.cowgill@blaize.com>,
	linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
		linux-arm-kernel@lists.infradead.org, kernel@collabora.com,
	Diederik de Haas	 <didi.debian@cknow.org>
Subject: Re: [PATCH v4 11/15] media: rkvdec: Enable all clocks without naming them
Date: Wed, 10 Dec 2025 15:36:09 -0500	[thread overview]
Message-ID: <1ba983fd1b805bd18406e8d614bc9c72a109a0f9.camel@collabora.com> (raw)
In-Reply-To: <20251022174508.284929-12-detlev.casanova@collabora.com>


[-- Attachment #1.1: Type: text/plain, Size: 3513 bytes --]

Le mercredi 22 octobre 2025 à 13:45 -0400, Detlev Casanova a écrit :
> For other variants, the clock names and number will differ.
> 
> There is no need to keep track of the clock names in the driver so drop
> them to avoid having a list for each variant.
> 
> Tested-by: Diederik de Haas <didi.debian@cknow.org>  # Rock 5B
> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

> ---
>  .../media/platform/rockchip/rkvdec/rkvdec.c   | 24 +++++--------------
>  .../media/platform/rockchip/rkvdec/rkvdec.h   |  1 +
>  2 files changed, 7 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.c b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> index b0e90c9b826e..aa92b586429e 100644
> --- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> @@ -1311,15 +1311,10 @@ static const struct of_device_id of_rkvdec_match[] = {
>  };
>  MODULE_DEVICE_TABLE(of, of_rkvdec_match);
>  
> -static const char * const rkvdec_clk_names[] = {
> -	"axi", "ahb", "cabac", "core"
> -};
> -
>  static int rkvdec_probe(struct platform_device *pdev)
>  {
>  	const struct rkvdec_variant *variant;
>  	struct rkvdec_dev *rkvdec;
> -	unsigned int i;
>  	int ret, irq;
>  
>  	variant = of_device_get_match_data(&pdev->dev);
> @@ -1336,19 +1331,12 @@ static int rkvdec_probe(struct platform_device *pdev)
>  	mutex_init(&rkvdec->vdev_lock);
>  	INIT_DELAYED_WORK(&rkvdec->watchdog_work, rkvdec_watchdog_func);
>  
> -	rkvdec->clocks = devm_kcalloc(&pdev->dev, ARRAY_SIZE(rkvdec_clk_names),
> -				      sizeof(*rkvdec->clocks), GFP_KERNEL);
> -	if (!rkvdec->clocks)
> -		return -ENOMEM;
> -
> -	for (i = 0; i < ARRAY_SIZE(rkvdec_clk_names); i++)
> -		rkvdec->clocks[i].id = rkvdec_clk_names[i];
> -
> -	ret = devm_clk_bulk_get(&pdev->dev, ARRAY_SIZE(rkvdec_clk_names),
> -				rkvdec->clocks);
> -	if (ret)
> +	ret = devm_clk_bulk_get_all_enabled(&pdev->dev, &rkvdec->clocks);
> +	if (ret < 0)
>  		return ret;
>  
> +	rkvdec->clk_count = ret;
> +
>  	rkvdec->regs = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(rkvdec->regs))
>  		return PTR_ERR(rkvdec->regs);
> @@ -1426,7 +1414,7 @@ static int rkvdec_runtime_resume(struct device *dev)
>  {
>  	struct rkvdec_dev *rkvdec = dev_get_drvdata(dev);
>  
> -	return clk_bulk_prepare_enable(ARRAY_SIZE(rkvdec_clk_names),
> +	return clk_bulk_prepare_enable(rkvdec->clk_count,
>  				       rkvdec->clocks);
>  }
>  
> @@ -1434,7 +1422,7 @@ static int rkvdec_runtime_suspend(struct device *dev)
>  {
>  	struct rkvdec_dev *rkvdec = dev_get_drvdata(dev);
>  
> -	clk_bulk_disable_unprepare(ARRAY_SIZE(rkvdec_clk_names),
> +	clk_bulk_disable_unprepare(rkvdec->clk_count,
>  				   rkvdec->clocks);
>  	return 0;
>  }
> diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.h b/drivers/media/platform/rockchip/rkvdec/rkvdec.h
> index dfafb2c2cbc1..4094f92f8a44 100644
> --- a/drivers/media/platform/rockchip/rkvdec/rkvdec.h
> +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.h
> @@ -131,6 +131,7 @@ struct rkvdec_dev {
>  	struct v4l2_m2m_dev *m2m_dev;
>  	struct device *dev;
>  	struct clk_bulk_data *clocks;
> +	unsigned int clk_count;
>  	void __iomem *regs;
>  	struct mutex vdev_lock; /* serializes ioctls */
>  	struct delayed_work watchdog_work;

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  parent reply	other threads:[~2025-12-10 20:36 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22 17:44 [PATCH v4 00/15] media: rkvdec: Add support for VDPU381 and VDPU383 Detlev Casanova
2025-10-22 17:44 ` [PATCH v4 01/15] media: uapi: HEVC: Add v4l2_ctrl_hevc_ext_sps_[ls]t_rps controls Detlev Casanova
2025-10-22 17:44 ` [PATCH v4 02/15] media: v4l2-ctrls: Add hevc_ext_sps_[ls]t_rps controls Detlev Casanova
2025-10-23  8:04   ` Hans Verkuil
2025-10-23 14:07     ` Detlev Casanova
2025-11-04 16:07     ` Nicolas Dufresne
2025-10-22 17:44 ` [PATCH v4 03/15] media: rkvdec: Switch to using structs instead of writel Detlev Casanova
2025-12-10 20:17   ` Nicolas Dufresne
2025-10-22 17:44 ` [PATCH v4 04/15] media: rkvdec: Move cabac tables to their own source file Detlev Casanova
2025-12-10 20:18   ` Nicolas Dufresne
2025-10-22 17:44 ` [PATCH v4 05/15] media: rkvdec: Use structs to represent the HW RPS Detlev Casanova
2025-12-10 20:19   ` Nicolas Dufresne
2025-10-22 17:44 ` [PATCH v4 06/15] media: rkvdec: Move h264 functions to common file Detlev Casanova
2025-10-22 21:38   ` Jonas Karlman
2025-12-10 20:20   ` Nicolas Dufresne
2025-10-22 17:44 ` [PATCH v4 07/15] media: rkvdec: Move hevc " Detlev Casanova
2025-10-22 21:44   ` Jonas Karlman
2025-12-10 20:22   ` Nicolas Dufresne
2025-10-22 17:45 ` [PATCH v4 08/15] media: rkvdec: Add generic configuration for variants Detlev Casanova
2025-10-22 20:57   ` Jonas Karlman
2025-10-22 21:12     ` Jonas Karlman
2025-10-23 19:35     ` Detlev Casanova
2025-12-10 20:24   ` Nicolas Dufresne
2025-10-22 17:45 ` [PATCH v4 09/15] media: rkvdec: Add RCB and SRAM support Detlev Casanova
2025-10-22 21:07   ` Jonas Karlman
2025-10-23 19:46     ` Detlev Casanova
2025-12-10 20:32   ` Nicolas Dufresne
2025-10-22 17:45 ` [PATCH v4 10/15] media: rkvdec: Support per-variant interrupt handler Detlev Casanova
2025-12-10 20:35   ` Nicolas Dufresne
2025-10-22 17:45 ` [PATCH v4 11/15] media: rkvdec: Enable all clocks without naming them Detlev Casanova
2025-10-22 21:18   ` Jonas Karlman
2025-12-10 20:36   ` Nicolas Dufresne [this message]
2025-10-22 17:45 ` [PATCH v4 12/15] media: rkvdec: Add H264 support for the VDPU381 variant Detlev Casanova
2025-12-10 20:41   ` Nicolas Dufresne
2025-10-22 17:45 ` [PATCH v4 13/15] media: rkvdec: Add H264 support for the VDPU383 variant Detlev Casanova
2025-12-10 20:45   ` Nicolas Dufresne
2025-10-22 17:45 ` [PATCH v4 14/15] media: rkvdec: Add HEVC support for the VDPU381 variant Detlev Casanova
2025-12-10 20:46   ` Nicolas Dufresne
2025-10-22 17:45 ` [PATCH v4 15/15] media: rkvdec: Add HEVC support for the VDPU383 variant Detlev Casanova
2025-12-10 20:47   ` Nicolas Dufresne

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=1ba983fd1b805bd18406e8d614bc9c72a109a0f9.camel@collabora.com \
    --to=nicolas.dufresne@collabora.com \
    --cc=corbet@lwn.net \
    --cc=detlev.casanova@collabora.com \
    --cc=didi.debian@cknow.org \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=hansg@kernel.org \
    --cc=heiko@sntech.de \
    --cc=hverkuil@kernel.org \
    --cc=james.cowgill@blaize.com \
    --cc=kernel@collabora.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=yunkec@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