summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorStelian Pop <stelian.pop@fr.alcove.com>2002-10-29 22:59:36 -0800
committerLinus Torvalds <torvalds@penguin.transmeta.com>2002-10-29 22:59:36 -0800
commitaf4d0bf616ac9b79fa52911edb4da9a1ef574550 (patch)
tree1d9215f56f78e645a36ee145478ab088bfc6c788 /drivers
parent0fca836550e270830988f4780fde41675518ec23 (diff)
[PATCH] sonypi driver update
This patch adds some new events to the sonypi driver (Fn key pressed alone, jogdial turned fast or very fast) and cleanups the code a little bit. Thanks to Christian Gennerat for this contribution.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/sonypi.c16
-rw-r--r--drivers/char/sonypi.h28
2 files changed, 34 insertions, 10 deletions
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 80198eb4dfdc..e7b563ebd399 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -1,4 +1,4 @@
-/*
+/*
* Sony Programmable I/O Control Device driver for VAIO
*
* Copyright (C) 2001 Stelian Pop <stelian.pop@fr.alcove.com>, Alcôve
@@ -542,7 +542,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
down(&sonypi_device.lock);
switch (cmd) {
case SONYPI_IOCGBRT:
- val8 = sonypi_ecrget(0x96);
+ val8 = sonypi_ecrget(SONYPI_LCD_LIGHT);
if (copy_to_user((u8 *)arg, &val8, sizeof(val8))) {
ret = -EFAULT;
goto out;
@@ -553,38 +553,38 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
ret = -EFAULT;
goto out;
}
- sonypi_ecrset(0x96, val8);
+ sonypi_ecrset(SONYPI_LCD_LIGHT, val8);
break;
case SONYPI_IOCGBAT1CAP:
- val16 = sonypi_ecrget16(0xb2);
+ val16 = sonypi_ecrget16(SONYPI_BAT1_FULL);
if (copy_to_user((u16 *)arg, &val16, sizeof(val16))) {
ret = -EFAULT;
goto out;
}
break;
case SONYPI_IOCGBAT1REM:
- val16 = sonypi_ecrget16(0xa2);
+ val16 = sonypi_ecrget16(SONYPI_BAT1_LEFT);
if (copy_to_user((u16 *)arg, &val16, sizeof(val16))) {
ret = -EFAULT;
goto out;
}
break;
case SONYPI_IOCGBAT2CAP:
- val16 = sonypi_ecrget16(0xba);
+ val16 = sonypi_ecrget16(SONYPI_BAT2_FULL);
if (copy_to_user((u16 *)arg, &val16, sizeof(val16))) {
ret = -EFAULT;
goto out;
}
break;
case SONYPI_IOCGBAT2REM:
- val16 = sonypi_ecrget16(0xaa);
+ val16 = sonypi_ecrget16(SONYPI_BAT2_LEFT);
if (copy_to_user((u16 *)arg, &val16, sizeof(val16))) {
ret = -EFAULT;
goto out;
}
break;
case SONYPI_IOCGBATFLAGS:
- val8 = sonypi_ecrget(0x81) & 0x07;
+ val8 = sonypi_ecrget(SONYPI_BAT_FLAGS) & 0x07;
if (copy_to_user((u8 *)arg, &val8, sizeof(val8))) {
ret = -EFAULT;
goto out;
diff --git a/drivers/char/sonypi.h b/drivers/char/sonypi.h
index 5b64e7c533dd..25acec82eb0f 100644
--- a/drivers/char/sonypi.h
+++ b/drivers/char/sonypi.h
@@ -35,7 +35,7 @@
#ifdef __KERNEL__
#define SONYPI_DRIVER_MAJORVERSION 1
-#define SONYPI_DRIVER_MINORVERSION 13
+#define SONYPI_DRIVER_MINORVERSION 14
#include <linux/types.h>
#include <linux/pci.h>
@@ -54,6 +54,20 @@
#define SONYPI_SHIB 0x9d
#define SONYPI_TYPE2_REGION_SIZE 0x20
+/* battery / brightness addresses */
+#define SONYPI_BAT_FLAGS 0x81
+#define SONYPI_LCD_LIGHT 0x96
+#define SONYPI_BAT1_PCTRM 0xa0
+#define SONYPI_BAT1_LEFT 0xa2
+#define SONYPI_BAT1_MAXRT 0xa4
+#define SONYPI_BAT2_PCTRM 0xa8
+#define SONYPI_BAT2_LEFT 0xaa
+#define SONYPI_BAT2_MAXRT 0xac
+#define SONYPI_BAT1_MAXTK 0xb0
+#define SONYPI_BAT1_FULL 0xb2
+#define SONYPI_BAT2_MAXTK 0xb8
+#define SONYPI_BAT2_FULL 0xba
+
/* ioports used for brightness and type2 events */
#define SONYPI_DATA_IOPORT 0x62
#define SONYPI_CST_IOPORT 0x66
@@ -156,6 +170,14 @@ static struct sonypi_event sonypi_joggerev[] = {
{ 0x01, SONYPI_EVENT_JOGDIAL_DOWN },
{ 0x5f, SONYPI_EVENT_JOGDIAL_UP_PRESSED },
{ 0x41, SONYPI_EVENT_JOGDIAL_DOWN_PRESSED },
+ { 0x1e, SONYPI_EVENT_JOGDIAL_FAST_UP },
+ { 0x02, SONYPI_EVENT_JOGDIAL_FAST_DOWN },
+ { 0x5e, SONYPI_EVENT_JOGDIAL_FAST_UP_PRESSED },
+ { 0x42, SONYPI_EVENT_JOGDIAL_FAST_DOWN_PRESSED },
+ { 0x1d, SONYPI_EVENT_JOGDIAL_VFAST_UP },
+ { 0x03, SONYPI_EVENT_JOGDIAL_VFAST_DOWN },
+ { 0x5d, SONYPI_EVENT_JOGDIAL_VFAST_UP_PRESSED },
+ { 0x43, SONYPI_EVENT_JOGDIAL_VFAST_DOWN_PRESSED },
{ 0x40, SONYPI_EVENT_JOGDIAL_PRESSED },
{ 0x00, SONYPI_EVENT_JOGDIAL_RELEASED },
{ 0x00, 0x00 }
@@ -192,6 +214,7 @@ static struct sonypi_event sonypi_fnkeyev[] = {
{ 0x33, SONYPI_EVENT_FNKEY_F },
{ 0x34, SONYPI_EVENT_FNKEY_S },
{ 0x35, SONYPI_EVENT_FNKEY_B },
+ { 0x36, SONYPI_EVENT_FNKEY_ONLY },
{ 0x00, 0x00 }
};
@@ -214,6 +237,7 @@ static struct sonypi_event sonypi_blueev[] = {
/* The set of possible back button events */
static struct sonypi_event sonypi_backev[] = {
{ 0x20, SONYPI_EVENT_BACK_PRESSED },
+ { 0x3b, SONYPI_EVENT_HELP_PRESSED },
{ 0x00, 0x00 }
};
@@ -258,7 +282,7 @@ struct sonypi_device {
while (--n && (command)) \
udelay(1); \
if (!n && (verbose || !quiet)) \
- printk(KERN_WARNING "sonypi command failed at %s : %s(line %d)\n", __FILE__, __FUNCTION__, __LINE__); \
+ printk(KERN_WARNING "sonypi command failed at %s : %s (line %d)\n", __FILE__, __FUNCTION__, __LINE__); \
}
#endif /* __KERNEL__ */