clk: qcom: Revert sync_state based clk_disable_unused

Revert the postponement of clk_disable_unused() for clock providers that
implement sync_state, and the change to drivers implementing this, until
agreement on the implementation has been reached.

This reverts:
29e31415e1 ("clk: qcom: Remove need for clk_ignore_unused on sc8280xp")
99c0f7d35c ("clk: qcom: sdm845: Use generic clk_sync_state_disable_unused callback")
26b36df751 ("clk: Add generic sync_state callback for disabling unused clocks")

Requested-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
This commit is contained in:
Bjorn Andersson 2023-02-22 06:31:10 -08:00
parent 7935b534d3
commit c1855dd0a6
8 changed files with 11 additions and 53 deletions

View File

@ -1302,26 +1302,14 @@ static void clk_core_disable_unprepare(struct clk_core *core)
clk_core_unprepare_lock(core);
}
static void clk_unprepare_unused_subtree(struct clk_core *core,
struct device *dev)
static void __init clk_unprepare_unused_subtree(struct clk_core *core)
{
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, 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))
return;
clk_unprepare_unused_subtree(child);
if (core->prepare_count)
return;
@ -1344,27 +1332,15 @@ static void clk_unprepare_unused_subtree(struct clk_core *core,
clk_pm_runtime_put(core);
}
static void clk_disable_unused_subtree(struct clk_core *core,
struct device *dev)
static void __init clk_disable_unused_subtree(struct clk_core *core)
{
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, 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 && dev_has_sync_state(core->dev))
return;
clk_disable_unused_subtree(child);
if (core->flags & CLK_OPS_PARENT_ENABLE)
clk_core_prepare_enable(core->parent);
@ -1402,7 +1378,7 @@ unprepare_out:
clk_core_disable_unprepare(core->parent);
}
static bool clk_ignore_unused;
static bool clk_ignore_unused __initdata;
static int __init clk_ignore_unused_setup(char *__unused)
{
clk_ignore_unused = true;
@ -1410,46 +1386,35 @@ static int __init clk_ignore_unused_setup(char *__unused)
}
__setup("clk_ignore_unused", clk_ignore_unused_setup);
static void __clk_disable_unused(struct device *dev)
static int __init clk_disable_unused(void)
{
struct clk_core *core;
if (clk_ignore_unused) {
pr_warn("clk: Not disabling unused clocks\n");
return;
return 0;
}
clk_prepare_lock();
hlist_for_each_entry(core, &clk_root_list, child_node)
clk_disable_unused_subtree(core, dev);
clk_disable_unused_subtree(core);
hlist_for_each_entry(core, &clk_orphan_list, child_node)
clk_disable_unused_subtree(core, dev);
clk_disable_unused_subtree(core);
hlist_for_each_entry(core, &clk_root_list, child_node)
clk_unprepare_unused_subtree(core, dev);
clk_unprepare_unused_subtree(core);
hlist_for_each_entry(core, &clk_orphan_list, child_node)
clk_unprepare_unused_subtree(core, dev);
clk_unprepare_unused_subtree(core);
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)
{

View File

@ -1743,7 +1743,6 @@ 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,
},
};

View File

@ -3199,7 +3199,6 @@ static struct platform_driver disp_cc_sc8280xp_driver = {
.driver = {
.name = "disp_cc-sc8280xp",
.of_match_table = disp_cc_sc8280xp_match_table,
.sync_state = clk_sync_state_disable_unused,
},
};

View File

@ -869,7 +869,6 @@ 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,
},
};

View File

@ -7441,7 +7441,6 @@ static struct platform_driver gcc_sc8280xp_driver = {
.driver = {
.name = "gcc-sc8280xp",
.of_match_table = gcc_sc8280xp_match_table,
.sync_state = clk_sync_state_disable_unused,
},
};

View File

@ -4020,7 +4020,6 @@ 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,
},
};

View File

@ -200,7 +200,6 @@ 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,
},
};

View File

@ -720,7 +720,6 @@ 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