Author: markj Date: Mon Jul 6 13:54:18 2020 New Revision: 362959 URL: https://svnweb.freebsd.org/changeset/base/362959
Log: MFC r362496, r362592: acpi_ibm(4): Add support for putting fans in disengaged mode. PR: 247306 Modified: stable/12/share/man/man4/acpi_ibm.4 stable/12/sys/dev/acpi_support/acpi_ibm.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/acpi_ibm.4 ============================================================================== --- stable/12/share/man/man4/acpi_ibm.4 Mon Jul 6 11:57:59 2020 (r362958) +++ stable/12/share/man/man4/acpi_ibm.4 Mon Jul 6 13:54:18 2020 (r362959) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 19, 2015 +.Dd June 24, 2020 .Dt ACPI_IBM 4 .Os .Sh NAME @@ -289,7 +289,12 @@ fan control might overheat the ThinkPad and lead to pe 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 unthrottled 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 @@ -302,6 +307,8 @@ off ~3600 RPM .It Li 6, 7 ~4300 RPM +.It Li 8 +~6400 RPM (Full-speed, unthrottled) .El .It Va dev.acpi_ibm.0.fan_speed (read-only) Modified: stable/12/sys/dev/acpi_support/acpi_ibm.c ============================================================================== --- stable/12/sys/dev/acpi_support/acpi_ibm.c Mon Jul 6 11:57:59 2020 (r362958) +++ stable/12/sys/dev/acpi_support/acpi_ibm.c Mon Jul 6 13:54:18 2020 (r362959) @@ -2,6 +2,7 @@ * Copyright (c) 2004 Takanori Watanabe * Copyright (c) 2005 Markus Brueffer <mar...@freebsd.org> * All rights reserved. + * Copyright (c) 2020 Ali Abdallah <ali.abdal...@suse.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -105,7 +106,7 @@ ACPI_MODULE_NAME("IBM") #define IBM_EC_MASK_MUTE (1 << 6) #define IBM_EC_FANSTATUS 0x2F #define IBM_EC_MASK_FANLEVEL 0x3f -#define IBM_EC_MASK_FANDISENGAGED (1 << 6) +#define IBM_EC_MASK_FANUNTHROTTLED (1 << 6) #define IBM_EC_MASK_FANSTATUS (1 << 7) #define IBM_EC_FANSPEED 0x84 @@ -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 (unthrottled, full-speed)", }, { .name = "fan", @@ -830,7 +832,10 @@ acpi_ibm_sysctl_get(struct acpi_ibm_softc *sc, int met */ 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_FANUNTHROTTLED) + val = 8; + else + val = val_ec & IBM_EC_MASK_FANLEVEL; } break; @@ -914,15 +919,23 @@ acpi_ibm_sysctl_set(struct acpi_ibm_softc *sc, int met 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_FANUNTHROTTLED); - return ACPI_EC_WRITE(sc->ec_dev, IBM_EC_FANSTATUS, val | arg, 1); + if (arg == 8) + /* Full speed, set the unthrottled bit. */ + val |= 7 | IBM_EC_MASK_FANUNTHROTTLED; + else + val |= arg; + + return (ACPI_EC_WRITE(sc->ec_dev, IBM_EC_FANSTATUS, val, + 1)); } break; _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"