Commit 8967788d authored by Stelian Pop's avatar Stelian Pop Committed by Linus Torvalds

[PATCH] sonypi driver update

This little patch changes the way button release events are reported
by the sonypi driver to the application: previously, separate
release events were detected for each button. However, many buttons
(example: the jogdial, the capture button, the back button etc) share
the same release event.

The attached patch propagates a single 'ANYBUTTON_RELEASED' event
to the userspace, leaving all state machine intelligence to the
application.

Kunihiko IMAI should be credited for his ideas and tests.
parent 1eebea60
...@@ -714,11 +714,11 @@ static int __devinit sonypi_probe(struct pci_dev *pcidev) { ...@@ -714,11 +714,11 @@ static int __devinit sonypi_probe(struct pci_dev *pcidev) {
SONYPI_DRIVER_MAJORVERSION, SONYPI_DRIVER_MAJORVERSION,
SONYPI_DRIVER_MINORVERSION); SONYPI_DRIVER_MINORVERSION);
printk(KERN_INFO "sonypi: detected %s model, " printk(KERN_INFO "sonypi: detected %s model, "
"verbose = %s, fnkeyinit = %s, camera = %s, " "verbose = %d, fnkeyinit = %s, camera = %s, "
"compat = %s, mask = 0x%08lx\n", "compat = %s, mask = 0x%08lx\n",
(sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE1) ? (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE1) ?
"type1" : "type2", "type1" : "type2",
verbose ? "on" : "off", verbose,
fnkeyinit ? "on" : "off", fnkeyinit ? "on" : "off",
camera ? "on" : "off", camera ? "on" : "off",
compat ? "on" : "off", compat ? "on" : "off",
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#define SONYPI_DRIVER_MAJORVERSION 1 #define SONYPI_DRIVER_MAJORVERSION 1
#define SONYPI_DRIVER_MINORVERSION 16 #define SONYPI_DRIVER_MINORVERSION 17
#define SONYPI_DEVICE_MODEL_TYPE1 1 #define SONYPI_DEVICE_MODEL_TYPE1 1
#define SONYPI_DEVICE_MODEL_TYPE2 2 #define SONYPI_DEVICE_MODEL_TYPE2 2
...@@ -171,6 +171,13 @@ struct sonypi_event { ...@@ -171,6 +171,13 @@ struct sonypi_event {
u8 data; u8 data;
u8 event; u8 event;
}; };
/* The set of possible button release events */
static struct sonypi_event sonypi_releaseev[] = {
{ 0x00, SONYPI_EVENT_ANYBUTTON_RELEASED },
{ 0, 0 }
};
/* The set of possible jogger events */ /* The set of possible jogger events */
static struct sonypi_event sonypi_joggerev[] = { static struct sonypi_event sonypi_joggerev[] = {
{ 0x1f, SONYPI_EVENT_JOGDIAL_UP }, { 0x1f, SONYPI_EVENT_JOGDIAL_UP },
...@@ -186,7 +193,6 @@ static struct sonypi_event sonypi_joggerev[] = { ...@@ -186,7 +193,6 @@ static struct sonypi_event sonypi_joggerev[] = {
{ 0x5d, SONYPI_EVENT_JOGDIAL_VFAST_UP_PRESSED }, { 0x5d, SONYPI_EVENT_JOGDIAL_VFAST_UP_PRESSED },
{ 0x43, SONYPI_EVENT_JOGDIAL_VFAST_DOWN_PRESSED }, { 0x43, SONYPI_EVENT_JOGDIAL_VFAST_DOWN_PRESSED },
{ 0x40, SONYPI_EVENT_JOGDIAL_PRESSED }, { 0x40, SONYPI_EVENT_JOGDIAL_PRESSED },
{ 0x00, SONYPI_EVENT_JOGDIAL_RELEASED },
{ 0, 0 } { 0, 0 }
}; };
...@@ -195,7 +201,6 @@ static struct sonypi_event sonypi_captureev[] = { ...@@ -195,7 +201,6 @@ static struct sonypi_event sonypi_captureev[] = {
{ 0x05, SONYPI_EVENT_CAPTURE_PARTIALPRESSED }, { 0x05, SONYPI_EVENT_CAPTURE_PARTIALPRESSED },
{ 0x07, SONYPI_EVENT_CAPTURE_PRESSED }, { 0x07, SONYPI_EVENT_CAPTURE_PRESSED },
{ 0x01, SONYPI_EVENT_CAPTURE_PARTIALRELEASED }, { 0x01, SONYPI_EVENT_CAPTURE_PARTIALRELEASED },
{ 0x00, SONYPI_EVENT_CAPTURE_RELEASED },
{ 0, 0 } { 0, 0 }
}; };
...@@ -293,6 +298,7 @@ struct sonypi_eventtypes { ...@@ -293,6 +298,7 @@ struct sonypi_eventtypes {
unsigned long mask; unsigned long mask;
struct sonypi_event * events; struct sonypi_event * events;
} sonypi_eventtypes[] = { } sonypi_eventtypes[] = {
{ SONYPI_DEVICE_MODEL_TYPE1, 0, 0xffffffff, sonypi_releaseev },
{ SONYPI_DEVICE_MODEL_TYPE1, 0x70, SONYPI_MEYE_MASK, sonypi_meyeev }, { SONYPI_DEVICE_MODEL_TYPE1, 0x70, SONYPI_MEYE_MASK, sonypi_meyeev },
{ SONYPI_DEVICE_MODEL_TYPE1, 0x30, SONYPI_LID_MASK, sonypi_lidev }, { SONYPI_DEVICE_MODEL_TYPE1, 0x30, SONYPI_LID_MASK, sonypi_lidev },
{ SONYPI_DEVICE_MODEL_TYPE1, 0x60, SONYPI_CAPTURE_MASK, sonypi_captureev }, { SONYPI_DEVICE_MODEL_TYPE1, 0x60, SONYPI_CAPTURE_MASK, sonypi_captureev },
...@@ -301,6 +307,7 @@ struct sonypi_eventtypes { ...@@ -301,6 +307,7 @@ struct sonypi_eventtypes {
{ SONYPI_DEVICE_MODEL_TYPE1, 0x30, SONYPI_BLUETOOTH_MASK, sonypi_blueev }, { SONYPI_DEVICE_MODEL_TYPE1, 0x30, SONYPI_BLUETOOTH_MASK, sonypi_blueev },
{ SONYPI_DEVICE_MODEL_TYPE1, 0x40, SONYPI_PKEY_MASK, sonypi_pkeyev }, { SONYPI_DEVICE_MODEL_TYPE1, 0x40, SONYPI_PKEY_MASK, sonypi_pkeyev },
{ SONYPI_DEVICE_MODEL_TYPE2, 0, 0xffffffff, sonypi_releaseev },
{ SONYPI_DEVICE_MODEL_TYPE2, 0x38, SONYPI_LID_MASK, sonypi_lidev }, { SONYPI_DEVICE_MODEL_TYPE2, 0x38, SONYPI_LID_MASK, sonypi_lidev },
{ SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_JOGGER_MASK, sonypi_joggerev }, { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_JOGGER_MASK, sonypi_joggerev },
{ SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_CAPTURE_MASK, sonypi_captureev }, { SONYPI_DEVICE_MODEL_TYPE2, 0x08, SONYPI_CAPTURE_MASK, sonypi_captureev },
......
...@@ -43,9 +43,9 @@ ...@@ -43,9 +43,9 @@
#define SONYPI_EVENT_JOGDIAL_DOWN_PRESSED 3 #define SONYPI_EVENT_JOGDIAL_DOWN_PRESSED 3
#define SONYPI_EVENT_JOGDIAL_UP_PRESSED 4 #define SONYPI_EVENT_JOGDIAL_UP_PRESSED 4
#define SONYPI_EVENT_JOGDIAL_PRESSED 5 #define SONYPI_EVENT_JOGDIAL_PRESSED 5
#define SONYPI_EVENT_JOGDIAL_RELEASED 6 #define SONYPI_EVENT_JOGDIAL_RELEASED 6 /* obsolete */
#define SONYPI_EVENT_CAPTURE_PRESSED 7 #define SONYPI_EVENT_CAPTURE_PRESSED 7
#define SONYPI_EVENT_CAPTURE_RELEASED 8 #define SONYPI_EVENT_CAPTURE_RELEASED 8 /* obsolete */
#define SONYPI_EVENT_CAPTURE_PARTIALPRESSED 9 #define SONYPI_EVENT_CAPTURE_PARTIALPRESSED 9
#define SONYPI_EVENT_CAPTURE_PARTIALRELEASED 10 #define SONYPI_EVENT_CAPTURE_PARTIALRELEASED 10
#define SONYPI_EVENT_FNKEY_ESC 11 #define SONYPI_EVENT_FNKEY_ESC 11
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
#define SONYPI_EVENT_MEYE_OPPOSITE 53 #define SONYPI_EVENT_MEYE_OPPOSITE 53
#define SONYPI_EVENT_MEMORYSTICK_INSERT 54 #define SONYPI_EVENT_MEMORYSTICK_INSERT 54
#define SONYPI_EVENT_MEMORYSTICK_EJECT 55 #define SONYPI_EVENT_MEMORYSTICK_EJECT 55
#define SONYPI_EVENT_ANYBUTTON_RELEASED 56
/* get/set brightness */ /* get/set brightness */
#define SONYPI_IOCGBRT _IOR('v', 0, __u8) #define SONYPI_IOCGBRT _IOR('v', 0, __u8)
......
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