Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=eaa7571b2d1a08873e4bdd8e6db3431df61cd9ad
Commit:     eaa7571b2d1a08873e4bdd8e6db3431df61cd9ad
Parent:     fe98a52ce7540fb3a19d57488a08864110cf4d5c
Author:     Henrique de Moraes Holschuh <[EMAIL PROTECTED]>
AuthorDate: Tue Apr 24 11:48:18 2007 -0300
Committer:  Len Brown <[EMAIL PROTECTED]>
CommitDate: Wed Apr 25 02:00:27 2007 -0400

    ACPI: thinkpad-acpi: add a safety net for TPEC fan control mode
    
    The Linux ThinkPad community is not positive that all ThinkPads that do
    HFSP EC fan control do implement full-speed and auto modes, some of the
    earlier ones supporting HFSP might not.
    
    If the EC ignores the AUTO or FULL-SPEED bits, it will pay attention to the
    lower three bits that set the fan level.  And as thinkpad-acpi was leaving
    these set to zero, it would stop(!) the fan, which is Not A Good Thing.
    
    So, as a safety net, we now make sure to also set the fan level part of the
    HFSP register to speed 7 for full-speed, and a minimum of speed 4 for auto
    mode.
    
    Signed-off-by: Henrique de Moraes Holschuh <[EMAIL PROTECTED]>
    Signed-off-by: Len Brown <[EMAIL PROTECTED]>
---
 drivers/misc/thinkpad_acpi.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index a4d7ee4..79abc68 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -3185,6 +3185,13 @@ static int fan_set_level(int level)
                    ((level < 0) || (level > 7)))
                        return -EINVAL;
 
+               /* safety net should the EC not support AUTO
+                * or FULLSPEED mode bits and just ignore them */
+               if (level & TP_EC_FAN_FULLSPEED)
+                       level |= 7;     /* safety min speed 7 */
+               else if (level & TP_EC_FAN_FULLSPEED)
+                       level |= 4;     /* safety min speed 4 */
+
                if (!acpi_ec_write(fan_status_offset, level))
                        return -EIO;
                else
@@ -3233,8 +3240,10 @@ static int fan_set_enable(void)
                        break;
 
                /* Don't go out of emergency fan mode */
-               if (s != 7)
-                       s = TP_EC_FAN_AUTO;
+               if (s != 7) {
+                       s &= 0x07;
+                       s |= TP_EC_FAN_AUTO | 4; /* min fan speed 4 */
+               }
 
                if (!acpi_ec_write(fan_status_offset, s))
                        rc = -EIO;
@@ -3252,8 +3261,7 @@ static int fan_set_enable(void)
                s &= 0x07;
 
                /* Set fan to at least level 4 */
-               if (s < 4)
-                       s = 4;
+               s |= 4;
 
                if (!acpi_evalf(sfan_handle, NULL, NULL, "vd", s))
                        rc= -EIO;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to