svn commit: r362496 - in head: share/man/man4 sys/dev/acpi_support

Mark Johnston markj at FreeBSD.org
Mon Jun 22 12:36:06 UTC 2020


Author: markj
Date: Mon Jun 22 12:36:05 2020
New Revision: 362496
URL: https://svnweb.freebsd.org/changeset/base/362496

Log:
  acpi_ibm(4): Add support for putting fans in disengaged mode.
  
  PR:		247306
  Submitted by:	Ali Abdallah <ali.abdallah at suse.com>
  MFC after:	2 weeks

Modified:
  head/share/man/man4/acpi_ibm.4
  head/sys/dev/acpi_support/acpi_ibm.c

Modified: head/share/man/man4/acpi_ibm.4
==============================================================================
--- head/share/man/man4/acpi_ibm.4	Mon Jun 22 11:03:36 2020	(r362495)
+++ head/share/man/man4/acpi_ibm.4	Mon Jun 22 12:36:05 2020	(r362496)
@@ -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 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 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)

Modified: head/sys/dev/acpi_support/acpi_ibm.c
==============================================================================
--- head/sys/dev/acpi_support/acpi_ibm.c	Mon Jun 22 11:03:36 2020	(r362495)
+++ head/sys/dev/acpi_support/acpi_ibm.c	Mon Jun 22 12:36:05 2020	(r362496)
@@ -2,6 +2,7 @@
  * Copyright (c) 2004 Takanori Watanabe
  * Copyright (c) 2005 Markus Brueffer <markus at FreeBSD.org>
  * All rights reserved.
+ * Copyright (c) 2020 Ali Abdallah <ali.abdallah at suse.com>
  *
  * 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 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_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 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_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;
 


More information about the svn-src-head mailing list