From: Mattia Dongili <malattia@linux.it>
To: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org, Matthew Garrett <mjg59@srcf.ucam.org>,
Matthew Garrett <mjg@redhat.com>,
Mattia Dongili <malattia@linux.it>
Subject: [PATCH 05/14] sony-laptop: Add support for extended hotkeys
Date: Thu, 26 Mar 2009 21:58:16 +0900 [thread overview]
Message-ID: <1238072305-8085-6-git-send-email-malattia@linux.it> (raw)
In-Reply-To: <1238072305-8085-5-git-send-email-malattia@linux.it>
From: Matthew Garrett <mjg59@srcf.ucam.org>
Recent Sony SR-series machines have an additional set of buttons accessed
via the 0x127 method rather than the 0x100 method. Add support for these.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
---
drivers/platform/x86/sony-laptop.c | 65 +++++++++++++++++++++++++++++-------
include/linux/sonypi.h | 4 ++
2 files changed, 57 insertions(+), 12 deletions(-)
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index f458870..e000c9f 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -226,6 +226,10 @@ static int sony_laptop_input_index[] = {
49, /* 62 SONYPI_EVENT_ZOOM_IN_PRESSED */
50, /* 63 SONYPI_EVENT_ZOOM_OUT_PRESSED */
51, /* 64 SONYPI_EVENT_CD_EJECT_PRESSED */
+ 52, /* 65 SONYPI_EVENT_MODEKEY_PRESSED */
+ 53, /* 66 SONYPI_EVENT_PKEY_P4 */
+ 54, /* 67 SONYPI_EVENT_PKEY_P5 */
+ 55, /* 68 SONYPI_EVENT_SETTINGKEY_PRESSED */
};
static int sony_laptop_input_keycode_map[] = {
@@ -280,7 +284,11 @@ static int sony_laptop_input_keycode_map[] = {
KEY_WLAN, /* 48 SONYPI_EVENT_WIRELESS_OFF */
KEY_ZOOMIN, /* 49 SONYPI_EVENT_ZOOM_IN_PRESSED */
KEY_ZOOMOUT, /* 50 SONYPI_EVENT_ZOOM_OUT_PRESSED */
- KEY_EJECTCD /* 51 SONYPI_EVENT_CD_EJECT_PRESSED */
+ KEY_EJECTCD, /* 51 SONYPI_EVENT_CD_EJECT_PRESSED */
+ KEY_F13, /* 52 SONYPI_EVENT_MODEKEY_PRESSED */
+ KEY_PROG4, /* 53 SONYPI_EVENT_PKEY_P4 */
+ KEY_F14, /* 54 SONYPI_EVENT_PKEY_P5 */
+ KEY_F15, /* 55 SONYPI_EVENT_SETTINGKEY_PRESSED */
};
/* release buttons after a short delay if pressed */
@@ -850,7 +858,7 @@ struct sony_nc_event {
u8 event;
};
-static struct sony_nc_event sony_nc_events[] = {
+static struct sony_nc_event sony_100_events[] = {
{ 0x90, SONYPI_EVENT_PKEY_P1 },
{ 0x10, SONYPI_EVENT_ANYBUTTON_RELEASED },
{ 0x91, SONYPI_EVENT_PKEY_P1 },
@@ -874,6 +882,25 @@ static struct sony_nc_event sony_nc_events[] = {
{ 0, 0 },
};
+static struct sony_nc_event sony_127_events[] = {
+ { 0x81, SONYPI_EVENT_MODEKEY_PRESSED },
+ { 0x01, SONYPI_EVENT_ANYBUTTON_RELEASED },
+ { 0x82, SONYPI_EVENT_PKEY_P1 },
+ { 0x02, SONYPI_EVENT_ANYBUTTON_RELEASED },
+ { 0x83, SONYPI_EVENT_PKEY_P2 },
+ { 0x03, SONYPI_EVENT_ANYBUTTON_RELEASED },
+ { 0x84, SONYPI_EVENT_PKEY_P3 },
+ { 0x04, SONYPI_EVENT_ANYBUTTON_RELEASED },
+ { 0x85, SONYPI_EVENT_PKEY_P4 },
+ { 0x05, SONYPI_EVENT_ANYBUTTON_RELEASED },
+ { 0x86, SONYPI_EVENT_PKEY_P5 },
+ { 0x06, SONYPI_EVENT_ANYBUTTON_RELEASED },
+ { 0x06, SONYPI_EVENT_ANYBUTTON_RELEASED },
+ { 0x87, SONYPI_EVENT_SETTINGKEY_PRESSED },
+ { 0x07, SONYPI_EVENT_ANYBUTTON_RELEASED },
+ { 0, 0 },
+};
+
/*
* ACPI callbacks
*/
@@ -884,27 +911,41 @@ static void sony_acpi_notify(acpi_handle handle, u32 event, void *data)
if (ev >= 0x90) {
/* New-style event */
- int origev = ev;
+ int key_handle = 0;
ev -= 0x90;
- if (sony_find_snc_handle(0x100) == ev) {
- int i;
+ if (sony_find_snc_handle(0x100) == ev)
+ key_handle = 0x100;
+ if (sony_find_snc_handle(0x127) == ev)
+ key_handle = 0x127;
+
+ if (handle) {
+ struct sony_nc_event *key_event;
- if (sony_call_snc_handle(0x100, 0x200, &result))
- dprintk("sony_acpi_notify, unable to decode event 0x%.2x\n", ev);
+ if (sony_call_snc_handle(key_handle, 0x200, &result))
+ dprintk("sony_acpi_notify, unable to decode"
+ " event 0x%.2x 0x%.2x\n", key_handle,
+ ev);
else
ev = result & 0xFF;
- for (i = 0; sony_nc_events[i].event; i++) {
- if (sony_nc_events[i].data == ev) {
- ev = sony_nc_events[i].event;
+ if (key_handle == 0x100)
+ key_event = sony_100_events;
+ else
+ key_event = sony_127_events;
+
+ for (; key_event->data; key_event++) {
+ if (key_event->data == ev) {
+ ev = key_event->event;
break;
}
}
- if (!sony_nc_events[i].data)
+ if (!key_event->data) {
printk(KERN_INFO DRV_PFX
- "Unknown event: %x %x\n", origev, ev);
+ "Unknown event: 0x%x 0x%x\n", key_handle,
+ ev);
+ }
} else if (sony_find_snc_handle(0x124) == ev) {
sony_nc_rfkill_update();
return;
diff --git a/include/linux/sonypi.h b/include/linux/sonypi.h
index 8458dbe..bb83501 100644
--- a/include/linux/sonypi.h
+++ b/include/linux/sonypi.h
@@ -104,6 +104,10 @@
#define SONYPI_EVENT_ZOOM_IN_PRESSED 62
#define SONYPI_EVENT_ZOOM_OUT_PRESSED 63
#define SONYPI_EVENT_CD_EJECT_PRESSED 64
+#define SONYPI_EVENT_MODEKEY_PRESSED 65
+#define SONYPI_EVENT_PKEY_P4 66
+#define SONYPI_EVENT_PKEY_P5 67
+#define SONYPI_EVENT_SETTINGKEY_PRESSED 68
/* get/set brightness */
#define SONYPI_IOCGBRT _IOR('v', 0, __u8)
--
1.6.2
next prev parent reply other threads:[~2009-03-26 12:58 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-26 12:58 [PATCH 0/14] sony-laptop for 2.6.30 Mattia Dongili
2009-03-26 12:58 ` [PATCH 01/14] sony-laptop: Add support for new Sony platform API Mattia Dongili
2009-03-26 12:58 ` [PATCH 02/14] sony-laptop: Enable EC on newer hardware Mattia Dongili
2009-03-26 12:58 ` [PATCH 03/14] sony-laptop: Add support for extra keyboard events Mattia Dongili
2009-03-26 12:58 ` [PATCH 04/14] sony-laptop: Add rfkill support on new models Mattia Dongili
2009-03-26 12:58 ` Mattia Dongili [this message]
2009-03-26 12:58 ` [PATCH 06/14] sony-laptop: merge Type4 into Type3 Mattia Dongili
2009-03-26 12:58 ` [PATCH 07/14] sony-laptop: VGN-A317M hotkey support Mattia Dongili
2009-03-26 12:58 ` [PATCH 08/14] sony-laptop: Eliminate BKL in ioctls Mattia Dongili
2009-03-26 12:58 ` [PATCH 09/14] sony-laptop: detect the ICH9 chipset as Type3 Mattia Dongili
2009-03-26 12:58 ` [PATCH 10/14] sony-laptop: notify the hardware of a state change in wwanpower Mattia Dongili
2009-03-26 12:58 ` [PATCH 11/14] sony-laptop: Add FW specific hotkey events and DMI Mattia Dongili
2009-03-26 12:58 ` [PATCH 12/14] sony-laptop: Make sony_pic_set_wwanpower not take mutexes Mattia Dongili
2009-03-26 12:58 ` [PATCH 13/14] sony-laptop: update copyright Mattia Dongili
2009-03-26 12:58 ` [PATCH 14/14] sony-laptop: Kill the BKL Mattia Dongili
2009-03-26 13:08 ` [PATCH 11/14] sony-laptop: Add FW specific hotkey events and DMI Matthew Garrett
2009-03-26 13:21 ` Mattia Dongili
2009-03-26 13:44 ` [PATCH 11/14 v2] sony-laptop: Add FW specific hotkey events Mattia Dongili
2009-03-27 16:25 ` [PATCH 0/14] sony-laptop for 2.6.30 Len Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1238072305-8085-6-git-send-email-malattia@linux.it \
--to=malattia@linux.it \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=mjg59@srcf.ucam.org \
--cc=mjg@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox