]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/misc/thinkpad_acpi.c
ACPI: thinkpad-acpi: add debug mode
[linux-2.6-omap-h63xx.git] / drivers / misc / thinkpad_acpi.c
index cac73e5f96e217656196add7f64f242830d62b5b..7fa906fd45c0a6f67ab69017840816ea00e0a17f 100644 (file)
@@ -459,7 +459,7 @@ static char *next_cmd(char **cmds)
  ****************************************************************************/
 
 /*************************************************************************
- * ibm-acpi init subdriver
+ * thinkpad-acpi init subdriver
  */
 
 static int thinkpad_acpi_driver_init(void)
@@ -781,16 +781,16 @@ static int video_init(void)
 
        if (!vid_handle)
                /* video switching not supported on R30, R31 */
-               video_supported = IBMACPI_VIDEO_NONE;
+               video_supported = TPACPI_VIDEO_NONE;
        else if (acpi_evalf(vid_handle, &video_orig_autosw, "SWIT", "qd"))
                /* 570 */
-               video_supported = IBMACPI_VIDEO_570;
+               video_supported = TPACPI_VIDEO_570;
        else if (acpi_evalf(vid_handle, &video_orig_autosw, "^VADL", "qd"))
                /* 600e/x, 770e, 770x */
-               video_supported = IBMACPI_VIDEO_770;
+               video_supported = TPACPI_VIDEO_770;
        else
                /* all others */
-               video_supported = IBMACPI_VIDEO_NEW;
+               video_supported = TPACPI_VIDEO_NEW;
 
        return 0;
 }
@@ -805,15 +805,15 @@ static int video_status(void)
        int status = 0;
        int i;
 
-       if (video_supported == IBMACPI_VIDEO_570) {
+       if (video_supported == TPACPI_VIDEO_570) {
                if (acpi_evalf(NULL, &i, "\\_SB.PHS", "dd", 0x87))
                        status = i & 3;
-       } else if (video_supported == IBMACPI_VIDEO_770) {
+       } else if (video_supported == TPACPI_VIDEO_770) {
                if (acpi_evalf(NULL, &i, "\\VCDL", "d"))
                        status |= 0x01 * i;
                if (acpi_evalf(NULL, &i, "\\VCDC", "d"))
                        status |= 0x02 * i;
-       } else if (video_supported == IBMACPI_VIDEO_NEW) {
+       } else if (video_supported == TPACPI_VIDEO_NEW) {
                acpi_evalf(NULL, NULL, "\\VUPS", "vd", 1);
                if (acpi_evalf(NULL, &i, "\\VCDC", "d"))
                        status |= 0x02 * i;
@@ -832,10 +832,10 @@ static int video_autosw(void)
 {
        int autosw = 0;
 
-       if (video_supported == IBMACPI_VIDEO_570)
+       if (video_supported == TPACPI_VIDEO_570)
                acpi_evalf(vid_handle, &autosw, "SWIT", "d");
-       else if (video_supported == IBMACPI_VIDEO_770 ||
-                video_supported == IBMACPI_VIDEO_NEW)
+       else if (video_supported == TPACPI_VIDEO_770 ||
+                video_supported == TPACPI_VIDEO_NEW)
                acpi_evalf(vid_handle, &autosw, "^VDEE", "d");
 
        return autosw & 1;
@@ -848,7 +848,7 @@ static int video_switch(void)
 
        if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", 1))
                return -EIO;
-       ret = video_supported == IBMACPI_VIDEO_570 ?
+       ret = video_supported == TPACPI_VIDEO_570 ?
            acpi_evalf(ec_handle, NULL, "_Q16", "v") :
            acpi_evalf(vid_handle, NULL, "VSWT", "v");
        acpi_evalf(vid_handle, NULL, "_DOS", "vd", autosw);
@@ -858,9 +858,9 @@ static int video_switch(void)
 
 static int video_expand(void)
 {
-       if (video_supported == IBMACPI_VIDEO_570)
+       if (video_supported == TPACPI_VIDEO_570)
                return acpi_evalf(ec_handle, NULL, "_Q17", "v");
-       else if (video_supported == IBMACPI_VIDEO_770)
+       else if (video_supported == TPACPI_VIDEO_770)
                return acpi_evalf(vid_handle, NULL, "VEXP", "v");
        else
                return acpi_evalf(NULL, NULL, "\\VEXP", "v");
@@ -870,10 +870,10 @@ static int video_switch2(int status)
 {
        int ret;
 
-       if (video_supported == IBMACPI_VIDEO_570) {
+       if (video_supported == TPACPI_VIDEO_570) {
                ret = acpi_evalf(NULL, NULL,
                                 "\\_SB.PHS2", "vdd", 0x8b, status | 0x80);
-       } else if (video_supported == IBMACPI_VIDEO_770) {
+       } else if (video_supported == TPACPI_VIDEO_770) {
                int autosw = video_autosw();
                if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", 1))
                        return -EIO;
@@ -904,12 +904,12 @@ static int video_read(char *p)
        len += sprintf(p + len, "status:\t\tsupported\n");
        len += sprintf(p + len, "lcd:\t\t%s\n", enabled(status, 0));
        len += sprintf(p + len, "crt:\t\t%s\n", enabled(status, 1));
-       if (video_supported == IBMACPI_VIDEO_NEW)
+       if (video_supported == TPACPI_VIDEO_NEW)
                len += sprintf(p + len, "dvi:\t\t%s\n", enabled(status, 3));
        len += sprintf(p + len, "auto:\t\t%s\n", enabled(autosw, 0));
        len += sprintf(p + len, "commands:\tlcd_enable, lcd_disable\n");
        len += sprintf(p + len, "commands:\tcrt_enable, crt_disable\n");
-       if (video_supported == IBMACPI_VIDEO_NEW)
+       if (video_supported == TPACPI_VIDEO_NEW)
                len += sprintf(p + len, "commands:\tdvi_enable, dvi_disable\n");
        len += sprintf(p + len, "commands:\tauto_enable, auto_disable\n");
        len += sprintf(p + len, "commands:\tvideo_switch, expand_toggle\n");
@@ -936,10 +936,10 @@ static int video_write(char *buf)
                        enable |= 0x02;
                } else if (strlencmp(cmd, "crt_disable") == 0) {
                        disable |= 0x02;
-               } else if (video_supported == IBMACPI_VIDEO_NEW &&
+               } else if (video_supported == TPACPI_VIDEO_NEW &&
                           strlencmp(cmd, "dvi_enable") == 0) {
                        enable |= 0x08;
-               } else if (video_supported == IBMACPI_VIDEO_NEW &&
+               } else if (video_supported == TPACPI_VIDEO_NEW &&
                           strlencmp(cmd, "dvi_disable") == 0) {
                        disable |= 0x08;
                } else if (strlencmp(cmd, "auto_enable") == 0) {
@@ -1283,16 +1283,16 @@ static int led_init(void)
 {
        if (!led_handle)
                /* led not supported on R30, R31 */
-               led_supported = IBMACPI_LED_NONE;
+               led_supported = TPACPI_LED_NONE;
        else if (strlencmp(led_path, "SLED") == 0)
                /* 570 */
-               led_supported = IBMACPI_LED_570;
+               led_supported = TPACPI_LED_570;
        else if (strlencmp(led_path, "SYSL") == 0)
                /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */
-               led_supported = IBMACPI_LED_OLD;
+               led_supported = TPACPI_LED_OLD;
        else
                /* all others */
-               led_supported = IBMACPI_LED_NEW;
+               led_supported = TPACPI_LED_NEW;
 
        return 0;
 }
@@ -1309,7 +1309,7 @@ static int led_read(char *p)
        }
        len += sprintf(p + len, "status:\t\tsupported\n");
 
-       if (led_supported == IBMACPI_LED_570) {
+       if (led_supported == TPACPI_LED_570) {
                /* 570 */
                int i, status;
                for (i = 0; i < 8; i++) {
@@ -1354,23 +1354,23 @@ static int led_write(char *buf)
                } else
                        return -EINVAL;
 
-               if (led_supported == IBMACPI_LED_570) {
+               if (led_supported == TPACPI_LED_570) {
                        /* 570 */
                        led = 1 << led;
                        if (!acpi_evalf(led_handle, NULL, NULL, "vdd",
                                        led, led_sled_arg1[ind]))
                                return -EIO;
-               } else if (led_supported == IBMACPI_LED_OLD) {
+               } else if (led_supported == TPACPI_LED_OLD) {
                        /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20 */
                        led = 1 << led;
-                       ret = ec_write(IBMACPI_LED_EC_HLMS, led);
+                       ret = ec_write(TPACPI_LED_EC_HLMS, led);
                        if (ret >= 0)
                                ret =
-                                   ec_write(IBMACPI_LED_EC_HLBL,
+                                   ec_write(TPACPI_LED_EC_HLBL,
                                             led * led_exp_hlbl[ind]);
                        if (ret >= 0)
                                ret =
-                                   ec_write(IBMACPI_LED_EC_HLCL,
+                                   ec_write(TPACPI_LED_EC_HLCL,
                                             led * led_exp_hlcl[ind]);
                        if (ret < 0)
                                return ret;
@@ -1467,29 +1467,29 @@ static int thermal_init(void)
                                printk(IBM_ERR
                                       "ThinkPad ACPI EC access misbehaving, "
                                       "falling back to ACPI TMPx access mode\n");
-                               thermal_read_mode = IBMACPI_THERMAL_ACPI_TMP07;
+                               thermal_read_mode = TPACPI_THERMAL_ACPI_TMP07;
                        } else {
                                printk(IBM_ERR
                                       "ThinkPad ACPI EC access misbehaving, "
                                       "disabling thermal sensors access\n");
-                               thermal_read_mode = IBMACPI_THERMAL_NONE;
+                               thermal_read_mode = TPACPI_THERMAL_NONE;
                        }
                } else {
                        thermal_read_mode =
                            (ta2 != 0) ?
-                           IBMACPI_THERMAL_TPEC_16 : IBMACPI_THERMAL_TPEC_8;
+                           TPACPI_THERMAL_TPEC_16 : TPACPI_THERMAL_TPEC_8;
                }
        } else if (acpi_tmp7) {
                if (acpi_evalf(ec_handle, NULL, "UPDT", "qv")) {
                        /* 600e/x, 770e, 770x */
-                       thermal_read_mode = IBMACPI_THERMAL_ACPI_UPDT;
+                       thermal_read_mode = TPACPI_THERMAL_ACPI_UPDT;
                } else {
                        /* Standard ACPI TMPx access, max 8 sensors */
-                       thermal_read_mode = IBMACPI_THERMAL_ACPI_TMP07;
+                       thermal_read_mode = TPACPI_THERMAL_ACPI_TMP07;
                }
        } else {
                /* temperatures not supported on 570, G4x, R30, R31, R32 */
-               thermal_read_mode = IBMACPI_THERMAL_NONE;
+               thermal_read_mode = TPACPI_THERMAL_NONE;
        }
 
        return 0;
@@ -1505,8 +1505,8 @@ static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s)
                return -EINVAL;
 
        switch (thermal_read_mode) {
-#if IBMACPI_MAX_THERMAL_SENSORS >= 16
-       case IBMACPI_THERMAL_TPEC_16:
+#if TPACPI_MAX_THERMAL_SENSORS >= 16
+       case TPACPI_THERMAL_TPEC_16:
                for (i = 0; i < 8; i++) {
                        if (!acpi_ec_read(0xC0 + i, &tmp))
                                return -EIO;
@@ -1514,15 +1514,15 @@ static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s)
                }
                /* fallthrough */
 #endif
-       case IBMACPI_THERMAL_TPEC_8:
+       case TPACPI_THERMAL_TPEC_8:
                for (i = 0; i < 8; i++) {
                        if (!acpi_ec_read(0x78 + i, &tmp))
                                return -EIO;
                        s->temp[i] = tmp * 1000;
                }
-               return (thermal_read_mode == IBMACPI_THERMAL_TPEC_16) ? 16 : 8;
+               return (thermal_read_mode == TPACPI_THERMAL_TPEC_16) ? 16 : 8;
 
-       case IBMACPI_THERMAL_ACPI_UPDT:
+       case TPACPI_THERMAL_ACPI_UPDT:
                if (!acpi_evalf(ec_handle, NULL, "UPDT", "v"))
                        return -EIO;
                for (i = 0; i < 8; i++) {
@@ -1533,7 +1533,7 @@ static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s)
                }
                return 8;
 
-       case IBMACPI_THERMAL_ACPI_TMP07:
+       case TPACPI_THERMAL_ACPI_TMP07:
                for (i = 0; i < 8; i++) {
                        tmpi[3] = '0' + i;
                        if (!acpi_evalf(ec_handle, &t, tmpi, "d"))
@@ -1542,7 +1542,7 @@ static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s)
                }
                return 8;
 
-       case IBMACPI_THERMAL_NONE:
+       case TPACPI_THERMAL_NONE:
        default:
                return 0;
        }
@@ -1848,20 +1848,21 @@ static int volume_write(char *buf)
 /*
  * FAN ACCESS MODES
  *
- * IBMACPI_FAN_RD_ACPI_GFAN:
+ * TPACPI_FAN_RD_ACPI_GFAN:
  *     ACPI GFAN method: returns fan level
  *
- *     see IBMACPI_FAN_WR_ACPI_SFAN
- *     EC 0x2f not available if GFAN exists
+ *     see TPACPI_FAN_WR_ACPI_SFAN
+ *     EC 0x2f (HFSP) not available if GFAN exists
  *
- * IBMACPI_FAN_WR_ACPI_SFAN:
+ * TPACPI_FAN_WR_ACPI_SFAN:
  *     ACPI SFAN method: sets fan level, 0 (stop) to 7 (max)
  *
- *     EC 0x2f might be available *for reading*, but never for writing.
+ *     EC 0x2f (HFSP) might be available *for reading*, but do not use
+ *     it for writing.
  *
- * IBMACPI_FAN_WR_TPEC:
- *     ThinkPad EC register 0x2f (HFSP): fan control loop mode Supported
- *     on almost all ThinkPads
+ * TPACPI_FAN_WR_TPEC:
+ *     ThinkPad EC register 0x2f (HFSP): fan control loop mode
+ *     Supported on almost all ThinkPads
  *
  *     Fan speed changes of any sort (including those caused by the
  *     disengaged mode) are usually done slowly by the firmware as the
@@ -1875,12 +1876,13 @@ static int volume_write(char *buf)
  *      7      automatic mode engaged;
  *             (default operation mode of the ThinkPad)
  *             fan level is ignored in this mode.
- *      6      disengage mode (takes precedence over bit 7);
+ *      6      full speed mode (takes precedence over bit 7);
  *             not available on all thinkpads.  May disable
- *             the tachometer, and speeds up fan to 100% duty-cycle,
- *             which speeds it up far above the standard RPM
- *             levels.  It is not impossible that it could cause
- *             hardware damage.
+ *             the tachometer while the fan controller ramps up
+ *             the speed (which can take up to a few *minutes*).
+ *             Speeds up fan to 100% duty-cycle, which is far above
+ *             the standard RPM levels.  It is not impossible that
+ *             it could cause hardware damage.
  *     5-3     unused in some models.  Extra bits for fan level
  *             in others, but still useless as all values above
  *             7 map to the same speed as level 7 in these models.
@@ -1888,7 +1890,7 @@ static int volume_write(char *buf)
  *                     0x00 = stop
  *                     0x07 = max (set when temperatures critical)
  *             Some ThinkPads may have other levels, see
- *             IBMACPI_FAN_WR_ACPI_FANS (X31/X40/X41)
+ *             TPACPI_FAN_WR_ACPI_FANS (X31/X40/X41)
  *
  *     FIRMWARE BUG: on some models, EC 0x2f might not be initialized at
  *     boot. Apparently the EC does not intialize it, so unless ACPI DSDT
@@ -1916,14 +1918,13 @@ static int volume_write(char *buf)
  *     FIRMWARE BUG: always read 0x84 first, otherwise incorrect readings
  *     might result.
  *
- *     FIRMWARE BUG: when EC 0x2f bit 6 is set (disengaged mode), this
- *     register is not invalidated in ThinkPads that disable tachometer
- *     readings.  Thus, the tachometer readings go stale.
+ *     FIRMWARE BUG: may go stale while the EC is switching to full speed
+ *     mode.
  *
  *     For firmware bugs, refer to:
  *     http://thinkwiki.org/wiki/Embedded_Controller_Firmware#Firmware_Issues
  *
- * IBMACPI_FAN_WR_ACPI_FANS:
+ * TPACPI_FAN_WR_ACPI_FANS:
  *     ThinkPad X31, X40, X41.  Not available in the X60.
  *
  *     FANS ACPI handle: takes three arguments: low speed, medium speed,
@@ -1940,7 +1941,7 @@ static int volume_write(char *buf)
  *     ACPI DSDT switches which set is in use depending on various
  *     factors.
  *
- *     IBMACPI_FAN_WR_TPEC is also available and should be used to
+ *     TPACPI_FAN_WR_TPEC is also available and should be used to
  *     command the fan.  The X31/X40/X41 seems to have 8 fan levels,
  *     but the ACPI tables just mention level 7.
  */
@@ -1966,21 +1967,21 @@ IBM_HANDLE(sfan, ec, "SFAN",    /* 570 */
 
 static int fan_init(void)
 {
-       fan_status_access_mode = IBMACPI_FAN_NONE;
-       fan_control_access_mode = IBMACPI_FAN_WR_NONE;
+       fan_status_access_mode = TPACPI_FAN_NONE;
+       fan_control_access_mode = TPACPI_FAN_WR_NONE;
        fan_control_commands = 0;
        fan_control_status_known = 1;
        fan_watchdog_maxinterval = 0;
 
        if (gfan_handle) {
                /* 570, 600e/x, 770e, 770x */
-               fan_status_access_mode = IBMACPI_FAN_RD_ACPI_GFAN;
+               fan_status_access_mode = TPACPI_FAN_RD_ACPI_GFAN;
        } else {
                /* all other ThinkPads: note that even old-style
                 * ThinkPad ECs supports the fan control register */
                if (likely(acpi_ec_read(fan_status_offset,
                                        &fan_control_initial_status))) {
-                       fan_status_access_mode = IBMACPI_FAN_RD_TPEC;
+                       fan_status_access_mode = TPACPI_FAN_RD_TPEC;
 
                        /* In some ThinkPads, neither the EC nor the ACPI
                         * DSDT initialize the fan status, and it ends up
@@ -2015,9 +2016,9 @@ static int fan_init(void)
 
        if (sfan_handle) {
                /* 570, 770x-JL */
-               fan_control_access_mode = IBMACPI_FAN_WR_ACPI_SFAN;
+               fan_control_access_mode = TPACPI_FAN_WR_ACPI_SFAN;
                fan_control_commands |=
-                   IBMACPI_FAN_CMD_LEVEL | IBMACPI_FAN_CMD_ENABLE;
+                   TPACPI_FAN_CMD_LEVEL | TPACPI_FAN_CMD_ENABLE;
        } else {
                if (!gfan_handle) {
                        /* gfan without sfan means no fan control */
@@ -2026,16 +2027,16 @@ static int fan_init(void)
                        if (fans_handle) {
                                /* X31, X40, X41 */
                                fan_control_access_mode =
-                                   IBMACPI_FAN_WR_ACPI_FANS;
+                                   TPACPI_FAN_WR_ACPI_FANS;
                                fan_control_commands |=
-                                   IBMACPI_FAN_CMD_SPEED |
-                                   IBMACPI_FAN_CMD_LEVEL |
-                                   IBMACPI_FAN_CMD_ENABLE;
+                                   TPACPI_FAN_CMD_SPEED |
+                                   TPACPI_FAN_CMD_LEVEL |
+                                   TPACPI_FAN_CMD_ENABLE;
                        } else {
-                               fan_control_access_mode = IBMACPI_FAN_WR_TPEC;
+                               fan_control_access_mode = TPACPI_FAN_WR_TPEC;
                                fan_control_commands |=
-                                   IBMACPI_FAN_CMD_LEVEL |
-                                   IBMACPI_FAN_CMD_ENABLE;
+                                   TPACPI_FAN_CMD_LEVEL |
+                                   TPACPI_FAN_CMD_ENABLE;
                        }
                }
        }
@@ -2048,10 +2049,10 @@ static int fan_get_status(u8 *status)
        u8 s;
 
        /* TODO:
-        * Add IBMACPI_FAN_RD_ACPI_FANS ? */
+        * Add TPACPI_FAN_RD_ACPI_FANS ? */
 
        switch (fan_status_access_mode) {
-       case IBMACPI_FAN_RD_ACPI_GFAN:
+       case TPACPI_FAN_RD_ACPI_GFAN:
                /* 570, 600e/x, 770e, 770x */
 
                if (unlikely(!acpi_evalf(gfan_handle, &s, NULL, "d")))
@@ -2062,7 +2063,7 @@ static int fan_get_status(u8 *status)
 
                break;
 
-       case IBMACPI_FAN_RD_TPEC:
+       case TPACPI_FAN_RD_TPEC:
                /* all except 570, 600e/x, 770e, 770x */
                if (unlikely(!acpi_ec_read(fan_status_offset, &s)))
                        return -EIO;
@@ -2090,7 +2091,7 @@ static int fan_get_speed(unsigned int *speed)
        u8 hi, lo;
 
        switch (fan_status_access_mode) {
-       case IBMACPI_FAN_RD_TPEC:
+       case TPACPI_FAN_RD_TPEC:
                /* all except 570, 600e/x, 770e, 770x */
                if (unlikely(!acpi_ec_read(fan_rpm_offset, &lo) ||
                             !acpi_ec_read(fan_rpm_offset + 1, &hi)))
@@ -2140,7 +2141,7 @@ static void fan_watchdog_reset(void)
 static int fan_set_level(int level)
 {
        switch (fan_control_access_mode) {
-       case IBMACPI_FAN_WR_ACPI_SFAN:
+       case TPACPI_FAN_WR_ACPI_SFAN:
                if (level >= 0 && level <= 7) {
                        if (!acpi_evalf(sfan_handle, NULL, NULL, "vd", level))
                                return -EIO;
@@ -2148,10 +2149,10 @@ static int fan_set_level(int level)
                        return -EINVAL;
                break;
 
-       case IBMACPI_FAN_WR_ACPI_FANS:
-       case IBMACPI_FAN_WR_TPEC:
-               if ((level != IBMACPI_FAN_EC_AUTO) &&
-                   (level != IBMACPI_FAN_EC_DISENGAGED) &&
+       case TPACPI_FAN_WR_ACPI_FANS:
+       case TPACPI_FAN_WR_TPEC:
+               if ((level != TP_EC_FAN_AUTO) &&
+                   (level != TP_EC_FAN_FULLSPEED) &&
                    ((level < 0) || (level > 7)))
                        return -EINVAL;
 
@@ -2173,14 +2174,14 @@ static int fan_set_enable(void)
        int rc;
 
        switch (fan_control_access_mode) {
-       case IBMACPI_FAN_WR_ACPI_FANS:
-       case IBMACPI_FAN_WR_TPEC:
+       case TPACPI_FAN_WR_ACPI_FANS:
+       case TPACPI_FAN_WR_TPEC:
                if ((rc = fan_get_status(&s)) < 0)
                        return rc;
 
                /* Don't go out of emergency fan mode */
                if (s != 7)
-                       s = IBMACPI_FAN_EC_AUTO;
+                       s = TP_EC_FAN_AUTO;
 
                if (!acpi_ec_write(fan_status_offset, s))
                        return -EIO;
@@ -2188,7 +2189,7 @@ static int fan_set_enable(void)
                        fan_control_status_known = 1;
                break;
 
-       case IBMACPI_FAN_WR_ACPI_SFAN:
+       case TPACPI_FAN_WR_ACPI_SFAN:
                if ((rc = fan_get_status(&s)) < 0)
                        return rc;
 
@@ -2211,15 +2212,15 @@ static int fan_set_enable(void)
 static int fan_set_disable(void)
 {
        switch (fan_control_access_mode) {
-       case IBMACPI_FAN_WR_ACPI_FANS:
-       case IBMACPI_FAN_WR_TPEC:
+       case TPACPI_FAN_WR_ACPI_FANS:
+       case TPACPI_FAN_WR_TPEC:
                if (!acpi_ec_write(fan_status_offset, 0x00))
                        return -EIO;
                else
                        fan_control_status_known = 1;
                break;
 
-       case IBMACPI_FAN_WR_ACPI_SFAN:
+       case TPACPI_FAN_WR_ACPI_SFAN:
                if (!acpi_evalf(sfan_handle, NULL, NULL, "vd", 0x00))
                        return -EIO;
                break;
@@ -2233,7 +2234,7 @@ static int fan_set_disable(void)
 static int fan_set_speed(int speed)
 {
        switch (fan_control_access_mode) {
-       case IBMACPI_FAN_WR_ACPI_FANS:
+       case TPACPI_FAN_WR_ACPI_FANS:
                if (speed >= 0 && speed <= 65535) {
                        if (!acpi_evalf(fans_handle, NULL, NULL, "vddd",
                                        speed, speed, speed))
@@ -2256,7 +2257,7 @@ static int fan_read(char *p)
        unsigned int speed = 0;
 
        switch (fan_status_access_mode) {
-       case IBMACPI_FAN_RD_ACPI_GFAN:
+       case TPACPI_FAN_RD_ACPI_GFAN:
                /* 570, 600e/x, 770e, 770x */
                if ((rc = fan_get_status(&status)) < 0)
                        return rc;
@@ -2266,7 +2267,7 @@ static int fan_read(char *p)
                               (status != 0) ? "enabled" : "disabled", status);
                break;
 
-       case IBMACPI_FAN_RD_TPEC:
+       case TPACPI_FAN_RD_TPEC:
                /* all except 570, 600e/x, 770e, 770x */
                if ((rc = fan_get_status(&status)) < 0)
                        return rc;
@@ -2277,39 +2278,36 @@ static int fan_read(char *p)
                        else
                                /* Return most likely status. In fact, it
                                 * might be the only possible status */
-                               status = IBMACPI_FAN_EC_AUTO;
+                               status = TP_EC_FAN_AUTO;
                }
 
                len += sprintf(p + len, "status:\t\t%s\n",
                               (status != 0) ? "enabled" : "disabled");
 
-               /* No ThinkPad boots on disengaged mode, we can safely
-                * assume the tachometer is online if fan control status
-                * was unknown */
                if ((rc = fan_get_speed(&speed)) < 0)
                        return rc;
 
                len += sprintf(p + len, "speed:\t\t%d\n", speed);
 
-               if (status & IBMACPI_FAN_EC_DISENGAGED)
+               if (status & TP_EC_FAN_FULLSPEED)
                        /* Disengaged mode takes precedence */
                        len += sprintf(p + len, "level:\t\tdisengaged\n");
-               else if (status & IBMACPI_FAN_EC_AUTO)
+               else if (status & TP_EC_FAN_AUTO)
                        len += sprintf(p + len, "level:\t\tauto\n");
                else
                        len += sprintf(p + len, "level:\t\t%d\n", status);
                break;
 
-       case IBMACPI_FAN_NONE:
+       case TPACPI_FAN_NONE:
        default:
                len += sprintf(p + len, "status:\t\tnot supported\n");
        }
 
-       if (fan_control_commands & IBMACPI_FAN_CMD_LEVEL) {
+       if (fan_control_commands & TPACPI_FAN_CMD_LEVEL) {
                len += sprintf(p + len, "commands:\tlevel <level>");
 
                switch (fan_control_access_mode) {
-               case IBMACPI_FAN_WR_ACPI_SFAN:
+               case TPACPI_FAN_WR_ACPI_SFAN:
                        len += sprintf(p + len, " (<level> is 0-7)\n");
                        break;
 
@@ -2320,12 +2318,12 @@ static int fan_read(char *p)
                }
        }
 
-       if (fan_control_commands & IBMACPI_FAN_CMD_ENABLE)
+       if (fan_control_commands & TPACPI_FAN_CMD_ENABLE)
                len += sprintf(p + len, "commands:\tenable, disable\n"
                               "commands:\twatchdog <timeout> (<timeout> is 0 (off), "
                               "1-120 (seconds))\n");
 
-       if (fan_control_commands & IBMACPI_FAN_CMD_SPEED)
+       if (fan_control_commands & TPACPI_FAN_CMD_SPEED)
                len += sprintf(p + len, "commands:\tspeed <speed>"
                               " (<speed> is 0-65535)\n");
 
@@ -2337,9 +2335,9 @@ static int fan_write_cmd_level(const char *cmd, int *rc)
        int level;
 
        if (strlencmp(cmd, "level auto") == 0)
-               level = IBMACPI_FAN_EC_AUTO;
+               level = TP_EC_FAN_AUTO;
        else if (strlencmp(cmd, "level disengaged") == 0)
-               level = IBMACPI_FAN_EC_DISENGAGED;
+               level = TP_EC_FAN_FULLSPEED;
        else if (sscanf(cmd, "level %d", &level) != 1)
                return 0;
 
@@ -2412,13 +2410,13 @@ static int fan_write(char *buf)
        int rc = 0;
 
        while (!rc && (cmd = next_cmd(&buf))) {
-               if (!((fan_control_commands & IBMACPI_FAN_CMD_LEVEL) &&
+               if (!((fan_control_commands & TPACPI_FAN_CMD_LEVEL) &&
                      fan_write_cmd_level(cmd, &rc)) &&
-                   !((fan_control_commands & IBMACPI_FAN_CMD_ENABLE) &&
+                   !((fan_control_commands & TPACPI_FAN_CMD_ENABLE) &&
                      (fan_write_cmd_enable(cmd, &rc) ||
                       fan_write_cmd_disable(cmd, &rc) ||
                       fan_write_cmd_watchdog(cmd, &rc))) &&
-                   !((fan_control_commands & IBMACPI_FAN_CMD_SPEED) &&
+                   !((fan_control_commands & TPACPI_FAN_CMD_SPEED) &&
                      fan_write_cmd_speed(cmd, &rc))
                    )
                        rc = -EINVAL;
@@ -2686,6 +2684,9 @@ static int __init set_ibm_param(const char *val, struct kernel_param *kp)
 static int experimental;
 module_param(experimental, int, 0);
 
+static u32 dbg_level;
+module_param_named(debug, dbg_level, uint, 0);
+
 #define IBM_PARAM(feature) \
        module_param_call(feature, set_ibm_param, NULL, NULL, 0)
 
@@ -2707,7 +2708,7 @@ IBM_PARAM(brightness);
 IBM_PARAM(volume);
 IBM_PARAM(fan);
 
-static int __init acpi_ibm_init(void)
+static int __init thinkpad_acpi_module_init(void)
 {
        int ret, i;
 
@@ -2754,7 +2755,7 @@ static int __init acpi_ibm_init(void)
        proc_dir = proc_mkdir(IBM_DIR, acpi_root_dir);
        if (!proc_dir) {
                printk(IBM_ERR "unable to create proc dir %s", IBM_DIR);
-               acpi_ibm_exit();
+               thinkpad_acpi_module_exit();
                return -ENODEV;
        }
        proc_dir->owner = THIS_MODULE;
@@ -2764,7 +2765,7 @@ static int __init acpi_ibm_init(void)
                if (ret >= 0 && *ibms[i].param)
                        ret = ibms[i].write(ibms[i].param);
                if (ret < 0) {
-                       acpi_ibm_exit();
+                       thinkpad_acpi_module_exit();
                        return ret;
                }
        }
@@ -2772,7 +2773,7 @@ static int __init acpi_ibm_init(void)
        return 0;
 }
 
-static void acpi_ibm_exit(void)
+static void thinkpad_acpi_module_exit(void)
 {
        int i;
 
@@ -2786,5 +2787,5 @@ static void acpi_ibm_exit(void)
                kfree(ibm_thinkpad_ec_found);
 }
 
-module_init(acpi_ibm_init);
-module_exit(acpi_ibm_exit);
+module_init(thinkpad_acpi_module_init);
+module_exit(thinkpad_acpi_module_exit);