Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal management updates from Zhang Rui: - Improve thermal cpu_cooling interaction with cpufreq core. The cpu_cooling driver is designed to use CPU frequency scaling to avoid high thermal states for a platform. But it wasn't glued really well with cpufreq core. For example clipped-cpus is copied from the policy structure and its much better to use the policy->cpus (or related_cpus) fields directly as they may have got updated. Not that things were broken before this series, but they can be optimized a bit more. This series tries to improve interactions between cpufreq core and cpu_cooling driver and does some fixes/cleanups to the cpu_cooling driver. (Viresh Kumar) - A couple of fixes and cleanups in thermal core and imx, hisilicon, bcm_2835, int340x thermal drivers. (Arvind Yadav, Dan Carpenter, Sumeet Pawnikar, Srinivas Pandruvada, Willy WOLFF) * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (24 commits) thermal: bcm2835: fix an error code in probe() thermal: hisilicon: Handle return value of clk_prepare_enable thermal: imx: Handle return value of clk_prepare_enable thermal: int340x: check for sensor when PTYP is missing Thermal/int340x: Fix few typos and kernel-doc style thermal: fix source code documentation for parameters thermal: cpu_cooling: Replace kmalloc with kmalloc_array thermal: cpu_cooling: Rearrange struct cpufreq_cooling_device thermal: cpu_cooling: 'freq' can't be zero in cpufreq_state2power() thermal: cpu_cooling: don't store cpu_dev in cpufreq_cdev thermal: cpu_cooling: get_level() can't fail thermal: cpu_cooling: create structure for idle time stats thermal: cpu_cooling: merge frequency and power tables thermal: cpu_cooling: get rid of 'allowed_cpus' thermal: cpu_cooling: OPPs are registered for all CPUs thermal: cpu_cooling: store cpufreq policy cpufreq: create cpufreq_table_count_valid_entries() thermal: cpu_cooling: use cpufreq_policy to register cooling device thermal: cpu_cooling: get rid of a variable in cpufreq_set_cur_state() thermal: cpu_cooling: remove cpufreq_cooling_get_level() ...
This commit is contained in:
Коммит
4d25ec1966
|
@ -540,7 +540,7 @@ static void bL_cpufreq_ready(struct cpufreq_policy *policy)
|
||||||
&power_coefficient);
|
&power_coefficient);
|
||||||
|
|
||||||
cdev[cur_cluster] = of_cpufreq_power_cooling_register(np,
|
cdev[cur_cluster] = of_cpufreq_power_cooling_register(np,
|
||||||
policy->related_cpus, power_coefficient, NULL);
|
policy, power_coefficient, NULL);
|
||||||
if (IS_ERR(cdev[cur_cluster])) {
|
if (IS_ERR(cdev[cur_cluster])) {
|
||||||
dev_err(cpu_dev,
|
dev_err(cpu_dev,
|
||||||
"running cpufreq without cooling device: %ld\n",
|
"running cpufreq without cooling device: %ld\n",
|
||||||
|
|
|
@ -326,7 +326,7 @@ static void cpufreq_ready(struct cpufreq_policy *policy)
|
||||||
&power_coefficient);
|
&power_coefficient);
|
||||||
|
|
||||||
priv->cdev = of_cpufreq_power_cooling_register(np,
|
priv->cdev = of_cpufreq_power_cooling_register(np,
|
||||||
policy->related_cpus, power_coefficient, NULL);
|
policy, power_coefficient, NULL);
|
||||||
if (IS_ERR(priv->cdev)) {
|
if (IS_ERR(priv->cdev)) {
|
||||||
dev_err(priv->cpu_dev,
|
dev_err(priv->cpu_dev,
|
||||||
"running cpufreq without cooling device: %ld\n",
|
"running cpufreq without cooling device: %ld\n",
|
||||||
|
|
|
@ -170,11 +170,10 @@ void cpufreq_stats_create_table(struct cpufreq_policy *policy)
|
||||||
unsigned int i = 0, count = 0, ret = -ENOMEM;
|
unsigned int i = 0, count = 0, ret = -ENOMEM;
|
||||||
struct cpufreq_stats *stats;
|
struct cpufreq_stats *stats;
|
||||||
unsigned int alloc_size;
|
unsigned int alloc_size;
|
||||||
struct cpufreq_frequency_table *pos, *table;
|
struct cpufreq_frequency_table *pos;
|
||||||
|
|
||||||
/* We need cpufreq table for creating stats table */
|
count = cpufreq_table_count_valid_entries(policy);
|
||||||
table = policy->freq_table;
|
if (!count)
|
||||||
if (unlikely(!table))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* stats already initialized */
|
/* stats already initialized */
|
||||||
|
@ -185,10 +184,6 @@ void cpufreq_stats_create_table(struct cpufreq_policy *policy)
|
||||||
if (!stats)
|
if (!stats)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Find total allocation size */
|
|
||||||
cpufreq_for_each_valid_entry(pos, table)
|
|
||||||
count++;
|
|
||||||
|
|
||||||
alloc_size = count * sizeof(int) + count * sizeof(u64);
|
alloc_size = count * sizeof(int) + count * sizeof(u64);
|
||||||
|
|
||||||
alloc_size += count * count * sizeof(int);
|
alloc_size += count * count * sizeof(int);
|
||||||
|
@ -205,7 +200,7 @@ void cpufreq_stats_create_table(struct cpufreq_policy *policy)
|
||||||
stats->max_state = count;
|
stats->max_state = count;
|
||||||
|
|
||||||
/* Find valid-unique entries */
|
/* Find valid-unique entries */
|
||||||
cpufreq_for_each_valid_entry(pos, table)
|
cpufreq_for_each_valid_entry(pos, policy->freq_table)
|
||||||
if (freq_table_get_index(stats, pos->frequency) == -1)
|
if (freq_table_get_index(stats, pos->frequency) == -1)
|
||||||
stats->freq_table[i++] = pos->frequency;
|
stats->freq_table[i++] = pos->frequency;
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ static int dbx500_cpufreq_exit(struct cpufreq_policy *policy)
|
||||||
|
|
||||||
static void dbx500_cpufreq_ready(struct cpufreq_policy *policy)
|
static void dbx500_cpufreq_ready(struct cpufreq_policy *policy)
|
||||||
{
|
{
|
||||||
cdev = cpufreq_cooling_register(policy->cpus);
|
cdev = cpufreq_cooling_register(policy);
|
||||||
if (IS_ERR(cdev))
|
if (IS_ERR(cdev))
|
||||||
pr_err("Failed to register cooling device %ld\n", PTR_ERR(cdev));
|
pr_err("Failed to register cooling device %ld\n", PTR_ERR(cdev));
|
||||||
else
|
else
|
||||||
|
|
|
@ -320,9 +320,7 @@ static void mtk_cpufreq_ready(struct cpufreq_policy *policy)
|
||||||
of_property_read_u32(np, DYNAMIC_POWER, &capacitance);
|
of_property_read_u32(np, DYNAMIC_POWER, &capacitance);
|
||||||
|
|
||||||
info->cdev = of_cpufreq_power_cooling_register(np,
|
info->cdev = of_cpufreq_power_cooling_register(np,
|
||||||
policy->related_cpus,
|
policy, capacitance, NULL);
|
||||||
capacitance,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (IS_ERR(info->cdev)) {
|
if (IS_ERR(info->cdev)) {
|
||||||
dev_err(info->cpu_dev,
|
dev_err(info->cpu_dev,
|
||||||
|
|
|
@ -278,8 +278,7 @@ static void qoriq_cpufreq_ready(struct cpufreq_policy *policy)
|
||||||
struct device_node *np = of_get_cpu_node(policy->cpu, NULL);
|
struct device_node *np = of_get_cpu_node(policy->cpu, NULL);
|
||||||
|
|
||||||
if (of_find_property(np, "#cooling-cells", NULL)) {
|
if (of_find_property(np, "#cooling-cells", NULL)) {
|
||||||
cpud->cdev = of_cpufreq_cooling_register(np,
|
cpud->cdev = of_cpufreq_cooling_register(np, policy);
|
||||||
policy->related_cpus);
|
|
||||||
|
|
||||||
if (IS_ERR(cpud->cdev) && PTR_ERR(cpud->cdev) != -ENOSYS) {
|
if (IS_ERR(cpud->cdev) && PTR_ERR(cpud->cdev) != -ENOSYS) {
|
||||||
pr_err("cpu%d is not running as cooling device: %ld\n",
|
pr_err("cpu%d is not running as cooling device: %ld\n",
|
||||||
|
|
|
@ -245,7 +245,6 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
|
||||||
*/
|
*/
|
||||||
err = tz->ops->get_trip_temp(tz, 0, &trip_temp);
|
err = tz->ops->get_trip_temp(tz, 0, &trip_temp);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
err = PTR_ERR(tz);
|
|
||||||
dev_err(&pdev->dev,
|
dev_err(&pdev->dev,
|
||||||
"Not able to read trip_temp: %d\n",
|
"Not able to read trip_temp: %d\n",
|
||||||
err);
|
err);
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -71,6 +71,7 @@ static long get_target_state(struct thermal_zone_device *tz,
|
||||||
/**
|
/**
|
||||||
* fair_share_throttle - throttles devices associated with the given zone
|
* fair_share_throttle - throttles devices associated with the given zone
|
||||||
* @tz - thermal_zone_device
|
* @tz - thermal_zone_device
|
||||||
|
* @trip - trip point index
|
||||||
*
|
*
|
||||||
* Throttling Logic: This uses three parameters to calculate the new
|
* Throttling Logic: This uses three parameters to calculate the new
|
||||||
* throttle state of the cooling devices associated with the given zone.
|
* throttle state of the cooling devices associated with the given zone.
|
||||||
|
|
|
@ -397,8 +397,11 @@ static int hisi_thermal_suspend(struct device *dev)
|
||||||
static int hisi_thermal_resume(struct device *dev)
|
static int hisi_thermal_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
struct hisi_thermal_data *data = dev_get_drvdata(dev);
|
struct hisi_thermal_data *data = dev_get_drvdata(dev);
|
||||||
|
int ret;
|
||||||
|
|
||||||
clk_prepare_enable(data->clk);
|
ret = clk_prepare_enable(data->clk);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
data->irq_enabled = true;
|
data->irq_enabled = true;
|
||||||
hisi_thermal_enable_bind_irq_sensor(data);
|
hisi_thermal_enable_bind_irq_sensor(data);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
|
#include <linux/cpufreq.h>
|
||||||
#include <linux/cpu_cooling.h>
|
#include <linux/cpu_cooling.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
|
@ -88,6 +89,7 @@ static struct thermal_soc_data thermal_imx6sx_data = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct imx_thermal_data {
|
struct imx_thermal_data {
|
||||||
|
struct cpufreq_policy *policy;
|
||||||
struct thermal_zone_device *tz;
|
struct thermal_zone_device *tz;
|
||||||
struct thermal_cooling_device *cdev;
|
struct thermal_cooling_device *cdev;
|
||||||
enum thermal_device_mode mode;
|
enum thermal_device_mode mode;
|
||||||
|
@ -525,13 +527,18 @@ static int imx_thermal_probe(struct platform_device *pdev)
|
||||||
regmap_write(map, MISC0 + REG_SET, MISC0_REFTOP_SELBIASOFF);
|
regmap_write(map, MISC0 + REG_SET, MISC0_REFTOP_SELBIASOFF);
|
||||||
regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_POWER_DOWN);
|
regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_POWER_DOWN);
|
||||||
|
|
||||||
data->cdev = cpufreq_cooling_register(cpu_present_mask);
|
data->policy = cpufreq_cpu_get(0);
|
||||||
|
if (!data->policy) {
|
||||||
|
pr_debug("%s: CPUFreq policy not found\n", __func__);
|
||||||
|
return -EPROBE_DEFER;
|
||||||
|
}
|
||||||
|
|
||||||
|
data->cdev = cpufreq_cooling_register(data->policy);
|
||||||
if (IS_ERR(data->cdev)) {
|
if (IS_ERR(data->cdev)) {
|
||||||
ret = PTR_ERR(data->cdev);
|
ret = PTR_ERR(data->cdev);
|
||||||
if (ret != -EPROBE_DEFER)
|
dev_err(&pdev->dev,
|
||||||
dev_err(&pdev->dev,
|
"failed to register cpufreq cooling device: %d\n", ret);
|
||||||
"failed to register cpufreq cooling device: %d\n",
|
cpufreq_cpu_put(data->policy);
|
||||||
ret);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,6 +549,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
|
||||||
dev_err(&pdev->dev,
|
dev_err(&pdev->dev,
|
||||||
"failed to get thermal clk: %d\n", ret);
|
"failed to get thermal clk: %d\n", ret);
|
||||||
cpufreq_cooling_unregister(data->cdev);
|
cpufreq_cooling_unregister(data->cdev);
|
||||||
|
cpufreq_cpu_put(data->policy);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,6 +564,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "failed to enable thermal clk: %d\n", ret);
|
dev_err(&pdev->dev, "failed to enable thermal clk: %d\n", ret);
|
||||||
cpufreq_cooling_unregister(data->cdev);
|
cpufreq_cooling_unregister(data->cdev);
|
||||||
|
cpufreq_cpu_put(data->policy);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,6 +580,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
|
||||||
"failed to register thermal zone device %d\n", ret);
|
"failed to register thermal zone device %d\n", ret);
|
||||||
clk_disable_unprepare(data->thermal_clk);
|
clk_disable_unprepare(data->thermal_clk);
|
||||||
cpufreq_cooling_unregister(data->cdev);
|
cpufreq_cooling_unregister(data->cdev);
|
||||||
|
cpufreq_cpu_put(data->policy);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,6 +609,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
|
||||||
clk_disable_unprepare(data->thermal_clk);
|
clk_disable_unprepare(data->thermal_clk);
|
||||||
thermal_zone_device_unregister(data->tz);
|
thermal_zone_device_unregister(data->tz);
|
||||||
cpufreq_cooling_unregister(data->cdev);
|
cpufreq_cooling_unregister(data->cdev);
|
||||||
|
cpufreq_cpu_put(data->policy);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,6 +631,7 @@ static int imx_thermal_remove(struct platform_device *pdev)
|
||||||
|
|
||||||
thermal_zone_device_unregister(data->tz);
|
thermal_zone_device_unregister(data->tz);
|
||||||
cpufreq_cooling_unregister(data->cdev);
|
cpufreq_cooling_unregister(data->cdev);
|
||||||
|
cpufreq_cpu_put(data->policy);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -648,8 +660,11 @@ static int imx_thermal_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
struct imx_thermal_data *data = dev_get_drvdata(dev);
|
struct imx_thermal_data *data = dev_get_drvdata(dev);
|
||||||
struct regmap *map = data->tempmon;
|
struct regmap *map = data->tempmon;
|
||||||
|
int ret;
|
||||||
|
|
||||||
clk_prepare_enable(data->thermal_clk);
|
ret = clk_prepare_enable(data->thermal_clk);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
/* Enabled thermal sensor after resume */
|
/* Enabled thermal sensor after resume */
|
||||||
regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_POWER_DOWN);
|
regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_POWER_DOWN);
|
||||||
regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_MEASURE_TEMP);
|
regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_MEASURE_TEMP);
|
||||||
|
|
|
@ -62,8 +62,8 @@ static int acpi_thermal_rel_release(struct inode *inode, struct file *file)
|
||||||
* acpi_parse_trt - Thermal Relationship Table _TRT for passive cooling
|
* acpi_parse_trt - Thermal Relationship Table _TRT for passive cooling
|
||||||
*
|
*
|
||||||
* @handle: ACPI handle of the device contains _TRT
|
* @handle: ACPI handle of the device contains _TRT
|
||||||
* @art_count: the number of valid entries resulted from parsing _TRT
|
* @trt_count: the number of valid entries resulted from parsing _TRT
|
||||||
* @artp: pointer to pointer of array of art entries in parsing result
|
* @trtp: pointer to pointer of array of _TRT entries in parsing result
|
||||||
* @create_dev: whether to create platform devices for target and source
|
* @create_dev: whether to create platform devices for target and source
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -208,7 +208,7 @@ int acpi_parse_art(acpi_handle handle, int *art_count, struct art **artp,
|
||||||
if (art->target) {
|
if (art->target) {
|
||||||
result = acpi_bus_get_device(art->target, &adev);
|
result = acpi_bus_get_device(art->target, &adev);
|
||||||
if (result)
|
if (result)
|
||||||
pr_warn("Failed to get source ACPI device\n");
|
pr_warn("Failed to get target ACPI device\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -238,8 +238,16 @@ static int int3403_add(struct platform_device *pdev)
|
||||||
status = acpi_evaluate_integer(priv->adev->handle, "PTYP",
|
status = acpi_evaluate_integer(priv->adev->handle, "PTYP",
|
||||||
NULL, &priv->type);
|
NULL, &priv->type);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
result = -EINVAL;
|
unsigned long long tmp;
|
||||||
goto err;
|
|
||||||
|
status = acpi_evaluate_integer(priv->adev->handle, "_TMP",
|
||||||
|
NULL, &tmp);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
result = -EINVAL;
|
||||||
|
goto err;
|
||||||
|
} else {
|
||||||
|
priv->type = INT3403_TYPE_SENSOR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_set_drvdata(pdev, priv);
|
platform_set_drvdata(pdev, priv);
|
||||||
|
|
|
@ -186,8 +186,7 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
|
||||||
/**
|
/**
|
||||||
* step_wise_throttle - throttles devices associated with the given zone
|
* step_wise_throttle - throttles devices associated with the given zone
|
||||||
* @tz - thermal_zone_device
|
* @tz - thermal_zone_device
|
||||||
* @trip - the trip point
|
* @trip - trip point index
|
||||||
* @trip_type - type of the trip point
|
|
||||||
*
|
*
|
||||||
* Throttling Logic: This uses the trend of the thermal zone to throttle.
|
* Throttling Logic: This uses the trend of the thermal zone to throttle.
|
||||||
* If the thermal zone is 'heating up' this throttles all the cooling
|
* If the thermal zone is 'heating up' this throttles all the cooling
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
#include <linux/thermal.h>
|
#include <linux/thermal.h>
|
||||||
|
#include <linux/cpufreq.h>
|
||||||
#include <linux/cpumask.h>
|
#include <linux/cpumask.h>
|
||||||
#include <linux/cpu_cooling.h>
|
#include <linux/cpu_cooling.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
|
@ -37,6 +38,7 @@
|
||||||
|
|
||||||
/* common data structures */
|
/* common data structures */
|
||||||
struct ti_thermal_data {
|
struct ti_thermal_data {
|
||||||
|
struct cpufreq_policy *policy;
|
||||||
struct thermal_zone_device *ti_thermal;
|
struct thermal_zone_device *ti_thermal;
|
||||||
struct thermal_zone_device *pcb_tz;
|
struct thermal_zone_device *pcb_tz;
|
||||||
struct thermal_cooling_device *cool_dev;
|
struct thermal_cooling_device *cool_dev;
|
||||||
|
@ -247,15 +249,19 @@ int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
|
||||||
if (!data)
|
if (!data)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
data->policy = cpufreq_cpu_get(0);
|
||||||
|
if (!data->policy) {
|
||||||
|
pr_debug("%s: CPUFreq policy not found\n", __func__);
|
||||||
|
return -EPROBE_DEFER;
|
||||||
|
}
|
||||||
|
|
||||||
/* Register cooling device */
|
/* Register cooling device */
|
||||||
data->cool_dev = cpufreq_cooling_register(cpu_present_mask);
|
data->cool_dev = cpufreq_cooling_register(data->policy);
|
||||||
if (IS_ERR(data->cool_dev)) {
|
if (IS_ERR(data->cool_dev)) {
|
||||||
int ret = PTR_ERR(data->cool_dev);
|
int ret = PTR_ERR(data->cool_dev);
|
||||||
|
dev_err(bgp->dev, "Failed to register cpu cooling device %d\n",
|
||||||
if (ret != -EPROBE_DEFER)
|
ret);
|
||||||
dev_err(bgp->dev,
|
cpufreq_cpu_put(data->policy);
|
||||||
"Failed to register cpu cooling device %d\n",
|
|
||||||
ret);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -270,8 +276,10 @@ int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id)
|
||||||
|
|
||||||
data = ti_bandgap_get_sensor_data(bgp, id);
|
data = ti_bandgap_get_sensor_data(bgp, id);
|
||||||
|
|
||||||
if (data)
|
if (data) {
|
||||||
cpufreq_cooling_unregister(data->cool_dev);
|
cpufreq_cooling_unregister(data->cool_dev);
|
||||||
|
cpufreq_cpu_put(data->policy);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,12 +24,13 @@
|
||||||
|
|
||||||
#include <linux/thermal.h>
|
#include <linux/thermal.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
|
||||||
#include "thermal_core.h"
|
#include "thermal_core.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* notify_user_space - Notifies user space about thermal events
|
* notify_user_space - Notifies user space about thermal events
|
||||||
* @tz - thermal_zone_device
|
* @tz - thermal_zone_device
|
||||||
* @trip - Trip point index
|
* @trip - trip point index
|
||||||
*
|
*
|
||||||
* This function notifies the user space through UEvents.
|
* This function notifies the user space through UEvents.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -28,47 +28,49 @@
|
||||||
#include <linux/thermal.h>
|
#include <linux/thermal.h>
|
||||||
#include <linux/cpumask.h>
|
#include <linux/cpumask.h>
|
||||||
|
|
||||||
|
struct cpufreq_policy;
|
||||||
|
|
||||||
typedef int (*get_static_t)(cpumask_t *cpumask, int interval,
|
typedef int (*get_static_t)(cpumask_t *cpumask, int interval,
|
||||||
unsigned long voltage, u32 *power);
|
unsigned long voltage, u32 *power);
|
||||||
|
|
||||||
#ifdef CONFIG_CPU_THERMAL
|
#ifdef CONFIG_CPU_THERMAL
|
||||||
/**
|
/**
|
||||||
* cpufreq_cooling_register - function to create cpufreq cooling device.
|
* cpufreq_cooling_register - function to create cpufreq cooling device.
|
||||||
* @clip_cpus: cpumask of cpus where the frequency constraints will happen
|
* @policy: cpufreq policy.
|
||||||
*/
|
*/
|
||||||
struct thermal_cooling_device *
|
struct thermal_cooling_device *
|
||||||
cpufreq_cooling_register(const struct cpumask *clip_cpus);
|
cpufreq_cooling_register(struct cpufreq_policy *policy);
|
||||||
|
|
||||||
struct thermal_cooling_device *
|
struct thermal_cooling_device *
|
||||||
cpufreq_power_cooling_register(const struct cpumask *clip_cpus,
|
cpufreq_power_cooling_register(struct cpufreq_policy *policy,
|
||||||
u32 capacitance, get_static_t plat_static_func);
|
u32 capacitance, get_static_t plat_static_func);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* of_cpufreq_cooling_register - create cpufreq cooling device based on DT.
|
* of_cpufreq_cooling_register - create cpufreq cooling device based on DT.
|
||||||
* @np: a valid struct device_node to the cooling device device tree node.
|
* @np: a valid struct device_node to the cooling device device tree node.
|
||||||
* @clip_cpus: cpumask of cpus where the frequency constraints will happen
|
* @policy: cpufreq policy.
|
||||||
*/
|
*/
|
||||||
#ifdef CONFIG_THERMAL_OF
|
#ifdef CONFIG_THERMAL_OF
|
||||||
struct thermal_cooling_device *
|
struct thermal_cooling_device *
|
||||||
of_cpufreq_cooling_register(struct device_node *np,
|
of_cpufreq_cooling_register(struct device_node *np,
|
||||||
const struct cpumask *clip_cpus);
|
struct cpufreq_policy *policy);
|
||||||
|
|
||||||
struct thermal_cooling_device *
|
struct thermal_cooling_device *
|
||||||
of_cpufreq_power_cooling_register(struct device_node *np,
|
of_cpufreq_power_cooling_register(struct device_node *np,
|
||||||
const struct cpumask *clip_cpus,
|
struct cpufreq_policy *policy,
|
||||||
u32 capacitance,
|
u32 capacitance,
|
||||||
get_static_t plat_static_func);
|
get_static_t plat_static_func);
|
||||||
#else
|
#else
|
||||||
static inline struct thermal_cooling_device *
|
static inline struct thermal_cooling_device *
|
||||||
of_cpufreq_cooling_register(struct device_node *np,
|
of_cpufreq_cooling_register(struct device_node *np,
|
||||||
const struct cpumask *clip_cpus)
|
struct cpufreq_policy *policy)
|
||||||
{
|
{
|
||||||
return ERR_PTR(-ENOSYS);
|
return ERR_PTR(-ENOSYS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct thermal_cooling_device *
|
static inline struct thermal_cooling_device *
|
||||||
of_cpufreq_power_cooling_register(struct device_node *np,
|
of_cpufreq_power_cooling_register(struct device_node *np,
|
||||||
const struct cpumask *clip_cpus,
|
struct cpufreq_policy *policy,
|
||||||
u32 capacitance,
|
u32 capacitance,
|
||||||
get_static_t plat_static_func)
|
get_static_t plat_static_func)
|
||||||
{
|
{
|
||||||
|
@ -82,15 +84,14 @@ of_cpufreq_power_cooling_register(struct device_node *np,
|
||||||
*/
|
*/
|
||||||
void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
|
void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
|
||||||
|
|
||||||
unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq);
|
|
||||||
#else /* !CONFIG_CPU_THERMAL */
|
#else /* !CONFIG_CPU_THERMAL */
|
||||||
static inline struct thermal_cooling_device *
|
static inline struct thermal_cooling_device *
|
||||||
cpufreq_cooling_register(const struct cpumask *clip_cpus)
|
cpufreq_cooling_register(struct cpufreq_policy *policy)
|
||||||
{
|
{
|
||||||
return ERR_PTR(-ENOSYS);
|
return ERR_PTR(-ENOSYS);
|
||||||
}
|
}
|
||||||
static inline struct thermal_cooling_device *
|
static inline struct thermal_cooling_device *
|
||||||
cpufreq_power_cooling_register(const struct cpumask *clip_cpus,
|
cpufreq_power_cooling_register(struct cpufreq_policy *policy,
|
||||||
u32 capacitance, get_static_t plat_static_func)
|
u32 capacitance, get_static_t plat_static_func)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -98,14 +99,14 @@ cpufreq_power_cooling_register(const struct cpumask *clip_cpus,
|
||||||
|
|
||||||
static inline struct thermal_cooling_device *
|
static inline struct thermal_cooling_device *
|
||||||
of_cpufreq_cooling_register(struct device_node *np,
|
of_cpufreq_cooling_register(struct device_node *np,
|
||||||
const struct cpumask *clip_cpus)
|
struct cpufreq_policy *policy)
|
||||||
{
|
{
|
||||||
return ERR_PTR(-ENOSYS);
|
return ERR_PTR(-ENOSYS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct thermal_cooling_device *
|
static inline struct thermal_cooling_device *
|
||||||
of_cpufreq_power_cooling_register(struct device_node *np,
|
of_cpufreq_power_cooling_register(struct device_node *np,
|
||||||
const struct cpumask *clip_cpus,
|
struct cpufreq_policy *policy,
|
||||||
u32 capacitance,
|
u32 capacitance,
|
||||||
get_static_t plat_static_func)
|
get_static_t plat_static_func)
|
||||||
{
|
{
|
||||||
|
@ -117,11 +118,6 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
static inline
|
|
||||||
unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq)
|
|
||||||
{
|
|
||||||
return THERMAL_CSTATE_INVALID;
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_CPU_THERMAL */
|
#endif /* CONFIG_CPU_THERMAL */
|
||||||
|
|
||||||
#endif /* __CPU_COOLING_H__ */
|
#endif /* __CPU_COOLING_H__ */
|
||||||
|
|
|
@ -862,6 +862,20 @@ static inline int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int cpufreq_table_count_valid_entries(const struct cpufreq_policy *policy)
|
||||||
|
{
|
||||||
|
struct cpufreq_frequency_table *pos;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
if (unlikely(!policy->freq_table))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
cpufreq_for_each_valid_entry(pos, policy->freq_table)
|
||||||
|
count++;
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
static inline int cpufreq_boost_trigger_state(int state)
|
static inline int cpufreq_boost_trigger_state(int state)
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче