aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/clk/clk.c7
-rw-r--r--include/linux/clk-provider.h5
2 files changed, 10 insertions, 2 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index c0141f3e1109..253792a46c08 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -352,9 +352,12 @@ static void clk_unprepare_unused_subtree(struct clk *clk)
352 if (clk->flags & CLK_IGNORE_UNUSED) 352 if (clk->flags & CLK_IGNORE_UNUSED)
353 return; 353 return;
354 354
355 if (__clk_is_prepared(clk)) 355 if (__clk_is_prepared(clk)) {
356 if (clk->ops->unprepare) 356 if (clk->ops->unprepare_unused)
357 clk->ops->unprepare_unused(clk->hw);
358 else if (clk->ops->unprepare)
357 clk->ops->unprepare(clk->hw); 359 clk->ops->unprepare(clk->hw);
360 }
358} 361}
359 362
360/* caller must hold prepare_lock */ 363/* caller must hold prepare_lock */
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index ee946862e058..56e6cc12c796 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -49,6 +49,10 @@ struct clk_hw;
49 * This function is allowed to sleep. Optional, if this op is not 49 * This function is allowed to sleep. Optional, if this op is not
50 * set then the prepare count will be used. 50 * set then the prepare count will be used.
51 * 51 *
52 * @unprepare_unused: Unprepare the clock atomically. Only called from
53 * clk_disable_unused for prepare clocks with special needs.
54 * Called with prepare mutex held. This function may sleep.
55 *
52 * @enable: Enable the clock atomically. This must not return until the 56 * @enable: Enable the clock atomically. This must not return until the
53 * clock is generating a valid clock signal, usable by consumer 57 * clock is generating a valid clock signal, usable by consumer
54 * devices. Called with enable_lock held. This function must not 58 * devices. Called with enable_lock held. This function must not
@@ -113,6 +117,7 @@ struct clk_ops {
113 int (*prepare)(struct clk_hw *hw); 117 int (*prepare)(struct clk_hw *hw);
114 void (*unprepare)(struct clk_hw *hw); 118 void (*unprepare)(struct clk_hw *hw);
115 int (*is_prepared)(struct clk_hw *hw); 119 int (*is_prepared)(struct clk_hw *hw);
120 void (*unprepare_unused)(struct clk_hw *hw);
116 int (*enable)(struct clk_hw *hw); 121 int (*enable)(struct clk_hw *hw);
117 void (*disable)(struct clk_hw *hw); 122 void (*disable)(struct clk_hw *hw);
118 int (*is_enabled)(struct clk_hw *hw); 123 int (*is_enabled)(struct clk_hw *hw);