Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 142836
b: refs/heads/master
c: 13614e3
h: refs/heads/master
v: v3
  • Loading branch information
Jean Delvare authored and Len Brown committed Apr 7, 2009
1 parent 2e6aa76 commit 38a265b
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 10 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: fdbdc7fc79c02ae4ede869d514179a2c65633d28
refs/heads/master: 13614e37e94da4606a300ee6fe25c8c4a19ee670
1 change: 1 addition & 0 deletions trunk/arch/x86/kernel/cpu/cpufreq/longhaul.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <linux/timex.h>
#include <linux/io.h>
#include <linux/acpi.h>
#include <linux/kernel.h>

#include <asm/msr.h>
#include <acpi/processor.h>
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/acpi/acpica/hwvalid.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ static const struct acpi_port_info acpi_protected_ports[] = {
{"PIT2", 0x0048, 0x004B, ACPI_OSI_WIN_XP},
{"RTC", 0x0070, 0x0071, ACPI_OSI_WIN_XP},
{"CMOS", 0x0074, 0x0076, ACPI_OSI_WIN_XP},
{"DMA1", 0x0081, 0x0083, ACPI_OSI_WIN_XP},
{"DMA1L", 0x0087, 0x0087, ACPI_OSI_WIN_XP},
{"DMA2", 0x0089, 0x008B, ACPI_OSI_WIN_XP},
{"DMA2L", 0x008F, 0x008F, ACPI_OSI_WIN_XP},
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ static struct acpi_driver acpi_battery_driver = {
},
};

static void acpi_battery_init_async(void *unused, async_cookie_t cookie)
static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
{
if (acpi_disabled)
return;
Expand Down
41 changes: 34 additions & 7 deletions trunk/drivers/acpi/thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ struct acpi_thermal {
struct acpi_handle_list devices;
struct thermal_zone_device *thermal_zone;
int tz_enabled;
int kelvin_offset;
struct mutex lock;
};

Expand Down Expand Up @@ -581,7 +582,7 @@ static void acpi_thermal_check(void *data)
}

/* sys I/F for generic thermal sysfs support */
#define KELVIN_TO_MILLICELSIUS(t) (t * 100 - 273200)
#define KELVIN_TO_MILLICELSIUS(t, off) (((t) - (off)) * 100)

static int thermal_get_temp(struct thermal_zone_device *thermal,
unsigned long *temp)
Expand All @@ -596,7 +597,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal,
if (result)
return result;

*temp = KELVIN_TO_MILLICELSIUS(tz->temperature);
*temp = KELVIN_TO_MILLICELSIUS(tz->temperature, tz->kelvin_offset);
return 0;
}

Expand Down Expand Up @@ -702,7 +703,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
if (tz->trips.critical.flags.valid) {
if (!trip) {
*temp = KELVIN_TO_MILLICELSIUS(
tz->trips.critical.temperature);
tz->trips.critical.temperature,
tz->kelvin_offset);
return 0;
}
trip--;
Expand All @@ -711,7 +713,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
if (tz->trips.hot.flags.valid) {
if (!trip) {
*temp = KELVIN_TO_MILLICELSIUS(
tz->trips.hot.temperature);
tz->trips.hot.temperature,
tz->kelvin_offset);
return 0;
}
trip--;
Expand All @@ -720,7 +723,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
if (tz->trips.passive.flags.valid) {
if (!trip) {
*temp = KELVIN_TO_MILLICELSIUS(
tz->trips.passive.temperature);
tz->trips.passive.temperature,
tz->kelvin_offset);
return 0;
}
trip--;
Expand All @@ -730,7 +734,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
tz->trips.active[i].flags.valid; i++) {
if (!trip) {
*temp = KELVIN_TO_MILLICELSIUS(
tz->trips.active[i].temperature);
tz->trips.active[i].temperature,
tz->kelvin_offset);
return 0;
}
trip--;
Expand All @@ -745,7 +750,8 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal,

if (tz->trips.critical.flags.valid) {
*temperature = KELVIN_TO_MILLICELSIUS(
tz->trips.critical.temperature);
tz->trips.critical.temperature,
tz->kelvin_offset);
return 0;
} else
return -EINVAL;
Expand Down Expand Up @@ -1334,6 +1340,25 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz)
return 0;
}

/*
* The exact offset between Kelvin and degree Celsius is 273.15. However ACPI
* handles temperature values with a single decimal place. As a consequence,
* some implementations use an offset of 273.1 and others use an offset of
* 273.2. Try to find out which one is being used, to present the most
* accurate and visually appealing number.
*
* The heuristic below should work for all ACPI thermal zones which have a
* critical trip point with a value being a multiple of 0.5 degree Celsius.
*/
static void acpi_thermal_guess_offset(struct acpi_thermal *tz)
{
if (tz->trips.critical.flags.valid &&
(tz->trips.critical.temperature % 5) == 1)
tz->kelvin_offset = 2731;
else
tz->kelvin_offset = 2732;
}

static int acpi_thermal_add(struct acpi_device *device)
{
int result = 0;
Expand All @@ -1360,6 +1385,8 @@ static int acpi_thermal_add(struct acpi_device *device)
if (result)
goto free_memory;

acpi_thermal_guess_offset(tz);

result = acpi_thermal_register_thermal_zone(tz);
if (result)
goto free_memory;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/platform/x86/panasonic-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ static int acpi_pcc_retrieve_biosdata(struct pcc_acpi *pcc, u32 *sinf)
union acpi_object *hkey = NULL;
int i;

status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SINF, NULL,
status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SINF, 0,
&buffer);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
Expand Down

0 comments on commit 38a265b

Please sign in to comment.