aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorMatthew Garrett <mjg59@srcf.ucam.org>2009-03-26 08:58:16 -0400
committerLen Brown <len.brown@intel.com>2009-03-27 12:18:30 -0400
commit45c7942ba8f6b7d5d1147c10f84f0cbf5fa3a2b8 (patch)
tree687e01ac22adba1bf3ed8d30e1928468947cdb04 /drivers/platform
parent6cc056bc31ea9910afb01adc0848bb6ae68e0205 (diff)
sony-laptop: Add support for extended hotkeys
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> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/sony-laptop.c65
1 files changed, 53 insertions, 12 deletions
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index f458870c30b6..e000c9f6cdf5 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[] = {
226 49, /* 62 SONYPI_EVENT_ZOOM_IN_PRESSED */ 226 49, /* 62 SONYPI_EVENT_ZOOM_IN_PRESSED */
227 50, /* 63 SONYPI_EVENT_ZOOM_OUT_PRESSED */ 227 50, /* 63 SONYPI_EVENT_ZOOM_OUT_PRESSED */
228 51, /* 64 SONYPI_EVENT_CD_EJECT_PRESSED */ 228 51, /* 64 SONYPI_EVENT_CD_EJECT_PRESSED */
229 52, /* 65 SONYPI_EVENT_MODEKEY_PRESSED */
230 53, /* 66 SONYPI_EVENT_PKEY_P4 */
231 54, /* 67 SONYPI_EVENT_PKEY_P5 */
232 55, /* 68 SONYPI_EVENT_SETTINGKEY_PRESSED */
229}; 233};
230 234
231static int sony_laptop_input_keycode_map[] = { 235static int sony_laptop_input_keycode_map[] = {
@@ -280,7 +284,11 @@ static int sony_laptop_input_keycode_map[] = {
280 KEY_WLAN, /* 48 SONYPI_EVENT_WIRELESS_OFF */ 284 KEY_WLAN, /* 48 SONYPI_EVENT_WIRELESS_OFF */
281 KEY_ZOOMIN, /* 49 SONYPI_EVENT_ZOOM_IN_PRESSED */ 285 KEY_ZOOMIN, /* 49 SONYPI_EVENT_ZOOM_IN_PRESSED */
282 KEY_ZOOMOUT, /* 50 SONYPI_EVENT_ZOOM_OUT_PRESSED */ 286 KEY_ZOOMOUT, /* 50 SONYPI_EVENT_ZOOM_OUT_PRESSED */
283 KEY_EJECTCD /* 51 SONYPI_EVENT_CD_EJECT_PRESSED */ 287 KEY_EJECTCD, /* 51 SONYPI_EVENT_CD_EJECT_PRESSED */
288 KEY_F13, /* 52 SONYPI_EVENT_MODEKEY_PRESSED */
289 KEY_PROG4, /* 53 SONYPI_EVENT_PKEY_P4 */
290 KEY_F14, /* 54 SONYPI_EVENT_PKEY_P5 */
291 KEY_F15, /* 55 SONYPI_EVENT_SETTINGKEY_PRESSED */
284}; 292};
285 293
286/* release buttons after a short delay if pressed */ 294/* release buttons after a short delay if pressed */
@@ -850,7 +858,7 @@ struct sony_nc_event {
850 u8 event; 858 u8 event;
851}; 859};
852 860
853static struct sony_nc_event sony_nc_events[] = { 861static struct sony_nc_event sony_100_events[] = {
854 { 0x90, SONYPI_EVENT_PKEY_P1 }, 862 { 0x90, SONYPI_EVENT_PKEY_P1 },
855 { 0x10, SONYPI_EVENT_ANYBUTTON_RELEASED }, 863 { 0x10, SONYPI_EVENT_ANYBUTTON_RELEASED },
856 { 0x91, SONYPI_EVENT_PKEY_P1 }, 864 { 0x91, SONYPI_EVENT_PKEY_P1 },
@@ -874,6 +882,25 @@ static struct sony_nc_event sony_nc_events[] = {
874 { 0, 0 }, 882 { 0, 0 },
875}; 883};
876 884
885static struct sony_nc_event sony_127_events[] = {
886 { 0x81, SONYPI_EVENT_MODEKEY_PRESSED },
887 { 0x01, SONYPI_EVENT_ANYBUTTON_RELEASED },
888 { 0x82, SONYPI_EVENT_PKEY_P1 },
889 { 0x02, SONYPI_EVENT_ANYBUTTON_RELEASED },
890 { 0x83, SONYPI_EVENT_PKEY_P2 },
891 { 0x03, SONYPI_EVENT_ANYBUTTON_RELEASED },
892 { 0x84, SONYPI_EVENT_PKEY_P3 },
893 { 0x04, SONYPI_EVENT_ANYBUTTON_RELEASED },
894 { 0x85, SONYPI_EVENT_PKEY_P4 },
895 { 0x05, SONYPI_EVENT_ANYBUTTON_RELEASED },
896 { 0x86, SONYPI_EVENT_PKEY_P5 },
897 { 0x06, SONYPI_EVENT_ANYBUTTON_RELEASED },
898 { 0x06, SONYPI_EVENT_ANYBUTTON_RELEASED },
899 { 0x87, SONYPI_EVENT_SETTINGKEY_PRESSED },
900 { 0x07, SONYPI_EVENT_ANYBUTTON_RELEASED },
901 { 0, 0 },
902};
903
877/* 904/*
878 * ACPI callbacks 905 * ACPI callbacks
879 */ 906 */
@@ -884,27 +911,41 @@ static void sony_acpi_notify(acpi_handle handle, u32 event, void *data)
884 911
885 if (ev >= 0x90) { 912 if (ev >= 0x90) {
886 /* New-style event */ 913 /* New-style event */
887 int origev = ev; 914 int key_handle = 0;
888 ev -= 0x90; 915 ev -= 0x90;
889 916
890 if (sony_find_snc_handle(0x100) == ev) { 917 if (sony_find_snc_handle(0x100) == ev)
891 int i; 918 key_handle = 0x100;
919 if (sony_find_snc_handle(0x127) == ev)
920 key_handle = 0x127;
921
922 if (handle) {
923 struct sony_nc_event *key_event;
892 924
893 if (sony_call_snc_handle(0x100, 0x200, &result)) 925 if (sony_call_snc_handle(key_handle, 0x200, &result))
894 dprintk("sony_acpi_notify, unable to decode event 0x%.2x\n", ev); 926 dprintk("sony_acpi_notify, unable to decode"
927 " event 0x%.2x 0x%.2x\n", key_handle,
928 ev);
895 else 929 else
896 ev = result & 0xFF; 930 ev = result & 0xFF;
897 931
898 for (i = 0; sony_nc_events[i].event; i++) { 932 if (key_handle == 0x100)
899 if (sony_nc_events[i].data == ev) { 933 key_event = sony_100_events;
900 ev = sony_nc_events[i].event; 934 else
935 key_event = sony_127_events;
936
937 for (; key_event->data; key_event++) {
938 if (key_event->data == ev) {
939 ev = key_event->event;
901 break; 940 break;
902 } 941 }
903 } 942 }
904 943
905 if (!sony_nc_events[i].data) 944 if (!key_event->data) {
906 printk(KERN_INFO DRV_PFX 945 printk(KERN_INFO DRV_PFX
907 "Unknown event: %x %x\n", origev, ev); 946 "Unknown event: 0x%x 0x%x\n", key_handle,
947 ev);
948 }
908 } else if (sony_find_snc_handle(0x124) == ev) { 949 } else if (sony_find_snc_handle(0x124) == ev) {
909 sony_nc_rfkill_update(); 950 sony_nc_rfkill_update();
910 return; 951 return;