Skip to content

Commit 867fb0b

Browse files
bijudasgeertu
authored andcommitted
clk: renesas: rzg2l: Add helper for mod clock enable/disable
Refactor rzg2l_mod_clock_endisable() by extracting its logic into a new helper function rzg2l_mod_clock_endisable_helper(), which accepts an additional set_mstop_state boolean parameter. This allows callers to control whether the module stop state is updated alongside the clock enable/disable operation. No functional change for existing callers. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://patch.msgid.link/20260324114329.268249-5-biju.das.jz@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent 5865d25 commit 867fb0b

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

drivers/clk/renesas/rzg2l-cpg.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,8 @@ static int rzg2l_mod_clock_mstop_show(struct seq_file *s, void *what)
14391439
}
14401440
DEFINE_SHOW_ATTRIBUTE(rzg2l_mod_clock_mstop);
14411441

1442-
static int rzg2l_mod_clock_endisable(struct clk_hw *hw, bool enable)
1442+
static int rzg2l_mod_clock_endisable_helper(struct clk_hw *hw, bool enable,
1443+
bool set_mstop_state)
14431444
{
14441445
struct mod_clock *clock = to_mod_clock(hw);
14451446
struct rzg2l_cpg_priv *priv = clock->priv;
@@ -1464,9 +1465,11 @@ static int rzg2l_mod_clock_endisable(struct clk_hw *hw, bool enable)
14641465
scoped_guard(spinlock_irqsave, &priv->rmw_lock) {
14651466
if (enable) {
14661467
writel(value, priv->base + CLK_ON_R(reg));
1467-
rzg2l_mod_clock_module_set_state(clock, false);
1468+
if (set_mstop_state)
1469+
rzg2l_mod_clock_module_set_state(clock, false);
14681470
} else {
1469-
rzg2l_mod_clock_module_set_state(clock, true);
1471+
if (set_mstop_state)
1472+
rzg2l_mod_clock_module_set_state(clock, true);
14701473
writel(value, priv->base + CLK_ON_R(reg));
14711474
}
14721475
}
@@ -1486,6 +1489,11 @@ static int rzg2l_mod_clock_endisable(struct clk_hw *hw, bool enable)
14861489
return error;
14871490
}
14881491

1492+
static int rzg2l_mod_clock_endisable(struct clk_hw *hw, bool enable)
1493+
{
1494+
return rzg2l_mod_clock_endisable_helper(hw, enable, true);
1495+
}
1496+
14891497
static int rzg2l_mod_clock_enable(struct clk_hw *hw)
14901498
{
14911499
struct mod_clock *clock = to_mod_clock(hw);

0 commit comments

Comments
 (0)