Skip to contentSkip to conversation

force polling when manual trip points are set

PATCH New Dominik Brodowski 1 participant 1 message Nov 3, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 force polling when manual trip points are set

Hi Andy,

I'm sure you've seen the arguments on acpi-devel with the pros and cons for such a patch. Please decide,

Dominik

drivers/acpi/thermal.c renamed from drivers/acpi/thermal.c.original +12 -0
@@ -59,6 +59,8 @@
 #define ACPI_THERMAL_MODE_ACTIVE	0x00
 #define ACPI_THERMAL_MODE_PASSIVE	0x01
 #define ACPI_THERMAL_PATH_POWEROFF	"/sbin/poweroff"
+#define ACPI_THERMAL_POLLING_MANUAL_TRIPS  50    /* polling frequency when manual trip points are set. Can be overridden
+						    by writing into ACPI_THERMAL_FILE_POLLING_FREQ */
 
 #define ACPI_THERMAL_MAX_ACTIVE	10
 
@@ -879,6 +881,7 @@
 	struct acpi_thermal	*tz = (struct acpi_thermal *) data;
 	char			limit_string[25] = {'\0'};
 	int			critical, hot, passive, active0, active1;
+	int			result = 0;	
 
 	ACPI_FUNCTION_TRACE("acpi_thermal_write_trip_points");
 
@@ -904,6 +907,15 @@
 	tz->trips.passive.temperature = CELSIUS_TO_KELVIN(passive);
 	tz->trips.active[0].temperature = CELSIUS_TO_KELVIN(active0);
 	tz->trips.active[1].temperature = CELSIUS_TO_KELVIN(active1);
+
+	/* we need to start polling now as Firmware won't inform us of our custom trip points */
+	if (!tz->polling_frequency) {
+		acpi_thermal_set_polling(tz, ACPI_THERMAL_POLLING_MANUAL_TRIPS);
+		if (result)
+			return_VALUE(result);
+
+		acpi_thermal_check(tz);
+	}
 	
 	return_VALUE(count);
 }