[PATCH v3 02/14] counter: rz-mtu3-cnt: remove manual runtime PM handling

From: Cosmin Tanislav

Date: Tue Nov 17 2026 - 05:27:36 EST


The clock is already managed by the CPG power domain attached to the
parent device for all supported SoCs.

When runtime PM is enabled on the parent device, __device_attach()
temporarily resumes the parent for the duration of the child's probe and
drops the runtime PM reference afterwards. Runtime PM usage by the child
device also keeps the parent device active.

As a result, explicit runtime PM handling in the counter driver is not
necessary. Remove it.

Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@xxxxxxxxxxx>
---

V3:
* no changes

V2:
* remove struct rz_mtu3_cnt::clk documentation
* remove clk.h include

drivers/counter/rz-mtu3-cnt.c | 44 +++--------------------------------
1 file changed, 3 insertions(+), 41 deletions(-)

diff --git a/drivers/counter/rz-mtu3-cnt.c b/drivers/counter/rz-mtu3-cnt.c
index bafb8ef82afb..d8f13c5ac525 100644
--- a/drivers/counter/rz-mtu3-cnt.c
+++ b/drivers/counter/rz-mtu3-cnt.c
@@ -5,7 +5,6 @@
* Copyright (C) 2022 Renesas Electronics Corporation
*/

-#include <linux/clk.h>
#include <linux/counter.h>
#include <linux/mfd/rz-mtu3.h>
#include <linux/module.h>
@@ -65,7 +64,6 @@
/**
* struct rz_mtu3_cnt - MTU3 counter private data
*
- * @clk: MTU3 module clock
* @lock: Lock to prevent concurrent access for ceiling and count
* @ch: HW channels for the counters
* @count_is_enabled: Enabled state of Counter value channel
@@ -73,7 +71,6 @@
* @mtu_32bit_max: Cache for 32-bit counters
*/
struct rz_mtu3_cnt {
- struct clk *clk;
struct mutex lock;
struct rz_mtu3_channel *ch;
bool count_is_enabled[RZ_MTU3_MAX_LOGICAL_CNTR_CHANNELS];
@@ -807,34 +804,11 @@ static struct counter_comp rz_mtu3_device_ext[] = {
rz_mtu3_ext_input_phase_clock_select_enum),
};

-static int rz_mtu3_cnt_pm_runtime_suspend(struct device *dev)
-{
- struct clk *const clk = dev_get_drvdata(dev);
-
- clk_disable_unprepare(clk);
-
- return 0;
-}
-
-static int rz_mtu3_cnt_pm_runtime_resume(struct device *dev)
-{
- struct clk *const clk = dev_get_drvdata(dev);
-
- clk_prepare_enable(clk);
-
- return 0;
-}
-
-static DEFINE_RUNTIME_DEV_PM_OPS(rz_mtu3_cnt_pm_ops,
- rz_mtu3_cnt_pm_runtime_suspend,
- rz_mtu3_cnt_pm_runtime_resume, NULL);
-
static void rz_mtu3_cnt_pm_disable(void *data)
{
struct device *dev = data;

pm_runtime_disable(dev);
- pm_runtime_set_suspended(dev);
}

static int rz_mtu3_cnt_probe(struct platform_device *pdev)
@@ -851,20 +825,16 @@ static int rz_mtu3_cnt_probe(struct platform_device *pdev)
return -ENOMEM;

priv = counter_priv(counter);
- priv->clk = ddata->clk;
priv->mtu_32bit_max = U32_MAX;
priv->ch = &ddata->channels[RZ_MTU3_CHAN_1];
for (i = 0; i < RZ_MTU3_MAX_HW_CNTR_CHANNELS; i++)
priv->mtu_16bit_max[i] = U16_MAX;

mutex_init(&priv->lock);
- platform_set_drvdata(pdev, priv->clk);
- clk_prepare_enable(priv->clk);
- pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);
ret = devm_add_action_or_reset(&pdev->dev, rz_mtu3_cnt_pm_disable, dev);
if (ret < 0)
- goto disable_clock;
+ return ret;

counter->name = dev_name(dev);
counter->parent = dev;
@@ -878,24 +848,16 @@ static int rz_mtu3_cnt_probe(struct platform_device *pdev)

/* Register Counter device */
ret = devm_counter_add(dev, counter);
- if (ret < 0) {
- dev_err_probe(dev, ret, "Failed to add counter\n");
- goto disable_clock;
- }
+ if (ret < 0)
+ return dev_err_probe(dev, ret, "Failed to add counter\n");

return 0;
-
-disable_clock:
- clk_disable_unprepare(priv->clk);
-
- return ret;
}

static struct platform_driver rz_mtu3_cnt_driver = {
.probe = rz_mtu3_cnt_probe,
.driver = {
.name = "rz-mtu3-counter",
- .pm = pm_ptr(&rz_mtu3_cnt_pm_ops),
},
};
module_platform_driver(rz_mtu3_cnt_driver);
--
2.56.0