[ltp] [PATCH] ibm_acpi - Allow fan to be set to full speed

Thomas Renninger linux-thinkpad@linux-thinkpad.org
Tue, 23 Aug 2005 16:59:33 +0200


This is a multi-part message in MIME format.
--------------060702080105020801020502
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Efthym wrote:
> On Tue, 23 Aug 2005 10:10:24 +0300, Thomas Renninger <trenn@gmx.net> wrote:
> 
>> honey@gneek.com wrote:
>>> On Mon, 22 Aug 2005, Leon Brokken wrote:
>>>
>>>> Patch works on my T41.
>>>>
>>>> However, the ibm_manage_fan script doesn't work anymore (ibm_manage_fan
>>>> script disables the fan when CPU temp is below a certain value). Anyone
>>>> else noticed this behaviour?
>>>>
>>>> bash-bash-3.00# cat /proc/acpi/ibm/fan
>>>> status:         enabled
>>>> speed:          3581
>>>> commands:       enable, disable, full-speed
>>>> bash-3.00# echo full-speed > /proc/acpi/ibm/fan
>>>> bash-3.00# cat /proc/acpi/ibm/fan
>>>> status:         disabled
>>>> speed:          4986
>>>> commands:       enable, disable, full-speed
>>>>
>>>> Cheers, Leon.
>>>
>>> Leon - yes, it would be likely to break Paul's script once set, as
>>> the script reads back fan status from /proc/acpi/ibm/fan, which as
>>> you say is incorrect for full-speed currently.  It'd be great if
>>> Borislav implemented Thomas's work in ibm_acpi and fixed the status
>>> too.
>>
>> If correct speed status is needed for the script you can try this one.
>> I think it should work (untested, I unfortunetely don't own a
>> Thinkpad)  ...
>>
>> BTW: I never got that much positive feed-back on any patch, thanks.
>>
>>     Thomas
> 
> 
> Hi Thomas,
> 
> This one fails and unfortunately can't find the problem myself. Here's 
> what I get
> 
Sorry, I should have test compiled at least.
This one should work.

        Thomas

--------------060702080105020801020502
Content-Type: text/x-patch;
 name="ibm_add_full-speed_adjust_status.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="ibm_add_full-speed_adjust_status.diff"

--- ibm_acpi.c.orig	2005-08-21 03:42:16.000000000 +0200
+++ ibm_acpi.c	2005-08-23 16:32:02.000000000 +0200
@@ -1491,7 +1491,8 @@
 			len += sprintf(p + len, "status:\t\tunreadable\n");
 		else
 			len += sprintf(p + len, "status:\t\t%s\n",
-				       enabled(status, 7));
+				       (status ? "enabled" : "disabled"));
+//				       enabled(status, 7));
 
 		if (!acpi_ec_read(fan_rpm_offset,     &lo) ||
 		    !acpi_ec_read(fan_rpm_offset + 1, &hi))
@@ -1507,7 +1508,7 @@
 			       " (<level> is 0-7)\n");
 	if (!gfan_handle)
 		/* all except 570, 600e/x, 770e, 770x */
-		len += sprintf(p + len, "commands:\tenable, disable\n");
+		len += sprintf(p + len, "commands:\tenable, disable, full-speed\n");
 	if (fans_handle)
 		/* X31, X40 */
 		len += sprintf(p + len, "commands:\tspeed <speed>"
@@ -1538,6 +1539,11 @@
 			/* all except 570, 600e/x, 770e, 770x */
 			if (!acpi_ec_write(fan_status_offset, 0x00))
 				return -EIO;
+		} else if (!gfan_handle &&
+			   strlencmp(cmd, "full-speed") == 0) {
+			/* all except 570, 600e/x, 770e, 770x */
+			if (!acpi_ec_write(fan_status_offset, 0x50))
+				return -EIO;
 		} else if (fans_handle &&
 		    sscanf(cmd, "speed %d", &speed) == 1 &&
 		    speed >= 0 && speed <= 65535) {

--------------060702080105020801020502--