acpi_ibm(4): Add support for putting fans in disengaged mode.
PR: 247306 Submitted by: Ali Abdallah <ali.abdallah@suse.com> MFC after: 2 weeks
This commit is contained in:
parent
2abf05c4c6
commit
9f763f0092
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=362496
@ -25,7 +25,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd June 19, 2015
|
.Dd June 19, 2020
|
||||||
.Dt ACPI_IBM 4
|
.Dt ACPI_IBM 4
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -292,7 +292,12 @@ fan control might overheat the ThinkPad and lead to permanent damage if the
|
|||||||
is not set accordingly.
|
is not set accordingly.
|
||||||
.It Va dev.acpi_ibm.0.fan_level
|
.It Va dev.acpi_ibm.0.fan_level
|
||||||
Indicates at what speed the fan should run when being in manual mode.
|
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.
|
The resulting speed differs from model to model.
|
||||||
On a T41p this is as follows:
|
On a T41p this is as follows:
|
||||||
.Pp
|
.Pp
|
||||||
@ -305,6 +310,8 @@ off
|
|||||||
~3600 RPM
|
~3600 RPM
|
||||||
.It Li 6, 7
|
.It Li 6, 7
|
||||||
~4300 RPM
|
~4300 RPM
|
||||||
|
.It Li 8
|
||||||
|
~6400 RPM (Full-speed, disengaged)
|
||||||
.El
|
.El
|
||||||
.It Va dev.acpi_ibm.0.fan_speed
|
.It Va dev.acpi_ibm.0.fan_speed
|
||||||
(read-only)
|
(read-only)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
* Copyright (c) 2004 Takanori Watanabe
|
* Copyright (c) 2004 Takanori Watanabe
|
||||||
* Copyright (c) 2005 Markus Brueffer <markus@FreeBSD.org>
|
* Copyright (c) 2005 Markus Brueffer <markus@FreeBSD.org>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright (c) 2020 Ali Abdallah <ali.abdallah@suse.com>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@ -263,7 +264,8 @@ static struct {
|
|||||||
{
|
{
|
||||||
.name = "fan_level",
|
.name = "fan_level",
|
||||||
.method = ACPI_IBM_METHOD_FANLEVEL,
|
.method = ACPI_IBM_METHOD_FANLEVEL,
|
||||||
.description = "Fan level",
|
.description = "Fan level, 0-7 (recommended max), "
|
||||||
|
"8 (disengaged, full-speed)",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "fan",
|
.name = "fan",
|
||||||
@ -829,7 +831,10 @@ acpi_ibm_sysctl_get(struct acpi_ibm_softc *sc, int method)
|
|||||||
*/
|
*/
|
||||||
if (!sc->fan_handle) {
|
if (!sc->fan_handle) {
|
||||||
ACPI_EC_READ(sc->ec_dev, IBM_EC_FANSTATUS, &val_ec, 1);
|
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;
|
break;
|
||||||
|
|
||||||
@ -912,15 +917,23 @@ acpi_ibm_sysctl_set(struct acpi_ibm_softc *sc, int method, int arg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_IBM_METHOD_FANLEVEL:
|
case ACPI_IBM_METHOD_FANLEVEL:
|
||||||
if (arg < 0 || arg > 7)
|
if (arg < 0 || arg > 8)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
||||||
if (!sc->fan_handle) {
|
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);
|
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;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user