diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 504385b..93cb3e8 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -846,10 +846,11 @@ static void acpi_thermal_check(void *data) * Calculate Sleep Time * -------------------- * If we're in the passive state, use _TSP's value. Otherwise - * use the default polling frequency (e.g. _TZP). If no polling - * frequency is specified then we'll wait forever (at least until - * a thermal event occurs). Note that _TSP and _TZD values are - * given in 1/10th seconds (we must covert to milliseconds). + * use the default polling frequency (e.g. _TZP). If no + * polling frequency is specified then we'll wait 10 seconds + * (or until a thermal event occurs). Note that _TSP and _TZD + * values are given in 1/10th seconds (we must covert to + * milliseconds). */ if (tz->state.passive) { sleep_time = tz->trips.passive.tsp * 100; @@ -1575,8 +1576,9 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz) /* Get default polling frequency [_TZP] (optional) */ if (tzp) tz->polling_frequency = tzp; - else - acpi_thermal_get_polling_frequency(tz); + else if (acpi_thermal_get_polling_frequency(tz) == -ENODEV) + /* If no _TZP, default to polling every 10 seconds */ + tz->polling_frequency = 100; return 0; } diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 6d85289..3b8d036 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -30,6 +30,9 @@ struct acpi_device_bus_id{ struct list_head node; }; +struct acpi_handle_list acpi_processor_list; +EXPORT_SYMBOL(acpi_processor_list); + /* * Creates hid/cid(s) string needed for modalias and uevent * e.g. on a device with hid:IBM0001 and cid:ACPI0001 you get: @@ -1044,6 +1047,11 @@ static void acpi_device_set_id(struct acpi_device *device, break; case ACPI_BUS_TYPE_PROCESSOR: hid = ACPI_PROCESSOR_HID; + if (acpi_processor_list.count < ACPI_MAX_HANDLES) { + acpi_processor_list.handles[acpi_processor_list.count] + =handle; + acpi_processor_list.count++; + } break; case ACPI_BUS_TYPE_SYSTEM: hid = ACPI_SYSTEM_HID; diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 93cb3e8..19acfd3 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -116,6 +116,8 @@ static const struct acpi_device_id thermal_device_ids[] = { }; MODULE_DEVICE_TABLE(acpi, thermal_device_ids); +extern struct acpi_handle_list acpi_processor_list; + static struct acpi_driver acpi_thermal_driver = { .name = "thermal", .class = ACPI_THERMAL_CLASS, @@ -418,9 +420,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) "_PSV", NULL, &tz->trips.passive.temperature); } - if (ACPI_FAILURE(status)) - tz->trips.passive.flags.valid = 0; - else { + if (ACPI_SUCCESS(status)) { tz->trips.passive.flags.valid = 1; if (flag == ACPI_TRIPS_INIT) { status = acpi_evaluate_integer( @@ -440,20 +440,48 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) tz->trips.passive.flags.valid = 0; } } + + if (!tz->trips.passive.flags.valid) { + /* If there's no valid passive zone, add a fake + one in order to ensure that we don't hit the + critical temperature limit */ + + tz->trips.passive.flags.valid = 1; + tz->trips.passive.tc1 = 1; + tz->trips.passive.tc2 = 1; + + /* A high rate of polling here is acceptable - + if we're hitting this limit, then the + system is clearly under load. A higher + polling frequency means that we can weigh + the load against the temperature more + effeciently and overall reduce power + consumption */ + + tz->trips.passive.tsp = 10; + + /* Set the passive trip temperature to be either + the option passed by the user or 5 degrees below the + critical temperature. That should give us enough + head room without limiting performance */ + + if (!psv) + tz->trips.passive.temperature = + tz->trips.critical.temperature - 50; + } } if ((flag & ACPI_TRIPS_DEVICES) && tz->trips.passive.flags.valid) { memset(&devices, 0, sizeof(struct acpi_handle_list)); status = acpi_evaluate_reference(tz->device->handle, "_PSL", NULL, &devices); - if (ACPI_FAILURE(status)) - tz->trips.passive.flags.valid = 0; - else - tz->trips.passive.flags.valid = 1; - - if (memcmp(&tz->trips.passive.devices, &devices, + if (ACPI_FAILURE(status)) { + memcpy(&tz->trips.passive.devices, + &acpi_processor_list, + sizeof (struct acpi_handle_list)); + } else if (memcmp(&tz->trips.passive.devices, &devices, sizeof(struct acpi_handle_list))) { memcpy(&tz->trips.passive.devices, &devices, - sizeof(struct acpi_handle_list)); + sizeof(struct acpi_handle_list)); ACPI_THERMAL_TRIPS_EXCEPTION(flag, "device"); } }