diff options
-rw-r--r-- | 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 a4d7ee472396..79abc6841e30 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -3185,6 +3185,13 @@ static int fan_set_level(int level) | |||
3185 | ((level < 0) || (level > 7))) | 3185 | ((level < 0) || (level > 7))) |
3186 | return -EINVAL; | 3186 | return -EINVAL; |
3187 | 3187 | ||
3188 | /* safety net should the EC not support AUTO | ||
3189 | * or FULLSPEED mode bits and just ignore them */ | ||
3190 | if (level & TP_EC_FAN_FULLSPEED) | ||
3191 | level |= 7; /* safety min speed 7 */ | ||
3192 | else if (level & TP_EC_FAN_FULLSPEED) | ||
3193 | level |= 4; /* safety min speed 4 */ | ||
3194 | |||
3188 | if (!acpi_ec_write(fan_status_offset, level)) | 3195 | if (!acpi_ec_write(fan_status_offset, level)) |
3189 | return -EIO; | 3196 | return -EIO; |
3190 | else | 3197 | else |
@@ -3233,8 +3240,10 @@ static int fan_set_enable(void) | |||
3233 | break; | 3240 | break; |
3234 | 3241 | ||
3235 | /* Don't go out of emergency fan mode */ | 3242 | /* Don't go out of emergency fan mode */ |
3236 | if (s != 7) | 3243 | if (s != 7) { |
3237 | s = TP_EC_FAN_AUTO; | 3244 | s &= 0x07; |
3245 | s |= TP_EC_FAN_AUTO | 4; /* min fan speed 4 */ | ||
3246 | } | ||
3238 | 3247 | ||
3239 | if (!acpi_ec_write(fan_status_offset, s)) | 3248 | if (!acpi_ec_write(fan_status_offset, s)) |
3240 | rc = -EIO; | 3249 | rc = -EIO; |
@@ -3252,8 +3261,7 @@ static int fan_set_enable(void) | |||
3252 | s &= 0x07; | 3261 | s &= 0x07; |
3253 | 3262 | ||
3254 | /* Set fan to at least level 4 */ | 3263 | /* Set fan to at least level 4 */ |
3255 | if (s < 4) | 3264 | s |= 4; |
3256 | s = 4; | ||
3257 | 3265 | ||
3258 | if (!acpi_evalf(sfan_handle, NULL, NULL, "vd", s)) | 3266 | if (!acpi_evalf(sfan_handle, NULL, NULL, "vd", s)) |
3259 | rc= -EIO; | 3267 | rc= -EIO; |