public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] clk: Add generic sync_state callback for disabling unused clocks
@ 2022-12-25 16:47 Abel Vesa
  2022-12-25 16:47 ` [PATCH v2 2/2] clk: qcom: sdm845: Use generic clk_sync_state_disable_unused callback Abel Vesa
  2022-12-26  0:54 ` [PATCH v2 1/2] clk: Add generic sync_state callback for disabling unused clocks Dmitry Baryshkov
  0 siblings, 2 replies; 4+ messages in thread
From: Abel Vesa @ 2022-12-25 16:47 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd, Andy Gross, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-clk, Linux Kernel Mailing List, linux-arm-msm

There are unused clocks that need to remain untouched by clk_disable_unused,
and most likely could be disabled later on sync_state. So provide a generic
sync_state callback for the clock providers that register such clocks.
Then, use the same mechanism as clk_disable_unused from that generic
callback, but pass the device to make sure only the clocks belonging to
the current clock provider get disabled, if unused. Also, during the
default clk_disable_unused, if the driver that registered the clock has
the generic clk_sync_state_disable_unused callback set for sync_state,
skip disabling its clocks.

Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
---

Changes since v1:
 * Dropped the 0 returned by __clk_disable_unused when clk_ignore_unused
   is set.
 * Dropped __initdata for clk_ignore_unused

 drivers/clk/clk.c            | 59 +++++++++++++++++++++++++++++-------
 include/linux/clk-provider.h |  1 +
 2 files changed, 49 insertions(+), 11 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index e62552a75f08..5185b857fc65 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1302,14 +1302,27 @@ static void clk_core_disable_unprepare(struct clk_core *core)
 	clk_core_unprepare_lock(core);
 }
 
-static void __init clk_unprepare_unused_subtree(struct clk_core *core)
+static void clk_unprepare_unused_subtree(struct clk_core *core,
+						struct device *dev)
 {
+	bool from_sync_state = !!dev;
 	struct clk_core *child;
 
 	lockdep_assert_held(&prepare_lock);
 
 	hlist_for_each_entry(child, &core->children, child_node)
-		clk_unprepare_unused_subtree(child);
+		clk_unprepare_unused_subtree(child, dev);
+
+	if (from_sync_state && core->dev != dev)
+		return;
+
+	/*
+	 * clock will be unprepared on sync_state,
+	 * so leave as is for now
+	 */
+	if (!from_sync_state && dev_has_sync_state(core->dev) &&
+		core->dev->driver->sync_state == clk_sync_state_disable_unused)
+		return;
 
 	if (core->prepare_count)
 		return;
@@ -1332,15 +1345,28 @@ static void __init clk_unprepare_unused_subtree(struct clk_core *core)
 	clk_pm_runtime_put(core);
 }
 
-static void __init clk_disable_unused_subtree(struct clk_core *core)
+static void clk_disable_unused_subtree(struct clk_core *core,
+					struct device *dev)
 {
+	bool from_sync_state = !!dev;
 	struct clk_core *child;
 	unsigned long flags;
 
 	lockdep_assert_held(&prepare_lock);
 
 	hlist_for_each_entry(child, &core->children, child_node)
-		clk_disable_unused_subtree(child);
+		clk_disable_unused_subtree(child, dev);
+
+	if (from_sync_state && core->dev != dev)
+		return;
+
+	/*
+	 * clock will be disabled on sync_state,
+	 * so leave as is for now
+	 */
+	if (!from_sync_state &&
+		core->dev->driver->sync_state == clk_sync_state_disable_unused)
+		return;
 
 	if (core->flags & CLK_OPS_PARENT_ENABLE)
 		clk_core_prepare_enable(core->parent);
@@ -1378,7 +1404,7 @@ static void __init clk_disable_unused_subtree(struct clk_core *core)
 		clk_core_disable_unprepare(core->parent);
 }
 
-static bool clk_ignore_unused __initdata;
+static bool clk_ignore_unused;
 static int __init clk_ignore_unused_setup(char *__unused)
 {
 	clk_ignore_unused = true;
@@ -1386,35 +1412,46 @@ static int __init clk_ignore_unused_setup(char *__unused)
 }
 __setup("clk_ignore_unused", clk_ignore_unused_setup);
 
-static int __init clk_disable_unused(void)
+static void __clk_disable_unused(struct device *dev)
 {
 	struct clk_core *core;
 
 	if (clk_ignore_unused) {
 		pr_warn("clk: Not disabling unused clocks\n");
-		return 0;
+		return;
 	}
 
 	clk_prepare_lock();
 
 	hlist_for_each_entry(core, &clk_root_list, child_node)
-		clk_disable_unused_subtree(core);
+		clk_disable_unused_subtree(core, dev);
 
 	hlist_for_each_entry(core, &clk_orphan_list, child_node)
-		clk_disable_unused_subtree(core);
+		clk_disable_unused_subtree(core, dev);
 
 	hlist_for_each_entry(core, &clk_root_list, child_node)
-		clk_unprepare_unused_subtree(core);
+		clk_unprepare_unused_subtree(core, dev);
 
 	hlist_for_each_entry(core, &clk_orphan_list, child_node)
-		clk_unprepare_unused_subtree(core);
+		clk_unprepare_unused_subtree(core, dev);
 
 	clk_prepare_unlock();
+}
+
+static int __init clk_disable_unused(void)
+{
+	__clk_disable_unused(NULL);
 
 	return 0;
 }
 late_initcall_sync(clk_disable_unused);
 
+void clk_sync_state_disable_unused(struct device *dev)
+{
+	__clk_disable_unused(dev);
+}
+EXPORT_SYMBOL_GPL(clk_sync_state_disable_unused);
+
 static int clk_core_determine_round_nolock(struct clk_core *core,
 					   struct clk_rate_request *req)
 {
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 842e72a5348f..cf1adfeaf257 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -720,6 +720,7 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name,
 		void __iomem *reg, u8 shift, u8 width,
 		u8 clk_divider_flags, const struct clk_div_table *table,
 		spinlock_t *lock);
+void clk_sync_state_disable_unused(struct device *dev);
 /**
  * clk_register_divider - register a divider clock with the clock framework
  * @dev: device registering this clock
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] clk: qcom: sdm845: Use generic clk_sync_state_disable_unused callback
  2022-12-25 16:47 [PATCH v2 1/2] clk: Add generic sync_state callback for disabling unused clocks Abel Vesa
@ 2022-12-25 16:47 ` Abel Vesa
  2022-12-26  0:54 ` [PATCH v2 1/2] clk: Add generic sync_state callback for disabling unused clocks Dmitry Baryshkov
  1 sibling, 0 replies; 4+ messages in thread
From: Abel Vesa @ 2022-12-25 16:47 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd, Andy Gross, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-clk, Linux Kernel Mailing List, linux-arm-msm

By adding the newly added clk_sync_state_disable_unused as sync_state
callback to all sdm845 clock providers, we make sure that no clock
belonging to these providers gets disabled on clk_disable_unused,
but rather they are disabled on sync_state, when it is safe, since
all the consumers build as modules have had their chance of enabling
their own clocks.

Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
---

Changes since v1:
 * None

 drivers/clk/qcom/camcc-sdm845.c  | 1 +
 drivers/clk/qcom/dispcc-sdm845.c | 1 +
 drivers/clk/qcom/gcc-sdm845.c    | 1 +
 drivers/clk/qcom/gpucc-sdm845.c  | 1 +
 4 files changed, 4 insertions(+)

diff --git a/drivers/clk/qcom/camcc-sdm845.c b/drivers/clk/qcom/camcc-sdm845.c
index 27d44188a7ab..e5aeb832e47b 100644
--- a/drivers/clk/qcom/camcc-sdm845.c
+++ b/drivers/clk/qcom/camcc-sdm845.c
@@ -1743,6 +1743,7 @@ static struct platform_driver cam_cc_sdm845_driver = {
 	.driver	= {
 		.name = "sdm845-camcc",
 		.of_match_table = cam_cc_sdm845_match_table,
+		.sync_state = clk_sync_state_disable_unused,
 	},
 };
 
diff --git a/drivers/clk/qcom/dispcc-sdm845.c b/drivers/clk/qcom/dispcc-sdm845.c
index 735adfefc379..1810d58bad09 100644
--- a/drivers/clk/qcom/dispcc-sdm845.c
+++ b/drivers/clk/qcom/dispcc-sdm845.c
@@ -869,6 +869,7 @@ static struct platform_driver disp_cc_sdm845_driver = {
 	.driver		= {
 		.name	= "disp_cc-sdm845",
 		.of_match_table = disp_cc_sdm845_match_table,
+		.sync_state = clk_sync_state_disable_unused,
 	},
 };
 
diff --git a/drivers/clk/qcom/gcc-sdm845.c b/drivers/clk/qcom/gcc-sdm845.c
index 6af08e0ca847..0ff05af515c4 100644
--- a/drivers/clk/qcom/gcc-sdm845.c
+++ b/drivers/clk/qcom/gcc-sdm845.c
@@ -4020,6 +4020,7 @@ static struct platform_driver gcc_sdm845_driver = {
 	.driver		= {
 		.name	= "gcc-sdm845",
 		.of_match_table = gcc_sdm845_match_table,
+		.sync_state = clk_sync_state_disable_unused,
 	},
 };
 
diff --git a/drivers/clk/qcom/gpucc-sdm845.c b/drivers/clk/qcom/gpucc-sdm845.c
index 110b54401bc6..622a54a67d32 100644
--- a/drivers/clk/qcom/gpucc-sdm845.c
+++ b/drivers/clk/qcom/gpucc-sdm845.c
@@ -205,6 +205,7 @@ static struct platform_driver gpu_cc_sdm845_driver = {
 	.driver = {
 		.name = "sdm845-gpucc",
 		.of_match_table = gpu_cc_sdm845_match_table,
+		.sync_state = clk_sync_state_disable_unused,
 	},
 };
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] clk: Add generic sync_state callback for disabling unused clocks
  2022-12-25 16:47 [PATCH v2 1/2] clk: Add generic sync_state callback for disabling unused clocks Abel Vesa
  2022-12-25 16:47 ` [PATCH v2 2/2] clk: qcom: sdm845: Use generic clk_sync_state_disable_unused callback Abel Vesa
@ 2022-12-26  0:54 ` Dmitry Baryshkov
  2022-12-27 19:16   ` Abel Vesa
  1 sibling, 1 reply; 4+ messages in thread
From: Dmitry Baryshkov @ 2022-12-26  0:54 UTC (permalink / raw)
  To: Abel Vesa
  Cc: Mike Turquette, Stephen Boyd, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, linux-clk, Linux Kernel Mailing List,
	linux-arm-msm

On Sun, 25 Dec 2022 at 18:47, Abel Vesa <abel.vesa@linaro.org> wrote:
>
> There are unused clocks that need to remain untouched by clk_disable_unused,
> and most likely could be disabled later on sync_state. So provide a generic
> sync_state callback for the clock providers that register such clocks.
> Then, use the same mechanism as clk_disable_unused from that generic
> callback, but pass the device to make sure only the clocks belonging to
> the current clock provider get disabled, if unused. Also, during the
> default clk_disable_unused, if the driver that registered the clock has
> the generic clk_sync_state_disable_unused callback set for sync_state,
> skip disabling its clocks.
>
> Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
> ---
>
> Changes since v1:
>  * Dropped the 0 returned by __clk_disable_unused when clk_ignore_unused
>    is set.
>  * Dropped __initdata for clk_ignore_unused
>
>  drivers/clk/clk.c            | 59 +++++++++++++++++++++++++++++-------
>  include/linux/clk-provider.h |  1 +
>  2 files changed, 49 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index e62552a75f08..5185b857fc65 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -1302,14 +1302,27 @@ static void clk_core_disable_unprepare(struct clk_core *core)
>         clk_core_unprepare_lock(core);
>  }
>
> -static void __init clk_unprepare_unused_subtree(struct clk_core *core)
> +static void clk_unprepare_unused_subtree(struct clk_core *core,
> +                                               struct device *dev)
>  {
> +       bool from_sync_state = !!dev;
>         struct clk_core *child;
>
>         lockdep_assert_held(&prepare_lock);
>
>         hlist_for_each_entry(child, &core->children, child_node)
> -               clk_unprepare_unused_subtree(child);
> +               clk_unprepare_unused_subtree(child, dev);
> +
> +       if (from_sync_state && core->dev != dev)
> +               return;
> +
> +       /*
> +        * clock will be unprepared on sync_state,
> +        * so leave as is for now
> +        */
> +       if (!from_sync_state && dev_has_sync_state(core->dev) &&
> +               core->dev->driver->sync_state == clk_sync_state_disable_unused)

I link the overall approach, but I don't think we should check the
sync_state function.
Such a check would disallow a driver to wrap the
clk_sync_state_disable_unused() into some driver-specific code.

> +               return;
>
>         if (core->prepare_count)
>                 return;
> @@ -1332,15 +1345,28 @@ static void __init clk_unprepare_unused_subtree(struct clk_core *core)
>         clk_pm_runtime_put(core);
>  }
>
> -static void __init clk_disable_unused_subtree(struct clk_core *core)
> +static void clk_disable_unused_subtree(struct clk_core *core,
> +                                       struct device *dev)
>  {
> +       bool from_sync_state = !!dev;
>         struct clk_core *child;
>         unsigned long flags;
>
>         lockdep_assert_held(&prepare_lock);
>
>         hlist_for_each_entry(child, &core->children, child_node)
> -               clk_disable_unused_subtree(child);
> +               clk_disable_unused_subtree(child, dev);
> +
> +       if (from_sync_state && core->dev != dev)
> +               return;
> +
> +       /*
> +        * clock will be disabled on sync_state,
> +        * so leave as is for now
> +        */
> +       if (!from_sync_state &&
> +               core->dev->driver->sync_state == clk_sync_state_disable_unused)
> +               return;
>
>         if (core->flags & CLK_OPS_PARENT_ENABLE)
>                 clk_core_prepare_enable(core->parent);
> @@ -1378,7 +1404,7 @@ static void __init clk_disable_unused_subtree(struct clk_core *core)
>                 clk_core_disable_unprepare(core->parent);
>  }
>
> -static bool clk_ignore_unused __initdata;
> +static bool clk_ignore_unused;
>  static int __init clk_ignore_unused_setup(char *__unused)
>  {
>         clk_ignore_unused = true;
> @@ -1386,35 +1412,46 @@ static int __init clk_ignore_unused_setup(char *__unused)
>  }
>  __setup("clk_ignore_unused", clk_ignore_unused_setup);
>
> -static int __init clk_disable_unused(void)
> +static void __clk_disable_unused(struct device *dev)
>  {
>         struct clk_core *core;
>
>         if (clk_ignore_unused) {
>                 pr_warn("clk: Not disabling unused clocks\n");
> -               return 0;
> +               return;
>         }
>
>         clk_prepare_lock();
>
>         hlist_for_each_entry(core, &clk_root_list, child_node)
> -               clk_disable_unused_subtree(core);
> +               clk_disable_unused_subtree(core, dev);
>
>         hlist_for_each_entry(core, &clk_orphan_list, child_node)
> -               clk_disable_unused_subtree(core);
> +               clk_disable_unused_subtree(core, dev);
>
>         hlist_for_each_entry(core, &clk_root_list, child_node)
> -               clk_unprepare_unused_subtree(core);
> +               clk_unprepare_unused_subtree(core, dev);
>
>         hlist_for_each_entry(core, &clk_orphan_list, child_node)
> -               clk_unprepare_unused_subtree(core);
> +               clk_unprepare_unused_subtree(core, dev);
>
>         clk_prepare_unlock();
> +}
> +
> +static int __init clk_disable_unused(void)
> +{
> +       __clk_disable_unused(NULL);
>
>         return 0;
>  }
>  late_initcall_sync(clk_disable_unused);
>
> +void clk_sync_state_disable_unused(struct device *dev)
> +{
> +       __clk_disable_unused(dev);
> +}
> +EXPORT_SYMBOL_GPL(clk_sync_state_disable_unused);
> +
>  static int clk_core_determine_round_nolock(struct clk_core *core,
>                                            struct clk_rate_request *req)
>  {
> diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
> index 842e72a5348f..cf1adfeaf257 100644
> --- a/include/linux/clk-provider.h
> +++ b/include/linux/clk-provider.h
> @@ -720,6 +720,7 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name,
>                 void __iomem *reg, u8 shift, u8 width,
>                 u8 clk_divider_flags, const struct clk_div_table *table,
>                 spinlock_t *lock);
> +void clk_sync_state_disable_unused(struct device *dev);
>  /**
>   * clk_register_divider - register a divider clock with the clock framework
>   * @dev: device registering this clock
> --
> 2.34.1
>


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] clk: Add generic sync_state callback for disabling unused clocks
  2022-12-26  0:54 ` [PATCH v2 1/2] clk: Add generic sync_state callback for disabling unused clocks Dmitry Baryshkov
@ 2022-12-27 19:16   ` Abel Vesa
  0 siblings, 0 replies; 4+ messages in thread
From: Abel Vesa @ 2022-12-27 19:16 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Mike Turquette, Stephen Boyd, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, linux-clk, Linux Kernel Mailing List,
	linux-arm-msm

On 22-12-26 02:54:22, Dmitry Baryshkov wrote:
> On Sun, 25 Dec 2022 at 18:47, Abel Vesa <abel.vesa@linaro.org> wrote:
> >
> > There are unused clocks that need to remain untouched by clk_disable_unused,
> > and most likely could be disabled later on sync_state. So provide a generic
> > sync_state callback for the clock providers that register such clocks.
> > Then, use the same mechanism as clk_disable_unused from that generic
> > callback, but pass the device to make sure only the clocks belonging to
> > the current clock provider get disabled, if unused. Also, during the
> > default clk_disable_unused, if the driver that registered the clock has
> > the generic clk_sync_state_disable_unused callback set for sync_state,
> > skip disabling its clocks.
> >
> > Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
> > ---
> >
> > Changes since v1:
> >  * Dropped the 0 returned by __clk_disable_unused when clk_ignore_unused
> >    is set.
> >  * Dropped __initdata for clk_ignore_unused
> >
> >  drivers/clk/clk.c            | 59 +++++++++++++++++++++++++++++-------
> >  include/linux/clk-provider.h |  1 +
> >  2 files changed, 49 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > index e62552a75f08..5185b857fc65 100644
> > --- a/drivers/clk/clk.c
> > +++ b/drivers/clk/clk.c
> > @@ -1302,14 +1302,27 @@ static void clk_core_disable_unprepare(struct clk_core *core)
> >         clk_core_unprepare_lock(core);
> >  }
> >
> > -static void __init clk_unprepare_unused_subtree(struct clk_core *core)
> > +static void clk_unprepare_unused_subtree(struct clk_core *core,
> > +                                               struct device *dev)
> >  {
> > +       bool from_sync_state = !!dev;
> >         struct clk_core *child;
> >
> >         lockdep_assert_held(&prepare_lock);
> >
> >         hlist_for_each_entry(child, &core->children, child_node)
> > -               clk_unprepare_unused_subtree(child);
> > +               clk_unprepare_unused_subtree(child, dev);
> > +
> > +       if (from_sync_state && core->dev != dev)
> > +               return;
> > +
> > +       /*
> > +        * clock will be unprepared on sync_state,
> > +        * so leave as is for now
> > +        */
> > +       if (!from_sync_state && dev_has_sync_state(core->dev) &&
> > +               core->dev->driver->sync_state == clk_sync_state_disable_unused)
> 
> I link the overall approach, but I don't think we should check the
> sync_state function.
> Such a check would disallow a driver to wrap the
> clk_sync_state_disable_unused() into some driver-specific code.

OK, will drop it and resend.

> 
> > +               return;
> >
> >         if (core->prepare_count)
> >                 return;
> > @@ -1332,15 +1345,28 @@ static void __init clk_unprepare_unused_subtree(struct clk_core *core)
> >         clk_pm_runtime_put(core);
> >  }
> >
> > -static void __init clk_disable_unused_subtree(struct clk_core *core)
> > +static void clk_disable_unused_subtree(struct clk_core *core,
> > +                                       struct device *dev)
> >  {
> > +       bool from_sync_state = !!dev;
> >         struct clk_core *child;
> >         unsigned long flags;
> >
> >         lockdep_assert_held(&prepare_lock);
> >
> >         hlist_for_each_entry(child, &core->children, child_node)
> > -               clk_disable_unused_subtree(child);
> > +               clk_disable_unused_subtree(child, dev);
> > +
> > +       if (from_sync_state && core->dev != dev)
> > +               return;
> > +
> > +       /*
> > +        * clock will be disabled on sync_state,
> > +        * so leave as is for now
> > +        */
> > +       if (!from_sync_state &&
> > +               core->dev->driver->sync_state == clk_sync_state_disable_unused)
> > +               return;
> >
> >         if (core->flags & CLK_OPS_PARENT_ENABLE)
> >                 clk_core_prepare_enable(core->parent);
> > @@ -1378,7 +1404,7 @@ static void __init clk_disable_unused_subtree(struct clk_core *core)
> >                 clk_core_disable_unprepare(core->parent);
> >  }
> >
> > -static bool clk_ignore_unused __initdata;
> > +static bool clk_ignore_unused;
> >  static int __init clk_ignore_unused_setup(char *__unused)
> >  {
> >         clk_ignore_unused = true;
> > @@ -1386,35 +1412,46 @@ static int __init clk_ignore_unused_setup(char *__unused)
> >  }
> >  __setup("clk_ignore_unused", clk_ignore_unused_setup);
> >
> > -static int __init clk_disable_unused(void)
> > +static void __clk_disable_unused(struct device *dev)
> >  {
> >         struct clk_core *core;
> >
> >         if (clk_ignore_unused) {
> >                 pr_warn("clk: Not disabling unused clocks\n");
> > -               return 0;
> > +               return;
> >         }
> >
> >         clk_prepare_lock();
> >
> >         hlist_for_each_entry(core, &clk_root_list, child_node)
> > -               clk_disable_unused_subtree(core);
> > +               clk_disable_unused_subtree(core, dev);
> >
> >         hlist_for_each_entry(core, &clk_orphan_list, child_node)
> > -               clk_disable_unused_subtree(core);
> > +               clk_disable_unused_subtree(core, dev);
> >
> >         hlist_for_each_entry(core, &clk_root_list, child_node)
> > -               clk_unprepare_unused_subtree(core);
> > +               clk_unprepare_unused_subtree(core, dev);
> >
> >         hlist_for_each_entry(core, &clk_orphan_list, child_node)
> > -               clk_unprepare_unused_subtree(core);
> > +               clk_unprepare_unused_subtree(core, dev);
> >
> >         clk_prepare_unlock();
> > +}
> > +
> > +static int __init clk_disable_unused(void)
> > +{
> > +       __clk_disable_unused(NULL);
> >
> >         return 0;
> >  }
> >  late_initcall_sync(clk_disable_unused);
> >
> > +void clk_sync_state_disable_unused(struct device *dev)
> > +{
> > +       __clk_disable_unused(dev);
> > +}
> > +EXPORT_SYMBOL_GPL(clk_sync_state_disable_unused);
> > +
> >  static int clk_core_determine_round_nolock(struct clk_core *core,
> >                                            struct clk_rate_request *req)
> >  {
> > diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
> > index 842e72a5348f..cf1adfeaf257 100644
> > --- a/include/linux/clk-provider.h
> > +++ b/include/linux/clk-provider.h
> > @@ -720,6 +720,7 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name,
> >                 void __iomem *reg, u8 shift, u8 width,
> >                 u8 clk_divider_flags, const struct clk_div_table *table,
> >                 spinlock_t *lock);
> > +void clk_sync_state_disable_unused(struct device *dev);
> >  /**
> >   * clk_register_divider - register a divider clock with the clock framework
> >   * @dev: device registering this clock
> > --
> > 2.34.1
> >
> 
> 
> -- 
> With best wishes
> Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-27 19:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-25 16:47 [PATCH v2 1/2] clk: Add generic sync_state callback for disabling unused clocks Abel Vesa
2022-12-25 16:47 ` [PATCH v2 2/2] clk: qcom: sdm845: Use generic clk_sync_state_disable_unused callback Abel Vesa
2022-12-26  0:54 ` [PATCH v2 1/2] clk: Add generic sync_state callback for disabling unused clocks Dmitry Baryshkov
2022-12-27 19:16   ` Abel Vesa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox