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

cpufreq: cpu0: rename driver and internals to 'cpufreq_dt'

The naming convention of this driver was always under the scanner, people
complained that it should have a more generic name than cpu0, as it manages all
CPUs that are sharing clock lines.

Also, in future it will be modified to support any number of clusters with
separate clock/voltage lines.

Lets rename it to 'cpufreq_dt' from 'cpufreq_cpu0'.

Tested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Viresh Kumar and committed by
Rafael J. Wysocki
bbcf0719 0bf18f19

+46 -46
+4 -4
Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt Documentation/devicetree/bindings/cpufreq/cpufreq-dt.txt
··· 1 - Generic CPU0 cpufreq driver 1 + Generic cpufreq driver 2 2 3 - It is a generic cpufreq driver for CPU0 frequency management. It 4 - supports both uniprocessor (UP) and symmetric multiprocessor (SMP) 5 - systems which share clock and voltage across all CPUs. 3 + It is a generic DT based cpufreq driver for frequency management. It supports 4 + both uniprocessor (UP) and symmetric multiprocessor (SMP) systems which share 5 + clock and voltage across all CPUs. 6 6 7 7 Both required and optional properties listed below must be defined 8 8 under node /cpus/cpu@0.
+1 -1
arch/arm/configs/mvebu_v7_defconfig
··· 32 32 CONFIG_CPU_IDLE=y 33 33 CONFIG_ARM_MVEBU_V7_CPUIDLE=y 34 34 CONFIG_CPU_FREQ=y 35 - CONFIG_CPUFREQ_GENERIC=y 35 + CONFIG_CPUFREQ_DT=y 36 36 CONFIG_VFP=y 37 37 CONFIG_NET=y 38 38 CONFIG_INET=y
+1 -1
arch/arm/mach-imx/imx27-dt.c
··· 20 20 21 21 static void __init imx27_dt_init(void) 22 22 { 23 - struct platform_device_info devinfo = { .name = "cpufreq-cpu0", }; 23 + struct platform_device_info devinfo = { .name = "cpufreq-dt", }; 24 24 25 25 mxc_arch_reset_init_dt(); 26 26
+1 -1
arch/arm/mach-imx/mach-imx51.c
··· 51 51 52 52 static void __init imx51_dt_init(void) 53 53 { 54 - struct platform_device_info devinfo = { .name = "cpufreq-cpu0", }; 54 + struct platform_device_info devinfo = { .name = "cpufreq-dt", }; 55 55 56 56 mxc_arch_reset_init_dt(); 57 57 imx51_ipu_mipi_setup();
+1 -1
arch/arm/mach-mvebu/pmsu.c
··· 644 644 } 645 645 } 646 646 647 - platform_device_register_simple("cpufreq-generic", -1, NULL, 0); 647 + platform_device_register_simple("cpufreq-dt", -1, NULL, 0); 648 648 return 0; 649 649 } 650 650
+1 -1
arch/arm/mach-omap2/pm.c
··· 282 282 if (!of_have_populated_dt()) 283 283 devinfo.name = "omap-cpufreq"; 284 284 else 285 - devinfo.name = "cpufreq-cpu0"; 285 + devinfo.name = "cpufreq-dt"; 286 286 platform_device_register_full(&devinfo); 287 287 } 288 288
+1 -1
arch/arm/mach-shmobile/board-ape6evm-reference.c
··· 50 50 51 51 r8a73a4_add_dt_devices(); 52 52 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 53 - platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0); 53 + platform_device_register_simple("cpufreq-dt", -1, NULL, 0); 54 54 } 55 55 56 56 static const char *ape6evm_boards_compat_dt[] __initdata = {
+1 -1
arch/arm/mach-shmobile/cpufreq.c
··· 12 12 13 13 int __init shmobile_cpufreq_init(void) 14 14 { 15 - platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0); 15 + platform_device_register_simple("cpufreq-dt", -1, NULL, 0); 16 16 return 0; 17 17 }
+2 -2
arch/arm/mach-shmobile/setup-sh73a0.c
··· 775 775 776 776 void __init sh73a0_add_standard_devices_dt(void) 777 777 { 778 - struct platform_device_info devinfo = { .name = "cpufreq-cpu0", .id = -1, }; 778 + struct platform_device_info devinfo = { .name = "cpufreq-dt", .id = -1, }; 779 779 780 780 /* clocks are setup late during boot in the case of DT */ 781 781 sh73a0_clock_init(); ··· 784 784 ARRAY_SIZE(sh73a0_devices_dt)); 785 785 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 786 786 787 - /* Instantiate cpufreq-cpu0 */ 787 + /* Instantiate cpufreq-dt */ 788 788 platform_device_register_full(&devinfo); 789 789 } 790 790
+1 -1
arch/arm/mach-zynq/common.c
··· 104 104 */ 105 105 static void __init zynq_init_machine(void) 106 106 { 107 - struct platform_device_info devinfo = { .name = "cpufreq-cpu0", }; 107 + struct platform_device_info devinfo = { .name = "cpufreq-dt", }; 108 108 struct soc_device_attribute *soc_dev_attr; 109 109 struct soc_device *soc_dev; 110 110 struct device *parent = NULL;
+4 -4
drivers/cpufreq/Kconfig
··· 183 183 184 184 If in doubt, say N. 185 185 186 - config GENERIC_CPUFREQ_CPU0 187 - tristate "Generic CPU0 cpufreq driver" 186 + config CPUFREQ_DT 187 + tristate "Generic DT based cpufreq driver" 188 188 depends on HAVE_CLK && OF 189 - # if CPU_THERMAL is on and THERMAL=m, CPU0 cannot be =y: 189 + # if CPU_THERMAL is on and THERMAL=m, CPUFREQ_DT cannot be =y: 190 190 depends on !CPU_THERMAL || THERMAL 191 191 select PM_OPP 192 192 help 193 - This adds a generic cpufreq driver for CPU0 frequency management. 193 + This adds a generic DT based cpufreq driver for frequency management. 194 194 It supports both uniprocessor (UP) and symmetric multiprocessor (SMP) 195 195 systems which share clock and voltage across all CPUs. 196 196
+1 -1
drivers/cpufreq/Kconfig.arm
··· 92 92 93 93 config ARM_HIGHBANK_CPUFREQ 94 94 tristate "Calxeda Highbank-based" 95 - depends on ARCH_HIGHBANK && GENERIC_CPUFREQ_CPU0 && REGULATOR 95 + depends on ARCH_HIGHBANK && CPUFREQ_DT && REGULATOR 96 96 default m 97 97 help 98 98 This adds the CPUFreq driver for Calxeda Highbank SoC
+1 -1
drivers/cpufreq/Makefile
··· 13 13 obj-$(CONFIG_CPU_FREQ_GOV_CONSERVATIVE) += cpufreq_conservative.o 14 14 obj-$(CONFIG_CPU_FREQ_GOV_COMMON) += cpufreq_governor.o 15 15 16 - obj-$(CONFIG_GENERIC_CPUFREQ_CPU0) += cpufreq-cpu0.o 16 + obj-$(CONFIG_CPUFREQ_DT) += cpufreq-dt.o 17 17 18 18 ################################################################################## 19 19 # x86 drivers.
+19 -19
drivers/cpufreq/cpufreq-cpu0.c drivers/cpufreq/cpufreq-dt.c
··· 4 4 * Copyright (C) 2014 Linaro. 5 5 * Viresh Kumar <viresh.kumar@linaro.org> 6 6 * 7 - * The OPP code in function cpu0_set_target() is reused from 7 + * The OPP code in function set_target() is reused from 8 8 * drivers/cpufreq/omap-cpufreq.c 9 9 * 10 10 * This program is free software; you can redistribute it and/or modify ··· 35 35 unsigned int voltage_tolerance; /* in percentage */ 36 36 }; 37 37 38 - static int cpu0_set_target(struct cpufreq_policy *policy, unsigned int index) 38 + static int set_target(struct cpufreq_policy *policy, unsigned int index) 39 39 { 40 40 struct dev_pm_opp *opp; 41 41 struct cpufreq_frequency_table *freq_table = policy->freq_table; ··· 176 176 return ret; 177 177 } 178 178 179 - static int cpu0_cpufreq_init(struct cpufreq_policy *policy) 179 + static int cpufreq_init(struct cpufreq_policy *policy) 180 180 { 181 181 struct cpufreq_frequency_table *freq_table; 182 182 struct thermal_cooling_device *cdev; ··· 287 287 return ret; 288 288 } 289 289 290 - static int cpu0_cpufreq_exit(struct cpufreq_policy *policy) 290 + static int cpufreq_exit(struct cpufreq_policy *policy) 291 291 { 292 292 struct private_data *priv = policy->driver_data; 293 293 ··· 301 301 return 0; 302 302 } 303 303 304 - static struct cpufreq_driver cpu0_cpufreq_driver = { 304 + static struct cpufreq_driver dt_cpufreq_driver = { 305 305 .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK, 306 306 .verify = cpufreq_generic_frequency_table_verify, 307 - .target_index = cpu0_set_target, 307 + .target_index = set_target, 308 308 .get = cpufreq_generic_get, 309 - .init = cpu0_cpufreq_init, 310 - .exit = cpu0_cpufreq_exit, 311 - .name = "generic_cpu0", 309 + .init = cpufreq_init, 310 + .exit = cpufreq_exit, 311 + .name = "cpufreq-dt", 312 312 .attr = cpufreq_generic_attr, 313 313 }; 314 314 315 - static int cpu0_cpufreq_probe(struct platform_device *pdev) 315 + static int dt_cpufreq_probe(struct platform_device *pdev) 316 316 { 317 317 struct device *cpu_dev; 318 318 struct regulator *cpu_reg; ··· 334 334 if (!IS_ERR(cpu_reg)) 335 335 regulator_put(cpu_reg); 336 336 337 - ret = cpufreq_register_driver(&cpu0_cpufreq_driver); 337 + ret = cpufreq_register_driver(&dt_cpufreq_driver); 338 338 if (ret) 339 339 dev_err(cpu_dev, "failed register driver: %d\n", ret); 340 340 341 341 return ret; 342 342 } 343 343 344 - static int cpu0_cpufreq_remove(struct platform_device *pdev) 344 + static int dt_cpufreq_remove(struct platform_device *pdev) 345 345 { 346 - cpufreq_unregister_driver(&cpu0_cpufreq_driver); 346 + cpufreq_unregister_driver(&dt_cpufreq_driver); 347 347 return 0; 348 348 } 349 349 350 - static struct platform_driver cpu0_cpufreq_platdrv = { 350 + static struct platform_driver dt_cpufreq_platdrv = { 351 351 .driver = { 352 - .name = "cpufreq-cpu0", 352 + .name = "cpufreq-dt", 353 353 .owner = THIS_MODULE, 354 354 }, 355 - .probe = cpu0_cpufreq_probe, 356 - .remove = cpu0_cpufreq_remove, 355 + .probe = dt_cpufreq_probe, 356 + .remove = dt_cpufreq_remove, 357 357 }; 358 - module_platform_driver(cpu0_cpufreq_platdrv); 358 + module_platform_driver(dt_cpufreq_platdrv); 359 359 360 360 MODULE_AUTHOR("Viresh Kumar <viresh.kumar@linaro.org>"); 361 361 MODULE_AUTHOR("Shawn Guo <shawn.guo@linaro.org>"); 362 - MODULE_DESCRIPTION("Generic CPU0 cpufreq driver"); 362 + MODULE_DESCRIPTION("Generic cpufreq driver"); 363 363 MODULE_LICENSE("GPL");
+1 -1
drivers/cpufreq/exynos4210-cpufreq.c
··· 127 127 * dependencies on platform headers. It is necessary to enable 128 128 * Exynos multi-platform support and will be removed together with 129 129 * this whole driver as soon as Exynos gets migrated to use 130 - * cpufreq-cpu0 driver. 130 + * cpufreq-dt driver. 131 131 */ 132 132 np = of_find_compatible_node(NULL, NULL, "samsung,exynos4210-clock"); 133 133 if (!np) {
+1 -1
drivers/cpufreq/exynos4x12-cpufreq.c
··· 174 174 * dependencies on platform headers. It is necessary to enable 175 175 * Exynos multi-platform support and will be removed together with 176 176 * this whole driver as soon as Exynos gets migrated to use 177 - * cpufreq-cpu0 driver. 177 + * cpufreq-dt driver. 178 178 */ 179 179 np = of_find_compatible_node(NULL, NULL, "samsung,exynos4412-clock"); 180 180 if (!np) {
+1 -1
drivers/cpufreq/exynos5250-cpufreq.c
··· 153 153 * dependencies on platform headers. It is necessary to enable 154 154 * Exynos multi-platform support and will be removed together with 155 155 * this whole driver as soon as Exynos gets migrated to use 156 - * cpufreq-cpu0 driver. 156 + * cpufreq-dt driver. 157 157 */ 158 158 np = of_find_compatible_node(NULL, NULL, "samsung,exynos5250-clock"); 159 159 if (!np) {
+3 -3
drivers/cpufreq/highbank-cpufreq.c
··· 6 6 * published by the Free Software Foundation. 7 7 * 8 8 * This driver provides the clk notifier callbacks that are used when 9 - * the cpufreq-cpu0 driver changes to frequency to alert the highbank 9 + * the cpufreq-dt driver changes to frequency to alert the highbank 10 10 * EnergyCore Management Engine (ECME) about the need to change 11 11 * voltage. The ECME interfaces with the actual voltage regulators. 12 12 */ ··· 60 60 61 61 static int hb_cpufreq_driver_init(void) 62 62 { 63 - struct platform_device_info devinfo = { .name = "cpufreq-cpu0", }; 63 + struct platform_device_info devinfo = { .name = "cpufreq-dt", }; 64 64 struct device *cpu_dev; 65 65 struct clk *cpu_clk; 66 66 struct device_node *np; ··· 95 95 goto out_put_node; 96 96 } 97 97 98 - /* Instantiate cpufreq-cpu0 */ 98 + /* Instantiate cpufreq-dt */ 99 99 platform_device_register_full(&devinfo); 100 100 101 101 out_put_node:
+1 -1
drivers/cpufreq/s5pv210-cpufreq.c
··· 597 597 * and dependencies on platform headers. It is necessary to enable 598 598 * S5PV210 multi-platform support and will be removed together with 599 599 * this whole driver as soon as S5PV210 gets migrated to use 600 - * cpufreq-cpu0 driver. 600 + * cpufreq-dt driver. 601 601 */ 602 602 np = of_find_compatible_node(NULL, NULL, "samsung,s5pv210-clock"); 603 603 if (!np) {