Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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:
29e31415e14e ("clk: qcom: Remove need for clk_ignore_unused on sc8280xp")
99c0f7d35c4b ("clk: qcom: sdm845: Use generic clk_sync_state_disable_unused callback")
26b36df75166 ("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>

+11 -53
+11 -46
drivers/clk/clk.c
··· 1302 1302 clk_core_unprepare_lock(core); 1303 1303 } 1304 1304 1305 - static void clk_unprepare_unused_subtree(struct clk_core *core, 1306 - struct device *dev) 1305 + static void __init clk_unprepare_unused_subtree(struct clk_core *core) 1307 1306 { 1308 - bool from_sync_state = !!dev; 1309 1307 struct clk_core *child; 1310 1308 1311 1309 lockdep_assert_held(&prepare_lock); 1312 1310 1313 1311 hlist_for_each_entry(child, &core->children, child_node) 1314 - clk_unprepare_unused_subtree(child, dev); 1315 - 1316 - if (from_sync_state && core->dev != dev) 1317 - return; 1318 - 1319 - /* 1320 - * clock will be unprepared on sync_state, 1321 - * so leave as is for now 1322 - */ 1323 - if (!from_sync_state && dev_has_sync_state(core->dev)) 1324 - return; 1312 + clk_unprepare_unused_subtree(child); 1325 1313 1326 1314 if (core->prepare_count) 1327 1315 return; ··· 1332 1344 clk_pm_runtime_put(core); 1333 1345 } 1334 1346 1335 - static void clk_disable_unused_subtree(struct clk_core *core, 1336 - struct device *dev) 1347 + static void __init clk_disable_unused_subtree(struct clk_core *core) 1337 1348 { 1338 - bool from_sync_state = !!dev; 1339 1349 struct clk_core *child; 1340 1350 unsigned long flags; 1341 1351 1342 1352 lockdep_assert_held(&prepare_lock); 1343 1353 1344 1354 hlist_for_each_entry(child, &core->children, child_node) 1345 - clk_disable_unused_subtree(child, dev); 1346 - 1347 - if (from_sync_state && core->dev != dev) 1348 - return; 1349 - 1350 - /* 1351 - * clock will be disabled on sync_state, 1352 - * so leave as is for now 1353 - */ 1354 - if (!from_sync_state && dev_has_sync_state(core->dev)) 1355 - return; 1355 + clk_disable_unused_subtree(child); 1356 1356 1357 1357 if (core->flags & CLK_OPS_PARENT_ENABLE) 1358 1358 clk_core_prepare_enable(core->parent); ··· 1378 1402 clk_core_disable_unprepare(core->parent); 1379 1403 } 1380 1404 1381 - static bool clk_ignore_unused; 1405 + static bool clk_ignore_unused __initdata; 1382 1406 static int __init clk_ignore_unused_setup(char *__unused) 1383 1407 { 1384 1408 clk_ignore_unused = true; ··· 1386 1410 } 1387 1411 __setup("clk_ignore_unused", clk_ignore_unused_setup); 1388 1412 1389 - static void __clk_disable_unused(struct device *dev) 1413 + static int __init clk_disable_unused(void) 1390 1414 { 1391 1415 struct clk_core *core; 1392 1416 1393 1417 if (clk_ignore_unused) { 1394 1418 pr_warn("clk: Not disabling unused clocks\n"); 1395 - return; 1419 + return 0; 1396 1420 } 1397 1421 1398 1422 clk_prepare_lock(); 1399 1423 1400 1424 hlist_for_each_entry(core, &clk_root_list, child_node) 1401 - clk_disable_unused_subtree(core, dev); 1425 + clk_disable_unused_subtree(core); 1402 1426 1403 1427 hlist_for_each_entry(core, &clk_orphan_list, child_node) 1404 - clk_disable_unused_subtree(core, dev); 1428 + clk_disable_unused_subtree(core); 1405 1429 1406 1430 hlist_for_each_entry(core, &clk_root_list, child_node) 1407 - clk_unprepare_unused_subtree(core, dev); 1431 + clk_unprepare_unused_subtree(core); 1408 1432 1409 1433 hlist_for_each_entry(core, &clk_orphan_list, child_node) 1410 - clk_unprepare_unused_subtree(core, dev); 1434 + clk_unprepare_unused_subtree(core); 1411 1435 1412 1436 clk_prepare_unlock(); 1413 - } 1414 - 1415 - static int __init clk_disable_unused(void) 1416 - { 1417 - __clk_disable_unused(NULL); 1418 1437 1419 1438 return 0; 1420 1439 } 1421 1440 late_initcall_sync(clk_disable_unused); 1422 - 1423 - void clk_sync_state_disable_unused(struct device *dev) 1424 - { 1425 - __clk_disable_unused(dev); 1426 - } 1427 - EXPORT_SYMBOL_GPL(clk_sync_state_disable_unused); 1428 1441 1429 1442 static int clk_core_determine_round_nolock(struct clk_core *core, 1430 1443 struct clk_rate_request *req)
-1
drivers/clk/qcom/camcc-sdm845.c
··· 1743 1743 .driver = { 1744 1744 .name = "sdm845-camcc", 1745 1745 .of_match_table = cam_cc_sdm845_match_table, 1746 - .sync_state = clk_sync_state_disable_unused, 1747 1746 }, 1748 1747 }; 1749 1748
-1
drivers/clk/qcom/dispcc-sc8280xp.c
··· 3199 3199 .driver = { 3200 3200 .name = "disp_cc-sc8280xp", 3201 3201 .of_match_table = disp_cc_sc8280xp_match_table, 3202 - .sync_state = clk_sync_state_disable_unused, 3203 3202 }, 3204 3203 }; 3205 3204
-1
drivers/clk/qcom/dispcc-sdm845.c
··· 869 869 .driver = { 870 870 .name = "disp_cc-sdm845", 871 871 .of_match_table = disp_cc_sdm845_match_table, 872 - .sync_state = clk_sync_state_disable_unused, 873 872 }, 874 873 }; 875 874
-1
drivers/clk/qcom/gcc-sc8280xp.c
··· 7441 7441 .driver = { 7442 7442 .name = "gcc-sc8280xp", 7443 7443 .of_match_table = gcc_sc8280xp_match_table, 7444 - .sync_state = clk_sync_state_disable_unused, 7445 7444 }, 7446 7445 }; 7447 7446
-1
drivers/clk/qcom/gcc-sdm845.c
··· 4020 4020 .driver = { 4021 4021 .name = "gcc-sdm845", 4022 4022 .of_match_table = gcc_sdm845_match_table, 4023 - .sync_state = clk_sync_state_disable_unused, 4024 4023 }, 4025 4024 }; 4026 4025
-1
drivers/clk/qcom/gpucc-sdm845.c
··· 200 200 .driver = { 201 201 .name = "sdm845-gpucc", 202 202 .of_match_table = gpu_cc_sdm845_match_table, 203 - .sync_state = clk_sync_state_disable_unused, 204 203 }, 205 204 }; 206 205
-1
include/linux/clk-provider.h
··· 720 720 void __iomem *reg, u8 shift, u8 width, 721 721 u8 clk_divider_flags, const struct clk_div_table *table, 722 722 spinlock_t *lock); 723 - void clk_sync_state_disable_unused(struct device *dev); 724 723 /** 725 724 * clk_register_divider - register a divider clock with the clock framework 726 725 * @dev: device registering this clock