From: Detlev Casanova <detlev.casanova@collabora.com>
To: linux-kernel@vger.kernel.org
Cc: Detlev Casanova <detlev.casanova@collabora.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Heiko Stuebner <heiko@sntech.de>,
linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
linux-arm-kernel@lists.infradead.org, kernel@collabora.com
Subject: [PATCH v2 08/12] media: rkvdec: Enable all clocks without naming them
Date: Fri, 8 Aug 2025 16:03:30 -0400 [thread overview]
Message-ID: <20250808200340.156393-9-detlev.casanova@collabora.com> (raw)
In-Reply-To: <20250808200340.156393-1-detlev.casanova@collabora.com>
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.
Signed-off-by: Detlev Casanova <detlev.casanova@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 5f3057e8136b5..0ccf1ba81958a 100644
--- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c
+++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
@@ -1161,14 +1161,9 @@ 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)
{
struct rkvdec_dev *rkvdec;
- unsigned int i;
int ret, irq;
rkvdec = devm_kzalloc(&pdev->dev, sizeof(*rkvdec), GFP_KERNEL);
@@ -1183,19 +1178,12 @@ static int rkvdec_probe(struct platform_device *pdev)
rkvdec->config =
(struct rkvdec_config *)of_device_get_match_data(rkvdec->dev);
- 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);
@@ -1269,7 +1257,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);
}
@@ -1277,7 +1265,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 679de66df2479..af47f16cb417d 100644
--- a/drivers/media/platform/rockchip/rkvdec/rkvdec.h
+++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.h
@@ -117,6 +117,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;
--
2.50.1
next prev parent reply other threads:[~2025-08-08 20:04 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-08 20:03 [PATCH v2 00/12] media: rkvdec: Add support for VDPU381 and VDPU383 Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 01/12] media: rkvdec: Switch to using structs instead of writel Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 02/12] media: rkvdec: Move cabac table to its own source file Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 03/12] media: rkvdec: Use structs to represent the HW RPS Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 04/12] media: rkvdec: Move h264 functions to common file Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 05/12] media: rkvdec: Add per variant configuration Detlev Casanova
2025-08-11 6:13 ` Krzysztof Kozlowski
2025-08-11 13:52 ` Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 06/12] media: rkvdec: Add RCB and SRAM support Detlev Casanova
2025-08-11 6:13 ` Krzysztof Kozlowski
2025-08-11 13:54 ` Detlev Casanova
2025-08-11 14:01 ` Krzysztof Kozlowski
2025-08-11 18:44 ` Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 07/12] media: rkvdec: Support per-variant interrupt handler Detlev Casanova
2025-08-08 20:03 ` Detlev Casanova [this message]
2025-08-08 20:03 ` [PATCH v2 09/12] media: rkvdec: Add H264 support for the VDPU381 variant Detlev Casanova
2025-08-12 17:07 ` Dmitry Osipenko
2025-09-20 15:00 ` Diederik de Haas
2025-09-20 16:15 ` Jonas Karlman
2025-09-20 18:06 ` Diederik de Haas
2025-08-08 20:03 ` [PATCH v2 10/12] media: rkvdec: Add H264 support for the VDPU383 variant Detlev Casanova
2025-08-09 11:53 ` kernel test robot
2025-08-11 18:28 ` Nicolas Dufresne
2025-08-08 20:03 ` [PATCH v2 11/12] media: rkvdec: Add HEVC support for the VDPU381 variant Detlev Casanova
2025-08-09 13:17 ` kernel test robot
2025-09-20 15:07 ` Diederik de Haas
2025-09-20 16:23 ` Jonas Karlman
2025-09-22 14:19 ` Nicolas Dufresne
2025-09-29 12:47 ` Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 12/12] media: rkvdec: Add HEVC support for the VDPU383 variant Detlev Casanova
2025-08-11 9:56 ` [PATCH v2 00/12] media: rkvdec: Add support for VDPU381 and VDPU383 Heiko Stübner
2025-08-11 16:33 ` Detlev Casanova
2025-08-12 7:20 ` Piotr Oniszczuk
2025-09-17 17:34 ` Diederik de Haas
2025-09-18 13:31 ` 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=20250808200340.156393-9-detlev.casanova@collabora.com \
--to=detlev.casanova@collabora.com \
--cc=heiko@sntech.de \
--cc=kernel@collabora.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 \
/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
all inboxes | Powered by JetHome®