Difference between revisions of "Code/ibm-acpi-0.12a-2.6.14-fan.patch"
(Moved from Patch for controlling fan speed) |
(Undo corruption) |
(One intermediate revision by one other user not shown) | |
(No difference)
|
Latest revision as of 04:57, 11 April 2007
--- drivers/acpi/ibm_acpi.c.orig 2005-11-01 19:47:44.262270250 +0100 +++ drivers/acpi/ibm_acpi.c 2005-11-01 20:16:16.081252250 +0100 @@ -1465,6 +1465,7 @@ static int fan_read(char *p)
{ int len = 0; int s;
+ char status_read = 0;
u8 lo, hi, status;
if (gfan_handle) {
@@ -1477,9 +1478,11 @@ static int fan_read(char *p)
/* all except 570, 600e/x, 770e, 770x */ if (!acpi_ec_read(fan_status_offset, &status)) len += sprintf(p + len, "status:\t\tunreadable\n");
- else + else {
len += sprintf(p + len, "status:\t\t%s\n",
- enabled(status, 7)); + status ? "enabled" : "disabled"); + status_read = 1; + }
if (!acpi_ec_read(fan_rpm_offset, &lo) || !acpi_ec_read(fan_rpm_offset + 1, &hi))
@@ -1487,6 +1490,14 @@ static int fan_read(char *p)
else len += sprintf(p + len, "speed:\t\t%d\n", (hi << 8) + lo);
+ if (status_read) { + if (status & 0x40) + len += sprintf(p + len, "level:\t\tdisengaged\n"); + else if (status & 0x80) + len += sprintf(p + len, "level:\t\tauto\n"); + else + len += sprintf(p + len, "level:\t\t%d\n", status); + }
}
if (sfan_handle)
@@ -1495,7 +1506,10 @@ static int fan_read(char *p)
" (<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, level <level>\n" + " \t(<level> is 0-7, auto " + "or disengaged)\n");
if (fans_handle) /* X31, X40 */ len += sprintf(p + len, "commands:\tspeed <speed>"
@@ -1516,7 +1530,8 @@ static int fan_write(char *buf)
/* 570, 770x-JL */ if (!acpi_evalf(sfan_handle, NULL, NULL, "vd", level)) return -EIO;
- } else if (!gfan_handle && strlencmp(cmd, "enable") == 0) { + } else if (!gfan_handle && ( (strlencmp(cmd, "enable") == 0) || + (strlencmp(cmd, "level auto") == 0) ) ) {
/* all except 570, 600e/x, 770e, 770x */ if (!acpi_ec_write(fan_status_offset, 0x80)) return -EIO;
@@ -1524,6 +1539,17 @@ static int fan_write(char *buf)
/* all except 570, 600e/x, 770e, 770x */ if (!acpi_ec_write(fan_status_offset, 0x00)) return -EIO;
+ } else if (!gfan_handle && + strlencmp(cmd, "level disengaged") == 0) { + /* all except 570, 600e/x, 770e, 770x */ + if (!acpi_ec_write(fan_status_offset, 0x40)) + return -EIO; + } else if (!gfan_handle && + sscanf(cmd, "level %d", &level) == 1 && + level >=0 && level <= 7) { + /* all except 570, 600e/x, 770e, 770x */ + if (!acpi_ec_write(fan_status_offset, level)) + return -EIO;
} else if (fans_handle && sscanf(cmd, "speed %d", &speed) == 1 && speed >= 0 && speed <= 65535) {