Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 44969
b: refs/heads/master
c: 1c6a334
h: refs/heads/master
i:
  44967: 0772551
v: v3
  • Loading branch information
Henrique de Moraes Holschuh authored and Len Brown committed Dec 7, 2006
1 parent 3062264 commit 20f36ab
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bab812a329cc244ca63c2675b0e05016518855ce
refs/heads/master: 1c6a334e9c028c2b72c5350650cb14e6d5fdc232
34 changes: 32 additions & 2 deletions trunk/drivers/acpi/ibm_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1820,7 +1820,8 @@ static int fan_init(void)
if (sfan_handle) {
/* 570, 770x-JL */
fan_control_access_mode = IBMACPI_FAN_WR_ACPI_SFAN;
fan_control_commands |= IBMACPI_FAN_CMD_LEVEL;
fan_control_commands |=
IBMACPI_FAN_CMD_LEVEL | IBMACPI_FAN_CMD_ENABLE;
} else {
if (!gfan_handle) {
/* gfan without sfan means no fan control */
Expand Down Expand Up @@ -1980,10 +1981,34 @@ static int fan_set_level(int level)

static int fan_set_enable(void)
{
u8 s;
int rc;

switch (fan_control_access_mode) {
case IBMACPI_FAN_WR_ACPI_FANS:
case IBMACPI_FAN_WR_TPEC:
if (!acpi_ec_write(fan_status_offset, 0x80))
if ((rc = fan_get_status(&s)) < 0)
return rc;

/* Don't go out of emergency fan mode */
if (s != 7)
s = IBMACPI_FAN_EC_AUTO;

if (!acpi_ec_write(fan_status_offset, s))
return -EIO;
break;

case IBMACPI_FAN_WR_ACPI_SFAN:
if ((rc = fan_get_status(&s)) < 0)
return rc;

s &= 0x07;

/* Set fan to at least level 4 */
if (s < 4)
s = 4;

if (!acpi_evalf(sfan_handle, NULL, NULL, "vd", s))
return -EIO;
break;

Expand All @@ -2002,6 +2027,11 @@ static int fan_set_disable(void)
return -EIO;
break;

case IBMACPI_FAN_WR_ACPI_SFAN:
if (!acpi_evalf(sfan_handle, NULL, NULL, "vd", 0x00))
return -EIO;
break;

default:
return -ENXIO;
}
Expand Down

0 comments on commit 20f36ab

Please sign in to comment.