aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/thermal.c
diff options
context:
space:
mode:
authorZhao Yakui <yakui.zhao@intel.com>2008-07-14 03:14:03 -0400
committerAndi Kleen <ak@linux.intel.com>2008-07-17 19:41:50 -0400
commitea51011a27db48ea0a80a5e20de3969b292d5d4d (patch)
tree1c59582d9b0402390a58f96d410d9693edd0bbd3 /drivers/acpi/thermal.c
parentc2c789057f075022658b38b498755c29c1ba8055 (diff)
ACPI : Set FAN device to correct state in boot phase
Subject:ACPI: Set FAN device to correct state in boot phase From: Zhao Yakui <yakui.zhao@intel.com> On some laptops when ACPI FAN driver is loaded, maybe the FAN device will be turned on. But if the temperature is below the threshold, the corresponding FAN device should be turned off in the course of loading thermal driver. So it is necessary to set the FAN device to the correct state in course of loading the thermal driver. http://bugzilla.kernel.org/show_bug.cgi?id=8049 Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Andi Kleen <ak@linux.intel.com>
Diffstat (limited to 'drivers/acpi/thermal.c')
-rw-r--r--drivers/acpi/thermal.c43
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
772static 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
772static void acpi_thermal_check(void *data) 813static 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,