From: Mattia Dongili <malattia@linux.it>
To: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org, Stelian Pop <stelian@popies.net>,
Mattia Dongili <malattia@linux.it>
Subject: [PATCH 3/7] Add support for recent Vaios Fn keys (C series for now)
Date: Mon, 16 Jul 2007 02:34:35 +0900 [thread overview]
Message-ID: <11845208793678-git-send-email-malattia@linux.it> (raw)
In-Reply-To: <11845208793336-git-send-email-malattia@linux.it>
Recent Vaios (C, AR, N, FE) need some special initialization
sequence to enable Fn keys interrupts through the Embedded
Controller. Moreover Fn keys have to be decoded internally
using ACPI methods to get the key code.
Thus a new DMI table to add SNC init time callbacks and new
mappings for model-specific key code to generic sony-laptop
code have been added.
Signed-off-by: Mattia Dongili <malattia@linux.it>
---
drivers/misc/sony-laptop.c | 107 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 104 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 9e27616..ecac39b 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -705,13 +705,107 @@ static struct backlight_ops sony_backlight_ops = {
};
/*
+ * New SNC-only Vaios event mapping to driver known keys
+ */
+struct sony_nc_event {
+ u8 data;
+ u8 event;
+};
+
+static struct sony_nc_event *sony_nc_events;
+
+/* Vaio C* --maybe also FE*, N* and AR* ?-- special init sequence
+ * for Fn keys
+ */
+static int sony_nc_C_enable(struct dmi_system_id *id)
+{
+ int result = 0;
+
+ printk(KERN_NOTICE DRV_PFX "detected %s\n", id->ident);
+
+ sony_nc_events = id->driver_data;
+
+ if (acpi_callsetfunc(sony_nc_acpi_handle, "SN02", 0x4, &result) < 0
+ || acpi_callsetfunc(sony_nc_acpi_handle, "SN07", 0x2, &result) < 0
+ || acpi_callsetfunc(sony_nc_acpi_handle, "SN02", 0x10, &result) < 0
+ || acpi_callsetfunc(sony_nc_acpi_handle, "SN07", 0x0, &result) < 0
+ || acpi_callsetfunc(sony_nc_acpi_handle, "SN03", 0x2, &result) < 0
+ || acpi_callsetfunc(sony_nc_acpi_handle, "SN07", 0x101, &result) < 0) {
+ printk(KERN_WARNING DRV_PFX "failed to initialize SNC, some "
+ "functionalities may be missing\n");
+ return 1;
+ }
+ return 0;
+}
+
+static struct sony_nc_event sony_C_events[] = {
+ { 0x81, SONYPI_EVENT_FNKEY_F1 },
+ { 0x01, SONYPI_EVENT_FNKEY_RELEASED },
+ { 0x85, SONYPI_EVENT_FNKEY_F5 },
+ { 0x05, SONYPI_EVENT_FNKEY_RELEASED },
+ { 0x86, SONYPI_EVENT_FNKEY_F6 },
+ { 0x06, SONYPI_EVENT_FNKEY_RELEASED },
+ { 0x87, SONYPI_EVENT_FNKEY_F7 },
+ { 0x07, SONYPI_EVENT_FNKEY_RELEASED },
+ { 0x8A, SONYPI_EVENT_FNKEY_F10 },
+ { 0x0A, SONYPI_EVENT_FNKEY_RELEASED },
+ { 0x8C, SONYPI_EVENT_FNKEY_F12 },
+ { 0x0C, SONYPI_EVENT_FNKEY_RELEASED },
+ { 0, 0 },
+};
+
+/* SNC-only model map */
+struct dmi_system_id sony_nc_ids[] = {
+ {
+ .ident = "Sony Vaio C Series",
+ .callback = sony_nc_C_enable,
+ .driver_data = sony_C_events,
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "VGN-C"),
+ },
+ },
+ { }
+};
+
+/*
* ACPI callbacks
*/
static void sony_acpi_notify(acpi_handle handle, u32 event, void *data)
{
- dprintk("sony_acpi_notify, event: %d\n", event);
- sony_laptop_report_input_event(event);
- acpi_bus_generate_event(sony_nc_acpi_device, 1, event);
+ struct sony_nc_event *evmap;
+ u32 ev = event;
+ int result;
+
+ if (ev == 0x92) {
+ /* read the key pressed from EC.GECR
+ * A call to SN07 with 0x0202 will do it as well respecting
+ * the current protocol on different OSes
+ *
+ * Note: the path for GECR may be
+ * \_SB.PCI0.LPCB.EC (C, FE, AR, N and friends)
+ * \_SB.PCI0.PIB.EC0 (VGN-FR notifications are sent directly, no GECR)
+ *
+ * TODO: we may want to do the same for the older GHKE -need
+ * dmi list- so this snippet may become one more callback.
+ */
+ if (acpi_callsetfunc(handle, "SN07", 0x0202, &result) < 0)
+ dprintk("sony_acpi_notify, unable to decode event 0x%.2x\n", ev);
+ else
+ ev = result & 0xFF;
+ }
+
+ if (sony_nc_events)
+ for (evmap = sony_nc_events; evmap->event; evmap++) {
+ if (evmap->data == ev) {
+ ev = evmap->event;
+ break;
+ }
+ }
+
+ dprintk("sony_acpi_notify, event: 0x%.2x\n", ev);
+ sony_laptop_report_input_event(ev);
+ acpi_bus_generate_event(sony_nc_acpi_device, 1, ev);
}
static acpi_status sony_walk_callback(acpi_handle handle, u32 level,
@@ -748,6 +842,10 @@ static int sony_nc_resume(struct acpi_device *device)
break;
}
}
+
+ /* re-initialize models with specific requirements */
+ dmi_check_system(sony_nc_ids);
+
return 0;
}
@@ -811,6 +909,9 @@ static int sony_nc_add(struct acpi_device *device)
}
+ /* initialize models with specific requirements */
+ dmi_check_system(sony_nc_ids);
+
result = sony_pf_add();
if (result)
goto outbacklight;
--
1.5.2.3
next prev parent reply other threads:[~2007-07-15 17:34 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-15 17:34 [PATCH 0/7] sony-laptop for 2.6.23 (updated) Mattia Dongili
2007-07-15 17:34 ` [PATCH 1/7] sony-laptop: add new SNC handlers Mattia Dongili
2007-07-15 17:34 ` [PATCH 2/7] sony-laptop: map wireless switch events to KEY_WLAN Mattia Dongili
2007-07-15 17:34 ` Mattia Dongili [this message]
2007-07-15 17:34 ` [PATCH 4/7] Invoke _INI for SNC devices that provide it Mattia Dongili
2007-07-15 17:34 ` [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table Mattia Dongili
2007-07-15 17:34 ` [PATCH 6/7] Add Vaio FE to the special init sequence Mattia Dongili
2007-07-15 17:34 ` [PATCH 7/7] Fix event reading in sony-laptop Mattia Dongili
2007-07-15 21:11 ` [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table Matthew Garrett
2007-07-16 17:06 ` Richard Hughes
2007-07-16 18:09 ` Matthew Garrett
2007-07-17 10:37 ` Richard Hughes
2007-07-17 10:46 ` Matthew Garrett
2007-07-18 11:45 ` Mattia Dongili
2007-07-18 14:28 ` Matthew Garrett
2007-07-18 15:05 ` Dmitry Torokhov
2007-07-18 15:17 ` Richard Hughes
2007-07-18 16:02 ` Dmitry Torokhov
2007-07-18 16:20 ` Richard Hughes
2007-07-18 16:25 ` Matthew Garrett
2007-07-18 16:39 ` Dmitry Torokhov
2007-07-18 16:44 ` Richard Hughes
2007-07-18 16:56 ` Matthew Garrett
2007-07-19 15:51 ` Mattia Dongili
2007-07-16 13:22 ` Dmitry Torokhov
2007-07-18 11:33 ` Mattia Dongili
2007-07-19 17:01 ` Mattia Dongili
2007-07-22 4:36 ` Len Brown
2007-07-18 11:45 ` Mattia Dongili
2007-07-22 4:37 ` [PATCH 0/7] sony-laptop for 2.6.23 (updated) 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=11845208793678-git-send-email-malattia@linux.it \
--to=malattia@linux.it \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=stelian@popies.net \
/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