diff options
-rw-r--r-- | drivers/acpi/thermal.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 84c795fb9b1e..9adfd180df6a 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -769,6 +769,47 @@ static void acpi_thermal_run(unsigned long data) | |||
769 | acpi_os_execute(OSL_GPE_HANDLER, acpi_thermal_check, (void *)data); | 769 | acpi_os_execute(OSL_GPE_HANDLER, acpi_thermal_check, (void *)data); |
770 | } | 770 | } |
771 | 771 | ||
772 | static void acpi_thermal_active_off(void *data) | ||
773 | { | ||
774 | int result = 0; | ||
775 | struct acpi_thermal *tz = data; | ||
776 | int i = 0; | ||
777 | int j = 0; | ||
778 | struct acpi_thermal_active *active = NULL; | ||
779 | |||
780 | if (!tz) { | ||
781 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); | ||
782 | return; | ||
783 | } | ||
784 | |||
785 | result = acpi_thermal_get_temperature(tz); | ||
786 | if (result) | ||
787 | return; | ||
788 | |||
789 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { | ||
790 | active = &(tz->trips.active[i]); | ||
791 | if (!active || !active->flags.valid) | ||
792 | break; | ||
793 | if (tz->temperature >= active->temperature) { | ||
794 | /* | ||
795 | * If the thermal temperature is greater than the | ||
796 | * active threshod, unnecessary to turn off the | ||
797 | * the active cooling device. | ||
798 | */ | ||
799 | continue; | ||
800 | } | ||
801 | /* | ||
802 | * Below Threshold? | ||
803 | * ---------------- | ||
804 | * Turn OFF all cooling devices associated with this | ||
805 | * threshold. | ||
806 | */ | ||
807 | for (j = 0; j < active->devices.count; j++) | ||
808 | result = acpi_bus_set_power(active->devices.handles[j], | ||
809 | ACPI_STATE_D3); | ||
810 | } | ||
811 | } | ||
812 | |||
772 | static void acpi_thermal_check(void *data) | 813 | static void acpi_thermal_check(void *data) |
773 | { | 814 | { |
774 | int result = 0; | 815 | int result = 0; |
@@ -1624,6 +1665,8 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
1624 | 1665 | ||
1625 | init_timer(&tz->timer); | 1666 | init_timer(&tz->timer); |
1626 | 1667 | ||
1668 | acpi_thermal_active_off(tz); | ||
1669 | |||
1627 | acpi_thermal_check(tz); | 1670 | acpi_thermal_check(tz); |
1628 | 1671 | ||
1629 | status = acpi_install_notify_handler(device->handle, | 1672 | status = acpi_install_notify_handler(device->handle, |