public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* Thermal managment broken
@ 2002-09-16 16:36 Pavel Machek
       [not found] ` <20020916163600.GA11617-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2002-09-16 16:36 UTC (permalink / raw)
  To: Andrew Grover, ACPI mailing list

Hi!

Thermal managment forgets previous state, so it can never ever get to
slower state than T1.

Second patch allows user to set trip points. This is neccessary on XE3
-- BIOS claims passive cooling at 83C and critical at 100C. Yet it
powers down at ~85C. This allows user to override.

First is strict bugfix, please take. Second is needed, please take it,
too.

								Pavel 

--- clean/drivers/acpi/processor.c	2002-07-29 20:02:23.000000000 +0200
+++ linux/drivers/acpi/processor.c	2002-09-16 17:54:01.000000000 +0200
@@ -1468,6 +1468,9 @@
 	 * performance state.
 	 */
 
+	px = pr->limit.thermal.px;
+	tx = pr->limit.thermal.tx;
+
 	switch (type) {
 
 	case ACPI_PROCESSOR_LIMIT_NONE:
--- clean/drivers/acpi/thermal.c	2002-08-28 22:38:43.000000000 +0200
+++ linux/drivers/acpi/thermal.c	2002-09-16 17:43:37.000000000 +0200
@@ -60,6 +60,7 @@
 #define ACPI_THERMAL_MAX_ACTIVE	10
 
 #define KELVIN_TO_CELSIUS(t)	((t-2732+5)/10)
+#define CELSIUS_TO_KELVIN(t)	((t+273)*10)
 
 static int acpi_thermal_add (struct acpi_device *device);
 static int acpi_thermal_remove (struct acpi_device *device, int type);
@@ -854,6 +868,46 @@
 
 
 static int
+acpi_thermal_write_trip_points (
+        struct file		*file,
+        const char		*buffer,
+        unsigned long		count,
+        void			*data)
+{
+	struct acpi_thermal	*tz = (struct acpi_thermal *) data;
+	char			limit_string[25] = {'\0'};
+	int			critical, hot, passive, active0, active1;
+
+	ACPI_FUNCTION_TRACE("acpi_thermal_write_trip_points");
+
+	if (!tz || (count > sizeof(limit_string) - 1)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n"));
+		return_VALUE(-EINVAL);
+	}
+	
+	if (copy_from_user(limit_string, buffer, count)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n"));
+		return_VALUE(-EFAULT);
+	}
+	
+	limit_string[count] = '\0';
+
+	if (sscanf(limit_string, "%d:%d:%d:%d:%d", &critical, &hot, &passive, &active0, &active1) != 5) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n"));
+		return_VALUE(-EINVAL);
+	}
+
+	tz->trips.critical.temperature = CELSIUS_TO_KELVIN(critical);
+	tz->trips.hot.temperature = CELSIUS_TO_KELVIN(hot);
+	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);
+	
+	return_VALUE(count);
+}
+
+
+static int
 acpi_thermal_read_cooling_mode (
 	char			*page,
 	char			**start,
@@ -1042,15 +1096,16 @@
 		entry->data = acpi_driver_data(device);
 	}
 
-	/* 'trip_points' [R] */
+	/* 'trip_points' [R/W] */
 	entry = create_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS,
-		S_IRUGO, acpi_device_dir(device));
+		S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
 	if (!entry)
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 			"Unable to create '%s' fs entry\n",
 			ACPI_THERMAL_FILE_POLLING_FREQ));
 	else {
 		entry->read_proc = acpi_thermal_read_trip_points;
+		entry->write_proc = acpi_thermal_write_trip_points;
 		entry->data = acpi_driver_data(device);
 	}
 

-- 
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

^ permalink raw reply	[flat|nested] 5+ messages in thread
* RE: Thermal managment broken
@ 2002-09-17 16:12 Herbert Nachtnebel
  0 siblings, 0 replies; 5+ messages in thread
From: Herbert Nachtnebel @ 2002-09-17 16:12 UTC (permalink / raw)
  To: Dominik Brodowski, Pavel Machek; +Cc: Andrew Grover, ACPI mailing list


> You explicitely want to support _two_ active trip points here. While this
> seems to be the amount of active trip points seen on most systems, I'd
> prefer you'd do a more flexible interface [zero to ACPI_THERMAL_MAX_ACTIVE
> would be best].
 
At least the compaq e500 has three trip points, one should be able to change each trip which is specified by the DSDT.
 
Greatings,
Herbert.


-------------------------------------------------------
Sponsored by: AMD - Your access to the experts on Hammer Technology!
Open Source & Linux Developers, register now for the AMD Developer
Symposium. Code: EX8664 http://www.developwithamd.com/developerlab

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-09-18 17:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-16 16:36 Thermal managment broken Pavel Machek
     [not found] ` <20020916163600.GA11617-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2002-09-16 20:55   ` Dominik Brodowski
     [not found]     ` <20020916225518.B2247-JhLEnvuH02M@public.gmane.org>
2002-09-18 10:25       ` Pavel Machek
     [not found]         ` <20020918102555.GB18221-jyMamyUUXNJG4ohzP4jBZS1Fcj925eT/@public.gmane.org>
2002-09-18 17:00           ` Dominik Brodowski
  -- strict thread matches above, loose matches on Subject: below --
2002-09-17 16:12 Herbert Nachtnebel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox