diff options
author | Matthew Garrett <mjg59@srcf.ucam.org> | 2009-03-26 08:58:14 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-03-27 12:18:07 -0400 |
commit | 9b57896e62bfa752ee7435e6cfe57fb210c0db8c (patch) | |
tree | f56a81d1fc8baa4a852b8c75c9a7ac8d9fe730e9 /drivers/platform | |
parent | 82734bfc8622f3e8f015a5783b739739f97f89f9 (diff) |
sony-laptop: Add support for extra keyboard events
The current sony-laptop code assumes that the keyboard event method is
always located at slot 2 in the platform code. Remove this assumption and
add support for some additional hotkeys.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/sony-laptop.c | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 04deed826180..f6cdc8929fd7 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -211,6 +211,7 @@ static int sony_laptop_input_index[] = { | |||
211 | 48, /* 61 SONYPI_EVENT_WIRELESS_OFF */ | 211 | 48, /* 61 SONYPI_EVENT_WIRELESS_OFF */ |
212 | 49, /* 62 SONYPI_EVENT_ZOOM_IN_PRESSED */ | 212 | 49, /* 62 SONYPI_EVENT_ZOOM_IN_PRESSED */ |
213 | 50, /* 63 SONYPI_EVENT_ZOOM_OUT_PRESSED */ | 213 | 50, /* 63 SONYPI_EVENT_ZOOM_OUT_PRESSED */ |
214 | 51, /* 64 SONYPI_EVENT_CD_EJECT_PRESSED */ | ||
214 | }; | 215 | }; |
215 | 216 | ||
216 | static int sony_laptop_input_keycode_map[] = { | 217 | static int sony_laptop_input_keycode_map[] = { |
@@ -264,7 +265,8 @@ static int sony_laptop_input_keycode_map[] = { | |||
264 | KEY_WLAN, /* 47 SONYPI_EVENT_WIRELESS_ON */ | 265 | KEY_WLAN, /* 47 SONYPI_EVENT_WIRELESS_ON */ |
265 | KEY_WLAN, /* 48 SONYPI_EVENT_WIRELESS_OFF */ | 266 | KEY_WLAN, /* 48 SONYPI_EVENT_WIRELESS_OFF */ |
266 | KEY_ZOOMIN, /* 49 SONYPI_EVENT_ZOOM_IN_PRESSED */ | 267 | KEY_ZOOMIN, /* 49 SONYPI_EVENT_ZOOM_IN_PRESSED */ |
267 | KEY_ZOOMOUT /* 50 SONYPI_EVENT_ZOOM_OUT_PRESSED */ | 268 | KEY_ZOOMOUT, /* 50 SONYPI_EVENT_ZOOM_OUT_PRESSED */ |
269 | KEY_EJECTCD /* 51 SONYPI_EVENT_CD_EJECT_PRESSED */ | ||
268 | }; | 270 | }; |
269 | 271 | ||
270 | /* release buttons after a short delay if pressed */ | 272 | /* release buttons after a short delay if pressed */ |
@@ -834,7 +836,11 @@ struct sony_nc_event { | |||
834 | u8 event; | 836 | u8 event; |
835 | }; | 837 | }; |
836 | 838 | ||
837 | static struct sony_nc_event sony_C_events[] = { | 839 | static struct sony_nc_event sony_nc_events[] = { |
840 | { 0x90, SONYPI_EVENT_PKEY_P1 }, | ||
841 | { 0x10, SONYPI_EVENT_ANYBUTTON_RELEASED }, | ||
842 | { 0x91, SONYPI_EVENT_PKEY_P1 }, | ||
843 | { 0x11, SONYPI_EVENT_ANYBUTTON_RELEASED }, | ||
838 | { 0x81, SONYPI_EVENT_FNKEY_F1 }, | 844 | { 0x81, SONYPI_EVENT_FNKEY_F1 }, |
839 | { 0x01, SONYPI_EVENT_FNKEY_RELEASED }, | 845 | { 0x01, SONYPI_EVENT_FNKEY_RELEASED }, |
840 | { 0x85, SONYPI_EVENT_FNKEY_F5 }, | 846 | { 0x85, SONYPI_EVENT_FNKEY_F5 }, |
@@ -843,10 +849,14 @@ static struct sony_nc_event sony_C_events[] = { | |||
843 | { 0x06, SONYPI_EVENT_FNKEY_RELEASED }, | 849 | { 0x06, SONYPI_EVENT_FNKEY_RELEASED }, |
844 | { 0x87, SONYPI_EVENT_FNKEY_F7 }, | 850 | { 0x87, SONYPI_EVENT_FNKEY_F7 }, |
845 | { 0x07, SONYPI_EVENT_FNKEY_RELEASED }, | 851 | { 0x07, SONYPI_EVENT_FNKEY_RELEASED }, |
852 | { 0x89, SONYPI_EVENT_FNKEY_F9 }, | ||
853 | { 0x09, SONYPI_EVENT_FNKEY_RELEASED }, | ||
846 | { 0x8A, SONYPI_EVENT_FNKEY_F10 }, | 854 | { 0x8A, SONYPI_EVENT_FNKEY_F10 }, |
847 | { 0x0A, SONYPI_EVENT_FNKEY_RELEASED }, | 855 | { 0x0A, SONYPI_EVENT_FNKEY_RELEASED }, |
848 | { 0x8C, SONYPI_EVENT_FNKEY_F12 }, | 856 | { 0x8C, SONYPI_EVENT_FNKEY_F12 }, |
849 | { 0x0C, SONYPI_EVENT_FNKEY_RELEASED }, | 857 | { 0x0C, SONYPI_EVENT_FNKEY_RELEASED }, |
858 | { 0x9f, SONYPI_EVENT_CD_EJECT_PRESSED }, | ||
859 | { 0x1f, SONYPI_EVENT_ANYBUTTON_RELEASED }, | ||
850 | { 0, 0 }, | 860 | { 0, 0 }, |
851 | }; | 861 | }; |
852 | 862 | ||
@@ -855,38 +865,33 @@ static struct sony_nc_event sony_C_events[] = { | |||
855 | */ | 865 | */ |
856 | static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) | 866 | static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) |
857 | { | 867 | { |
858 | int i; | ||
859 | u32 ev = event; | 868 | u32 ev = event; |
860 | int result; | 869 | int result; |
861 | 870 | ||
862 | if (ev == 0x92 || ev == 0x90) { | 871 | if (ev >= 0x90) { |
872 | /* New-style event */ | ||
863 | int origev = ev; | 873 | int origev = ev; |
864 | /* read the key pressed from EC.GECR | 874 | ev -= 0x90; |
865 | * A call to SN07 with 0x0202 will do it as well respecting | ||
866 | * the current protocol on different OSes | ||
867 | * | ||
868 | * Note: the path for GECR may be | ||
869 | * \_SB.PCI0.LPCB.EC (C, FE, AR, N and friends) | ||
870 | * \_SB.PCI0.PIB.EC0 (VGN-FR notifications are sent directly, no GECR) | ||
871 | * | ||
872 | * TODO: we may want to do the same for the older GHKE -need | ||
873 | * dmi list- so this snippet may become one more callback. | ||
874 | */ | ||
875 | if (sony_call_snc_handle(0x100, 0x200, &result)) | ||
876 | dprintk("sony_acpi_notify, unable to decode event 0x%.2x\n", ev); | ||
877 | else | ||
878 | ev = result & 0xFF; | ||
879 | 875 | ||
880 | for (i = 0; sony_C_events[i].data; i++) { | 876 | if (sony_find_snc_handle(0x100) == ev) { |
881 | if (sony_C_events[i].data == ev) { | 877 | int i; |
882 | ev = sony_C_events[i].event; | 878 | |
883 | break; | 879 | if (sony_call_snc_handle(0x100, 0x200, &result)) |
880 | dprintk("sony_acpi_notify, unable to decode event 0x%.2x\n", ev); | ||
881 | else | ||
882 | ev = result & 0xFF; | ||
883 | |||
884 | for (i = 0; sony_nc_events[i].event; i++) { | ||
885 | if (sony_nc_events[i].data == ev) { | ||
886 | ev = sony_nc_events[i].event; | ||
887 | break; | ||
888 | } | ||
884 | } | 889 | } |
885 | } | ||
886 | 890 | ||
887 | if (!sony_C_events[i].data) | 891 | if (!sony_nc_events[i].data) |
888 | printk(KERN_INFO DRV_PFX "Unknown event: %x %x\n", | 892 | printk(KERN_INFO DRV_PFX |
889 | origev, ev); | 893 | "Unknown event: %x %x\n", origev, ev); |
894 | } | ||
890 | } | 895 | } |
891 | 896 | ||
892 | dprintk("sony_acpi_notify, event: 0x%.2x\n", ev); | 897 | dprintk("sony_acpi_notify, event: 0x%.2x\n", ev); |