From owner-svn-src-stable@freebsd.org Mon Jul 6 13:54:18 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFAB03686EF; Mon, 6 Jul 2020 13:54:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0n9k63dcz45Bp; Mon, 6 Jul 2020 13:54:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B30ED1F588; Mon, 6 Jul 2020 13:54:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 066DsIqG088791; Mon, 6 Jul 2020 13:54:18 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 066DsIv2088788; Mon, 6 Jul 2020 13:54:18 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202007061354.066DsIv2088788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 6 Jul 2020 13:54:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r362959 - in stable/12: share/man/man4 sys/dev/acpi_support X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/acpi_support X-SVN-Commit-Revision: 362959 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Jul 2020 13:54:19 -0000 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 * 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 @@ -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;