Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 298047
b: refs/heads/master
c: 2815ab9
h: refs/heads/master
i:
  298045: 9901a17
  298043: c55d9ea
  298039: d28dfff
  298031: 597859e
  298015: 97bf5f8
  297983: d5e8fd9
v: v3
  • Loading branch information
Andi Kleen authored and Len Brown committed Mar 22, 2012
1 parent 752d2ac commit 1093d32
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 297 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 344e222edf486bf42da1ced137e36df7a345b0ad
refs/heads/master: 2815ab92ba3ab27556212cc306288dc95692824b
45 changes: 37 additions & 8 deletions trunk/drivers/acpi/processor_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,27 @@ ACPI_MODULE_NAME("processor_thermal");
static DEFINE_PER_CPU(unsigned int, cpufreq_thermal_reduction_pctg);
static unsigned int acpi_thermal_cpufreq_is_init = 0;

#define reduction_pctg(cpu) \
per_cpu(cpufreq_thermal_reduction_pctg, phys_package_first_cpu(cpu))

/*
* Emulate "per package data" using per cpu data (which should really be
* provided elsewhere)
*
* Note we can lose a CPU on cpu hotunplug, in this case we forget the state
* temporarily. Fortunately that's not a big issue here (I hope)
*/
static int phys_package_first_cpu(int cpu)
{
int i;
int id = topology_physical_package_id(cpu);

for_each_online_cpu(i)
if (topology_physical_package_id(i) == id)
return i;
return 0;
}

static int cpu_has_cpufreq(unsigned int cpu)
{
struct cpufreq_policy policy;
Expand All @@ -76,7 +97,7 @@ static int acpi_thermal_cpufreq_notifier(struct notifier_block *nb,

max_freq = (
policy->cpuinfo.max_freq *
(100 - per_cpu(cpufreq_thermal_reduction_pctg, policy->cpu) * 20)
(100 - reduction_pctg(policy->cpu) * 20)
) / 100;

cpufreq_verify_within_limits(policy, 0, max_freq);
Expand All @@ -102,27 +123,35 @@ static int cpufreq_get_cur_state(unsigned int cpu)
if (!cpu_has_cpufreq(cpu))
return 0;

return per_cpu(cpufreq_thermal_reduction_pctg, cpu);
return reduction_pctg(cpu);
}

static int cpufreq_set_cur_state(unsigned int cpu, int state)
{
int i;

if (!cpu_has_cpufreq(cpu))
return 0;

per_cpu(cpufreq_thermal_reduction_pctg, cpu) = state;
cpufreq_update_policy(cpu);
reduction_pctg(cpu) = state;

/*
* Update all the CPUs in the same package because they all
* contribute to the temperature and often share the same
* frequency.
*/
for_each_online_cpu(i) {
if (topology_physical_package_id(i) ==
topology_physical_package_id(cpu))
cpufreq_update_policy(i);
}
return 0;
}

void acpi_thermal_cpufreq_init(void)
{
int i;

for (i = 0; i < nr_cpu_ids; i++)
if (cpu_present(i))
per_cpu(cpufreq_thermal_reduction_pctg, i) = 0;

i = cpufreq_register_notifier(&acpi_thermal_cpufreq_notifier_block,
CPUFREQ_POLICY_NOTIFIER);
if (!i)
Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/acpi/processor_throttling.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,19 +769,20 @@ static int acpi_read_throttling_status(struct acpi_processor *pr,
u64 *value)
{
u32 bit_width, bit_offset;
u32 ptc_value;
u64 ptc_value;
u64 ptc_mask;
struct acpi_processor_throttling *throttling;
int ret = -1;

throttling = &pr->throttling;
switch (throttling->status_register.space_id) {
case ACPI_ADR_SPACE_SYSTEM_IO:
ptc_value = 0;
bit_width = throttling->status_register.bit_width;
bit_offset = throttling->status_register.bit_offset;

acpi_os_read_port((acpi_io_address) throttling->status_register.
address, &ptc_value,
address, (u32 *) &ptc_value,
(u32) (bit_width + bit_offset));
ptc_mask = (1 << bit_width) - 1;
*value = (u64) ((ptc_value >> bit_offset) & ptc_mask);
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/acpi/thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,13 +941,13 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz)
if (!tz)
return -EINVAL;

/* Get trip points [_CRT, _PSV, etc.] (required) */
result = acpi_thermal_get_trip_points(tz);
/* Get temperature [_TMP] (required) */
result = acpi_thermal_get_temperature(tz);
if (result)
return result;

/* Get temperature [_TMP] (required) */
result = acpi_thermal_get_temperature(tz);
/* Get trip points [_CRT, _PSV, etc.] (required) */
result = acpi_thermal_get_trip_points(tz);
if (result)
return result;

Expand Down
13 changes: 11 additions & 2 deletions trunk/drivers/platform/x86/intel_ips.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,16 +609,25 @@ static bool mcp_exceeded(struct ips_driver *ips)
bool ret = false;
u32 temp_limit;
u32 avg_power;
const char *msg = "MCP limit exceeded: ";

spin_lock_irqsave(&ips->turbo_status_lock, flags);

temp_limit = ips->mcp_temp_limit * 100;
if (ips->mcp_avg_temp > temp_limit)
if (ips->mcp_avg_temp > temp_limit) {
dev_info(&ips->dev->dev,
"%sAvg temp %u, limit %u\n", msg, ips->mcp_avg_temp,
temp_limit);
ret = true;
}

avg_power = ips->cpu_avg_power + ips->mch_avg_power;
if (avg_power > ips->mcp_power_limit)
if (avg_power > ips->mcp_power_limit) {
dev_info(&ips->dev->dev,
"%sAvg power %u, limit %u\n", msg, avg_power,
ips->mcp_power_limit);
ret = true;
}

spin_unlock_irqrestore(&ips->turbo_status_lock, flags);

Expand Down
8 changes: 0 additions & 8 deletions trunk/drivers/thermal/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,3 @@ config THERMAL_HWMON
depends on THERMAL
depends on HWMON=y || HWMON=THERMAL
default y

config SPEAR_THERMAL
bool "SPEAr thermal sensor driver"
depends on THERMAL
depends on PLAT_SPEAR
help
Enable this to plug the SPEAr thermal sensor driver into the Linux
thermal framework
1 change: 0 additions & 1 deletion trunk/drivers/thermal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
#

obj-$(CONFIG_THERMAL) += thermal_sys.o
obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o
206 changes: 0 additions & 206 deletions trunk/drivers/thermal/spear_thermal.c

This file was deleted.

Loading

0 comments on commit 1093d32

Please sign in to comment.