Commit 05d19498 authored by Stelian Pop's avatar Stelian Pop Committed by Linus Torvalds

[PATCH] sonypi: add fan and temperature status/control

1. FAN Status/Control: you can now get the fan status (running or not) and
   also set the fan speed (for <5 seconds only). The problem is that there
   is an auto regulator that kicks in within about 5 seconds after that to
   restart the fan if it is above a threshold temperature (39 Degree C in
   my Vaio). It is useful just to get the fan status (primarily). It also
   appears that you can change the speed by increasing the values (much
   like the LCD control) - there are effectively only about 6 speeds (it
   seems - not sure, but from what I've played with on my Vaio).

2. Temperature: you can get the current temperature (same as reported by
   ACPI). This is primarily useful for APM users (since ACPI already gives
   this). I have used this to detect when the fan comes on in my Vaio (39
   Degree C).

From: Narayanan R S <nars@kadamba.org>
Signed-off-by: default avatarStelian Pop <stelian@popies.net>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3b2d3681
......@@ -3,6 +3,8 @@
*
* Copyright (C) 2001-2005 Stelian Pop <stelian@popies.net>
*
* Copyright (C) 2005 Narayanan R S <nars@kadamba.org>
*
* Copyright (C) 2001-2002 Alcve <www.alcove.com>
*
* Copyright (C) 2001 Michael Ashley <m.ashley@unsw.edu.au>
......@@ -126,6 +128,10 @@ MODULE_PARM_DESC(useinput,
#define SONYPI_BAT2_MAXTK 0xb8
#define SONYPI_BAT2_FULL 0xba
/* FAN0 information (reverse engineered from ACPI tables) */
#define SONYPI_FAN0_STATUS 0x93
#define SONYPI_TEMP_STATUS 0xC1
/* ioports used for brightness and type2 events */
#define SONYPI_DATA_IOPORT 0x62
#define SONYPI_CST_IOPORT 0x66
......@@ -1009,6 +1015,32 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
}
sonypi_setbluetoothpower(val8);
break;
/* FAN Controls */
case SONYPI_IOCGFAN:
if (sonypi_ec_read(SONYPI_FAN0_STATUS, &val8)) {
ret = -EIO;
break;
}
if (copy_to_user((u8 *)arg, &val8, sizeof(val8)))
ret = -EFAULT;
break;
case SONYPI_IOCSFAN:
if (copy_from_user(&val8, (u8 *)arg, sizeof(val8))) {
ret = -EFAULT;
break;
}
if (sonypi_ec_write(SONYPI_FAN0_STATUS, val8))
ret = -EIO;
break;
/* GET Temperature (useful under APM) */
case SONYPI_IOCGTEMP:
if (sonypi_ec_read(SONYPI_TEMP_STATUS, &val8)) {
ret = -EIO;
break;
}
if (copy_to_user((u8 *)arg, &val8, sizeof(val8)))
ret = -EFAULT;
break;
default:
ret = -EINVAL;
}
......
/*
* Sony Programmable I/O Control Device driver for VAIO
*
* Copyright (C) 2001-2004 Stelian Pop <stelian@popies.net>
* Copyright (C) 2001-2005 Stelian Pop <stelian@popies.net>
*
* Copyright (C) 2005 Narayanan R S <nars@kadamba.org>
* Copyright (C) 2001-2002 Alcve <www.alcove.com>
*
* Copyright (C) 2001 Michael Ashley <m.ashley@unsw.edu.au>
......@@ -118,6 +120,13 @@
#define SONYPI_IOCGBLUE _IOR('v', 8, __u8)
#define SONYPI_IOCSBLUE _IOW('v', 9, __u8)
/* get/set fan state on/off */
#define SONYPI_IOCGFAN _IOR('v', 10, __u8)
#define SONYPI_IOCSFAN _IOW('v', 11, __u8)
/* get temperature (C) */
#define SONYPI_IOCGTEMP _IOR('v', 12, __u8)
#ifdef __KERNEL__
/* used only for communication between v4l and sonypi */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment