diff --git a/share/man/man4/acpi_ibm.4 b/share/man/man4/acpi_ibm.4 index 87ecb4157fcf..0ba5c67afb80 100644 --- a/share/man/man4/acpi_ibm.4 +++ b/share/man/man4/acpi_ibm.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 19, 2015 +.Dd June 19, 2020 .Dt ACPI_IBM 4 .Os .Sh NAME @@ -292,7 +292,12 @@ fan control might overheat the ThinkPad and lead to permanent damage if the is not set accordingly. .It Va dev.acpi_ibm.0.fan_level Indicates at what speed the fan should run when being in manual mode. -Values are ranging from 0 (off) to 7 (max). +Valid values range from 0 (off) to 7 (max) and 8. +Level 8 is used by the driver to set the fan in disengaged mode. +In this mode, the fan is set to spin freely and will quickly reach a very +high speed. +Use this mode only if absolutely necessary, e.g., if the system has reached its +critical temperature and it is about to shut down. The resulting speed differs from model to model. On a T41p this is as follows: .Pp @@ -305,6 +310,8 @@ off ~3600 RPM .It Li 6, 7 ~4300 RPM +.It Li 8 +~6400 RPM (Full-speed, disengaged) .El .It Va dev.acpi_ibm.0.fan_speed (read-only) diff --git a/sys/dev/acpi_support/acpi_ibm.c b/sys/dev/acpi_support/acpi_ibm.c index 9ec9f7e84c94..256940e094a8 100644 --- a/sys/dev/acpi_support/acpi_ibm.c +++ b/sys/dev/acpi_support/acpi_ibm.c @@ -2,6 +2,7 @@ * Copyright (c) 2004 Takanori Watanabe * Copyright (c) 2005 Markus Brueffer * All rights reserved. + * Copyright (c) 2020 Ali Abdallah * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -263,7 +264,8 @@ static struct { { .name = "fan_level", .method = ACPI_IBM_METHOD_FANLEVEL, - .description = "Fan level", + .description = "Fan level, 0-7 (recommended max), " + "8 (disengaged, full-speed)", }, { .name = "fan", @@ -829,7 +831,10 @@ acpi_ibm_sysctl_get(struct acpi_ibm_softc *sc, int method) */ if (!sc->fan_handle) { ACPI_EC_READ(sc->ec_dev, IBM_EC_FANSTATUS, &val_ec, 1); - val = val_ec & IBM_EC_MASK_FANLEVEL; + if (val_ec & IBM_EC_MASK_FANDISENGAGED) + val = 8; + else + val = val_ec & IBM_EC_MASK_FANLEVEL; } break; @@ -912,15 +917,23 @@ acpi_ibm_sysctl_set(struct acpi_ibm_softc *sc, int method, int arg) break; case ACPI_IBM_METHOD_FANLEVEL: - if (arg < 0 || arg > 7) + if (arg < 0 || arg > 8) return (EINVAL); if (!sc->fan_handle) { - /* Read the current fanstatus */ + /* Read the current fan status. */ ACPI_EC_READ(sc->ec_dev, IBM_EC_FANSTATUS, &val_ec, 1); - val = val_ec & (~IBM_EC_MASK_FANLEVEL); + val = val_ec & ~(IBM_EC_MASK_FANLEVEL | + IBM_EC_MASK_FANDISENGAGED); - return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_FANSTATUS, val | arg, 1); + if (arg == 8) + /* Full speed, set the disengaged bit. */ + val |= 7 | IBM_EC_MASK_FANDISENGAGED; + else + val |= arg; + + return (ACPI_EC_WRITE(sc->ec_dev, IBM_EC_FANSTATUS, val, + 1)); } break;