aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/ibm_acpi.c
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2006-11-24 08:47:13 -0500
committerLen Brown <len.brown@intel.com>2006-12-07 01:38:43 -0500
commita12095c2b50c8a7c80517e37c00d6e6c863d43c5 (patch)
tree61f17cfdfa283430531e1b4749e2de93b2b0a812 /drivers/acpi/ibm_acpi.c
parent1c6a334e9c028c2b72c5350650cb14e6d5fdc232 (diff)
ACPI: ibm-acpi: fix and extend fan control functions
This patch extend fan control functions, implementing enable/disable for all write access modes, implementing level control for all level-capable write access modes. The patch also updates the documentation, explaining levels auto and disengaged. ABI changes: 1. Support level 0 as an equivalent to disable 2. Add support for level auto and level disengaged when doing EC 0x2f fan control 3. Support enable/disable for all level-based write access modes 4. Add support for level command on FANS thinkpads, as per thinkwiki reports Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Diffstat (limited to 'drivers/acpi/ibm_acpi.c')
-rw-r--r--drivers/acpi/ibm_acpi.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index ecb5ece79a37..4001ad193ddc 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -1833,10 +1833,13 @@ static int fan_init(void)
1833 IBMACPI_FAN_WR_ACPI_FANS; 1833 IBMACPI_FAN_WR_ACPI_FANS;
1834 fan_control_commands |= 1834 fan_control_commands |=
1835 IBMACPI_FAN_CMD_SPEED | 1835 IBMACPI_FAN_CMD_SPEED |
1836 IBMACPI_FAN_CMD_LEVEL |
1836 IBMACPI_FAN_CMD_ENABLE; 1837 IBMACPI_FAN_CMD_ENABLE;
1837 } else { 1838 } else {
1838 fan_control_access_mode = IBMACPI_FAN_WR_TPEC; 1839 fan_control_access_mode = IBMACPI_FAN_WR_TPEC;
1839 fan_control_commands |= IBMACPI_FAN_CMD_ENABLE; 1840 fan_control_commands |=
1841 IBMACPI_FAN_CMD_LEVEL |
1842 IBMACPI_FAN_CMD_ENABLE;
1840 } 1843 }
1841 } 1844 }
1842 } 1845 }
@@ -1948,9 +1951,20 @@ static int fan_read(char *p)
1948 len += sprintf(p + len, "status:\t\tnot supported\n"); 1951 len += sprintf(p + len, "status:\t\tnot supported\n");
1949 } 1952 }
1950 1953
1951 if (fan_control_commands & IBMACPI_FAN_CMD_LEVEL) 1954 if (fan_control_commands & IBMACPI_FAN_CMD_LEVEL) {
1952 len += sprintf(p + len, "commands:\tlevel <level>" 1955 len += sprintf(p + len, "commands:\tlevel <level>");
1953 " (<level> is 0-7)\n"); 1956
1957 switch (fan_control_access_mode) {
1958 case IBMACPI_FAN_WR_ACPI_SFAN:
1959 len += sprintf(p + len, " (<level> is 0-7)\n");
1960 break;
1961
1962 default:
1963 len += sprintf(p + len, " (<level> is 0-7, "
1964 "auto, disengaged)\n");
1965 break;
1966 }
1967 }
1954 1968
1955 if (fan_control_commands & IBMACPI_FAN_CMD_ENABLE) 1969 if (fan_control_commands & IBMACPI_FAN_CMD_ENABLE)
1956 len += sprintf(p + len, "commands:\tenable, disable\n"); 1970 len += sprintf(p + len, "commands:\tenable, disable\n");
@@ -1973,6 +1987,17 @@ static int fan_set_level(int level)
1973 return -EINVAL; 1987 return -EINVAL;
1974 break; 1988 break;
1975 1989
1990 case IBMACPI_FAN_WR_ACPI_FANS:
1991 case IBMACPI_FAN_WR_TPEC:
1992 if ((level != IBMACPI_FAN_EC_AUTO) &&
1993 (level != IBMACPI_FAN_EC_DISENGAGED) &&
1994 ((level < 0) || (level > 7)))
1995 return -EINVAL;
1996
1997 if (!acpi_ec_write(fan_status_offset, level))
1998 return -EIO;
1999 break;
2000
1976 default: 2001 default:
1977 return -ENXIO; 2002 return -ENXIO;
1978 } 2003 }
@@ -2060,7 +2085,11 @@ static int fan_write_cmd_level(const char *cmd, int *rc)
2060{ 2085{
2061 int level; 2086 int level;
2062 2087
2063 if (sscanf(cmd, "level %d", &level) != 1) 2088 if (strlencmp(cmd, "level auto") == 0)
2089 level = IBMACPI_FAN_EC_AUTO;
2090 else if (strlencmp(cmd, "level disengaged") == 0)
2091 level = IBMACPI_FAN_EC_DISENGAGED;
2092 else if (sscanf(cmd, "level %d", &level) != 1)
2064 return 0; 2093 return 0;
2065 2094
2066 if ((*rc = fan_set_level(level)) == -ENXIO) 2095 if ((*rc = fan_set_level(level)) == -ENXIO)