Talk:Code/ibm-acpi-0.11-2.6.17-fan.patch

From ThinkWiki
Revision as of 12:27, 22 August 2006 by Dimeco (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

--- drivers/acpi/ibm_acpi.c.orig 2006-08-22 19:04:43.000000000 +0900 +++ drivers/acpi/ibm_acpi.c 2006-08-22 19:10:28.000000000 +0900 @@ -1466,6 +1466,7 @@

{
       int len = 0;
       int s;

+ char status_read = 0;

       u8 lo, hi, status;
       if (gfan_handle) {

@@ -1479,8 +1480,11 @@

               if (!acpi_ec_read(fan_status_offset, &status))
                       len += sprintf(p + len, "status:\t\tunreadable\n");
               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))

@@ -1488,6 +1492,16 @@

               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)

@@ -1496,7 +1510,10 @@

                              " (<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>"

@@ -1517,7 +1534,8 @@

                       /* 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;

@@ -1525,6 +1543,17 @@

                       /* 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) {