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

cpufreq: dt: Support governor tunables per policy

The cpufreq-dt driver is also used for systems with multiple
clock/voltage domains for CPUs, i.e. multiple cpufreq policies in a
system.

And in such cases the platform users may want to enable "governor
tunables per policy". Support that via platform data, as not all users
of the driver would want that behavior.

Reported-by: Juri Lelli <Juri.Lelli@arm.com>
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
297a6622 33cc4fc1

+30 -2
+5 -2
drivers/cpufreq/cpufreq-dt-platdev.c
··· 11 11 #include <linux/of.h> 12 12 #include <linux/platform_device.h> 13 13 14 + #include "cpufreq-dt.h" 15 + 14 16 static const struct of_device_id machines[] __initconst = { 15 17 { .compatible = "allwinner,sun4i-a10", }, 16 18 { .compatible = "allwinner,sun5i-a10s", }, ··· 95 93 if (!match) 96 94 return -ENODEV; 97 95 98 - return PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", -1, 99 - NULL, 0)); 96 + return PTR_ERR_OR_ZERO(platform_device_register_data(NULL, "cpufreq-dt", 97 + -1, match->data, 98 + sizeof(struct cpufreq_dt_platform_data))); 100 99 } 101 100 device_initcall(cpufreq_dt_platdev_init);
+6
drivers/cpufreq/cpufreq-dt.c
··· 25 25 #include <linux/slab.h> 26 26 #include <linux/thermal.h> 27 27 28 + #include "cpufreq-dt.h" 29 + 28 30 struct private_data { 29 31 struct device *cpu_dev; 30 32 struct thermal_cooling_device *cdev; ··· 355 353 356 354 static int dt_cpufreq_probe(struct platform_device *pdev) 357 355 { 356 + struct cpufreq_dt_platform_data *data = dev_get_platdata(&pdev->dev); 358 357 int ret; 359 358 360 359 /* ··· 368 365 ret = resources_available(); 369 366 if (ret) 370 367 return ret; 368 + 369 + if (data && data->have_governor_per_policy) 370 + dt_cpufreq_driver.flags |= CPUFREQ_HAVE_GOVERNOR_PER_POLICY; 371 371 372 372 ret = cpufreq_register_driver(&dt_cpufreq_driver); 373 373 if (ret)
+19
drivers/cpufreq/cpufreq-dt.h
··· 1 + /* 2 + * Copyright (C) 2016 Linaro 3 + * Viresh Kumar <viresh.kumar@linaro.org> 4 + * 5 + * This program is free software; you can redistribute it and/or modify 6 + * it under the terms of the GNU General Public License version 2 as 7 + * published by the Free Software Foundation. 8 + */ 9 + 10 + #ifndef __CPUFREQ_DT_H__ 11 + #define __CPUFREQ_DT_H__ 12 + 13 + #include <linux/types.h> 14 + 15 + struct cpufreq_dt_platform_data { 16 + bool have_governor_per_policy; 17 + }; 18 + 19 + #endif /* __CPUFREQ_DT_H__ */