Difference between revisions of "Code/ibm-acpi-0.11-2.6.13-fan.patch"

From ThinkWiki
Jump to: navigation, search
 
m
Line 1: Line 1:
--- ibm-acpi-0.11-orig/ibm_acpi.c 2005-03-17 12:06:16.000000000 +0200
+
--- ibm-acpi-0.11-orig/ibm_acpi.c 2005-03-17 12:06:16.000000000 0200
+++ ibm-acpi-0.11/ibm_acpi.c 2005-10-26 06:21:57.000000000 +0200
+
    ibm-acpi-0.11/ibm_acpi.c 2005-10-26 06:21:57.000000000 0200
@@ -1488,11 +1488,18 @@ static int fan_read(char *p)
+
@@ -1488,11 1488,18 @@ static int fan_read(char *p)
 
  } else {
 
  } else {
 
  /* all except 570, 600e/x, 770e, 770x */
 
  /* all except 570, 600e/x, 770e, 770x */
  if (!acpi_ec_read(fan_status_offset, &status))
+
  if (!acpi_ec_read(fan_status_offset,
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");
+
+ 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 (!acpi_ec_read(fan_rpm_offset,    &lo) ||
+
    !acpi_ec_read(fan_rpm_offset + 1, &hi))
+
len += sprintf(p + len, "speed:\t\tunreadable\n");
+
@@ -1506,9 +1513,12 @@ static int fan_read(char *p)
+
len += sprintf(p + len, "commands:\tlevel <level>"
+
      " (<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>"
+
      " (<speed> is 0-65535)\n");
+
@@ -1528,17 +1538,29 @@ 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) {
+
+   ( (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;
+
} else if (!gfan_handle &&
+
  strlencmp(cmd, "disable") == 0) {
+
/* 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) {
+
/* X31, X40 */
+
@@ -1751,9 +1773,9 @@ static int __init setup_notify(struct ib
+
+
return 0;
+
}
+
+
-static int device_add(struct acpi_device *device)
+
+static int ibmacpi_device_add(struct acpi_device *device)
+
{
+
return 0;
+
}
+
+
@@ -1769,9 +1791,9 @@ static int __init register_driver(struct
+
+
memset(ibm->driver, 0, sizeof(struct acpi_driver));
+
sprintf(ibm->driver->name, "%s/%s", IBM_NAME, ibm->name);
+
ibm->driver->ids = ibm->hid;
+
- ibm->driver->ops.add = &device_add;
+
+ ibm->driver->ops.add = &ibmacpi_device_add;
+
+
ret = acpi_bus_register_driver(ibm->driver);
+
if (ret < 0) {
+
printk(IBM_ERR "acpi_bus_register_driver(%s) failed: %d\n",
+

Revision as of 06:16, 11 April 2007

--- ibm-acpi-0.11-orig/ibm_acpi.c 2005-03-17 12:06:16.000000000 0200

   ibm-acpi-0.11/ibm_acpi.c	2005-10-26 06:21:57.000000000  0200

@@ -1488,11 1488,18 @@ static int fan_read(char *p)

	} else {
		/* all except 570, 600e/x, 770e, 770x */
		if (!acpi_ec_read(fan_status_offset,