Commit 0710ad20 authored by Len Brown's avatar Len Brown Committed by Len Brown

[ACPI] /proc/acpi/thermal_zone/THRM/cooling_mode

Add concept of (mandatory) "critical", when (optional)
"passive" and "active" are not present.  (Zhenyu Z Wang)
http://bugzilla.kernel.org/show_bug.cgi?id=1770
parent caa26d76
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#define ACPI_THERMAL_NOTIFY_HOT 0xF1 #define ACPI_THERMAL_NOTIFY_HOT 0xF1
#define ACPI_THERMAL_MODE_ACTIVE 0x00 #define ACPI_THERMAL_MODE_ACTIVE 0x00
#define ACPI_THERMAL_MODE_PASSIVE 0x01 #define ACPI_THERMAL_MODE_PASSIVE 0x01
#define ACPI_THERMAL_MODE_CRT 0xff
#define ACPI_THERMAL_PATH_POWEROFF "/sbin/poweroff" #define ACPI_THERMAL_PATH_POWEROFF "/sbin/poweroff"
#define ACPI_THERMAL_MAX_ACTIVE 10 #define ACPI_THERMAL_MAX_ACTIVE 10
...@@ -289,13 +290,6 @@ acpi_thermal_set_cooling_mode ( ...@@ -289,13 +290,6 @@ acpi_thermal_set_cooling_mode (
status = acpi_get_handle(tz->handle, "_SCP", &handle); status = acpi_get_handle(tz->handle, "_SCP", &handle);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n")); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n"));
status = acpi_get_handle(tz->handle, "_PSV", &handle);
if(!ACPI_FAILURE(status)) {
tz->cooling_mode = 1;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling mode [%s]\n",
mode?"passive":"active"));
return_VALUE(0);
}
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
} }
...@@ -950,12 +944,14 @@ static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) ...@@ -950,12 +944,14 @@ static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset)
goto end; goto end;
if (!tz->flags.cooling_mode) { if (!tz->flags.cooling_mode) {
seq_puts(seq, "<not supported>\n"); seq_puts(seq, "<setting not supported>\n");
goto end;
} }
seq_printf(seq, "cooling mode: %s\n", if ( tz->cooling_mode == ACPI_THERMAL_MODE_CRT )
tz->cooling_mode?"passive":"active"); seq_printf(seq, "cooling mode: critical\n");
else
seq_printf(seq, "cooling mode: %s\n",
tz->cooling_mode?"passive":"active");
end: end:
return 0; return 0;
...@@ -997,6 +993,8 @@ acpi_thermal_write_cooling_mode ( ...@@ -997,6 +993,8 @@ acpi_thermal_write_cooling_mode (
if (result) if (result)
return_VALUE(result); return_VALUE(result);
acpi_thermal_check(tz);
return_VALUE(count); return_VALUE(count);
} }
...@@ -1234,16 +1232,34 @@ acpi_thermal_get_info ( ...@@ -1234,16 +1232,34 @@ acpi_thermal_get_info (
if (result) if (result)
return_VALUE(result); return_VALUE(result);
/* Set the cooling mode [_SCP] to active cooling (default) */
result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE);
if (!result)
tz->flags.cooling_mode = 1;
/* Get trip points [_CRT, _PSV, etc.] (required) */ /* Get trip points [_CRT, _PSV, etc.] (required) */
result = acpi_thermal_get_trip_points(tz); result = acpi_thermal_get_trip_points(tz);
if (result) if (result)
return_VALUE(result); return_VALUE(result);
/* Set the cooling mode [_SCP] to active cooling (default) */
result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE);
if (!result)
tz->flags.cooling_mode = 1;
else {
/* Oh,we have not _SCP method.
Generally show cooling_mode by _ACx, _PSV,spec 12.2*/
tz->flags.cooling_mode = 0;
if ( tz->trips.active[0].flags.valid && tz->trips.passive.flags.valid ) {
if ( tz->trips.passive.temperature > tz->trips.active[0].temperature )
tz->cooling_mode = ACPI_THERMAL_MODE_ACTIVE;
else
tz->cooling_mode = ACPI_THERMAL_MODE_PASSIVE;
} else if ( !tz->trips.active[0].flags.valid && tz->trips.passive.flags.valid ) {
tz->cooling_mode = ACPI_THERMAL_MODE_PASSIVE;
} else if ( tz->trips.active[0].flags.valid && !tz->trips.passive.flags.valid ) {
tz->cooling_mode = ACPI_THERMAL_MODE_ACTIVE;
} else {
/* _ACx and _PSV are optional, but _CRT is required */
tz->cooling_mode = ACPI_THERMAL_MODE_CRT;
}
}
/* Get default polling frequency [_TZP] (optional) */ /* Get default polling frequency [_TZP] (optional) */
if (tzp) if (tzp)
tz->polling_frequency = tzp; tz->polling_frequency = tzp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment