Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (51 commits)
Input: appletouch - give up maintainership
Input: dm355evm_kbd - switch to using sparse keymap library
Input: wistron_btns - switch to using sparse keymap library
Input: add generic support for sparse keymaps
Input: fix memory leak in force feedback core
Input: wistron - remove identification strings from DMI table
Input: psmouse - remove identification strings from DMI tables
Input: atkbd - remove identification strings from DMI table
Input: i8042 - remove identification strings from DMI tables
DMI: allow omitting ident strings in DMI tables
Input: psmouse - do not carry DMI data around
Input: matrix-keypad - switch to using dev_pm_ops
Input: keyboard - fix lack of locking when traversing handler->h_list
Input: gpio_keys - scan gpio state at probe and resume time
Input: keyboard - add locking around event handling
Input: usbtouchscreen - add support for ET&T TC5UH touchscreen controller
Input: xpad - add two new Xbox 360 devices
Input: polled device - do not start polling if interval is zero
Input: polled device - schedule first poll immediately
Input: add S3C24XX touchscreen driver
...

+3095 -1152
+13
Documentation/DocBook/device-drivers.tmpl
··· 293 293 294 294 <chapter id="input_subsystem"> 295 295 <title>Input Subsystem</title> 296 + <sect1><title>Input core</title> 296 297 !Iinclude/linux/input.h 297 298 !Edrivers/input/input.c 298 299 !Edrivers/input/ff-core.c 299 300 !Edrivers/input/ff-memless.c 301 + </sect1> 302 + <sect1><title>Polled input devices</title> 303 + !Iinclude/linux/input-polldev.h 304 + !Edrivers/input/input-polldev.c 305 + </sect1> 306 + <sect1><title>Matrix keyboars/keypads</title> 307 + !Iinclude/linux/input/matrix_keypad.h 308 + </sect1> 309 + <sect1><title>Sparse keymap support</title> 310 + !Iinclude/linux/input/sparse-keymap.h 311 + !Edrivers/input/sparse-keymap.c 312 + </sect1> 300 313 </chapter> 301 314 302 315 <chapter id="spi">
-7
MAINTAINERS
··· 486 486 F: drivers/net/appletalk/ 487 487 F: net/appletalk/ 488 488 489 - APPLETOUCH TOUCHPAD DRIVER 490 - M: Johannes Berg <johannes@sipsolutions.net> 491 - L: linux-input@vger.kernel.org 492 - S: Maintained 493 - F: Documentation/input/appletouch.txt 494 - F: drivers/input/mouse/appletouch.c 495 - 496 489 ARC FRAMEBUFFER DRIVER 497 490 M: Jaya Kumar <jayalk@intworks.biz> 498 491 S: Maintained
+51
arch/arm/mach-at91/at91sam9g45_devices.c
··· 866 866 867 867 868 868 /* -------------------------------------------------------------------- 869 + * Touchscreen 870 + * -------------------------------------------------------------------- */ 871 + 872 + #if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE) 873 + static u64 tsadcc_dmamask = DMA_BIT_MASK(32); 874 + static struct at91_tsadcc_data tsadcc_data; 875 + 876 + static struct resource tsadcc_resources[] = { 877 + [0] = { 878 + .start = AT91SAM9G45_BASE_TSC, 879 + .end = AT91SAM9G45_BASE_TSC + SZ_16K - 1, 880 + .flags = IORESOURCE_MEM, 881 + }, 882 + [1] = { 883 + .start = AT91SAM9G45_ID_TSC, 884 + .end = AT91SAM9G45_ID_TSC, 885 + .flags = IORESOURCE_IRQ, 886 + } 887 + }; 888 + 889 + static struct platform_device at91sam9g45_tsadcc_device = { 890 + .name = "atmel_tsadcc", 891 + .id = -1, 892 + .dev = { 893 + .dma_mask = &tsadcc_dmamask, 894 + .coherent_dma_mask = DMA_BIT_MASK(32), 895 + .platform_data = &tsadcc_data, 896 + }, 897 + .resource = tsadcc_resources, 898 + .num_resources = ARRAY_SIZE(tsadcc_resources), 899 + }; 900 + 901 + void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) 902 + { 903 + if (!data) 904 + return; 905 + 906 + at91_set_gpio_input(AT91_PIN_PD20, 0); /* AD0_XR */ 907 + at91_set_gpio_input(AT91_PIN_PD21, 0); /* AD1_XL */ 908 + at91_set_gpio_input(AT91_PIN_PD22, 0); /* AD2_YT */ 909 + at91_set_gpio_input(AT91_PIN_PD23, 0); /* AD3_TB */ 910 + 911 + tsadcc_data = *data; 912 + platform_device_register(&at91sam9g45_tsadcc_device); 913 + } 914 + #else 915 + void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {} 916 + #endif 917 + 918 + 919 + /* -------------------------------------------------------------------- 869 920 * RTT 870 921 * -------------------------------------------------------------------- */ 871 922
+8 -2
arch/arm/mach-at91/at91sam9rl_devices.c
··· 622 622 623 623 #if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE) 624 624 static u64 tsadcc_dmamask = DMA_BIT_MASK(32); 625 + static struct at91_tsadcc_data tsadcc_data; 625 626 626 627 static struct resource tsadcc_resources[] = { 627 628 [0] = { ··· 643 642 .dev = { 644 643 .dma_mask = &tsadcc_dmamask, 645 644 .coherent_dma_mask = DMA_BIT_MASK(32), 645 + .platform_data = &tsadcc_data, 646 646 }, 647 647 .resource = tsadcc_resources, 648 648 .num_resources = ARRAY_SIZE(tsadcc_resources), 649 649 }; 650 650 651 - void __init at91_add_device_tsadcc(void) 651 + void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) 652 652 { 653 + if (!data) 654 + return; 655 + 653 656 at91_set_A_periph(AT91_PIN_PA17, 0); /* AD0_XR */ 654 657 at91_set_A_periph(AT91_PIN_PA18, 0); /* AD1_XL */ 655 658 at91_set_A_periph(AT91_PIN_PA19, 0); /* AD2_YT */ 656 659 at91_set_A_periph(AT91_PIN_PA20, 0); /* AD3_TB */ 657 660 661 + tsadcc_data = *data; 658 662 platform_device_register(&at91sam9rl_tsadcc_device); 659 663 } 660 664 #else 661 - void __init at91_add_device_tsadcc(void) {} 665 + void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {} 662 666 #endif 663 667 664 668
+12
arch/arm/mach-at91/board-sam9m10g45ek.c
··· 229 229 230 230 231 231 /* 232 + * Touchscreen 233 + */ 234 + static struct at91_tsadcc_data ek_tsadcc_data = { 235 + .adc_clock = 300000, 236 + .pendet_debounce = 0x0d, 237 + .ts_sample_hold_time = 0x0a, 238 + }; 239 + 240 + 241 + /* 232 242 * GPIO Buttons 233 243 */ 234 244 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) ··· 389 379 at91_add_device_i2c(0, NULL, 0); 390 380 /* LCD Controller */ 391 381 at91_add_device_lcdc(&ek_lcdc_data); 382 + /* Touch Screen */ 383 + at91_add_device_tsadcc(&ek_tsadcc_data); 392 384 /* Push Buttons */ 393 385 ek_add_device_buttons(); 394 386 /* AC97 */
+11 -1
arch/arm/mach-at91/board-sam9rlek.c
··· 243 243 244 244 245 245 /* 246 + * Touchscreen 247 + */ 248 + static struct at91_tsadcc_data ek_tsadcc_data = { 249 + .adc_clock = 1000000, 250 + .pendet_debounce = 0x0f, 251 + .ts_sample_hold_time = 0x03, 252 + }; 253 + 254 + 255 + /* 246 256 * GPIO Buttons 247 257 */ 248 258 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) ··· 320 310 /* AC97 */ 321 311 at91_add_device_ac97(&ek_ac97_data); 322 312 /* Touch Screen Controller */ 323 - at91_add_device_tsadcc(); 313 + at91_add_device_tsadcc(&ek_tsadcc_data); 324 314 /* LEDs */ 325 315 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 326 316 /* Push Buttons */
+6 -1
arch/arm/mach-at91/include/mach/board.h
··· 187 187 extern void __init at91_add_device_isi(void); 188 188 189 189 /* Touchscreen Controller */ 190 - extern void __init at91_add_device_tsadcc(void); 190 + struct at91_tsadcc_data { 191 + unsigned int adc_clock; 192 + u8 pendet_debounce; 193 + u8 ts_sample_hold_time; 194 + }; 195 + extern void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data); 191 196 192 197 /* CAN */ 193 198 struct at91_can_data {
+41
arch/arm/mach-davinci/include/mach/keyscan.h
··· 1 + /* 2 + * Copyright (C) 2009 Texas Instruments, Inc 3 + * 4 + * Author: Miguel Aguilar <miguel.aguilar@ridgerun.com> 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License as published by 8 + * the Free Software Foundation; either version 2 of the License, or 9 + * (at your option) any later version. 10 + * 11 + * This program is distributed in the hope that it will be useful, 12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + * GNU General Public License for more details. 15 + * 16 + * You should have received a copy of the GNU General Public License 17 + * along with this program; if not, write to the Free Software 18 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 + */ 20 + 21 + #ifndef DAVINCI_KEYSCAN_H 22 + #define DAVINCI_KEYSCAN_H 23 + 24 + #include <linux/io.h> 25 + 26 + enum davinci_matrix_types { 27 + DAVINCI_KEYSCAN_MATRIX_4X4, 28 + DAVINCI_KEYSCAN_MATRIX_5X3, 29 + }; 30 + 31 + struct davinci_ks_platform_data { 32 + unsigned short *keymap; 33 + u32 keymapsize; 34 + u8 rep:1; 35 + u8 strobe; 36 + u8 interval; 37 + u8 matrix_type; 38 + }; 39 + 40 + #endif 41 +
+113 -98
drivers/char/keyboard.c
··· 46 46 47 47 extern void ctrl_alt_del(void); 48 48 49 - #define to_handle_h(n) container_of(n, struct input_handle, h_node) 50 - 51 49 /* 52 50 * Exported functions/variables 53 51 */ ··· 130 132 */ 131 133 132 134 static struct input_handler kbd_handler; 135 + static DEFINE_SPINLOCK(kbd_event_lock); 133 136 static unsigned long key_down[BITS_TO_LONGS(KEY_CNT)]; /* keyboard key bitmap */ 134 137 static unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */ 135 138 static int dead_key_next; ··· 189 190 * etc.). So this means that scancodes for the extra function keys won't 190 191 * be valid for the first event device, but will be for the second. 191 192 */ 193 + 194 + struct getset_keycode_data { 195 + unsigned int scancode; 196 + unsigned int keycode; 197 + int error; 198 + }; 199 + 200 + static int getkeycode_helper(struct input_handle *handle, void *data) 201 + { 202 + struct getset_keycode_data *d = data; 203 + 204 + d->error = input_get_keycode(handle->dev, d->scancode, &d->keycode); 205 + 206 + return d->error == 0; /* stop as soon as we successfully get one */ 207 + } 208 + 192 209 int getkeycode(unsigned int scancode) 193 210 { 194 - struct input_handle *handle; 195 - int keycode; 196 - int error = -ENODEV; 211 + struct getset_keycode_data d = { scancode, 0, -ENODEV }; 197 212 198 - list_for_each_entry(handle, &kbd_handler.h_list, h_node) { 199 - error = input_get_keycode(handle->dev, scancode, &keycode); 200 - if (!error) 201 - return keycode; 202 - } 213 + input_handler_for_each_handle(&kbd_handler, &d, getkeycode_helper); 203 214 204 - return error; 215 + return d.error ?: d.keycode; 216 + } 217 + 218 + static int setkeycode_helper(struct input_handle *handle, void *data) 219 + { 220 + struct getset_keycode_data *d = data; 221 + 222 + d->error = input_set_keycode(handle->dev, d->scancode, d->keycode); 223 + 224 + return d->error == 0; /* stop as soon as we successfully set one */ 205 225 } 206 226 207 227 int setkeycode(unsigned int scancode, unsigned int keycode) 208 228 { 209 - struct input_handle *handle; 210 - int error = -ENODEV; 229 + struct getset_keycode_data d = { scancode, keycode, -ENODEV }; 211 230 212 - list_for_each_entry(handle, &kbd_handler.h_list, h_node) { 213 - error = input_set_keycode(handle->dev, scancode, keycode); 214 - if (!error) 215 - break; 216 - } 231 + input_handler_for_each_handle(&kbd_handler, &d, setkeycode_helper); 217 232 218 - return error; 233 + return d.error; 219 234 } 220 235 221 236 /* 222 237 * Making beeps and bells. 223 238 */ 239 + 240 + static int kd_sound_helper(struct input_handle *handle, void *data) 241 + { 242 + unsigned int *hz = data; 243 + struct input_dev *dev = handle->dev; 244 + 245 + if (test_bit(EV_SND, dev->evbit)) { 246 + if (test_bit(SND_TONE, dev->sndbit)) 247 + input_inject_event(handle, EV_SND, SND_TONE, *hz); 248 + if (test_bit(SND_BELL, handle->dev->sndbit)) 249 + input_inject_event(handle, EV_SND, SND_BELL, *hz ? 1 : 0); 250 + } 251 + 252 + return 0; 253 + } 254 + 224 255 static void kd_nosound(unsigned long ignored) 225 256 { 226 - struct input_handle *handle; 257 + static unsigned int zero; 227 258 228 - list_for_each_entry(handle, &kbd_handler.h_list, h_node) { 229 - if (test_bit(EV_SND, handle->dev->evbit)) { 230 - if (test_bit(SND_TONE, handle->dev->sndbit)) 231 - input_inject_event(handle, EV_SND, SND_TONE, 0); 232 - if (test_bit(SND_BELL, handle->dev->sndbit)) 233 - input_inject_event(handle, EV_SND, SND_BELL, 0); 234 - } 235 - } 259 + input_handler_for_each_handle(&kbd_handler, &zero, kd_sound_helper); 236 260 } 237 261 238 262 static DEFINE_TIMER(kd_mksound_timer, kd_nosound, 0, 0); 239 263 240 264 void kd_mksound(unsigned int hz, unsigned int ticks) 241 265 { 242 - struct list_head *node; 266 + del_timer_sync(&kd_mksound_timer); 243 267 244 - del_timer(&kd_mksound_timer); 268 + input_handler_for_each_handle(&kbd_handler, &hz, kd_sound_helper); 245 269 246 - if (hz) { 247 - list_for_each_prev(node, &kbd_handler.h_list) { 248 - struct input_handle *handle = to_handle_h(node); 249 - if (test_bit(EV_SND, handle->dev->evbit)) { 250 - if (test_bit(SND_TONE, handle->dev->sndbit)) { 251 - input_inject_event(handle, EV_SND, SND_TONE, hz); 252 - break; 253 - } 254 - if (test_bit(SND_BELL, handle->dev->sndbit)) { 255 - input_inject_event(handle, EV_SND, SND_BELL, 1); 256 - break; 257 - } 258 - } 259 - } 260 - if (ticks) 261 - mod_timer(&kd_mksound_timer, jiffies + ticks); 262 - } else 263 - kd_nosound(0); 270 + if (hz && ticks) 271 + mod_timer(&kd_mksound_timer, jiffies + ticks); 264 272 } 265 273 EXPORT_SYMBOL(kd_mksound); 266 274 ··· 275 269 * Setting the keyboard rate. 276 270 */ 277 271 272 + static int kbd_rate_helper(struct input_handle *handle, void *data) 273 + { 274 + struct input_dev *dev = handle->dev; 275 + struct kbd_repeat *rep = data; 276 + 277 + if (test_bit(EV_REP, dev->evbit)) { 278 + 279 + if (rep[0].delay > 0) 280 + input_inject_event(handle, 281 + EV_REP, REP_DELAY, rep[0].delay); 282 + if (rep[0].period > 0) 283 + input_inject_event(handle, 284 + EV_REP, REP_PERIOD, rep[0].period); 285 + 286 + rep[1].delay = dev->rep[REP_DELAY]; 287 + rep[1].period = dev->rep[REP_PERIOD]; 288 + } 289 + 290 + return 0; 291 + } 292 + 278 293 int kbd_rate(struct kbd_repeat *rep) 279 294 { 280 - struct list_head *node; 281 - unsigned int d = 0; 282 - unsigned int p = 0; 295 + struct kbd_repeat data[2] = { *rep }; 283 296 284 - list_for_each(node, &kbd_handler.h_list) { 285 - struct input_handle *handle = to_handle_h(node); 286 - struct input_dev *dev = handle->dev; 297 + input_handler_for_each_handle(&kbd_handler, data, kbd_rate_helper); 298 + *rep = data[1]; /* Copy currently used settings */ 287 299 288 - if (test_bit(EV_REP, dev->evbit)) { 289 - if (rep->delay > 0) 290 - input_inject_event(handle, EV_REP, REP_DELAY, rep->delay); 291 - if (rep->period > 0) 292 - input_inject_event(handle, EV_REP, REP_PERIOD, rep->period); 293 - d = dev->rep[REP_DELAY]; 294 - p = dev->rep[REP_PERIOD]; 295 - } 296 - } 297 - rep->delay = d; 298 - rep->period = p; 299 300 return 0; 300 301 } 301 302 ··· 1010 997 return leds; 1011 998 } 1012 999 1013 - /* 1014 - * This routine is the bottom half of the keyboard interrupt 1015 - * routine, and runs with all interrupts enabled. It does 1016 - * console changing, led setting and copy_to_cooked, which can 1017 - * take a reasonably long time. 1018 - * 1019 - * Aside from timing (which isn't really that important for 1020 - * keyboard interrupts as they happen often), using the software 1021 - * interrupt routines for this thing allows us to easily mask 1022 - * this when we don't want any of the above to happen. 1023 - * This allows for easy and efficient race-condition prevention 1024 - * for kbd_start => input_inject_event(dev, EV_LED, ...) => ... 1025 - */ 1000 + static int kbd_update_leds_helper(struct input_handle *handle, void *data) 1001 + { 1002 + unsigned char leds = *(unsigned char *)data; 1026 1003 1004 + if (test_bit(EV_LED, handle->dev->evbit)) { 1005 + input_inject_event(handle, EV_LED, LED_SCROLLL, !!(leds & 0x01)); 1006 + input_inject_event(handle, EV_LED, LED_NUML, !!(leds & 0x02)); 1007 + input_inject_event(handle, EV_LED, LED_CAPSL, !!(leds & 0x04)); 1008 + input_inject_event(handle, EV_SYN, SYN_REPORT, 0); 1009 + } 1010 + 1011 + return 0; 1012 + } 1013 + 1014 + /* 1015 + * This is the tasklet that updates LED state on all keyboards 1016 + * attached to the box. The reason we use tasklet is that we 1017 + * need to handle the scenario when keyboard handler is not 1018 + * registered yet but we already getting updates form VT to 1019 + * update led state. 1020 + */ 1027 1021 static void kbd_bh(unsigned long dummy) 1028 1022 { 1029 - struct list_head *node; 1030 1023 unsigned char leds = getleds(); 1031 1024 1032 1025 if (leds != ledstate) { 1033 - list_for_each(node, &kbd_handler.h_list) { 1034 - struct input_handle *handle = to_handle_h(node); 1035 - input_inject_event(handle, EV_LED, LED_SCROLLL, !!(leds & 0x01)); 1036 - input_inject_event(handle, EV_LED, LED_NUML, !!(leds & 0x02)); 1037 - input_inject_event(handle, EV_LED, LED_CAPSL, !!(leds & 0x04)); 1038 - input_inject_event(handle, EV_SYN, SYN_REPORT, 0); 1039 - } 1026 + input_handler_for_each_handle(&kbd_handler, &leds, 1027 + kbd_update_leds_helper); 1028 + ledstate = leds; 1040 1029 } 1041 - 1042 - ledstate = leds; 1043 1030 } 1044 1031 1045 1032 DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0); ··· 1149 1136 static void kbd_rawcode(unsigned char data) 1150 1137 { 1151 1138 struct vc_data *vc = vc_cons[fg_console].d; 1152 - kbd = kbd_table + fg_console; 1139 + kbd = kbd_table + vc->vc_num; 1153 1140 if (kbd->kbdmode == VC_RAW) 1154 1141 put_queue(vc, data); 1155 1142 } ··· 1170 1157 tty->driver_data = vc; 1171 1158 } 1172 1159 1173 - kbd = kbd_table + fg_console; 1160 + kbd = kbd_table + vc->vc_num; 1174 1161 1175 1162 if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT) 1176 1163 sysrq_alt = down ? keycode : 0; ··· 1309 1296 static void kbd_event(struct input_handle *handle, unsigned int event_type, 1310 1297 unsigned int event_code, int value) 1311 1298 { 1299 + /* We are called with interrupts disabled, just take the lock */ 1300 + spin_lock(&kbd_event_lock); 1301 + 1312 1302 if (event_type == EV_MSC && event_code == MSC_RAW && HW_RAW(handle->dev)) 1313 1303 kbd_rawcode(value); 1314 1304 if (event_type == EV_KEY) 1315 1305 kbd_keycode(event_code, value, HW_RAW(handle->dev)); 1306 + 1307 + spin_unlock(&kbd_event_lock); 1308 + 1316 1309 tasklet_schedule(&keyboard_tasklet); 1317 1310 do_poke_blanked_console = 1; 1318 1311 schedule_console_callback(); ··· 1382 1363 */ 1383 1364 static void kbd_start(struct input_handle *handle) 1384 1365 { 1385 - unsigned char leds = ledstate; 1386 - 1387 1366 tasklet_disable(&keyboard_tasklet); 1388 - if (leds != 0xff) { 1389 - input_inject_event(handle, EV_LED, LED_SCROLLL, !!(leds & 0x01)); 1390 - input_inject_event(handle, EV_LED, LED_NUML, !!(leds & 0x02)); 1391 - input_inject_event(handle, EV_LED, LED_CAPSL, !!(leds & 0x04)); 1392 - input_inject_event(handle, EV_SYN, SYN_REPORT, 0); 1393 - } 1367 + 1368 + if (ledstate != 0xff) 1369 + kbd_update_leds_helper(handle, &ledstate); 1370 + 1394 1371 tasklet_enable(&keyboard_tasklet); 1395 1372 } 1396 1373
+12 -3
drivers/firmware/dmi_scan.c
··· 429 429 for (i = 0; i < ARRAY_SIZE(dmi->matches); i++) { 430 430 int s = dmi->matches[i].slot; 431 431 if (s == DMI_NONE) 432 - continue; 432 + break; 433 433 if (dmi_ident[s] 434 434 && strstr(dmi_ident[s], dmi->matches[i].substr)) 435 435 continue; ··· 437 437 return false; 438 438 } 439 439 return true; 440 + } 441 + 442 + /** 443 + * dmi_is_end_of_table - check for end-of-table marker 444 + * @dmi: pointer to the dmi_system_id structure to check 445 + */ 446 + static bool dmi_is_end_of_table(const struct dmi_system_id *dmi) 447 + { 448 + return dmi->matches[0].slot == DMI_NONE; 440 449 } 441 450 442 451 /** ··· 466 457 int count = 0; 467 458 const struct dmi_system_id *d; 468 459 469 - for (d = list; d->ident; d++) 460 + for (d = list; !dmi_is_end_of_table(d); d++) 470 461 if (dmi_matches(d)) { 471 462 count++; 472 463 if (d->callback && d->callback(d)) ··· 493 484 { 494 485 const struct dmi_system_id *d; 495 486 496 - for (d = list; d->ident; d++) 487 + for (d = list; !dmi_is_end_of_table(d); d++) 497 488 if (dmi_matches(d)) 498 489 return d; 499 490
+1 -1
drivers/hid/usbhid/usbkbd.c
··· 266 266 le16_to_cpu(dev->descriptor.idProduct)); 267 267 268 268 usb_make_path(dev, kbd->phys, sizeof(kbd->phys)); 269 - strlcpy(kbd->phys, "/input0", sizeof(kbd->phys)); 269 + strlcat(kbd->phys, "/input0", sizeof(kbd->phys)); 270 270 271 271 input_dev->name = kbd->name; 272 272 input_dev->phys = kbd->phys;
+20 -8
drivers/input/Kconfig
··· 8 8 config INPUT 9 9 tristate "Generic input layer (needed for keyboard, mouse, ...)" if EMBEDDED 10 10 default y 11 - ---help--- 11 + help 12 12 Say Y here if you have any input device (mouse, keyboard, tablet, 13 13 joystick, steering wheel ...) connected to your system and want 14 14 it to be available to applications. This includes standard PS/2 ··· 27 27 28 28 config INPUT_FF_MEMLESS 29 29 tristate "Support for memoryless force-feedback devices" 30 - default n 31 - ---help--- 30 + help 32 31 Say Y here if you have memoryless force-feedback input device 33 32 such as Logitech WingMan Force 3D, ThrustMaster FireStorm Dual 34 33 Power 2, or similar. You will also need to enable hardware-specific ··· 51 52 To compile this driver as a module, choose M here: the 52 53 module will be called input-polldev. 53 54 55 + config INPUT_SPARSEKMAP 56 + tristate "Sparse keymap support library" 57 + help 58 + Say Y here if you are using a driver for an input 59 + device that uses sparse keymap. This option is only 60 + useful for out-of-tree drivers since in-tree drivers 61 + select it automatically. 62 + 63 + If unsure, say N. 64 + 65 + To compile this driver as a module, choose M here: the 66 + module will be called sparse-keymap. 67 + 54 68 comment "Userland interfaces" 55 69 56 70 config INPUT_MOUSEDEV 57 71 tristate "Mouse interface" if EMBEDDED 58 72 default y 59 - ---help--- 73 + help 60 74 Say Y here if you want your mouse to be accessible as char devices 61 75 13:32+ - /dev/input/mouseX and 13:63 - /dev/input/mice as an 62 76 emulated IntelliMouse Explorer PS/2 mouse. That way, all user space ··· 85 73 bool "Provide legacy /dev/psaux device" 86 74 default y 87 75 depends on INPUT_MOUSEDEV 88 - ---help--- 76 + help 89 77 Say Y here if you want your mouse also be accessible as char device 90 78 10:1 - /dev/psaux. The data available through /dev/psaux is exactly 91 79 the same as the data from /dev/input/mice. ··· 115 103 116 104 config INPUT_JOYDEV 117 105 tristate "Joystick interface" 118 - ---help--- 106 + help 119 107 Say Y here if you want your joystick or gamepad to be 120 108 accessible as char device 13:0+ - /dev/input/jsX device. 121 109 ··· 137 125 138 126 config INPUT_EVBUG 139 127 tristate "Event debugging" 140 - ---help--- 128 + help 141 129 Say Y here if you have a problem with the input subsystem and 142 130 want all events (keypresses, mouse movements), to be output to 143 131 the system log. While this is useful for debugging, it's also ··· 152 140 config INPUT_APMPOWER 153 141 tristate "Input Power Event -> APM Bridge" if EMBEDDED 154 142 depends on INPUT && APM_EMULATION 155 - ---help--- 143 + help 156 144 Say Y here if you want suspend key events to trigger a user 157 145 requested suspend through APM. This is useful on embedded 158 146 systems where such behaviour is desired without userspace
+1
drivers/input/Makefile
··· 9 9 10 10 obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o 11 11 obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o 12 + obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o 12 13 13 14 obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o 14 15 obj-$(CONFIG_INPUT_JOYDEV) += joydev.o
+2 -1
drivers/input/ff-core.c
··· 353 353 EXPORT_SYMBOL_GPL(input_ff_create); 354 354 355 355 /** 356 - * input_ff_free() - frees force feedback portion of input device 356 + * input_ff_destroy() - frees force feedback portion of input device 357 357 * @dev: input device supporting force feedback 358 358 * 359 359 * This function is only needed in error path as input core will ··· 369 369 if (ff->destroy) 370 370 ff->destroy(ff); 371 371 kfree(ff->private); 372 + kfree(ff->effects); 372 373 kfree(ff); 373 374 dev->ff = NULL; 374 375 }
+123 -14
drivers/input/input-polldev.c
··· 56 56 mutex_unlock(&polldev_mutex); 57 57 } 58 58 59 - static void input_polled_device_work(struct work_struct *work) 59 + static void input_polldev_queue_work(struct input_polled_dev *dev) 60 60 { 61 - struct input_polled_dev *dev = 62 - container_of(work, struct input_polled_dev, work.work); 63 61 unsigned long delay; 64 - 65 - dev->poll(dev); 66 62 67 63 delay = msecs_to_jiffies(dev->poll_interval); 68 64 if (delay >= HZ) 69 65 delay = round_jiffies_relative(delay); 70 66 71 67 queue_delayed_work(polldev_wq, &dev->work, delay); 68 + } 69 + 70 + static void input_polled_device_work(struct work_struct *work) 71 + { 72 + struct input_polled_dev *dev = 73 + container_of(work, struct input_polled_dev, work.work); 74 + 75 + dev->poll(dev); 76 + input_polldev_queue_work(dev); 72 77 } 73 78 74 79 static int input_open_polled_device(struct input_dev *input) ··· 85 80 if (error) 86 81 return error; 87 82 88 - if (dev->flush) 89 - dev->flush(dev); 83 + if (dev->open) 84 + dev->open(dev); 90 85 91 - queue_delayed_work(polldev_wq, &dev->work, 92 - msecs_to_jiffies(dev->poll_interval)); 86 + /* Only start polling if polling is enabled */ 87 + if (dev->poll_interval > 0) 88 + queue_delayed_work(polldev_wq, &dev->work, 0); 93 89 94 90 return 0; 95 91 } ··· 101 95 102 96 cancel_delayed_work_sync(&dev->work); 103 97 input_polldev_stop_workqueue(); 98 + 99 + if (dev->close) 100 + dev->close(dev); 104 101 } 102 + 103 + /* SYSFS interface */ 104 + 105 + static ssize_t input_polldev_get_poll(struct device *dev, 106 + struct device_attribute *attr, char *buf) 107 + { 108 + struct input_polled_dev *polldev = dev_get_drvdata(dev); 109 + 110 + return sprintf(buf, "%d\n", polldev->poll_interval); 111 + } 112 + 113 + static ssize_t input_polldev_set_poll(struct device *dev, 114 + struct device_attribute *attr, const char *buf, 115 + size_t count) 116 + { 117 + struct input_polled_dev *polldev = dev_get_drvdata(dev); 118 + struct input_dev *input = polldev->input; 119 + unsigned long interval; 120 + 121 + if (strict_strtoul(buf, 0, &interval)) 122 + return -EINVAL; 123 + 124 + if (interval < polldev->poll_interval_min) 125 + return -EINVAL; 126 + 127 + if (interval > polldev->poll_interval_max) 128 + return -EINVAL; 129 + 130 + mutex_lock(&input->mutex); 131 + 132 + polldev->poll_interval = interval; 133 + 134 + if (input->users) { 135 + cancel_delayed_work_sync(&polldev->work); 136 + if (polldev->poll_interval > 0) 137 + input_polldev_queue_work(polldev); 138 + } 139 + 140 + mutex_unlock(&input->mutex); 141 + 142 + return count; 143 + } 144 + 145 + static DEVICE_ATTR(poll, S_IRUGO | S_IWUSR, input_polldev_get_poll, 146 + input_polldev_set_poll); 147 + 148 + 149 + static ssize_t input_polldev_get_max(struct device *dev, 150 + struct device_attribute *attr, char *buf) 151 + { 152 + struct input_polled_dev *polldev = dev_get_drvdata(dev); 153 + 154 + return sprintf(buf, "%d\n", polldev->poll_interval_max); 155 + } 156 + 157 + static DEVICE_ATTR(max, S_IRUGO, input_polldev_get_max, NULL); 158 + 159 + static ssize_t input_polldev_get_min(struct device *dev, 160 + struct device_attribute *attr, char *buf) 161 + { 162 + struct input_polled_dev *polldev = dev_get_drvdata(dev); 163 + 164 + return sprintf(buf, "%d\n", polldev->poll_interval_min); 165 + } 166 + 167 + static DEVICE_ATTR(min, S_IRUGO, input_polldev_get_min, NULL); 168 + 169 + static struct attribute *sysfs_attrs[] = { 170 + &dev_attr_poll.attr, 171 + &dev_attr_max.attr, 172 + &dev_attr_min.attr, 173 + NULL 174 + }; 175 + 176 + static struct attribute_group input_polldev_attribute_group = { 177 + .attrs = sysfs_attrs 178 + }; 105 179 106 180 /** 107 181 * input_allocate_polled_device - allocated memory polled device ··· 212 126 * @dev: device to free 213 127 * 214 128 * The function frees memory allocated for polling device and drops 215 - * reference to the associated input device (if present). 129 + * reference to the associated input device. 216 130 */ 217 131 void input_free_polled_device(struct input_polled_dev *dev) 218 132 { ··· 236 150 int input_register_polled_device(struct input_polled_dev *dev) 237 151 { 238 152 struct input_dev *input = dev->input; 153 + int error; 239 154 240 155 input_set_drvdata(input, dev); 241 156 INIT_DELAYED_WORK(&dev->work, input_polled_device_work); 242 157 if (!dev->poll_interval) 243 158 dev->poll_interval = 500; 159 + if (!dev->poll_interval_max) 160 + dev->poll_interval_max = dev->poll_interval; 244 161 input->open = input_open_polled_device; 245 162 input->close = input_close_polled_device; 246 163 247 - return input_register_device(input); 164 + error = input_register_device(input); 165 + if (error) 166 + return error; 167 + 168 + error = sysfs_create_group(&input->dev.kobj, 169 + &input_polldev_attribute_group); 170 + if (error) { 171 + input_unregister_device(input); 172 + return error; 173 + } 174 + 175 + /* 176 + * Take extra reference to the underlying input device so 177 + * that it survives call to input_unregister_polled_device() 178 + * and is deleted only after input_free_polled_device() 179 + * has been invoked. This is needed to ease task of freeing 180 + * sparse keymaps. 181 + */ 182 + input_get_device(input); 183 + 184 + return 0; 248 185 } 249 186 EXPORT_SYMBOL(input_register_polled_device); 250 187 ··· 278 169 * The function unregisters previously registered polled input 279 170 * device from input layer. Polling is stopped and device is 280 171 * ready to be freed with call to input_free_polled_device(). 281 - * Callers should not attempt to access dev->input pointer 282 - * after calling this function. 283 172 */ 284 173 void input_unregister_polled_device(struct input_polled_dev *dev) 285 174 { 175 + sysfs_remove_group(&dev->input->dev.kobj, 176 + &input_polldev_attribute_group); 177 + 286 178 input_unregister_device(dev->input); 287 - dev->input = NULL; 288 179 } 289 180 EXPORT_SYMBOL(input_unregister_polled_device); 290 181
+35 -2
drivers/input/input.c
··· 1658 1658 EXPORT_SYMBOL(input_unregister_handler); 1659 1659 1660 1660 /** 1661 + * input_handler_for_each_handle - handle iterator 1662 + * @handler: input handler to iterate 1663 + * @data: data for the callback 1664 + * @fn: function to be called for each handle 1665 + * 1666 + * Iterate over @bus's list of devices, and call @fn for each, passing 1667 + * it @data and stop when @fn returns a non-zero value. The function is 1668 + * using RCU to traverse the list and therefore may be usind in atonic 1669 + * contexts. The @fn callback is invoked from RCU critical section and 1670 + * thus must not sleep. 1671 + */ 1672 + int input_handler_for_each_handle(struct input_handler *handler, void *data, 1673 + int (*fn)(struct input_handle *, void *)) 1674 + { 1675 + struct input_handle *handle; 1676 + int retval = 0; 1677 + 1678 + rcu_read_lock(); 1679 + 1680 + list_for_each_entry_rcu(handle, &handler->h_list, h_node) { 1681 + retval = fn(handle, data); 1682 + if (retval) 1683 + break; 1684 + } 1685 + 1686 + rcu_read_unlock(); 1687 + 1688 + return retval; 1689 + } 1690 + EXPORT_SYMBOL(input_handler_for_each_handle); 1691 + 1692 + /** 1661 1693 * input_register_handle - register a new input handle 1662 1694 * @handle: handle to register 1663 1695 * ··· 1722 1690 * we can't be racing with input_unregister_handle() 1723 1691 * and so separate lock is not needed here. 1724 1692 */ 1725 - list_add_tail(&handle->h_node, &handler->h_list); 1693 + list_add_tail_rcu(&handle->h_node, &handler->h_list); 1726 1694 1727 1695 if (handler->start) 1728 1696 handler->start(handle); ··· 1745 1713 { 1746 1714 struct input_dev *dev = handle->dev; 1747 1715 1748 - list_del_init(&handle->h_node); 1716 + list_del_rcu(&handle->h_node); 1749 1717 1750 1718 /* 1751 1719 * Take dev->mutex to prevent race with input_release_device(). ··· 1753 1721 mutex_lock(&dev->mutex); 1754 1722 list_del_rcu(&handle->d_node); 1755 1723 mutex_unlock(&dev->mutex); 1724 + 1756 1725 synchronize_rcu(); 1757 1726 } 1758 1727 EXPORT_SYMBOL(input_unregister_handle);
+3
drivers/input/joystick/xpad.c
··· 125 125 { 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, 126 126 { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 127 127 { 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, 128 + { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, 128 129 { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, 129 130 { 0x0c12, 0x8802, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 130 131 { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", MAP_DPAD_TO_AXES, XTYPE_XBOX }, ··· 147 146 { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, 148 147 { 0x045e, 0x028e, "Microsoft X-Box 360 pad", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, 149 148 { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, 149 + { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, 150 150 { 0xffff, 0xffff, "Chinese-made Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 151 151 { 0x0000, 0x0000, "Generic X-Box pad", MAP_DPAD_UNKNOWN, XTYPE_UNKNOWN } 152 152 }; ··· 214 212 XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ 215 213 XPAD_XBOX360_VENDOR(0x146b), /* BigBen Interactive Controllers */ 216 214 XPAD_XBOX360_VENDOR(0x1bad), /* Rock Band Drums */ 215 + XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ 217 216 { } 218 217 }; 219 218
+10
drivers/input/keyboard/Kconfig
··· 361 361 To compile this driver as a module, choose M here: the 362 362 module will be called sh_keysc. 363 363 364 + config KEYBOARD_DAVINCI 365 + tristate "TI DaVinci Key Scan" 366 + depends on ARCH_DAVINCI_DM365 367 + help 368 + Say Y to enable keypad module support for the TI DaVinci 369 + platforms (DM365). 370 + 371 + To compile this driver as a module, choose M here: the 372 + module will be called davinci_keyscan. 373 + 364 374 config KEYBOARD_OMAP 365 375 tristate "TI OMAP keypad support" 366 376 depends on (ARCH_OMAP1 || ARCH_OMAP2)
+1
drivers/input/keyboard/Makefile
··· 11 11 obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o 12 12 obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o 13 13 obj-$(CONFIG_KEYBOARD_CORGI) += corgikbd.o 14 + obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o 14 15 obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o 15 16 obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o 16 17 obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o
+9 -17
drivers/input/keyboard/atkbd.c
··· 1567 1567 return 0; 1568 1568 } 1569 1569 1570 - static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = { 1570 + static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = { 1571 1571 { 1572 - .ident = "Dell Laptop", 1573 1572 .matches = { 1574 1573 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1575 1574 DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */ ··· 1577 1578 .driver_data = atkbd_dell_laptop_forced_release_keys, 1578 1579 }, 1579 1580 { 1580 - .ident = "Dell Laptop", 1581 1581 .matches = { 1582 1582 DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"), 1583 1583 DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */ ··· 1585 1587 .driver_data = atkbd_dell_laptop_forced_release_keys, 1586 1588 }, 1587 1589 { 1588 - .ident = "HP 2133", 1589 1590 .matches = { 1590 1591 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 1591 1592 DMI_MATCH(DMI_PRODUCT_NAME, "HP 2133"), ··· 1593 1596 .driver_data = atkbd_hp_forced_release_keys, 1594 1597 }, 1595 1598 { 1596 - .ident = "HP Pavilion ZV6100", 1597 1599 .matches = { 1598 1600 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 1599 1601 DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion ZV6100"), ··· 1601 1605 .driver_data = atkbd_volume_forced_release_keys, 1602 1606 }, 1603 1607 { 1604 - .ident = "HP Presario R4000", 1605 1608 .matches = { 1606 1609 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 1607 1610 DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4000"), ··· 1609 1614 .driver_data = atkbd_volume_forced_release_keys, 1610 1615 }, 1611 1616 { 1612 - .ident = "HP Presario R4100", 1613 1617 .matches = { 1614 1618 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 1615 1619 DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4100"), ··· 1617 1623 .driver_data = atkbd_volume_forced_release_keys, 1618 1624 }, 1619 1625 { 1620 - .ident = "HP Presario R4200", 1621 1626 .matches = { 1622 1627 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 1623 1628 DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4200"), ··· 1625 1632 .driver_data = atkbd_volume_forced_release_keys, 1626 1633 }, 1627 1634 { 1628 - .ident = "Inventec Symphony", 1635 + /* Inventec Symphony */ 1629 1636 .matches = { 1630 1637 DMI_MATCH(DMI_SYS_VENDOR, "INVENTEC"), 1631 1638 DMI_MATCH(DMI_PRODUCT_NAME, "SYMPHONY 6.0/7.0"), ··· 1634 1641 .driver_data = atkbd_volume_forced_release_keys, 1635 1642 }, 1636 1643 { 1637 - .ident = "Samsung NC10", 1644 + /* Samsung NC10 */ 1638 1645 .matches = { 1639 1646 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 1640 1647 DMI_MATCH(DMI_PRODUCT_NAME, "NC10"), ··· 1643 1650 .driver_data = atkbd_samsung_forced_release_keys, 1644 1651 }, 1645 1652 { 1646 - .ident = "Samsung NC20", 1653 + /* Samsung NC20 */ 1647 1654 .matches = { 1648 1655 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 1649 1656 DMI_MATCH(DMI_PRODUCT_NAME, "NC20"), ··· 1652 1659 .driver_data = atkbd_samsung_forced_release_keys, 1653 1660 }, 1654 1661 { 1655 - .ident = "Samsung SQ45S70S", 1662 + /* Samsung SQ45S70S */ 1656 1663 .matches = { 1657 1664 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 1658 1665 DMI_MATCH(DMI_PRODUCT_NAME, "SQ45S70S"), ··· 1661 1668 .driver_data = atkbd_samsung_forced_release_keys, 1662 1669 }, 1663 1670 { 1664 - .ident = "Fujitsu Amilo PA 1510", 1671 + /* Fujitsu Amilo PA 1510 */ 1665 1672 .matches = { 1666 1673 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 1667 1674 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pa 1510"), ··· 1670 1677 .driver_data = atkbd_volume_forced_release_keys, 1671 1678 }, 1672 1679 { 1673 - .ident = "Fujitsu Amilo Pi 3525", 1680 + /* Fujitsu Amilo Pi 3525 */ 1674 1681 .matches = { 1675 1682 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 1676 1683 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pi 3525"), ··· 1679 1686 .driver_data = atkbd_amilo_pi3525_forced_release_keys, 1680 1687 }, 1681 1688 { 1682 - .ident = "Fujitsu Amilo Xi 3650", 1689 + /* Fujitsu Amilo Xi 3650 */ 1683 1690 .matches = { 1684 1691 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 1685 1692 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Xi 3650"), ··· 1688 1695 .driver_data = atkbd_amilo_xi3650_forced_release_keys, 1689 1696 }, 1690 1697 { 1691 - .ident = "Soltech Corporation TA12", 1692 1698 .matches = { 1693 1699 DMI_MATCH(DMI_SYS_VENDOR, "Soltech Corporation"), 1694 1700 DMI_MATCH(DMI_PRODUCT_NAME, "TA12"), ··· 1696 1704 .driver_data = atkdb_soltech_ta12_forced_release_keys, 1697 1705 }, 1698 1706 { 1699 - .ident = "OQO Model 01+", 1707 + /* OQO Model 01+ */ 1700 1708 .matches = { 1701 1709 DMI_MATCH(DMI_SYS_VENDOR, "OQO"), 1702 1710 DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
+337
drivers/input/keyboard/davinci_keyscan.c
··· 1 + /* 2 + * DaVinci Key Scan Driver for TI platforms 3 + * 4 + * Copyright (C) 2009 Texas Instruments, Inc 5 + * 6 + * Author: Miguel Aguilar <miguel.aguilar@ridgerun.com> 7 + * 8 + * Intial Code: Sandeep Paulraj <s-paulraj@ti.com> 9 + * 10 + * This program is free software; you can redistribute it and/or modify 11 + * it under the terms of the GNU General Public License as published by 12 + * the Free Software Foundation; either version 2 of the License, or 13 + * (at your option) any later version. 14 + * 15 + * This program is distributed in the hope that it will be useful, 16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 + * GNU General Public License for more details. 19 + * 20 + * You should have received a copy of the GNU General Public License 21 + * along with this program; if not, write to the Free Software 22 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 + */ 24 + #include <linux/module.h> 25 + #include <linux/init.h> 26 + #include <linux/interrupt.h> 27 + #include <linux/types.h> 28 + #include <linux/input.h> 29 + #include <linux/kernel.h> 30 + #include <linux/delay.h> 31 + #include <linux/platform_device.h> 32 + #include <linux/errno.h> 33 + 34 + #include <asm/irq.h> 35 + 36 + #include <mach/hardware.h> 37 + #include <mach/irqs.h> 38 + #include <mach/keyscan.h> 39 + 40 + /* Key scan registers */ 41 + #define DAVINCI_KEYSCAN_KEYCTRL 0x0000 42 + #define DAVINCI_KEYSCAN_INTENA 0x0004 43 + #define DAVINCI_KEYSCAN_INTFLAG 0x0008 44 + #define DAVINCI_KEYSCAN_INTCLR 0x000c 45 + #define DAVINCI_KEYSCAN_STRBWIDTH 0x0010 46 + #define DAVINCI_KEYSCAN_INTERVAL 0x0014 47 + #define DAVINCI_KEYSCAN_CONTTIME 0x0018 48 + #define DAVINCI_KEYSCAN_CURRENTST 0x001c 49 + #define DAVINCI_KEYSCAN_PREVSTATE 0x0020 50 + #define DAVINCI_KEYSCAN_EMUCTRL 0x0024 51 + #define DAVINCI_KEYSCAN_IODFTCTRL 0x002c 52 + 53 + /* Key Control Register (KEYCTRL) */ 54 + #define DAVINCI_KEYSCAN_KEYEN 0x00000001 55 + #define DAVINCI_KEYSCAN_PREVMODE 0x00000002 56 + #define DAVINCI_KEYSCAN_CHATOFF 0x00000004 57 + #define DAVINCI_KEYSCAN_AUTODET 0x00000008 58 + #define DAVINCI_KEYSCAN_SCANMODE 0x00000010 59 + #define DAVINCI_KEYSCAN_OUTTYPE 0x00000020 60 + 61 + /* Masks for the interrupts */ 62 + #define DAVINCI_KEYSCAN_INT_CONT 0x00000008 63 + #define DAVINCI_KEYSCAN_INT_OFF 0x00000004 64 + #define DAVINCI_KEYSCAN_INT_ON 0x00000002 65 + #define DAVINCI_KEYSCAN_INT_CHANGE 0x00000001 66 + #define DAVINCI_KEYSCAN_INT_ALL 0x0000000f 67 + 68 + struct davinci_ks { 69 + struct input_dev *input; 70 + struct davinci_ks_platform_data *pdata; 71 + int irq; 72 + void __iomem *base; 73 + resource_size_t pbase; 74 + size_t base_size; 75 + unsigned short keymap[]; 76 + }; 77 + 78 + /* Initializing the kp Module */ 79 + static int __init davinci_ks_initialize(struct davinci_ks *davinci_ks) 80 + { 81 + struct device *dev = &davinci_ks->input->dev; 82 + struct davinci_ks_platform_data *pdata = davinci_ks->pdata; 83 + u32 matrix_ctrl; 84 + 85 + /* Enable all interrupts */ 86 + __raw_writel(DAVINCI_KEYSCAN_INT_ALL, 87 + davinci_ks->base + DAVINCI_KEYSCAN_INTENA); 88 + 89 + /* Clear interrupts if any */ 90 + __raw_writel(DAVINCI_KEYSCAN_INT_ALL, 91 + davinci_ks->base + DAVINCI_KEYSCAN_INTCLR); 92 + 93 + /* Setup the scan period = strobe + interval */ 94 + __raw_writel(pdata->strobe, 95 + davinci_ks->base + DAVINCI_KEYSCAN_STRBWIDTH); 96 + __raw_writel(pdata->interval, 97 + davinci_ks->base + DAVINCI_KEYSCAN_INTERVAL); 98 + __raw_writel(0x01, 99 + davinci_ks->base + DAVINCI_KEYSCAN_CONTTIME); 100 + 101 + /* Define matrix type */ 102 + switch (pdata->matrix_type) { 103 + case DAVINCI_KEYSCAN_MATRIX_4X4: 104 + matrix_ctrl = 0; 105 + break; 106 + case DAVINCI_KEYSCAN_MATRIX_5X3: 107 + matrix_ctrl = (1 << 6); 108 + break; 109 + default: 110 + dev_err(dev->parent, "wrong matrix type\n"); 111 + return -EINVAL; 112 + } 113 + 114 + /* Enable key scan module and set matrix type */ 115 + __raw_writel(DAVINCI_KEYSCAN_AUTODET | DAVINCI_KEYSCAN_KEYEN | 116 + matrix_ctrl, davinci_ks->base + DAVINCI_KEYSCAN_KEYCTRL); 117 + 118 + return 0; 119 + } 120 + 121 + static irqreturn_t davinci_ks_interrupt(int irq, void *dev_id) 122 + { 123 + struct davinci_ks *davinci_ks = dev_id; 124 + struct device *dev = &davinci_ks->input->dev; 125 + unsigned short *keymap = davinci_ks->keymap; 126 + int keymapsize = davinci_ks->pdata->keymapsize; 127 + u32 prev_status, new_status, changed; 128 + bool release; 129 + int keycode = KEY_UNKNOWN; 130 + int i; 131 + 132 + /* Disable interrupt */ 133 + __raw_writel(0x0, davinci_ks->base + DAVINCI_KEYSCAN_INTENA); 134 + 135 + /* Reading previous and new status of the key scan */ 136 + prev_status = __raw_readl(davinci_ks->base + DAVINCI_KEYSCAN_PREVSTATE); 137 + new_status = __raw_readl(davinci_ks->base + DAVINCI_KEYSCAN_CURRENTST); 138 + 139 + changed = prev_status ^ new_status; 140 + 141 + if (changed) { 142 + /* 143 + * It goes through all bits in 'changed' to ensure 144 + * that no key changes are being missed 145 + */ 146 + for (i = 0 ; i < keymapsize; i++) { 147 + if ((changed>>i) & 0x1) { 148 + keycode = keymap[i]; 149 + release = (new_status >> i) & 0x1; 150 + dev_dbg(dev->parent, "key %d %s\n", keycode, 151 + release ? "released" : "pressed"); 152 + input_report_key(davinci_ks->input, keycode, 153 + !release); 154 + input_sync(davinci_ks->input); 155 + } 156 + } 157 + /* Clearing interrupt */ 158 + __raw_writel(DAVINCI_KEYSCAN_INT_ALL, 159 + davinci_ks->base + DAVINCI_KEYSCAN_INTCLR); 160 + } 161 + 162 + /* Enable interrupts */ 163 + __raw_writel(0x1, davinci_ks->base + DAVINCI_KEYSCAN_INTENA); 164 + 165 + return IRQ_HANDLED; 166 + } 167 + 168 + static int __init davinci_ks_probe(struct platform_device *pdev) 169 + { 170 + struct davinci_ks *davinci_ks; 171 + struct input_dev *key_dev; 172 + struct resource *res, *mem; 173 + struct device *dev = &pdev->dev; 174 + struct davinci_ks_platform_data *pdata = pdev->dev.platform_data; 175 + int error, i; 176 + 177 + if (!pdata->keymap) { 178 + dev_dbg(dev, "no keymap from pdata\n"); 179 + return -EINVAL; 180 + } 181 + 182 + davinci_ks = kzalloc(sizeof(struct davinci_ks) + 183 + sizeof(unsigned short) * pdata->keymapsize, GFP_KERNEL); 184 + if (!davinci_ks) { 185 + dev_dbg(dev, "could not allocate memory for private data\n"); 186 + return -ENOMEM; 187 + } 188 + 189 + memcpy(davinci_ks->keymap, pdata->keymap, 190 + sizeof(unsigned short) * pdata->keymapsize); 191 + 192 + key_dev = input_allocate_device(); 193 + if (!key_dev) { 194 + dev_dbg(dev, "could not allocate input device\n"); 195 + error = -ENOMEM; 196 + goto fail1; 197 + } 198 + 199 + davinci_ks->input = key_dev; 200 + 201 + davinci_ks->irq = platform_get_irq(pdev, 0); 202 + if (davinci_ks->irq < 0) { 203 + dev_err(dev, "no key scan irq\n"); 204 + error = davinci_ks->irq; 205 + goto fail2; 206 + } 207 + 208 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 209 + if (!res) { 210 + dev_err(dev, "no mem resource\n"); 211 + error = -EINVAL; 212 + goto fail2; 213 + } 214 + 215 + davinci_ks->pbase = res->start; 216 + davinci_ks->base_size = resource_size(res); 217 + 218 + mem = request_mem_region(davinci_ks->pbase, davinci_ks->base_size, 219 + pdev->name); 220 + if (!mem) { 221 + dev_err(dev, "key scan registers at %08x are not free\n", 222 + davinci_ks->pbase); 223 + error = -EBUSY; 224 + goto fail2; 225 + } 226 + 227 + davinci_ks->base = ioremap(davinci_ks->pbase, davinci_ks->base_size); 228 + if (!davinci_ks->base) { 229 + dev_err(dev, "can't ioremap MEM resource.\n"); 230 + error = -ENOMEM; 231 + goto fail3; 232 + } 233 + 234 + /* Enable auto repeat feature of Linux input subsystem */ 235 + if (pdata->rep) 236 + __set_bit(EV_REP, key_dev->evbit); 237 + 238 + /* Setup input device */ 239 + __set_bit(EV_KEY, key_dev->evbit); 240 + 241 + /* Setup the platform data */ 242 + davinci_ks->pdata = pdata; 243 + 244 + for (i = 0; i < davinci_ks->pdata->keymapsize; i++) 245 + __set_bit(davinci_ks->pdata->keymap[i], key_dev->keybit); 246 + 247 + key_dev->name = "davinci_keyscan"; 248 + key_dev->phys = "davinci_keyscan/input0"; 249 + key_dev->dev.parent = &pdev->dev; 250 + key_dev->id.bustype = BUS_HOST; 251 + key_dev->id.vendor = 0x0001; 252 + key_dev->id.product = 0x0001; 253 + key_dev->id.version = 0x0001; 254 + key_dev->keycode = davinci_ks->keymap; 255 + key_dev->keycodesize = sizeof(davinci_ks->keymap[0]); 256 + key_dev->keycodemax = davinci_ks->pdata->keymapsize; 257 + 258 + error = input_register_device(davinci_ks->input); 259 + if (error < 0) { 260 + dev_err(dev, "unable to register davinci key scan device\n"); 261 + goto fail4; 262 + } 263 + 264 + error = request_irq(davinci_ks->irq, davinci_ks_interrupt, 265 + IRQF_DISABLED, pdev->name, davinci_ks); 266 + if (error < 0) { 267 + dev_err(dev, "unable to register davinci key scan interrupt\n"); 268 + goto fail5; 269 + } 270 + 271 + error = davinci_ks_initialize(davinci_ks); 272 + if (error < 0) { 273 + dev_err(dev, "unable to initialize davinci key scan device\n"); 274 + goto fail6; 275 + } 276 + 277 + platform_set_drvdata(pdev, davinci_ks); 278 + return 0; 279 + 280 + fail6: 281 + free_irq(davinci_ks->irq, davinci_ks); 282 + fail5: 283 + input_unregister_device(davinci_ks->input); 284 + key_dev = NULL; 285 + fail4: 286 + iounmap(davinci_ks->base); 287 + fail3: 288 + release_mem_region(davinci_ks->pbase, davinci_ks->base_size); 289 + fail2: 290 + input_free_device(key_dev); 291 + fail1: 292 + kfree(davinci_ks); 293 + 294 + return error; 295 + } 296 + 297 + static int __devexit davinci_ks_remove(struct platform_device *pdev) 298 + { 299 + struct davinci_ks *davinci_ks = platform_get_drvdata(pdev); 300 + 301 + free_irq(davinci_ks->irq, davinci_ks); 302 + 303 + input_unregister_device(davinci_ks->input); 304 + 305 + iounmap(davinci_ks->base); 306 + release_mem_region(davinci_ks->pbase, davinci_ks->base_size); 307 + 308 + platform_set_drvdata(pdev, NULL); 309 + 310 + kfree(davinci_ks); 311 + 312 + return 0; 313 + } 314 + 315 + static struct platform_driver davinci_ks_driver = { 316 + .driver = { 317 + .name = "davinci_keyscan", 318 + .owner = THIS_MODULE, 319 + }, 320 + .remove = __devexit_p(davinci_ks_remove), 321 + }; 322 + 323 + static int __init davinci_ks_init(void) 324 + { 325 + return platform_driver_probe(&davinci_ks_driver, davinci_ks_probe); 326 + } 327 + module_init(davinci_ks_init); 328 + 329 + static void __exit davinci_ks_exit(void) 330 + { 331 + platform_driver_unregister(&davinci_ks_driver); 332 + } 333 + module_exit(davinci_ks_exit); 334 + 335 + MODULE_AUTHOR("Miguel Aguilar"); 336 + MODULE_DESCRIPTION("Texas Instruments DaVinci Key Scan Driver"); 337 + MODULE_LICENSE("GPL");
+81 -53
drivers/input/keyboard/gpio_keys.c
··· 23 23 #include <linux/input.h> 24 24 #include <linux/gpio_keys.h> 25 25 #include <linux/workqueue.h> 26 - 27 - #include <asm/gpio.h> 26 + #include <linux/gpio.h> 28 27 29 28 struct gpio_button_data { 30 29 struct gpio_keys_button *button; ··· 37 38 struct gpio_button_data data[0]; 38 39 }; 39 40 40 - static void gpio_keys_report_event(struct work_struct *work) 41 + static void gpio_keys_report_event(struct gpio_button_data *bdata) 41 42 { 42 - struct gpio_button_data *bdata = 43 - container_of(work, struct gpio_button_data, work); 44 43 struct gpio_keys_button *button = bdata->button; 45 44 struct input_dev *input = bdata->input; 46 45 unsigned int type = button->type ?: EV_KEY; ··· 46 49 47 50 input_event(input, type, button->code, !!state); 48 51 input_sync(input); 52 + } 53 + 54 + static void gpio_keys_work_func(struct work_struct *work) 55 + { 56 + struct gpio_button_data *bdata = 57 + container_of(work, struct gpio_button_data, work); 58 + 59 + gpio_keys_report_event(bdata); 49 60 } 50 61 51 62 static void gpio_keys_timer(unsigned long _data) ··· 79 74 return IRQ_HANDLED; 80 75 } 81 76 77 + static int __devinit gpio_keys_setup_key(struct device *dev, 78 + struct gpio_button_data *bdata, 79 + struct gpio_keys_button *button) 80 + { 81 + char *desc = button->desc ? button->desc : "gpio_keys"; 82 + int irq, error; 83 + 84 + setup_timer(&bdata->timer, gpio_keys_timer, (unsigned long)bdata); 85 + INIT_WORK(&bdata->work, gpio_keys_work_func); 86 + 87 + error = gpio_request(button->gpio, desc); 88 + if (error < 0) { 89 + dev_err(dev, "failed to request GPIO %d, error %d\n", 90 + button->gpio, error); 91 + goto fail2; 92 + } 93 + 94 + error = gpio_direction_input(button->gpio); 95 + if (error < 0) { 96 + dev_err(dev, "failed to configure" 97 + " direction for GPIO %d, error %d\n", 98 + button->gpio, error); 99 + goto fail3; 100 + } 101 + 102 + irq = gpio_to_irq(button->gpio); 103 + if (irq < 0) { 104 + error = irq; 105 + dev_err(dev, "Unable to get irq number for GPIO %d, error %d\n", 106 + button->gpio, error); 107 + goto fail3; 108 + } 109 + 110 + error = request_irq(irq, gpio_keys_isr, 111 + IRQF_SHARED | 112 + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 113 + desc, bdata); 114 + if (error) { 115 + dev_err(dev, "Unable to claim irq %d; error %d\n", 116 + irq, error); 117 + goto fail3; 118 + } 119 + 120 + return 0; 121 + 122 + fail3: 123 + gpio_free(button->gpio); 124 + fail2: 125 + return error; 126 + } 127 + 82 128 static int __devinit gpio_keys_probe(struct platform_device *pdev) 83 129 { 84 130 struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; 85 131 struct gpio_keys_drvdata *ddata; 132 + struct device *dev = &pdev->dev; 86 133 struct input_dev *input; 87 134 int i, error; 88 135 int wakeup = 0; ··· 144 87 GFP_KERNEL); 145 88 input = input_allocate_device(); 146 89 if (!ddata || !input) { 90 + dev_err(dev, "failed to allocate state\n"); 147 91 error = -ENOMEM; 148 92 goto fail1; 149 93 } ··· 169 111 for (i = 0; i < pdata->nbuttons; i++) { 170 112 struct gpio_keys_button *button = &pdata->buttons[i]; 171 113 struct gpio_button_data *bdata = &ddata->data[i]; 172 - int irq; 173 114 unsigned int type = button->type ?: EV_KEY; 174 115 175 116 bdata->input = input; 176 117 bdata->button = button; 177 - setup_timer(&bdata->timer, 178 - gpio_keys_timer, (unsigned long)bdata); 179 - INIT_WORK(&bdata->work, gpio_keys_report_event); 180 118 181 - error = gpio_request(button->gpio, button->desc ?: "gpio_keys"); 182 - if (error < 0) { 183 - pr_err("gpio-keys: failed to request GPIO %d," 184 - " error %d\n", button->gpio, error); 119 + error = gpio_keys_setup_key(dev, bdata, button); 120 + if (error) 185 121 goto fail2; 186 - } 187 - 188 - error = gpio_direction_input(button->gpio); 189 - if (error < 0) { 190 - pr_err("gpio-keys: failed to configure input" 191 - " direction for GPIO %d, error %d\n", 192 - button->gpio, error); 193 - gpio_free(button->gpio); 194 - goto fail2; 195 - } 196 - 197 - irq = gpio_to_irq(button->gpio); 198 - if (irq < 0) { 199 - error = irq; 200 - pr_err("gpio-keys: Unable to get irq number" 201 - " for GPIO %d, error %d\n", 202 - button->gpio, error); 203 - gpio_free(button->gpio); 204 - goto fail2; 205 - } 206 - 207 - error = request_irq(irq, gpio_keys_isr, 208 - IRQF_SHARED | 209 - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 210 - button->desc ? button->desc : "gpio_keys", 211 - bdata); 212 - if (error) { 213 - pr_err("gpio-keys: Unable to claim irq %d; error %d\n", 214 - irq, error); 215 - gpio_free(button->gpio); 216 - goto fail2; 217 - } 218 122 219 123 if (button->wakeup) 220 124 wakeup = 1; ··· 186 166 187 167 error = input_register_device(input); 188 168 if (error) { 189 - pr_err("gpio-keys: Unable to register input device, " 169 + dev_err(dev, "Unable to register input device, " 190 170 "error: %d\n", error); 191 171 goto fail2; 192 172 } 173 + 174 + /* get current state of buttons */ 175 + for (i = 0; i < pdata->nbuttons; i++) 176 + gpio_keys_report_event(&ddata->data[i]); 177 + input_sync(input); 193 178 194 179 device_init_wakeup(&pdev->dev, wakeup); 195 180 ··· 264 239 static int gpio_keys_resume(struct device *dev) 265 240 { 266 241 struct platform_device *pdev = to_platform_device(dev); 242 + struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev); 267 243 struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; 268 244 int i; 269 245 270 - if (device_may_wakeup(&pdev->dev)) { 271 - for (i = 0; i < pdata->nbuttons; i++) { 272 - struct gpio_keys_button *button = &pdata->buttons[i]; 273 - if (button->wakeup) { 274 - int irq = gpio_to_irq(button->gpio); 275 - disable_irq_wake(irq); 276 - } 246 + for (i = 0; i < pdata->nbuttons; i++) { 247 + 248 + struct gpio_keys_button *button = &pdata->buttons[i]; 249 + if (button->wakeup && device_may_wakeup(&pdev->dev)) { 250 + int irq = gpio_to_irq(button->gpio); 251 + disable_irq_wake(irq); 277 252 } 253 + 254 + gpio_keys_report_event(&ddata->data[i]); 278 255 } 256 + input_sync(ddata->input); 279 257 280 258 return 0; 281 259 }
+226 -246
drivers/input/keyboard/lkkbd.c
··· 72 72 73 73 #define DRIVER_DESC "LK keyboard driver" 74 74 75 - MODULE_AUTHOR ("Jan-Benedict Glaw <jbglaw@lug-owl.de>"); 76 - MODULE_DESCRIPTION (DRIVER_DESC); 77 - MODULE_LICENSE ("GPL"); 75 + MODULE_AUTHOR("Jan-Benedict Glaw <jbglaw@lug-owl.de>"); 76 + MODULE_DESCRIPTION(DRIVER_DESC); 77 + MODULE_LICENSE("GPL"); 78 78 79 79 /* 80 80 * Known parameters: ··· 85 85 * Please notice that there's not yet an API to set these at runtime. 86 86 */ 87 87 static int bell_volume = 100; /* % */ 88 - module_param (bell_volume, int, 0); 89 - MODULE_PARM_DESC (bell_volume, "Bell volume (in %). default is 100%"); 88 + module_param(bell_volume, int, 0); 89 + MODULE_PARM_DESC(bell_volume, "Bell volume (in %). default is 100%"); 90 90 91 91 static int keyclick_volume = 100; /* % */ 92 - module_param (keyclick_volume, int, 0); 93 - MODULE_PARM_DESC (keyclick_volume, "Keyclick volume (in %), default is 100%"); 92 + module_param(keyclick_volume, int, 0); 93 + MODULE_PARM_DESC(keyclick_volume, "Keyclick volume (in %), default is 100%"); 94 94 95 95 static int ctrlclick_volume = 100; /* % */ 96 - module_param (ctrlclick_volume, int, 0); 97 - MODULE_PARM_DESC (ctrlclick_volume, "Ctrlclick volume (in %), default is 100%"); 96 + module_param(ctrlclick_volume, int, 0); 97 + MODULE_PARM_DESC(ctrlclick_volume, "Ctrlclick volume (in %), default is 100%"); 98 98 99 99 static int lk201_compose_is_alt; 100 - module_param (lk201_compose_is_alt, int, 0); 101 - MODULE_PARM_DESC (lk201_compose_is_alt, "If set non-zero, LK201' Compose key " 102 - "will act as an Alt key"); 100 + module_param(lk201_compose_is_alt, int, 0); 101 + MODULE_PARM_DESC(lk201_compose_is_alt, 102 + "If set non-zero, LK201' Compose key will act as an Alt key"); 103 103 104 104 105 105 106 106 #undef LKKBD_DEBUG 107 107 #ifdef LKKBD_DEBUG 108 - #define DBG(x...) printk (x) 108 + #define DBG(x...) printk(x) 109 109 #else 110 110 #define DBG(x...) do {} while (0) 111 111 #endif ··· 122 122 #define LK_MODE_DOWN 0x80 123 123 #define LK_MODE_AUTODOWN 0x82 124 124 #define LK_MODE_UPDOWN 0x86 125 - #define LK_CMD_SET_MODE(mode,div) ((mode) | ((div) << 3)) 125 + #define LK_CMD_SET_MODE(mode, div) ((mode) | ((div) << 3)) 126 126 127 127 /* Misc commands */ 128 128 #define LK_CMD_ENABLE_KEYCLICK 0x1b ··· 152 152 153 153 #define LK_NUM_KEYCODES 256 154 154 #define LK_NUM_IGNORE_BYTES 6 155 - typedef u_int16_t lk_keycode_t; 156 155 157 - 158 - 159 - static lk_keycode_t lkkbd_keycode[LK_NUM_KEYCODES] = { 156 + static unsigned short lkkbd_keycode[LK_NUM_KEYCODES] = { 160 157 [0x56] = KEY_F1, 161 158 [0x57] = KEY_F2, 162 159 [0x58] = KEY_F3, ··· 265 268 }; 266 269 267 270 #define CHECK_LED(LK, VAR_ON, VAR_OFF, LED, BITS) do { \ 268 - if (test_bit (LED, (LK)->dev->led)) \ 271 + if (test_bit(LED, (LK)->dev->led)) \ 269 272 VAR_ON |= BITS; \ 270 273 else \ 271 274 VAR_OFF |= BITS; \ ··· 275 278 * Per-keyboard data 276 279 */ 277 280 struct lkkbd { 278 - lk_keycode_t keycode[LK_NUM_KEYCODES]; 281 + unsigned short keycode[LK_NUM_KEYCODES]; 279 282 int ignore_bytes; 280 283 unsigned char id[LK_NUM_IGNORE_BYTES]; 281 284 struct input_dev *dev; ··· 298 301 unsigned char *name; 299 302 } lk_response[] = { 300 303 #define RESPONSE(x) { .value = (x), .name = #x, } 301 - RESPONSE (LK_STUCK_KEY), 302 - RESPONSE (LK_SELFTEST_FAILED), 303 - RESPONSE (LK_ALL_KEYS_UP), 304 - RESPONSE (LK_METRONOME), 305 - RESPONSE (LK_OUTPUT_ERROR), 306 - RESPONSE (LK_INPUT_ERROR), 307 - RESPONSE (LK_KBD_LOCKED), 308 - RESPONSE (LK_KBD_TEST_MODE_ACK), 309 - RESPONSE (LK_PREFIX_KEY_DOWN), 310 - RESPONSE (LK_MODE_CHANGE_ACK), 311 - RESPONSE (LK_RESPONSE_RESERVED), 304 + RESPONSE(LK_STUCK_KEY), 305 + RESPONSE(LK_SELFTEST_FAILED), 306 + RESPONSE(LK_ALL_KEYS_UP), 307 + RESPONSE(LK_METRONOME), 308 + RESPONSE(LK_OUTPUT_ERROR), 309 + RESPONSE(LK_INPUT_ERROR), 310 + RESPONSE(LK_KBD_LOCKED), 311 + RESPONSE(LK_KBD_TEST_MODE_ACK), 312 + RESPONSE(LK_PREFIX_KEY_DOWN), 313 + RESPONSE(LK_MODE_CHANGE_ACK), 314 + RESPONSE(LK_RESPONSE_RESERVED), 312 315 #undef RESPONSE 313 316 }; 314 317 315 - static unsigned char * 316 - response_name (unsigned char value) 318 + static unsigned char *response_name(unsigned char value) 317 319 { 318 320 int i; 319 321 320 - for (i = 0; i < ARRAY_SIZE (lk_response); i++) 322 + for (i = 0; i < ARRAY_SIZE(lk_response); i++) 321 323 if (lk_response[i].value == value) 322 324 return lk_response[i].name; 323 325 ··· 327 331 /* 328 332 * Calculate volume parameter byte for a given volume. 329 333 */ 330 - static unsigned char 331 - volume_to_hw (int volume_percent) 334 + static unsigned char volume_to_hw(int volume_percent) 332 335 { 333 336 unsigned char ret = 0; 334 337 ··· 358 363 return ret; 359 364 } 360 365 361 - static void 362 - lkkbd_detection_done (struct lkkbd *lk) 366 + static void lkkbd_detection_done(struct lkkbd *lk) 363 367 { 364 368 int i; 365 369 ··· 371 377 * Print keyboard name and modify Compose=Alt on user's request. 372 378 */ 373 379 switch (lk->id[4]) { 374 - case 1: 375 - strlcpy (lk->name, "DEC LK201 keyboard", 376 - sizeof (lk->name)); 380 + case 1: 381 + strlcpy(lk->name, "DEC LK201 keyboard", sizeof(lk->name)); 377 382 378 - if (lk201_compose_is_alt) 379 - lk->keycode[0xb1] = KEY_LEFTALT; 380 - break; 383 + if (lk201_compose_is_alt) 384 + lk->keycode[0xb1] = KEY_LEFTALT; 385 + break; 381 386 382 - case 2: 383 - strlcpy (lk->name, "DEC LK401 keyboard", 384 - sizeof (lk->name)); 385 - break; 387 + case 2: 388 + strlcpy(lk->name, "DEC LK401 keyboard", sizeof(lk->name)); 389 + break; 386 390 387 - default: 388 - strlcpy (lk->name, "Unknown DEC keyboard", 389 - sizeof (lk->name)); 390 - printk (KERN_ERR "lkkbd: keyboard on %s is unknown, " 391 - "please report to Jan-Benedict Glaw " 392 - "<jbglaw@lug-owl.de>\n", lk->phys); 393 - printk (KERN_ERR "lkkbd: keyboard ID'ed as:"); 394 - for (i = 0; i < LK_NUM_IGNORE_BYTES; i++) 395 - printk (" 0x%02x", lk->id[i]); 396 - printk ("\n"); 397 - break; 391 + default: 392 + strlcpy(lk->name, "Unknown DEC keyboard", sizeof(lk->name)); 393 + printk(KERN_ERR 394 + "lkkbd: keyboard on %s is unknown, please report to " 395 + "Jan-Benedict Glaw <jbglaw@lug-owl.de>\n", lk->phys); 396 + printk(KERN_ERR "lkkbd: keyboard ID'ed as:"); 397 + for (i = 0; i < LK_NUM_IGNORE_BYTES; i++) 398 + printk(" 0x%02x", lk->id[i]); 399 + printk("\n"); 400 + break; 398 401 } 399 - printk (KERN_INFO "lkkbd: keyboard on %s identified as: %s\n", 400 - lk->phys, lk->name); 402 + 403 + printk(KERN_INFO "lkkbd: keyboard on %s identified as: %s\n", 404 + lk->phys, lk->name); 401 405 402 406 /* 403 407 * Report errors during keyboard boot-up. 404 408 */ 405 409 switch (lk->id[2]) { 406 - case 0x00: 407 - /* All okay */ 408 - break; 410 + case 0x00: 411 + /* All okay */ 412 + break; 409 413 410 - case LK_STUCK_KEY: 411 - printk (KERN_ERR "lkkbd: Stuck key on keyboard at " 412 - "%s\n", lk->phys); 413 - break; 414 + case LK_STUCK_KEY: 415 + printk(KERN_ERR "lkkbd: Stuck key on keyboard at %s\n", 416 + lk->phys); 417 + break; 414 418 415 - case LK_SELFTEST_FAILED: 416 - printk (KERN_ERR "lkkbd: Selftest failed on keyboard " 417 - "at %s, keyboard may not work " 418 - "properly\n", lk->phys); 419 - break; 419 + case LK_SELFTEST_FAILED: 420 + printk(KERN_ERR 421 + "lkkbd: Selftest failed on keyboard at %s, " 422 + "keyboard may not work properly\n", lk->phys); 423 + break; 420 424 421 - default: 422 - printk (KERN_ERR "lkkbd: Unknown error %02x on " 423 - "keyboard at %s\n", lk->id[2], 424 - lk->phys); 425 - break; 425 + default: 426 + printk(KERN_ERR 427 + "lkkbd: Unknown error %02x on keyboard at %s\n", 428 + lk->id[2], lk->phys); 429 + break; 426 430 } 427 431 428 432 /* 429 433 * Try to hint user if there's a stuck key. 430 434 */ 431 435 if (lk->id[2] == LK_STUCK_KEY && lk->id[3] != 0) 432 - printk (KERN_ERR "Scancode of stuck key is 0x%02x, keycode " 433 - "is 0x%04x\n", lk->id[3], 434 - lk->keycode[lk->id[3]]); 435 - 436 - return; 436 + printk(KERN_ERR 437 + "Scancode of stuck key is 0x%02x, keycode is 0x%04x\n", 438 + lk->id[3], lk->keycode[lk->id[3]]); 437 439 } 438 440 439 441 /* 440 442 * lkkbd_interrupt() is called by the low level driver when a character 441 443 * is received. 442 444 */ 443 - static irqreturn_t 444 - lkkbd_interrupt (struct serio *serio, unsigned char data, unsigned int flags) 445 + static irqreturn_t lkkbd_interrupt(struct serio *serio, 446 + unsigned char data, unsigned int flags) 445 447 { 446 - struct lkkbd *lk = serio_get_drvdata (serio); 448 + struct lkkbd *lk = serio_get_drvdata(serio); 449 + struct input_dev *input_dev = lk->dev; 450 + unsigned int keycode; 447 451 int i; 448 452 449 - DBG (KERN_INFO "Got byte 0x%02x\n", data); 453 + DBG(KERN_INFO "Got byte 0x%02x\n", data); 450 454 451 455 if (lk->ignore_bytes > 0) { 452 - DBG (KERN_INFO "Ignoring a byte on %s\n", lk->name); 456 + DBG(KERN_INFO "Ignoring a byte on %s\n", lk->name); 453 457 lk->id[LK_NUM_IGNORE_BYTES - lk->ignore_bytes--] = data; 454 458 455 459 if (lk->ignore_bytes == 0) 456 - lkkbd_detection_done (lk); 460 + lkkbd_detection_done(lk); 457 461 458 462 return IRQ_HANDLED; 459 463 } 460 464 461 465 switch (data) { 462 - case LK_ALL_KEYS_UP: 463 - for (i = 0; i < ARRAY_SIZE (lkkbd_keycode); i++) 464 - if (lk->keycode[i] != KEY_RESERVED) 465 - input_report_key (lk->dev, lk->keycode[i], 0); 466 - input_sync (lk->dev); 467 - break; 466 + case LK_ALL_KEYS_UP: 467 + for (i = 0; i < ARRAY_SIZE(lkkbd_keycode); i++) 468 + input_report_key(input_dev, lk->keycode[i], 0); 469 + input_sync(input_dev); 470 + break; 468 471 469 - case 0x01: 470 - DBG (KERN_INFO "Got 0x01, scheduling re-initialization\n"); 471 - lk->ignore_bytes = LK_NUM_IGNORE_BYTES; 472 - lk->id[LK_NUM_IGNORE_BYTES - lk->ignore_bytes--] = data; 473 - schedule_work (&lk->tq); 474 - break; 472 + case 0x01: 473 + DBG(KERN_INFO "Got 0x01, scheduling re-initialization\n"); 474 + lk->ignore_bytes = LK_NUM_IGNORE_BYTES; 475 + lk->id[LK_NUM_IGNORE_BYTES - lk->ignore_bytes--] = data; 476 + schedule_work(&lk->tq); 477 + break; 475 478 476 - case LK_METRONOME: 477 - case LK_OUTPUT_ERROR: 478 - case LK_INPUT_ERROR: 479 - case LK_KBD_LOCKED: 480 - case LK_KBD_TEST_MODE_ACK: 481 - case LK_PREFIX_KEY_DOWN: 482 - case LK_MODE_CHANGE_ACK: 483 - case LK_RESPONSE_RESERVED: 484 - DBG (KERN_INFO "Got %s and don't know how to handle...\n", 485 - response_name (data)); 486 - break; 479 + case LK_METRONOME: 480 + case LK_OUTPUT_ERROR: 481 + case LK_INPUT_ERROR: 482 + case LK_KBD_LOCKED: 483 + case LK_KBD_TEST_MODE_ACK: 484 + case LK_PREFIX_KEY_DOWN: 485 + case LK_MODE_CHANGE_ACK: 486 + case LK_RESPONSE_RESERVED: 487 + DBG(KERN_INFO "Got %s and don't know how to handle...\n", 488 + response_name(data)); 489 + break; 487 490 488 - default: 489 - if (lk->keycode[data] != KEY_RESERVED) { 490 - if (!test_bit (lk->keycode[data], lk->dev->key)) 491 - input_report_key (lk->dev, lk->keycode[data], 1); 492 - else 493 - input_report_key (lk->dev, lk->keycode[data], 0); 494 - input_sync (lk->dev); 495 - } else 496 - printk (KERN_WARNING "%s: Unknown key with " 497 - "scancode 0x%02x on %s.\n", 498 - __FILE__, data, lk->name); 491 + default: 492 + keycode = lk->keycode[data]; 493 + if (keycode != KEY_RESERVED) { 494 + input_report_key(input_dev, keycode, 495 + !test_bit(keycode, input_dev->key)); 496 + input_sync(input_dev); 497 + } else { 498 + printk(KERN_WARNING 499 + "%s: Unknown key with scancode 0x%02x on %s.\n", 500 + __FILE__, data, lk->name); 501 + } 499 502 } 500 503 501 504 return IRQ_HANDLED; 502 505 } 503 506 504 - /* 505 - * lkkbd_event() handles events from the input module. 506 - */ 507 - static int 508 - lkkbd_event (struct input_dev *dev, unsigned int type, unsigned int code, 509 - int value) 507 + static void lkkbd_toggle_leds(struct lkkbd *lk) 510 508 { 511 - struct lkkbd *lk = input_get_drvdata (dev); 509 + struct serio *serio = lk->serio; 512 510 unsigned char leds_on = 0; 513 511 unsigned char leds_off = 0; 514 512 513 + CHECK_LED(lk, leds_on, leds_off, LED_CAPSL, LK_LED_SHIFTLOCK); 514 + CHECK_LED(lk, leds_on, leds_off, LED_COMPOSE, LK_LED_COMPOSE); 515 + CHECK_LED(lk, leds_on, leds_off, LED_SCROLLL, LK_LED_SCROLLLOCK); 516 + CHECK_LED(lk, leds_on, leds_off, LED_SLEEP, LK_LED_WAIT); 517 + if (leds_on != 0) { 518 + serio_write(serio, LK_CMD_LED_ON); 519 + serio_write(serio, leds_on); 520 + } 521 + if (leds_off != 0) { 522 + serio_write(serio, LK_CMD_LED_OFF); 523 + serio_write(serio, leds_off); 524 + } 525 + } 526 + 527 + static void lkkbd_toggle_keyclick(struct lkkbd *lk, bool on) 528 + { 529 + struct serio *serio = lk->serio; 530 + 531 + if (on) { 532 + DBG("%s: Activating key clicks\n", __func__); 533 + serio_write(serio, LK_CMD_ENABLE_KEYCLICK); 534 + serio_write(serio, volume_to_hw(lk->keyclick_volume)); 535 + serio_write(serio, LK_CMD_ENABLE_CTRCLICK); 536 + serio_write(serio, volume_to_hw(lk->ctrlclick_volume)); 537 + } else { 538 + DBG("%s: Deactivating key clicks\n", __func__); 539 + serio_write(serio, LK_CMD_DISABLE_KEYCLICK); 540 + serio_write(serio, LK_CMD_DISABLE_CTRCLICK); 541 + } 542 + 543 + } 544 + 545 + /* 546 + * lkkbd_event() handles events from the input module. 547 + */ 548 + static int lkkbd_event(struct input_dev *dev, 549 + unsigned int type, unsigned int code, int value) 550 + { 551 + struct lkkbd *lk = input_get_drvdata(dev); 552 + 515 553 switch (type) { 516 - case EV_LED: 517 - CHECK_LED (lk, leds_on, leds_off, LED_CAPSL, LK_LED_SHIFTLOCK); 518 - CHECK_LED (lk, leds_on, leds_off, LED_COMPOSE, LK_LED_COMPOSE); 519 - CHECK_LED (lk, leds_on, leds_off, LED_SCROLLL, LK_LED_SCROLLLOCK); 520 - CHECK_LED (lk, leds_on, leds_off, LED_SLEEP, LK_LED_WAIT); 521 - if (leds_on != 0) { 522 - serio_write (lk->serio, LK_CMD_LED_ON); 523 - serio_write (lk->serio, leds_on); 524 - } 525 - if (leds_off != 0) { 526 - serio_write (lk->serio, LK_CMD_LED_OFF); 527 - serio_write (lk->serio, leds_off); 528 - } 554 + case EV_LED: 555 + lkkbd_toggle_leds(lk); 556 + return 0; 557 + 558 + case EV_SND: 559 + switch (code) { 560 + case SND_CLICK: 561 + lkkbd_toggle_keyclick(lk, value); 529 562 return 0; 530 563 531 - case EV_SND: 532 - switch (code) { 533 - case SND_CLICK: 534 - if (value == 0) { 535 - DBG ("%s: Deactivating key clicks\n", __func__); 536 - serio_write (lk->serio, LK_CMD_DISABLE_KEYCLICK); 537 - serio_write (lk->serio, LK_CMD_DISABLE_CTRCLICK); 538 - } else { 539 - DBG ("%s: Activating key clicks\n", __func__); 540 - serio_write (lk->serio, LK_CMD_ENABLE_KEYCLICK); 541 - serio_write (lk->serio, volume_to_hw (lk->keyclick_volume)); 542 - serio_write (lk->serio, LK_CMD_ENABLE_CTRCLICK); 543 - serio_write (lk->serio, volume_to_hw (lk->ctrlclick_volume)); 544 - } 545 - return 0; 564 + case SND_BELL: 565 + if (value != 0) 566 + serio_write(lk->serio, LK_CMD_SOUND_BELL); 546 567 547 - case SND_BELL: 548 - if (value != 0) 549 - serio_write (lk->serio, LK_CMD_SOUND_BELL); 568 + return 0; 569 + } 550 570 551 - return 0; 552 - } 553 - break; 571 + break; 554 572 555 - default: 556 - printk (KERN_ERR "%s (): Got unknown type %d, code %d, value %d\n", 557 - __func__, type, code, value); 573 + default: 574 + printk(KERN_ERR "%s(): Got unknown type %d, code %d, value %d\n", 575 + __func__, type, code, value); 558 576 } 559 577 560 578 return -1; ··· 576 570 * lkkbd_reinit() sets leds and beeps to a state the computer remembers they 577 571 * were in. 578 572 */ 579 - static void 580 - lkkbd_reinit (struct work_struct *work) 573 + static void lkkbd_reinit(struct work_struct *work) 581 574 { 582 575 struct lkkbd *lk = container_of(work, struct lkkbd, tq); 583 576 int division; 584 - unsigned char leds_on = 0; 585 - unsigned char leds_off = 0; 586 577 587 578 /* Ask for ID */ 588 - serio_write (lk->serio, LK_CMD_REQUEST_ID); 579 + serio_write(lk->serio, LK_CMD_REQUEST_ID); 589 580 590 581 /* Reset parameters */ 591 - serio_write (lk->serio, LK_CMD_SET_DEFAULTS); 582 + serio_write(lk->serio, LK_CMD_SET_DEFAULTS); 592 583 593 584 /* Set LEDs */ 594 - CHECK_LED (lk, leds_on, leds_off, LED_CAPSL, LK_LED_SHIFTLOCK); 595 - CHECK_LED (lk, leds_on, leds_off, LED_COMPOSE, LK_LED_COMPOSE); 596 - CHECK_LED (lk, leds_on, leds_off, LED_SCROLLL, LK_LED_SCROLLLOCK); 597 - CHECK_LED (lk, leds_on, leds_off, LED_SLEEP, LK_LED_WAIT); 598 - if (leds_on != 0) { 599 - serio_write (lk->serio, LK_CMD_LED_ON); 600 - serio_write (lk->serio, leds_on); 601 - } 602 - if (leds_off != 0) { 603 - serio_write (lk->serio, LK_CMD_LED_OFF); 604 - serio_write (lk->serio, leds_off); 605 - } 585 + lkkbd_toggle_leds(lk); 606 586 607 587 /* 608 588 * Try to activate extended LK401 mode. This command will 609 589 * only work with a LK401 keyboard and grants access to 610 590 * LAlt, RAlt, RCompose and RShift. 611 591 */ 612 - serio_write (lk->serio, LK_CMD_ENABLE_LK401); 592 + serio_write(lk->serio, LK_CMD_ENABLE_LK401); 613 593 614 594 /* Set all keys to UPDOWN mode */ 615 595 for (division = 1; division <= 14; division++) 616 - serio_write (lk->serio, LK_CMD_SET_MODE (LK_MODE_UPDOWN, 617 - division)); 596 + serio_write(lk->serio, 597 + LK_CMD_SET_MODE(LK_MODE_UPDOWN, division)); 618 598 619 599 /* Enable bell and set volume */ 620 - serio_write (lk->serio, LK_CMD_ENABLE_BELL); 621 - serio_write (lk->serio, volume_to_hw (lk->bell_volume)); 600 + serio_write(lk->serio, LK_CMD_ENABLE_BELL); 601 + serio_write(lk->serio, volume_to_hw(lk->bell_volume)); 622 602 623 603 /* Enable/disable keyclick (and possibly set volume) */ 624 - if (test_bit (SND_CLICK, lk->dev->snd)) { 625 - serio_write (lk->serio, LK_CMD_ENABLE_KEYCLICK); 626 - serio_write (lk->serio, volume_to_hw (lk->keyclick_volume)); 627 - serio_write (lk->serio, LK_CMD_ENABLE_CTRCLICK); 628 - serio_write (lk->serio, volume_to_hw (lk->ctrlclick_volume)); 629 - } else { 630 - serio_write (lk->serio, LK_CMD_DISABLE_KEYCLICK); 631 - serio_write (lk->serio, LK_CMD_DISABLE_CTRCLICK); 632 - } 604 + lkkbd_toggle_keyclick(lk, test_bit(SND_CLICK, lk->dev->snd)); 633 605 634 606 /* Sound the bell if needed */ 635 - if (test_bit (SND_BELL, lk->dev->snd)) 636 - serio_write (lk->serio, LK_CMD_SOUND_BELL); 607 + if (test_bit(SND_BELL, lk->dev->snd)) 608 + serio_write(lk->serio, LK_CMD_SOUND_BELL); 637 609 } 638 610 639 611 /* 640 612 * lkkbd_connect() probes for a LK keyboard and fills the necessary structures. 641 613 */ 642 - static int 643 - lkkbd_connect (struct serio *serio, struct serio_driver *drv) 614 + static int lkkbd_connect(struct serio *serio, struct serio_driver *drv) 644 615 { 645 616 struct lkkbd *lk; 646 617 struct input_dev *input_dev; 647 618 int i; 648 619 int err; 649 620 650 - lk = kzalloc (sizeof (struct lkkbd), GFP_KERNEL); 651 - input_dev = input_allocate_device (); 621 + lk = kzalloc(sizeof(struct lkkbd), GFP_KERNEL); 622 + input_dev = input_allocate_device(); 652 623 if (!lk || !input_dev) { 653 624 err = -ENOMEM; 654 625 goto fail1; ··· 633 650 634 651 lk->serio = serio; 635 652 lk->dev = input_dev; 636 - INIT_WORK (&lk->tq, lkkbd_reinit); 653 + INIT_WORK(&lk->tq, lkkbd_reinit); 637 654 lk->bell_volume = bell_volume; 638 655 lk->keyclick_volume = keyclick_volume; 639 656 lk->ctrlclick_volume = ctrlclick_volume; 640 - memcpy (lk->keycode, lkkbd_keycode, sizeof (lk_keycode_t) * LK_NUM_KEYCODES); 657 + memcpy(lk->keycode, lkkbd_keycode, sizeof(lk->keycode)); 641 658 642 - strlcpy (lk->name, "DEC LK keyboard", sizeof(lk->name)); 643 - snprintf (lk->phys, sizeof(lk->phys), "%s/input0", serio->phys); 659 + strlcpy(lk->name, "DEC LK keyboard", sizeof(lk->name)); 660 + snprintf(lk->phys, sizeof(lk->phys), "%s/input0", serio->phys); 644 661 645 662 input_dev->name = lk->name; 646 663 input_dev->phys = lk->phys; ··· 651 668 input_dev->dev.parent = &serio->dev; 652 669 input_dev->event = lkkbd_event; 653 670 654 - input_set_drvdata (input_dev, lk); 671 + input_set_drvdata(input_dev, lk); 655 672 656 - set_bit (EV_KEY, input_dev->evbit); 657 - set_bit (EV_LED, input_dev->evbit); 658 - set_bit (EV_SND, input_dev->evbit); 659 - set_bit (EV_REP, input_dev->evbit); 660 - set_bit (LED_CAPSL, input_dev->ledbit); 661 - set_bit (LED_SLEEP, input_dev->ledbit); 662 - set_bit (LED_COMPOSE, input_dev->ledbit); 663 - set_bit (LED_SCROLLL, input_dev->ledbit); 664 - set_bit (SND_BELL, input_dev->sndbit); 665 - set_bit (SND_CLICK, input_dev->sndbit); 673 + __set_bit(EV_KEY, input_dev->evbit); 674 + __set_bit(EV_LED, input_dev->evbit); 675 + __set_bit(EV_SND, input_dev->evbit); 676 + __set_bit(EV_REP, input_dev->evbit); 677 + __set_bit(LED_CAPSL, input_dev->ledbit); 678 + __set_bit(LED_SLEEP, input_dev->ledbit); 679 + __set_bit(LED_COMPOSE, input_dev->ledbit); 680 + __set_bit(LED_SCROLLL, input_dev->ledbit); 681 + __set_bit(SND_BELL, input_dev->sndbit); 682 + __set_bit(SND_CLICK, input_dev->sndbit); 666 683 667 684 input_dev->keycode = lk->keycode; 668 - input_dev->keycodesize = sizeof (lk_keycode_t); 669 - input_dev->keycodemax = LK_NUM_KEYCODES; 685 + input_dev->keycodesize = sizeof(lk->keycode[0]); 686 + input_dev->keycodemax = ARRAY_SIZE(lk->keycode); 670 687 671 688 for (i = 0; i < LK_NUM_KEYCODES; i++) 672 - __set_bit (lk->keycode[i], input_dev->keybit); 689 + __set_bit(lk->keycode[i], input_dev->keybit); 673 690 __clear_bit(KEY_RESERVED, input_dev->keybit); 674 691 675 - serio_set_drvdata (serio, lk); 692 + serio_set_drvdata(serio, lk); 676 693 677 - err = serio_open (serio, drv); 694 + err = serio_open(serio, drv); 678 695 if (err) 679 696 goto fail2; 680 697 681 - err = input_register_device (lk->dev); 698 + err = input_register_device(lk->dev); 682 699 if (err) 683 700 goto fail3; 684 701 685 - serio_write (lk->serio, LK_CMD_POWERCYCLE_RESET); 702 + serio_write(lk->serio, LK_CMD_POWERCYCLE_RESET); 686 703 687 704 return 0; 688 705 689 - fail3: serio_close (serio); 690 - fail2: serio_set_drvdata (serio, NULL); 691 - fail1: input_free_device (input_dev); 692 - kfree (lk); 706 + fail3: serio_close(serio); 707 + fail2: serio_set_drvdata(serio, NULL); 708 + fail1: input_free_device(input_dev); 709 + kfree(lk); 693 710 return err; 694 711 } 695 712 696 713 /* 697 714 * lkkbd_disconnect() unregisters and closes behind us. 698 715 */ 699 - static void 700 - lkkbd_disconnect (struct serio *serio) 716 + static void lkkbd_disconnect(struct serio *serio) 701 717 { 702 - struct lkkbd *lk = serio_get_drvdata (serio); 718 + struct lkkbd *lk = serio_get_drvdata(serio); 703 719 704 - input_get_device (lk->dev); 705 - input_unregister_device (lk->dev); 706 - serio_close (serio); 707 - serio_set_drvdata (serio, NULL); 708 - input_put_device (lk->dev); 709 - kfree (lk); 720 + input_get_device(lk->dev); 721 + input_unregister_device(lk->dev); 722 + serio_close(serio); 723 + serio_set_drvdata(serio, NULL); 724 + input_put_device(lk->dev); 725 + kfree(lk); 710 726 } 711 727 712 728 static struct serio_device_id lkkbd_serio_ids[] = { ··· 734 752 /* 735 753 * The functions for insering/removing us as a module. 736 754 */ 737 - static int __init 738 - lkkbd_init (void) 755 + static int __init lkkbd_init(void) 739 756 { 740 757 return serio_register_driver(&lkkbd_drv); 741 758 } 742 759 743 - static void __exit 744 - lkkbd_exit (void) 760 + static void __exit lkkbd_exit(void) 745 761 { 746 762 serio_unregister_driver(&lkkbd_drv); 747 763 } 748 764 749 - module_init (lkkbd_init); 750 - module_exit (lkkbd_exit); 765 + module_init(lkkbd_init); 766 + module_exit(lkkbd_exit); 751 767
+10 -7
drivers/input/keyboard/matrix_keypad.c
··· 213 213 } 214 214 215 215 #ifdef CONFIG_PM 216 - static int matrix_keypad_suspend(struct platform_device *pdev, pm_message_t state) 216 + static int matrix_keypad_suspend(struct device *dev) 217 217 { 218 + struct platform_device *pdev = to_platform_device(dev); 218 219 struct matrix_keypad *keypad = platform_get_drvdata(pdev); 219 220 const struct matrix_keypad_platform_data *pdata = keypad->pdata; 220 221 int i; ··· 229 228 return 0; 230 229 } 231 230 232 - static int matrix_keypad_resume(struct platform_device *pdev) 231 + static int matrix_keypad_resume(struct device *dev) 233 232 { 233 + struct platform_device *pdev = to_platform_device(dev); 234 234 struct matrix_keypad *keypad = platform_get_drvdata(pdev); 235 235 const struct matrix_keypad_platform_data *pdata = keypad->pdata; 236 236 int i; ··· 244 242 245 243 return 0; 246 244 } 247 - #else 248 - #define matrix_keypad_suspend NULL 249 - #define matrix_keypad_resume NULL 245 + 246 + static const SIMPLE_DEV_PM_OPS(matrix_keypad_pm_ops, 247 + matrix_keypad_suspend, matrix_keypad_resume); 250 248 #endif 251 249 252 250 static int __devinit init_matrix_gpio(struct platform_device *pdev, ··· 419 417 static struct platform_driver matrix_keypad_driver = { 420 418 .probe = matrix_keypad_probe, 421 419 .remove = __devexit_p(matrix_keypad_remove), 422 - .suspend = matrix_keypad_suspend, 423 - .resume = matrix_keypad_resume, 424 420 .driver = { 425 421 .name = "matrix-keypad", 426 422 .owner = THIS_MODULE, 423 + #ifdef CONFIG_PM 424 + .pm = &matrix_keypad_pm_ops, 425 + #endif 427 426 }, 428 427 }; 429 428
+2
drivers/input/misc/Kconfig
··· 80 80 tristate "x86 Wistron laptop button interface" 81 81 depends on X86 && !X86_64 82 82 select INPUT_POLLDEV 83 + select INPUT_SPARSEKMAP 83 84 select NEW_LEDS 84 85 select LEDS_CLASS 85 86 select CHECK_SIGNATURE ··· 282 281 config INPUT_DM355EVM 283 282 tristate "TI DaVinci DM355 EVM Keypad and IR Remote" 284 283 depends on MFD_DM355EVM_MSP 284 + select INPUT_SPARSEKMAP 285 285 help 286 286 Supports the pushbuttons and IR remote used with 287 287 the DM355 EVM board.
+1 -1
drivers/input/misc/ati_remote.c
··· 766 766 ati_remote->interface = interface; 767 767 768 768 usb_make_path(udev, ati_remote->phys, sizeof(ati_remote->phys)); 769 - strlcpy(ati_remote->phys, "/input0", sizeof(ati_remote->phys)); 769 + strlcat(ati_remote->phys, "/input0", sizeof(ati_remote->phys)); 770 770 771 771 if (udev->manufacturer) 772 772 strlcpy(ati_remote->name, udev->manufacturer, sizeof(ati_remote->name));
+56 -94
drivers/input/misc/dm355evm_keys.c
··· 11 11 #include <linux/kernel.h> 12 12 #include <linux/init.h> 13 13 #include <linux/input.h> 14 + #include <linux/input/sparse-keymap.h> 14 15 #include <linux/platform_device.h> 15 16 #include <linux/interrupt.h> 16 17 ··· 34 33 int irq; 35 34 }; 36 35 37 - /* These initial keycodes can be remapped by dm355evm_setkeycode(). */ 38 - static struct { 39 - u16 event; 40 - u16 keycode; 41 - } dm355evm_keys[] = { 42 - 36 + /* These initial keycodes can be remapped */ 37 + static const struct key_entry dm355evm_keys[] = { 43 38 /* 44 39 * Pushbuttons on the EVM board ... note that the labels for these 45 40 * are SW10/SW11/etc on the PC board. The left/right orientation ··· 44 47 * is to the right. (That is, rotate the board counter-clockwise 45 48 * by 90 degrees from the SW10/etc and "DM355 EVM" labels.) 46 49 */ 47 - { 0x00d8, KEY_OK, }, /* SW12 */ 48 - { 0x00b8, KEY_UP, }, /* SW13 */ 49 - { 0x00e8, KEY_DOWN, }, /* SW11 */ 50 - { 0x0078, KEY_LEFT, }, /* SW14 */ 51 - { 0x00f0, KEY_RIGHT, }, /* SW10 */ 50 + { KE_KEY, 0x00d8, { KEY_OK } }, /* SW12 */ 51 + { KE_KEY, 0x00b8, { KEY_UP } }, /* SW13 */ 52 + { KE_KEY, 0x00e8, { KEY_DOWN } }, /* SW11 */ 53 + { KE_KEY, 0x0078, { KEY_LEFT } }, /* SW14 */ 54 + { KE_KEY, 0x00f0, { KEY_RIGHT } }, /* SW10 */ 52 55 53 56 /* 54 57 * IR buttons ... codes assigned to match the universal remote ··· 62 65 * RC5 codes are 14 bits, with two start bits (0x3 prefix) 63 66 * and a toggle bit (masked out below). 64 67 */ 65 - { 0x300c, KEY_POWER, }, /* NOTE: docs omit this */ 66 - { 0x3000, KEY_NUMERIC_0, }, 67 - { 0x3001, KEY_NUMERIC_1, }, 68 - { 0x3002, KEY_NUMERIC_2, }, 69 - { 0x3003, KEY_NUMERIC_3, }, 70 - { 0x3004, KEY_NUMERIC_4, }, 71 - { 0x3005, KEY_NUMERIC_5, }, 72 - { 0x3006, KEY_NUMERIC_6, }, 73 - { 0x3007, KEY_NUMERIC_7, }, 74 - { 0x3008, KEY_NUMERIC_8, }, 75 - { 0x3009, KEY_NUMERIC_9, }, 76 - { 0x3022, KEY_ENTER, }, 77 - { 0x30ec, KEY_MODE, }, /* "tv/vcr/..." */ 78 - { 0x300f, KEY_SELECT, }, /* "info" */ 79 - { 0x3020, KEY_CHANNELUP, }, /* "up" */ 80 - { 0x302e, KEY_MENU, }, /* "in/out" */ 81 - { 0x3011, KEY_VOLUMEDOWN, }, /* "left" */ 82 - { 0x300d, KEY_MUTE, }, /* "ok" */ 83 - { 0x3010, KEY_VOLUMEUP, }, /* "right" */ 84 - { 0x301e, KEY_SUBTITLE, }, /* "cc" */ 85 - { 0x3021, KEY_CHANNELDOWN, }, /* "down" */ 86 - { 0x3022, KEY_PREVIOUS, }, 87 - { 0x3026, KEY_SLEEP, }, 88 - { 0x3172, KEY_REWIND, }, /* NOTE: docs wrongly say 0x30ca */ 89 - { 0x3175, KEY_PLAY, }, 90 - { 0x3174, KEY_FASTFORWARD, }, 91 - { 0x3177, KEY_RECORD, }, 92 - { 0x3176, KEY_STOP, }, 93 - { 0x3169, KEY_PAUSE, }, 68 + { KE_KEY, 0x300c, { KEY_POWER } }, /* NOTE: docs omit this */ 69 + { KE_KEY, 0x3000, { KEY_NUMERIC_0 } }, 70 + { KE_KEY, 0x3001, { KEY_NUMERIC_1 } }, 71 + { KE_KEY, 0x3002, { KEY_NUMERIC_2 } }, 72 + { KE_KEY, 0x3003, { KEY_NUMERIC_3 } }, 73 + { KE_KEY, 0x3004, { KEY_NUMERIC_4 } }, 74 + { KE_KEY, 0x3005, { KEY_NUMERIC_5 } }, 75 + { KE_KEY, 0x3006, { KEY_NUMERIC_6 } }, 76 + { KE_KEY, 0x3007, { KEY_NUMERIC_7 } }, 77 + { KE_KEY, 0x3008, { KEY_NUMERIC_8 } }, 78 + { KE_KEY, 0x3009, { KEY_NUMERIC_9 } }, 79 + { KE_KEY, 0x3022, { KEY_ENTER } }, 80 + { KE_KEY, 0x30ec, { KEY_MODE } }, /* "tv/vcr/..." */ 81 + { KE_KEY, 0x300f, { KEY_SELECT } }, /* "info" */ 82 + { KE_KEY, 0x3020, { KEY_CHANNELUP } }, /* "up" */ 83 + { KE_KEY, 0x302e, { KEY_MENU } }, /* "in/out" */ 84 + { KE_KEY, 0x3011, { KEY_VOLUMEDOWN } }, /* "left" */ 85 + { KE_KEY, 0x300d, { KEY_MUTE } }, /* "ok" */ 86 + { KE_KEY, 0x3010, { KEY_VOLUMEUP } }, /* "right" */ 87 + { KE_KEY, 0x301e, { KEY_SUBTITLE } }, /* "cc" */ 88 + { KE_KEY, 0x3021, { KEY_CHANNELDOWN } },/* "down" */ 89 + { KE_KEY, 0x3022, { KEY_PREVIOUS } }, 90 + { KE_KEY, 0x3026, { KEY_SLEEP } }, 91 + { KE_KEY, 0x3172, { KEY_REWIND } }, /* NOTE: docs wrongly say 0x30ca */ 92 + { KE_KEY, 0x3175, { KEY_PLAY } }, 93 + { KE_KEY, 0x3174, { KEY_FASTFORWARD } }, 94 + { KE_KEY, 0x3177, { KEY_RECORD } }, 95 + { KE_KEY, 0x3176, { KEY_STOP } }, 96 + { KE_KEY, 0x3169, { KEY_PAUSE } }, 94 97 }; 95 98 96 99 /* ··· 102 105 */ 103 106 static irqreturn_t dm355evm_keys_irq(int irq, void *_keys) 104 107 { 105 - struct dm355evm_keys *keys = _keys; 106 - int status; 108 + static u16 last_event; 109 + struct dm355evm_keys *keys = _keys; 110 + const struct key_entry *ke; 111 + unsigned int keycode; 112 + int status; 113 + u16 event; 107 114 108 115 /* For simplicity we ignore INPUT_COUNT and just read 109 116 * events until we get the "queue empty" indicator. 110 117 * Reading INPUT_LOW decrements the count. 111 118 */ 112 119 for (;;) { 113 - static u16 last_event; 114 - u16 event; 115 - int keycode; 116 - int i; 117 - 118 120 status = dm355evm_msp_read(DM355EVM_MSP_INPUT_HIGH); 119 121 if (status < 0) { 120 122 dev_dbg(keys->dev, "input high err %d\n", ··· 152 156 /* ignore the RC5 toggle bit */ 153 157 event &= ~0x0800; 154 158 155 - /* find the key, or leave it as unknown */ 156 - keycode = KEY_UNKNOWN; 157 - for (i = 0; i < ARRAY_SIZE(dm355evm_keys); i++) { 158 - if (dm355evm_keys[i].event != event) 159 - continue; 160 - keycode = dm355evm_keys[i].keycode; 161 - break; 162 - } 159 + /* find the key, or report it as unknown */ 160 + ke = sparse_keymap_entry_from_scancode(keys->input, event); 161 + keycode = ke ? ke->keycode : KEY_UNKNOWN; 163 162 dev_dbg(keys->dev, 164 163 "input event 0x%04x--> keycode %d\n", 165 164 event, keycode); ··· 165 174 input_report_key(keys->input, keycode, 0); 166 175 input_sync(keys->input); 167 176 } 177 + 168 178 return IRQ_HANDLED; 169 - } 170 - 171 - static int dm355evm_setkeycode(struct input_dev *dev, int index, int keycode) 172 - { 173 - u16 old_keycode; 174 - unsigned i; 175 - 176 - if (((unsigned)index) >= ARRAY_SIZE(dm355evm_keys)) 177 - return -EINVAL; 178 - 179 - old_keycode = dm355evm_keys[index].keycode; 180 - dm355evm_keys[index].keycode = keycode; 181 - set_bit(keycode, dev->keybit); 182 - 183 - for (i = 0; i < ARRAY_SIZE(dm355evm_keys); i++) { 184 - if (dm355evm_keys[index].keycode == old_keycode) 185 - goto done; 186 - } 187 - clear_bit(old_keycode, dev->keybit); 188 - done: 189 - return 0; 190 - } 191 - 192 - static int dm355evm_getkeycode(struct input_dev *dev, int index, int *keycode) 193 - { 194 - if (((unsigned)index) >= ARRAY_SIZE(dm355evm_keys)) 195 - return -EINVAL; 196 - 197 - return dm355evm_keys[index].keycode; 198 179 } 199 180 200 181 /*----------------------------------------------------------------------*/ ··· 176 213 struct dm355evm_keys *keys; 177 214 struct input_dev *input; 178 215 int status; 179 - int i; 180 216 181 217 /* allocate instance struct and input dev */ 182 218 keys = kzalloc(sizeof *keys, GFP_KERNEL); ··· 204 242 input->id.product = 0x0355; 205 243 input->id.version = dm355evm_msp_read(DM355EVM_MSP_FIRMREV); 206 244 207 - input->evbit[0] = BIT(EV_KEY); 208 - for (i = 0; i < ARRAY_SIZE(dm355evm_keys); i++) 209 - __set_bit(dm355evm_keys[i].keycode, input->keybit); 210 - 211 - input->setkeycode = dm355evm_setkeycode; 212 - input->getkeycode = dm355evm_getkeycode; 245 + status = sparse_keymap_setup(input, dm355evm_keys, NULL); 246 + if (status) 247 + goto fail1; 213 248 214 249 /* REVISIT: flush the event queue? */ 215 250 216 251 status = request_threaded_irq(keys->irq, NULL, dm355evm_keys_irq, 217 252 IRQF_TRIGGER_FALLING, dev_name(&pdev->dev), keys); 218 253 if (status < 0) 219 - goto fail1; 254 + goto fail2; 220 255 221 256 /* register */ 222 257 status = input_register_device(input); 223 258 if (status < 0) 224 - goto fail2; 259 + goto fail3; 225 260 226 261 platform_set_drvdata(pdev, keys); 227 262 228 263 return 0; 229 264 230 - fail2: 265 + fail3: 231 266 free_irq(keys->irq, keys); 267 + fail2: 268 + sparse_keymap_free(input); 232 269 fail1: 233 270 input_free_device(input); 234 271 kfree(keys); ··· 241 280 struct dm355evm_keys *keys = platform_get_drvdata(pdev); 242 281 243 282 free_irq(keys->irq, keys); 283 + sparse_keymap_free(keys->input); 244 284 input_unregister_device(keys->input); 245 285 kfree(keys); 246 286
+1 -1
drivers/input/misc/powermate.c
··· 338 338 pm->input = input_dev; 339 339 340 340 usb_make_path(udev, pm->phys, sizeof(pm->phys)); 341 - strlcpy(pm->phys, "/input0", sizeof(pm->phys)); 341 + strlcat(pm->phys, "/input0", sizeof(pm->phys)); 342 342 343 343 spin_lock_init(&pm->lock); 344 344
+84 -174
drivers/input/misc/wistron_btns.c
··· 21 21 #include <linux/dmi.h> 22 22 #include <linux/init.h> 23 23 #include <linux/input-polldev.h> 24 + #include <linux/input/sparse-keymap.h> 24 25 #include <linux/interrupt.h> 25 26 #include <linux/jiffies.h> 26 27 #include <linux/kernel.h> ··· 225 224 226 225 /* Hardware database */ 227 226 228 - struct key_entry { 229 - char type; /* See KE_* below */ 230 - u8 code; 231 - union { 232 - u16 keycode; /* For KE_KEY */ 233 - struct { /* For KE_SW */ 234 - u8 code; 235 - u8 value; 236 - } sw; 237 - }; 238 - }; 239 - 240 - enum { KE_END, KE_KEY, KE_SW, KE_WIFI, KE_BLUETOOTH }; 227 + #define KE_WIFI (KE_LAST + 1) 228 + #define KE_BLUETOOTH (KE_LAST + 2) 241 229 242 230 #define FE_MAIL_LED 0x01 243 231 #define FE_WIFI_LED 0x02 ··· 634 644 * a list of buttons and their key codes (reported when loading this module 635 645 * with force=1) and the output of dmidecode to $MODULE_AUTHOR. 636 646 */ 637 - static struct dmi_system_id dmi_ids[] __initdata = { 647 + static const struct dmi_system_id __initconst dmi_ids[] = { 638 648 { 649 + /* Fujitsu-Siemens Amilo Pro V2000 */ 639 650 .callback = dmi_matched, 640 - .ident = "Fujitsu-Siemens Amilo Pro V2000", 641 651 .matches = { 642 652 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 643 653 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2000"), ··· 645 655 .driver_data = keymap_fs_amilo_pro_v2000 646 656 }, 647 657 { 658 + /* Fujitsu-Siemens Amilo Pro Edition V3505 */ 648 659 .callback = dmi_matched, 649 - .ident = "Fujitsu-Siemens Amilo Pro Edition V3505", 650 660 .matches = { 651 661 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 652 662 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro Edition V3505"), ··· 654 664 .driver_data = keymap_fs_amilo_pro_v3505 655 665 }, 656 666 { 667 + /* Fujitsu-Siemens Amilo M7400 */ 657 668 .callback = dmi_matched, 658 - .ident = "Fujitsu-Siemens Amilo M7400", 659 669 .matches = { 660 670 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 661 671 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO M "), ··· 663 673 .driver_data = keymap_fs_amilo_pro_v2000 664 674 }, 665 675 { 676 + /* Maxdata Pro 7000 DX */ 666 677 .callback = dmi_matched, 667 - .ident = "Maxdata Pro 7000 DX", 668 678 .matches = { 669 679 DMI_MATCH(DMI_SYS_VENDOR, "MAXDATA"), 670 680 DMI_MATCH(DMI_PRODUCT_NAME, "Pro 7000"), ··· 672 682 .driver_data = keymap_fs_amilo_pro_v2000 673 683 }, 674 684 { 685 + /* Fujitsu N3510 */ 675 686 .callback = dmi_matched, 676 - .ident = "Fujitsu N3510", 677 687 .matches = { 678 688 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), 679 689 DMI_MATCH(DMI_PRODUCT_NAME, "N3510"), ··· 681 691 .driver_data = keymap_fujitsu_n3510 682 692 }, 683 693 { 694 + /* Acer Aspire 1500 */ 684 695 .callback = dmi_matched, 685 - .ident = "Acer Aspire 1500", 686 696 .matches = { 687 697 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 688 698 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1500"), ··· 690 700 .driver_data = keymap_acer_aspire_1500 691 701 }, 692 702 { 703 + /* Acer Aspire 1600 */ 693 704 .callback = dmi_matched, 694 - .ident = "Acer Aspire 1600", 695 705 .matches = { 696 706 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 697 707 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1600"), ··· 699 709 .driver_data = keymap_acer_aspire_1600 700 710 }, 701 711 { 712 + /* Acer Aspire 3020 */ 702 713 .callback = dmi_matched, 703 - .ident = "Acer Aspire 3020", 704 714 .matches = { 705 715 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 706 716 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 3020"), ··· 708 718 .driver_data = keymap_acer_aspire_5020 709 719 }, 710 720 { 721 + /* Acer Aspire 5020 */ 711 722 .callback = dmi_matched, 712 - .ident = "Acer Aspire 5020", 713 723 .matches = { 714 724 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 715 725 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5020"), ··· 717 727 .driver_data = keymap_acer_aspire_5020 718 728 }, 719 729 { 730 + /* Acer TravelMate 2100 */ 720 731 .callback = dmi_matched, 721 - .ident = "Acer TravelMate 2100", 722 732 .matches = { 723 733 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 724 734 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2100"), ··· 726 736 .driver_data = keymap_acer_aspire_5020 727 737 }, 728 738 { 739 + /* Acer TravelMate 2410 */ 729 740 .callback = dmi_matched, 730 - .ident = "Acer TravelMate 2410", 731 741 .matches = { 732 742 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 733 743 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2410"), ··· 735 745 .driver_data = keymap_acer_travelmate_2410 736 746 }, 737 747 { 748 + /* Acer TravelMate C300 */ 738 749 .callback = dmi_matched, 739 - .ident = "Acer TravelMate C300", 740 750 .matches = { 741 751 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 742 752 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate C300"), ··· 744 754 .driver_data = keymap_acer_travelmate_300 745 755 }, 746 756 { 757 + /* Acer TravelMate C100 */ 747 758 .callback = dmi_matched, 748 - .ident = "Acer TravelMate C100", 749 759 .matches = { 750 760 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 751 761 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate C100"), ··· 753 763 .driver_data = keymap_acer_travelmate_300 754 764 }, 755 765 { 766 + /* Acer TravelMate C110 */ 756 767 .callback = dmi_matched, 757 - .ident = "Acer TravelMate C110", 758 768 .matches = { 759 769 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 760 770 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate C110"), ··· 762 772 .driver_data = keymap_acer_travelmate_110 763 773 }, 764 774 { 775 + /* Acer TravelMate 380 */ 765 776 .callback = dmi_matched, 766 - .ident = "Acer TravelMate 380", 767 777 .matches = { 768 778 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 769 779 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 380"), ··· 771 781 .driver_data = keymap_acer_travelmate_380 772 782 }, 773 783 { 784 + /* Acer TravelMate 370 */ 774 785 .callback = dmi_matched, 775 - .ident = "Acer TravelMate 370", 776 786 .matches = { 777 787 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 778 788 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 370"), ··· 780 790 .driver_data = keymap_acer_travelmate_380 /* keyboard minus 1 key */ 781 791 }, 782 792 { 793 + /* Acer TravelMate 220 */ 783 794 .callback = dmi_matched, 784 - .ident = "Acer TravelMate 220", 785 795 .matches = { 786 796 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 787 797 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 220"), ··· 789 799 .driver_data = keymap_acer_travelmate_220 790 800 }, 791 801 { 802 + /* Acer TravelMate 260 */ 792 803 .callback = dmi_matched, 793 - .ident = "Acer TravelMate 260", 794 804 .matches = { 795 805 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 796 806 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 260"), ··· 798 808 .driver_data = keymap_acer_travelmate_220 799 809 }, 800 810 { 811 + /* Acer TravelMate 230 */ 801 812 .callback = dmi_matched, 802 - .ident = "Acer TravelMate 230", 803 813 .matches = { 804 814 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 805 815 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 230"), ··· 808 818 .driver_data = keymap_acer_travelmate_230 809 819 }, 810 820 { 821 + /* Acer TravelMate 280 */ 811 822 .callback = dmi_matched, 812 - .ident = "Acer TravelMate 280", 813 823 .matches = { 814 824 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 815 825 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 280"), ··· 817 827 .driver_data = keymap_acer_travelmate_230 818 828 }, 819 829 { 830 + /* Acer TravelMate 240 */ 820 831 .callback = dmi_matched, 821 - .ident = "Acer TravelMate 240", 822 832 .matches = { 823 833 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 824 834 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 240"), ··· 826 836 .driver_data = keymap_acer_travelmate_240 827 837 }, 828 838 { 839 + /* Acer TravelMate 250 */ 829 840 .callback = dmi_matched, 830 - .ident = "Acer TravelMate 250", 831 841 .matches = { 832 842 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 833 843 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 250"), ··· 835 845 .driver_data = keymap_acer_travelmate_240 836 846 }, 837 847 { 848 + /* Acer TravelMate 2424NWXCi */ 838 849 .callback = dmi_matched, 839 - .ident = "Acer TravelMate 2424NWXCi", 840 850 .matches = { 841 851 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 842 852 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2420"), ··· 844 854 .driver_data = keymap_acer_travelmate_240 845 855 }, 846 856 { 857 + /* Acer TravelMate 350 */ 847 858 .callback = dmi_matched, 848 - .ident = "Acer TravelMate 350", 849 859 .matches = { 850 860 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 851 861 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 350"), ··· 853 863 .driver_data = keymap_acer_travelmate_350 854 864 }, 855 865 { 866 + /* Acer TravelMate 360 */ 856 867 .callback = dmi_matched, 857 - .ident = "Acer TravelMate 360", 858 868 .matches = { 859 869 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 860 870 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"), ··· 862 872 .driver_data = keymap_acer_travelmate_360 863 873 }, 864 874 { 875 + /* Acer TravelMate 610 */ 865 876 .callback = dmi_matched, 866 - .ident = "Acer TravelMate 610", 867 877 .matches = { 868 878 DMI_MATCH(DMI_SYS_VENDOR, "ACER"), 869 879 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 610"), ··· 871 881 .driver_data = keymap_acer_travelmate_610 872 882 }, 873 883 { 884 + /* Acer TravelMate 620 */ 874 885 .callback = dmi_matched, 875 - .ident = "Acer TravelMate 620", 876 886 .matches = { 877 887 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 878 888 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 620"), ··· 880 890 .driver_data = keymap_acer_travelmate_630 881 891 }, 882 892 { 893 + /* Acer TravelMate 630 */ 883 894 .callback = dmi_matched, 884 - .ident = "Acer TravelMate 630", 885 895 .matches = { 886 896 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 887 897 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 630"), ··· 889 899 .driver_data = keymap_acer_travelmate_630 890 900 }, 891 901 { 902 + /* AOpen 1559AS */ 892 903 .callback = dmi_matched, 893 - .ident = "AOpen 1559AS", 894 904 .matches = { 895 905 DMI_MATCH(DMI_PRODUCT_NAME, "E2U"), 896 906 DMI_MATCH(DMI_BOARD_NAME, "E2U"), ··· 898 908 .driver_data = keymap_aopen_1559as 899 909 }, 900 910 { 911 + /* Medion MD 9783 */ 901 912 .callback = dmi_matched, 902 - .ident = "Medion MD 9783", 903 913 .matches = { 904 914 DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"), 905 915 DMI_MATCH(DMI_PRODUCT_NAME, "MD 9783"), ··· 907 917 .driver_data = keymap_wistron_ms2111 908 918 }, 909 919 { 920 + /* Medion MD 40100 */ 910 921 .callback = dmi_matched, 911 - .ident = "Medion MD 40100", 912 922 .matches = { 913 923 DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"), 914 924 DMI_MATCH(DMI_PRODUCT_NAME, "WID2000"), ··· 916 926 .driver_data = keymap_wistron_md40100 917 927 }, 918 928 { 929 + /* Medion MD 2900 */ 919 930 .callback = dmi_matched, 920 - .ident = "Medion MD 2900", 921 931 .matches = { 922 932 DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"), 923 933 DMI_MATCH(DMI_PRODUCT_NAME, "WIM 2000"), ··· 925 935 .driver_data = keymap_wistron_md2900 926 936 }, 927 937 { 938 + /* Medion MD 42200 */ 928 939 .callback = dmi_matched, 929 - .ident = "Medion MD 42200", 930 940 .matches = { 931 941 DMI_MATCH(DMI_SYS_VENDOR, "Medion"), 932 942 DMI_MATCH(DMI_PRODUCT_NAME, "WIM 2030"), ··· 934 944 .driver_data = keymap_fs_amilo_pro_v2000 935 945 }, 936 946 { 947 + /* Medion MD 96500 */ 937 948 .callback = dmi_matched, 938 - .ident = "Medion MD 96500", 939 949 .matches = { 940 950 DMI_MATCH(DMI_SYS_VENDOR, "MEDIONPC"), 941 951 DMI_MATCH(DMI_PRODUCT_NAME, "WIM 2040"), ··· 943 953 .driver_data = keymap_wistron_md96500 944 954 }, 945 955 { 956 + /* Medion MD 95400 */ 946 957 .callback = dmi_matched, 947 - .ident = "Medion MD 95400", 948 958 .matches = { 949 959 DMI_MATCH(DMI_SYS_VENDOR, "MEDIONPC"), 950 960 DMI_MATCH(DMI_PRODUCT_NAME, "WIM 2050"), ··· 952 962 .driver_data = keymap_wistron_md96500 953 963 }, 954 964 { 965 + /* Fujitsu Siemens Amilo D7820 */ 955 966 .callback = dmi_matched, 956 - .ident = "Fujitsu Siemens Amilo D7820", 957 967 .matches = { 958 968 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), /* not sure */ 959 969 DMI_MATCH(DMI_PRODUCT_NAME, "Amilo D"), ··· 961 971 .driver_data = keymap_fs_amilo_d88x0 962 972 }, 963 973 { 974 + /* Fujitsu Siemens Amilo D88x0 */ 964 975 .callback = dmi_matched, 965 - .ident = "Fujitsu Siemens Amilo D88x0", 966 976 .matches = { 967 977 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 968 978 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO D"), ··· 1026 1036 static unsigned long jiffies_last_press; 1027 1037 static bool wifi_enabled; 1028 1038 static bool bluetooth_enabled; 1029 - 1030 - static void report_key(struct input_dev *dev, unsigned int keycode) 1031 - { 1032 - input_report_key(dev, keycode, 1); 1033 - input_sync(dev); 1034 - input_report_key(dev, keycode, 0); 1035 - input_sync(dev); 1036 - } 1037 - 1038 - static void report_switch(struct input_dev *dev, unsigned int code, int value) 1039 - { 1040 - input_report_switch(dev, code, value); 1041 - input_sync(dev); 1042 - } 1043 - 1044 1039 1045 1040 /* led management */ 1046 1041 static void wistron_mail_led_set(struct led_classdev *led_cdev, ··· 1103 1128 led_classdev_resume(&wistron_wifi_led); 1104 1129 } 1105 1130 1106 - static struct key_entry *wistron_get_entry_by_scancode(int code) 1107 - { 1108 - struct key_entry *key; 1109 - 1110 - for (key = keymap; key->type != KE_END; key++) 1111 - if (code == key->code) 1112 - return key; 1113 - 1114 - return NULL; 1115 - } 1116 - 1117 - static struct key_entry *wistron_get_entry_by_keycode(int keycode) 1118 - { 1119 - struct key_entry *key; 1120 - 1121 - for (key = keymap; key->type != KE_END; key++) 1122 - if (key->type == KE_KEY && keycode == key->keycode) 1123 - return key; 1124 - 1125 - return NULL; 1126 - } 1127 - 1128 1131 static void handle_key(u8 code) 1129 1132 { 1130 - const struct key_entry *key = wistron_get_entry_by_scancode(code); 1133 + const struct key_entry *key = 1134 + sparse_keymap_entry_from_scancode(wistron_idev->input, code); 1131 1135 1132 1136 if (key) { 1133 1137 switch (key->type) { 1134 - case KE_KEY: 1135 - report_key(wistron_idev->input, key->keycode); 1136 - break; 1137 - 1138 - case KE_SW: 1139 - report_switch(wistron_idev->input, 1140 - key->sw.code, key->sw.value); 1141 - break; 1142 - 1143 1138 case KE_WIFI: 1144 1139 if (have_wifi) { 1145 1140 wifi_enabled = !wifi_enabled; ··· 1125 1180 break; 1126 1181 1127 1182 default: 1128 - BUG(); 1183 + sparse_keymap_report_entry(wistron_idev->input, 1184 + key, 1, true); 1185 + break; 1129 1186 } 1130 1187 jiffies_last_press = jiffies; 1131 1188 } else ··· 1167 1220 dev->poll_interval = POLL_INTERVAL_DEFAULT; 1168 1221 } 1169 1222 1170 - static int wistron_getkeycode(struct input_dev *dev, int scancode, int *keycode) 1223 + static int __devinit wistron_setup_keymap(struct input_dev *dev, 1224 + struct key_entry *entry) 1171 1225 { 1172 - const struct key_entry *key = wistron_get_entry_by_scancode(scancode); 1226 + switch (entry->type) { 1173 1227 1174 - if (key && key->type == KE_KEY) { 1175 - *keycode = key->keycode; 1176 - return 0; 1228 + /* if wifi or bluetooth are not available, create normal keys */ 1229 + case KE_WIFI: 1230 + if (!have_wifi) { 1231 + entry->type = KE_KEY; 1232 + entry->keycode = KEY_WLAN; 1233 + } 1234 + break; 1235 + 1236 + case KE_BLUETOOTH: 1237 + if (!have_bluetooth) { 1238 + entry->type = KE_KEY; 1239 + entry->keycode = KEY_BLUETOOTH; 1240 + } 1241 + break; 1242 + 1243 + case KE_END: 1244 + if (entry->code & FE_UNTESTED) 1245 + printk(KERN_WARNING "Untested laptop multimedia keys, " 1246 + "please report success or failure to " 1247 + "eric.piel@tremplin-utc.net\n"); 1248 + break; 1177 1249 } 1178 1250 1179 - return -EINVAL; 1180 - } 1181 - 1182 - static int wistron_setkeycode(struct input_dev *dev, int scancode, int keycode) 1183 - { 1184 - struct key_entry *key; 1185 - int old_keycode; 1186 - 1187 - if (keycode < 0 || keycode > KEY_MAX) 1188 - return -EINVAL; 1189 - 1190 - key = wistron_get_entry_by_scancode(scancode); 1191 - if (key && key->type == KE_KEY) { 1192 - old_keycode = key->keycode; 1193 - key->keycode = keycode; 1194 - set_bit(keycode, dev->keybit); 1195 - if (!wistron_get_entry_by_keycode(old_keycode)) 1196 - clear_bit(old_keycode, dev->keybit); 1197 - return 0; 1198 - } 1199 - 1200 - return -EINVAL; 1251 + return 0; 1201 1252 } 1202 1253 1203 1254 static int __devinit setup_input_dev(void) 1204 1255 { 1205 - struct key_entry *key; 1206 1256 struct input_dev *input_dev; 1207 1257 int error; 1208 1258 ··· 1207 1263 if (!wistron_idev) 1208 1264 return -ENOMEM; 1209 1265 1210 - wistron_idev->flush = wistron_flush; 1266 + wistron_idev->open = wistron_flush; 1211 1267 wistron_idev->poll = wistron_poll; 1212 1268 wistron_idev->poll_interval = POLL_INTERVAL_DEFAULT; 1213 1269 ··· 1217 1273 input_dev->id.bustype = BUS_HOST; 1218 1274 input_dev->dev.parent = &wistron_device->dev; 1219 1275 1220 - input_dev->getkeycode = wistron_getkeycode; 1221 - input_dev->setkeycode = wistron_setkeycode; 1222 - 1223 - for (key = keymap; key->type != KE_END; key++) { 1224 - switch (key->type) { 1225 - case KE_KEY: 1226 - set_bit(EV_KEY, input_dev->evbit); 1227 - set_bit(key->keycode, input_dev->keybit); 1228 - break; 1229 - 1230 - case KE_SW: 1231 - set_bit(EV_SW, input_dev->evbit); 1232 - set_bit(key->sw.code, input_dev->swbit); 1233 - break; 1234 - 1235 - /* if wifi or bluetooth are not available, create normal keys */ 1236 - case KE_WIFI: 1237 - if (!have_wifi) { 1238 - key->type = KE_KEY; 1239 - key->keycode = KEY_WLAN; 1240 - key--; 1241 - } 1242 - break; 1243 - 1244 - case KE_BLUETOOTH: 1245 - if (!have_bluetooth) { 1246 - key->type = KE_KEY; 1247 - key->keycode = KEY_BLUETOOTH; 1248 - key--; 1249 - } 1250 - break; 1251 - 1252 - default: 1253 - break; 1254 - } 1255 - } 1256 - 1257 - /* reads information flags on KE_END */ 1258 - if (key->code & FE_UNTESTED) 1259 - printk(KERN_WARNING "Untested laptop multimedia keys, " 1260 - "please report success or failure to eric.piel" 1261 - "@tremplin-utc.net\n"); 1276 + error = sparse_keymap_setup(input_dev, keymap, wistron_setup_keymap); 1277 + if (error) 1278 + goto err_free_dev; 1262 1279 1263 1280 error = input_register_polled_device(wistron_idev); 1264 - if (error) { 1265 - input_free_polled_device(wistron_idev); 1266 - return error; 1267 - } 1281 + if (error) 1282 + goto err_free_keymap; 1268 1283 1269 1284 return 0; 1285 + 1286 + err_free_keymap: 1287 + sparse_keymap_free(input_dev); 1288 + err_free_dev: 1289 + input_free_polled_device(wistron_idev); 1290 + return error; 1270 1291 } 1271 1292 1272 1293 /* Driver core */ ··· 1280 1371 { 1281 1372 wistron_led_remove(); 1282 1373 input_unregister_polled_device(wistron_idev); 1374 + sparse_keymap_free(wistron_idev->input); 1283 1375 input_free_polled_device(wistron_idev); 1284 1376 bios_detach(); 1285 1377
+65 -35
drivers/input/mouse/alps.c
··· 28 28 #define dbg(format, arg...) do {} while (0) 29 29 #endif 30 30 31 - #define ALPS_DUALPOINT 0x01 32 - #define ALPS_WHEEL 0x02 33 - #define ALPS_FW_BK_1 0x04 34 - #define ALPS_4BTN 0x08 35 - #define ALPS_OLDPROTO 0x10 36 - #define ALPS_PASS 0x20 37 - #define ALPS_FW_BK_2 0x40 31 + 32 + #define ALPS_OLDPROTO 0x01 /* old style input */ 33 + #define ALPS_DUALPOINT 0x02 /* touchpad has trackstick */ 34 + #define ALPS_PASS 0x04 /* device has a pass-through port */ 35 + 36 + #define ALPS_WHEEL 0x08 /* hardware wheel present */ 37 + #define ALPS_FW_BK_1 0x10 /* front & back buttons present */ 38 + #define ALPS_FW_BK_2 0x20 /* front & back buttons present */ 39 + #define ALPS_FOUR_BUTTONS 0x40 /* 4 direction button present */ 40 + 38 41 39 42 static const struct alps_model_info alps_model_data[] = { 40 43 { { 0x32, 0x02, 0x14 }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Toshiba Salellite Pro M10 */ ··· 59 56 { { 0x22, 0x02, 0x0a }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, 60 57 { { 0x22, 0x02, 0x14 }, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */ 61 58 { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude E6500 */ 62 - { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FW_BK_1 }, /* Dell Vostro 1400 */ 59 + { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ 63 60 }; 64 61 65 62 /* ··· 86 83 static void alps_process_packet(struct psmouse *psmouse) 87 84 { 88 85 struct alps_data *priv = psmouse->private; 86 + const struct alps_model_info *model = priv->i; 89 87 unsigned char *packet = psmouse->packet; 90 88 struct input_dev *dev = psmouse->dev; 91 89 struct input_dev *dev2 = priv->dev2; ··· 105 101 return; 106 102 } 107 103 108 - if (priv->i->flags & ALPS_OLDPROTO) { 104 + if (model->flags & ALPS_OLDPROTO) { 109 105 left = packet[2] & 0x10; 110 106 right = packet[2] & 0x08; 111 107 middle = 0; ··· 121 117 z = packet[5]; 122 118 } 123 119 124 - if (priv->i->flags & ALPS_FW_BK_1) { 120 + if (model->flags & ALPS_FW_BK_1) { 125 121 back = packet[0] & 0x10; 126 122 forward = packet[2] & 4; 127 123 } 128 124 129 - if (priv->i->flags & ALPS_FW_BK_2) { 125 + if (model->flags & ALPS_FW_BK_2) { 130 126 back = packet[3] & 4; 131 127 forward = packet[2] & 4; 132 128 if ((middle = forward && back)) ··· 136 132 ges = packet[2] & 1; 137 133 fin = packet[2] & 2; 138 134 139 - if ((priv->i->flags & ALPS_DUALPOINT) && z == 127) { 135 + if ((model->flags & ALPS_DUALPOINT) && z == 127) { 140 136 input_report_rel(dev2, REL_X, (x > 383 ? (x - 768) : x)); 141 137 input_report_rel(dev2, REL_Y, -(y > 255 ? (y - 512) : y)); 142 138 ··· 154 150 input_report_key(dev, BTN_MIDDLE, middle); 155 151 156 152 /* Convert hardware tap to a reasonable Z value */ 157 - if (ges && !fin) z = 40; 153 + if (ges && !fin) 154 + z = 40; 158 155 159 156 /* 160 157 * A "tap and drag" operation is reported by the hardware as a transition ··· 171 166 } 172 167 priv->prev_fin = fin; 173 168 174 - if (z > 30) input_report_key(dev, BTN_TOUCH, 1); 175 - if (z < 25) input_report_key(dev, BTN_TOUCH, 0); 169 + if (z > 30) 170 + input_report_key(dev, BTN_TOUCH, 1); 171 + if (z < 25) 172 + input_report_key(dev, BTN_TOUCH, 0); 176 173 177 174 if (z > 0) { 178 175 input_report_abs(dev, ABS_X, x); ··· 184 177 input_report_abs(dev, ABS_PRESSURE, z); 185 178 input_report_key(dev, BTN_TOOL_FINGER, z > 0); 186 179 187 - if (priv->i->flags & ALPS_WHEEL) 180 + if (model->flags & ALPS_WHEEL) 188 181 input_report_rel(dev, REL_WHEEL, ((packet[2] << 1) & 0x08) - ((packet[0] >> 4) & 0x07)); 189 182 190 - if (priv->i->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) { 183 + if (model->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) { 191 184 input_report_key(dev, BTN_FORWARD, forward); 192 185 input_report_key(dev, BTN_BACK, back); 186 + } 187 + 188 + if (model->flags & ALPS_FOUR_BUTTONS) { 189 + input_report_key(dev, BTN_0, packet[2] & 4); 190 + input_report_key(dev, BTN_1, packet[0] & 0x10); 191 + input_report_key(dev, BTN_2, packet[3] & 4); 192 + input_report_key(dev, BTN_3, packet[0] & 0x20); 193 193 } 194 194 195 195 input_sync(dev); ··· 407 393 return 0; 408 394 } 409 395 410 - static int alps_hw_init(struct psmouse *psmouse, int *version) 396 + static int alps_hw_init(struct psmouse *psmouse) 411 397 { 412 398 struct alps_data *priv = psmouse->private; 399 + const struct alps_model_info *model = priv->i; 413 400 414 - priv->i = alps_get_model(psmouse, version); 415 - if (!priv->i) 416 - return -1; 417 - 418 - if ((priv->i->flags & ALPS_PASS) && 401 + if ((model->flags & ALPS_PASS) && 419 402 alps_passthrough_mode(psmouse, true)) { 420 403 return -1; 421 404 } ··· 427 416 return -1; 428 417 } 429 418 430 - if ((priv->i->flags & ALPS_PASS) && 419 + if ((model->flags & ALPS_PASS) && 431 420 alps_passthrough_mode(psmouse, false)) { 432 421 return -1; 433 422 } ··· 443 432 444 433 static int alps_reconnect(struct psmouse *psmouse) 445 434 { 435 + const struct alps_model_info *model; 436 + 446 437 psmouse_reset(psmouse); 447 438 448 - if (alps_hw_init(psmouse, NULL)) 439 + model = alps_get_model(psmouse, NULL); 440 + if (!model) 449 441 return -1; 450 442 451 - return 0; 443 + return alps_hw_init(psmouse); 452 444 } 453 445 454 446 static void alps_disconnect(struct psmouse *psmouse) ··· 466 452 int alps_init(struct psmouse *psmouse) 467 453 { 468 454 struct alps_data *priv; 455 + const struct alps_model_info *model; 469 456 struct input_dev *dev1 = psmouse->dev, *dev2; 470 457 int version; 471 458 ··· 478 463 priv->dev2 = dev2; 479 464 psmouse->private = priv; 480 465 481 - if (alps_hw_init(psmouse, &version)) 466 + model = alps_get_model(psmouse, &version); 467 + if (!model) 468 + goto init_fail; 469 + 470 + priv->i = model; 471 + 472 + if (alps_hw_init(psmouse)) 482 473 goto init_fail; 483 474 484 475 dev1->evbit[BIT_WORD(EV_KEY)] |= BIT_MASK(EV_KEY); 485 476 dev1->keybit[BIT_WORD(BTN_TOUCH)] |= BIT_MASK(BTN_TOUCH); 486 477 dev1->keybit[BIT_WORD(BTN_TOOL_FINGER)] |= BIT_MASK(BTN_TOOL_FINGER); 487 - dev1->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_LEFT) | 488 - BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); 478 + dev1->keybit[BIT_WORD(BTN_LEFT)] |= 479 + BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT); 489 480 490 481 dev1->evbit[BIT_WORD(EV_ABS)] |= BIT_MASK(EV_ABS); 491 482 input_set_abs_params(dev1, ABS_X, 0, 1023, 0, 0); 492 483 input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0); 493 484 input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0); 494 485 495 - if (priv->i->flags & ALPS_WHEEL) { 486 + if (model->flags & ALPS_WHEEL) { 496 487 dev1->evbit[BIT_WORD(EV_REL)] |= BIT_MASK(EV_REL); 497 488 dev1->relbit[BIT_WORD(REL_WHEEL)] |= BIT_MASK(REL_WHEEL); 498 489 } 499 490 500 - if (priv->i->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) { 491 + if (model->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) { 501 492 dev1->keybit[BIT_WORD(BTN_FORWARD)] |= BIT_MASK(BTN_FORWARD); 502 493 dev1->keybit[BIT_WORD(BTN_BACK)] |= BIT_MASK(BTN_BACK); 503 494 } 504 495 496 + if (model->flags & ALPS_FOUR_BUTTONS) { 497 + dev1->keybit[BIT_WORD(BTN_0)] |= BIT_MASK(BTN_0); 498 + dev1->keybit[BIT_WORD(BTN_1)] |= BIT_MASK(BTN_1); 499 + dev1->keybit[BIT_WORD(BTN_2)] |= BIT_MASK(BTN_2); 500 + dev1->keybit[BIT_WORD(BTN_3)] |= BIT_MASK(BTN_3); 501 + } else { 502 + dev1->keybit[BIT_WORD(BTN_MIDDLE)] |= BIT_MASK(BTN_MIDDLE); 503 + } 504 + 505 505 snprintf(priv->phys, sizeof(priv->phys), "%s/input1", psmouse->ps2dev.serio->phys); 506 506 dev2->phys = priv->phys; 507 - dev2->name = (priv->i->flags & ALPS_DUALPOINT) ? "DualPoint Stick" : "PS/2 Mouse"; 507 + dev2->name = (model->flags & ALPS_DUALPOINT) ? "DualPoint Stick" : "PS/2 Mouse"; 508 508 dev2->id.bustype = BUS_I8042; 509 509 dev2->id.vendor = 0x0002; 510 510 dev2->id.product = PSMOUSE_ALPS; ··· 527 497 dev2->dev.parent = &psmouse->ps2dev.serio->dev; 528 498 529 499 dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); 530 - dev2->relbit[BIT_WORD(REL_X)] |= BIT_MASK(REL_X) | BIT_MASK(REL_Y); 531 - dev2->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_LEFT) | 532 - BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); 500 + dev2->relbit[BIT_WORD(REL_X)] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); 501 + dev2->keybit[BIT_WORD(BTN_LEFT)] = 502 + BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); 533 503 534 504 if (input_register_device(priv->dev2)) 535 505 goto init_fail;
+1
drivers/input/mouse/elantech.c
··· 420 420 421 421 __set_bit(EV_KEY, dev->evbit); 422 422 __set_bit(EV_ABS, dev->evbit); 423 + __clear_bit(EV_REL, dev->evbit); 423 424 424 425 __set_bit(BTN_LEFT, dev->keybit); 425 426 __set_bit(BTN_RIGHT, dev->keybit);
-13
drivers/input/mouse/hgpk.c
··· 430 430 struct input_dev *dev = psmouse->dev; 431 431 int err; 432 432 433 - /* unset the things that psmouse-base sets which we don't have */ 434 - __clear_bit(BTN_MIDDLE, dev->keybit); 435 - 436 - /* set the things we do have */ 437 - __set_bit(EV_KEY, dev->evbit); 438 - __set_bit(EV_REL, dev->evbit); 439 - 440 - __set_bit(REL_X, dev->relbit); 441 - __set_bit(REL_Y, dev->relbit); 442 - 443 - __set_bit(BTN_LEFT, dev->keybit); 444 - __set_bit(BTN_RIGHT, dev->keybit); 445 - 446 433 /* register handlers */ 447 434 psmouse->protocol_handler = hgpk_process_byte; 448 435 psmouse->poll = hgpk_poll;
+32 -23
drivers/input/mouse/lifebook.c
··· 25 25 char phys[32]; 26 26 }; 27 27 28 + static bool lifebook_present; 29 + 28 30 static const char *desired_serio_phys; 29 31 30 - static int lifebook_set_serio_phys(const struct dmi_system_id *d) 32 + static int lifebook_limit_serio3(const struct dmi_system_id *d) 31 33 { 32 - desired_serio_phys = d->driver_data; 34 + desired_serio_phys = "isa0060/serio3"; 33 35 return 0; 34 36 } 35 37 ··· 43 41 return 0; 44 42 } 45 43 46 - static const struct dmi_system_id lifebook_dmi_table[] = { 44 + static const struct dmi_system_id __initconst lifebook_dmi_table[] = { 45 + #if defined(CONFIG_DMI) && defined(CONFIG_X86) 47 46 { 48 - .ident = "FLORA-ie 55mi", 47 + /* FLORA-ie 55mi */ 49 48 .matches = { 50 49 DMI_MATCH(DMI_PRODUCT_NAME, "FLORA-ie 55mi"), 51 50 }, 52 51 }, 53 52 { 54 - .ident = "LifeBook B", 53 + /* LifeBook B */ 55 54 .matches = { 56 55 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"), 57 56 }, 58 57 }, 59 58 { 60 - .ident = "Lifebook B", 59 + /* Lifebook B */ 61 60 .matches = { 62 61 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"), 63 62 }, 64 63 }, 65 64 { 66 - .ident = "Lifebook B-2130", 65 + /* Lifebook B-2130 */ 67 66 .matches = { 68 67 DMI_MATCH(DMI_BOARD_NAME, "ZEPHYR"), 69 68 }, 70 69 }, 71 70 { 72 - .ident = "Lifebook B213x/B2150", 71 + /* Lifebook B213x/B2150 */ 73 72 .matches = { 74 73 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"), 75 74 }, 76 75 }, 77 76 { 78 - .ident = "Zephyr", 77 + /* Zephyr */ 79 78 .matches = { 80 79 DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"), 81 80 }, 82 81 }, 83 82 { 84 - .ident = "CF-18", 83 + /* Panasonic CF-18 */ 85 84 .matches = { 86 85 DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"), 87 86 }, 88 - .callback = lifebook_set_serio_phys, 89 - .driver_data = "isa0060/serio3", 87 + .callback = lifebook_limit_serio3, 90 88 }, 91 89 { 92 - .ident = "Panasonic CF-28", 90 + /* Panasonic CF-28 */ 93 91 .matches = { 94 92 DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"), 95 93 DMI_MATCH(DMI_PRODUCT_NAME, "CF-28"), ··· 97 95 .callback = lifebook_set_6byte_proto, 98 96 }, 99 97 { 100 - .ident = "Panasonic CF-29", 98 + /* Panasonic CF-29 */ 101 99 .matches = { 102 100 DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"), 103 101 DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"), ··· 105 103 .callback = lifebook_set_6byte_proto, 106 104 }, 107 105 { 108 - .ident = "CF-72", 106 + /* Panasonic CF-72 */ 109 107 .matches = { 110 108 DMI_MATCH(DMI_PRODUCT_NAME, "CF-72"), 111 109 }, 112 110 .callback = lifebook_set_6byte_proto, 113 111 }, 114 112 { 115 - .ident = "Lifebook B142", 113 + /* Lifebook B142 */ 116 114 .matches = { 117 115 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"), 118 116 }, 119 117 }, 120 118 { } 119 + #endif 121 120 }; 121 + 122 + void __init lifebook_module_init(void) 123 + { 124 + lifebook_present = dmi_check_system(lifebook_dmi_table); 125 + } 122 126 123 127 static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse) 124 128 { ··· 206 198 return -1; 207 199 208 200 /* 209 - Enable absolute output -- ps2_command fails always but if 210 - you leave this call out the touchsreen will never send 211 - absolute coordinates 212 - */ 201 + * Enable absolute output -- ps2_command fails always but if 202 + * you leave this call out the touchsreen will never send 203 + * absolute coordinates 204 + */ 213 205 param = lifebook_use_6byte_proto ? 0x08 : 0x07; 214 206 ps2_command(ps2dev, &param, PSMOUSE_CMD_SETRES); 215 207 ··· 251 243 252 244 int lifebook_detect(struct psmouse *psmouse, bool set_properties) 253 245 { 254 - if (!dmi_check_system(lifebook_dmi_table)) 246 + if (!lifebook_present) 255 247 return -1; 256 248 257 249 if (desired_serio_phys && ··· 291 283 292 284 dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); 293 285 dev2->relbit[BIT_WORD(REL_X)] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); 294 - dev2->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) | 295 - BIT_MASK(BTN_RIGHT); 286 + dev2->keybit[BIT_WORD(BTN_LEFT)] = 287 + BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT); 296 288 297 289 error = input_register_device(priv->dev2); 298 290 if (error) ··· 317 309 318 310 dev1->evbit[0] = BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY); 319 311 dev1->relbit[0] = 0; 312 + dev1->keybit[BIT_WORD(BTN_MOUSE)] = 0; 320 313 dev1->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); 321 314 input_set_abs_params(dev1, ABS_X, 0, max_coord, 0, 0); 322 315 input_set_abs_params(dev1, ABS_Y, 0, max_coord, 0, 0);
+4
drivers/input/mouse/lifebook.h
··· 12 12 #define _LIFEBOOK_H 13 13 14 14 #ifdef CONFIG_MOUSE_PS2_LIFEBOOK 15 + void lifebook_module_init(void); 15 16 int lifebook_detect(struct psmouse *psmouse, bool set_properties); 16 17 int lifebook_init(struct psmouse *psmouse); 17 18 #else 19 + inline void lifebook_module_init(void) 20 + { 21 + } 18 22 inline int lifebook_detect(struct psmouse *psmouse, bool set_properties) 19 23 { 20 24 return -ENOSYS;
+2 -2
drivers/input/mouse/logips2pp.c
··· 404 404 } 405 405 } 406 406 407 - if (buttons < 3) 408 - __clear_bit(BTN_MIDDLE, psmouse->dev->keybit); 407 + if (buttons >= 3) 408 + __set_bit(BTN_MIDDLE, psmouse->dev->keybit); 409 409 410 410 if (model_info) 411 411 ps2pp_set_model_properties(psmouse, model_info, use_ps2pp);
+30 -11
drivers/input/mouse/psmouse-base.c
··· 425 425 return -1; 426 426 427 427 if (set_properties) { 428 + __set_bit(BTN_MIDDLE, psmouse->dev->keybit); 428 429 __set_bit(BTN_EXTRA, psmouse->dev->keybit); 429 430 __set_bit(BTN_SIDE, psmouse->dev->keybit); 430 431 __set_bit(REL_WHEEL, psmouse->dev->relbit); ··· 461 460 __set_bit(BTN_MIDDLE, psmouse->dev->keybit); 462 461 __set_bit(REL_WHEEL, psmouse->dev->relbit); 463 462 464 - if (!psmouse->vendor) psmouse->vendor = "Generic"; 465 - if (!psmouse->name) psmouse->name = "Wheel Mouse"; 463 + if (!psmouse->vendor) 464 + psmouse->vendor = "Generic"; 465 + if (!psmouse->name) 466 + psmouse->name = "Wheel Mouse"; 466 467 psmouse->pktsize = 4; 467 468 } 468 469 ··· 507 504 __set_bit(BTN_SIDE, psmouse->dev->keybit); 508 505 __set_bit(BTN_EXTRA, psmouse->dev->keybit); 509 506 510 - if (!psmouse->vendor) psmouse->vendor = "Generic"; 511 - if (!psmouse->name) psmouse->name = "Explorer Mouse"; 507 + if (!psmouse->vendor) 508 + psmouse->vendor = "Generic"; 509 + if (!psmouse->name) 510 + psmouse->name = "Explorer Mouse"; 512 511 psmouse->pktsize = 4; 513 512 } 514 513 ··· 541 536 return -1; 542 537 543 538 if (set_properties) { 539 + __set_bit(BTN_MIDDLE, psmouse->dev->keybit); 544 540 __set_bit(BTN_EXTRA, psmouse->dev->keybit); 545 541 546 542 psmouse->vendor = "Kensington"; ··· 557 551 static int ps2bare_detect(struct psmouse *psmouse, bool set_properties) 558 552 { 559 553 if (set_properties) { 560 - if (!psmouse->vendor) psmouse->vendor = "Generic"; 561 - if (!psmouse->name) psmouse->name = "Mouse"; 554 + if (!psmouse->vendor) 555 + psmouse->vendor = "Generic"; 556 + if (!psmouse->name) 557 + psmouse->name = "Mouse"; 558 + 559 + /* 560 + * We have no way of figuring true number of buttons so let's 561 + * assume that the device has 3. 562 + */ 563 + __set_bit(BTN_MIDDLE, psmouse->dev->keybit); 562 564 } 563 565 564 566 return 0; ··· 581 567 if (set_properties) { 582 568 psmouse->vendor = "Cortron"; 583 569 psmouse->name = "PS/2 Trackball"; 570 + 571 + __set_bit(BTN_MIDDLE, psmouse->dev->keybit); 584 572 __set_bit(BTN_SIDE, psmouse->dev->keybit); 585 573 } 586 574 ··· 1200 1184 mutex_unlock(&psmouse_mutex); 1201 1185 } 1202 1186 1203 - static int psmouse_switch_protocol(struct psmouse *psmouse, const struct psmouse_protocol *proto) 1187 + static int psmouse_switch_protocol(struct psmouse *psmouse, 1188 + const struct psmouse_protocol *proto) 1204 1189 { 1205 1190 struct input_dev *input_dev = psmouse->dev; 1206 1191 1207 1192 input_dev->dev.parent = &psmouse->ps2dev.serio->dev; 1208 1193 1209 1194 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); 1210 - input_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) | 1211 - BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); 1195 + input_dev->keybit[BIT_WORD(BTN_MOUSE)] = 1196 + BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT); 1212 1197 input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); 1213 1198 1214 1199 psmouse->set_rate = psmouse_set_rate; ··· 1226 1209 return -1; 1227 1210 1228 1211 psmouse->type = proto->type; 1229 - } 1230 - else 1212 + } else 1231 1213 psmouse->type = psmouse_extensions(psmouse, 1232 1214 psmouse_max_proto, true); 1233 1215 ··· 1695 1679 static int __init psmouse_init(void) 1696 1680 { 1697 1681 int err; 1682 + 1683 + lifebook_module_init(); 1684 + synaptics_module_init(); 1698 1685 1699 1686 kpsmoused_wq = create_singlethread_workqueue("kpsmoused"); 1700 1687 if (!kpsmoused_wq) {
+1
drivers/input/mouse/sentelic.c
··· 836 836 priv->flags |= FSPDRV_FLAG_EN_OPC; 837 837 838 838 /* Set up various supported input event bits */ 839 + __set_bit(BTN_MIDDLE, psmouse->dev->keybit); 839 840 __set_bit(BTN_BACK, psmouse->dev->keybit); 840 841 __set_bit(BTN_FORWARD, psmouse->dev->keybit); 841 842 __set_bit(REL_WHEEL, psmouse->dev->relbit);
+20 -11
drivers/input/mouse/synaptics.c
··· 24 24 */ 25 25 26 26 #include <linux/module.h> 27 + #include <linux/dmi.h> 27 28 #include <linux/input.h> 28 29 #include <linux/serio.h> 29 30 #include <linux/libps2.h> ··· 630 629 return 0; 631 630 } 632 631 633 - #if defined(__i386__) 634 - #include <linux/dmi.h> 635 - static const struct dmi_system_id toshiba_dmi_table[] = { 632 + static bool impaired_toshiba_kbc; 633 + 634 + static const struct dmi_system_id __initconst toshiba_dmi_table[] = { 635 + #if defined(CONFIG_DMI) && defined(CONFIG_X86) 636 636 { 637 - .ident = "Toshiba Satellite", 637 + /* Toshiba Satellite */ 638 638 .matches = { 639 639 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 640 640 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite"), 641 641 }, 642 642 }, 643 643 { 644 - .ident = "Toshiba Dynabook", 644 + /* Toshiba Dynabook */ 645 645 .matches = { 646 646 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 647 647 DMI_MATCH(DMI_PRODUCT_NAME, "dynabook"), 648 648 }, 649 649 }, 650 650 { 651 - .ident = "Toshiba Portege M300", 651 + /* Toshiba Portege M300 */ 652 652 .matches = { 653 653 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 654 654 DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M300"), ··· 657 655 658 656 }, 659 657 { 660 - .ident = "Toshiba Portege M300", 658 + /* Toshiba Portege M300 */ 661 659 .matches = { 662 660 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 663 661 DMI_MATCH(DMI_PRODUCT_NAME, "Portable PC"), ··· 666 664 667 665 }, 668 666 { } 669 - }; 670 667 #endif 668 + }; 669 + 670 + void __init synaptics_module_init(void) 671 + { 672 + impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table); 673 + } 671 674 672 675 int synaptics_init(struct psmouse *psmouse) 673 676 { ··· 725 718 if (SYN_CAP_PASS_THROUGH(priv->capabilities)) 726 719 synaptics_pt_create(psmouse); 727 720 728 - #if defined(__i386__) 729 721 /* 730 722 * Toshiba's KBC seems to have trouble handling data from 731 723 * Synaptics as full rate, switch to lower rate which is roughly 732 724 * thye same as rate of standard PS/2 mouse. 733 725 */ 734 - if (psmouse->rate >= 80 && dmi_check_system(toshiba_dmi_table)) { 726 + if (psmouse->rate >= 80 && impaired_toshiba_kbc) { 735 727 printk(KERN_INFO "synaptics: Toshiba %s detected, limiting rate to 40pps.\n", 736 728 dmi_get_system_info(DMI_PRODUCT_NAME)); 737 729 psmouse->rate = 40; 738 730 } 739 - #endif 740 731 741 732 return 0; 742 733 ··· 744 739 } 745 740 746 741 #else /* CONFIG_MOUSE_PS2_SYNAPTICS */ 742 + 743 + void __init synaptics_module_init(void) 744 + { 745 + } 747 746 748 747 int synaptics_init(struct psmouse *psmouse) 749 748 {
+1
drivers/input/mouse/synaptics.h
··· 105 105 int scroll; 106 106 }; 107 107 108 + void synaptics_module_init(void); 108 109 int synaptics_detect(struct psmouse *psmouse, bool set_properties); 109 110 int synaptics_init(struct psmouse *psmouse); 110 111 void synaptics_reset(struct psmouse *psmouse);
+3 -3
drivers/input/mouse/synaptics_i2c.c
··· 420 420 } 421 421 422 422 /* Control the Device polling rate / Work Handler sleep time */ 423 - unsigned long synaptics_i2c_adjust_delay(struct synaptics_i2c *touch, 424 - bool have_data) 423 + static unsigned long synaptics_i2c_adjust_delay(struct synaptics_i2c *touch, 424 + bool have_data) 425 425 { 426 426 unsigned long delay, nodata_count_thres; 427 427 ··· 520 520 __set_bit(BTN_LEFT, input->keybit); 521 521 } 522 522 523 - struct synaptics_i2c *synaptics_i2c_touch_create(struct i2c_client *client) 523 + static struct synaptics_i2c *synaptics_i2c_touch_create(struct i2c_client *client) 524 524 { 525 525 struct synaptics_i2c *touch; 526 526
+2 -1
drivers/input/mouse/touchkit_ps2.c
··· 86 86 87 87 if (set_properties) { 88 88 dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); 89 - __set_bit(BTN_TOUCH, dev->keybit); 89 + dev->keybit[BIT_WORD(BTN_MOUSE)] = 0; 90 + dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); 90 91 input_set_abs_params(dev, ABS_X, 0, TOUCHKIT_MAX_XC, 0, 0); 91 92 input_set_abs_params(dev, ABS_Y, 0, TOUCHKIT_MAX_YC, 0, 0); 92 93
+8 -5
drivers/input/mouse/trackpoint.c
··· 284 284 285 285 int trackpoint_detect(struct psmouse *psmouse, bool set_properties) 286 286 { 287 - struct trackpoint_data *priv; 288 287 struct ps2dev *ps2dev = &psmouse->ps2dev; 289 288 unsigned char firmware_id; 290 289 unsigned char button_info; ··· 300 301 button_info = 0; 301 302 } 302 303 303 - psmouse->private = priv = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL); 304 - if (!priv) 304 + psmouse->private = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL); 305 + if (!psmouse->private) 305 306 return -1; 306 307 307 308 psmouse->vendor = "IBM"; ··· 310 311 psmouse->reconnect = trackpoint_reconnect; 311 312 psmouse->disconnect = trackpoint_disconnect; 312 313 313 - trackpoint_defaults(priv); 314 + if ((button_info & 0x0f) >= 3) 315 + __set_bit(BTN_MIDDLE, psmouse->dev->keybit); 316 + 317 + trackpoint_defaults(psmouse->private); 314 318 trackpoint_sync(psmouse); 315 319 316 320 error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); ··· 321 319 printk(KERN_ERR 322 320 "trackpoint.c: failed to create sysfs attributes, error: %d\n", 323 321 error); 324 - kfree(priv); 322 + kfree(psmouse->private); 323 + psmouse->private = NULL; 325 324 return -1; 326 325 } 327 326
+172 -196
drivers/input/mouse/vsxxxaa.c
··· 86 86 87 87 #define DRIVER_DESC "Driver for DEC VSXXX-AA and -GA mice and VSXXX-AB tablet" 88 88 89 - MODULE_AUTHOR ("Jan-Benedict Glaw <jbglaw@lug-owl.de>"); 90 - MODULE_DESCRIPTION (DRIVER_DESC); 91 - MODULE_LICENSE ("GPL"); 89 + MODULE_AUTHOR("Jan-Benedict Glaw <jbglaw@lug-owl.de>"); 90 + MODULE_DESCRIPTION(DRIVER_DESC); 91 + MODULE_LICENSE("GPL"); 92 92 93 93 #undef VSXXXAA_DEBUG 94 94 #ifdef VSXXXAA_DEBUG 95 - #define DBG(x...) printk (x) 95 + #define DBG(x...) printk(x) 96 96 #else 97 97 #define DBG(x...) do {} while (0) 98 98 #endif 99 99 100 100 #define VSXXXAA_INTRO_MASK 0x80 101 101 #define VSXXXAA_INTRO_HEAD 0x80 102 - #define IS_HDR_BYTE(x) (((x) & VSXXXAA_INTRO_MASK) \ 103 - == VSXXXAA_INTRO_HEAD) 102 + #define IS_HDR_BYTE(x) \ 103 + (((x) & VSXXXAA_INTRO_MASK) == VSXXXAA_INTRO_HEAD) 104 104 105 105 #define VSXXXAA_PACKET_MASK 0xe0 106 106 #define VSXXXAA_PACKET_REL 0x80 107 107 #define VSXXXAA_PACKET_ABS 0xc0 108 108 #define VSXXXAA_PACKET_POR 0xa0 109 - #define MATCH_PACKET_TYPE(data, type) (((data) & VSXXXAA_PACKET_MASK) == (type)) 109 + #define MATCH_PACKET_TYPE(data, type) \ 110 + (((data) & VSXXXAA_PACKET_MASK) == (type)) 110 111 111 112 112 113 ··· 124 123 char phys[32]; 125 124 }; 126 125 127 - static void 128 - vsxxxaa_drop_bytes (struct vsxxxaa *mouse, int num) 126 + static void vsxxxaa_drop_bytes(struct vsxxxaa *mouse, int num) 129 127 { 130 - if (num >= mouse->count) 128 + if (num >= mouse->count) { 131 129 mouse->count = 0; 132 - else { 133 - memmove (mouse->buf, mouse->buf + num - 1, BUFLEN - num); 130 + } else { 131 + memmove(mouse->buf, mouse->buf + num - 1, BUFLEN - num); 134 132 mouse->count -= num; 135 133 } 136 134 } 137 135 138 - static void 139 - vsxxxaa_queue_byte (struct vsxxxaa *mouse, unsigned char byte) 136 + static void vsxxxaa_queue_byte(struct vsxxxaa *mouse, unsigned char byte) 140 137 { 141 138 if (mouse->count == BUFLEN) { 142 - printk (KERN_ERR "%s on %s: Dropping a byte of full buffer.\n", 143 - mouse->name, mouse->phys); 144 - vsxxxaa_drop_bytes (mouse, 1); 139 + printk(KERN_ERR "%s on %s: Dropping a byte of full buffer.\n", 140 + mouse->name, mouse->phys); 141 + vsxxxaa_drop_bytes(mouse, 1); 145 142 } 146 - DBG (KERN_INFO "Queueing byte 0x%02x\n", byte); 143 + 144 + DBG(KERN_INFO "Queueing byte 0x%02x\n", byte); 147 145 148 146 mouse->buf[mouse->count++] = byte; 149 147 } 150 148 151 - static void 152 - vsxxxaa_detection_done (struct vsxxxaa *mouse) 149 + static void vsxxxaa_detection_done(struct vsxxxaa *mouse) 153 150 { 154 151 switch (mouse->type) { 155 - case 0x02: 156 - strlcpy (mouse->name, "DEC VSXXX-AA/-GA mouse", 157 - sizeof (mouse->name)); 158 - break; 152 + case 0x02: 153 + strlcpy(mouse->name, "DEC VSXXX-AA/-GA mouse", 154 + sizeof(mouse->name)); 155 + break; 159 156 160 - case 0x04: 161 - strlcpy (mouse->name, "DEC VSXXX-AB digitizer", 162 - sizeof (mouse->name)); 163 - break; 157 + case 0x04: 158 + strlcpy(mouse->name, "DEC VSXXX-AB digitizer", 159 + sizeof(mouse->name)); 160 + break; 164 161 165 - default: 166 - snprintf (mouse->name, sizeof (mouse->name), 167 - "unknown DEC pointer device (type = 0x%02x)", 168 - mouse->type); 169 - break; 162 + default: 163 + snprintf(mouse->name, sizeof(mouse->name), 164 + "unknown DEC pointer device (type = 0x%02x)", 165 + mouse->type); 166 + break; 170 167 } 171 168 172 - printk (KERN_INFO 169 + printk(KERN_INFO 173 170 "Found %s version 0x%02x from country 0x%02x on port %s\n", 174 171 mouse->name, mouse->version, mouse->country, mouse->phys); 175 172 } ··· 175 176 /* 176 177 * Returns number of bytes to be dropped, 0 if packet is okay. 177 178 */ 178 - static int 179 - vsxxxaa_check_packet (struct vsxxxaa *mouse, int packet_len) 179 + static int vsxxxaa_check_packet(struct vsxxxaa *mouse, int packet_len) 180 180 { 181 181 int i; 182 182 183 183 /* First byte must be a header byte */ 184 - if (!IS_HDR_BYTE (mouse->buf[0])) { 185 - DBG ("vsck: len=%d, 1st=0x%02x\n", packet_len, mouse->buf[0]); 184 + if (!IS_HDR_BYTE(mouse->buf[0])) { 185 + DBG("vsck: len=%d, 1st=0x%02x\n", packet_len, mouse->buf[0]); 186 186 return 1; 187 187 } 188 188 189 189 /* Check all following bytes */ 190 - if (packet_len > 1) { 191 - for (i = 1; i < packet_len; i++) { 192 - if (IS_HDR_BYTE (mouse->buf[i])) { 193 - printk (KERN_ERR "Need to drop %d bytes " 194 - "of a broken packet.\n", 195 - i - 1); 196 - DBG (KERN_INFO "check: len=%d, b[%d]=0x%02x\n", 197 - packet_len, i, mouse->buf[i]); 198 - return i - 1; 199 - } 190 + for (i = 1; i < packet_len; i++) { 191 + if (IS_HDR_BYTE(mouse->buf[i])) { 192 + printk(KERN_ERR 193 + "Need to drop %d bytes of a broken packet.\n", 194 + i - 1); 195 + DBG(KERN_INFO "check: len=%d, b[%d]=0x%02x\n", 196 + packet_len, i, mouse->buf[i]); 197 + return i - 1; 200 198 } 201 199 } 202 200 203 201 return 0; 204 202 } 205 203 206 - static __inline__ int 207 - vsxxxaa_smells_like_packet (struct vsxxxaa *mouse, unsigned char type, size_t len) 204 + static inline int vsxxxaa_smells_like_packet(struct vsxxxaa *mouse, 205 + unsigned char type, size_t len) 208 206 { 209 - return (mouse->count >= len) && MATCH_PACKET_TYPE (mouse->buf[0], type); 207 + return mouse->count >= len && MATCH_PACKET_TYPE(mouse->buf[0], type); 210 208 } 211 209 212 - static void 213 - vsxxxaa_handle_REL_packet (struct vsxxxaa *mouse) 210 + static void vsxxxaa_handle_REL_packet(struct vsxxxaa *mouse) 214 211 { 215 212 struct input_dev *dev = mouse->dev; 216 213 unsigned char *buf = mouse->buf; ··· 227 232 * 0, bit 4 of byte 0 is direction. 228 233 */ 229 234 dx = buf[1] & 0x7f; 230 - dx *= ((buf[0] >> 4) & 0x01)? 1: -1; 235 + dx *= ((buf[0] >> 4) & 0x01) ? 1 : -1; 231 236 232 237 /* 233 238 * Low 7 bit of byte 2 are abs(dy), bit 7 is 234 239 * 0, bit 3 of byte 0 is direction. 235 240 */ 236 241 dy = buf[2] & 0x7f; 237 - dy *= ((buf[0] >> 3) & 0x01)? -1: 1; 242 + dy *= ((buf[0] >> 3) & 0x01) ? -1 : 1; 238 243 239 244 /* 240 245 * Get button state. It's the low three bits 241 246 * (for three buttons) of byte 0. 242 247 */ 243 - left = (buf[0] & 0x04)? 1: 0; 244 - middle = (buf[0] & 0x02)? 1: 0; 245 - right = (buf[0] & 0x01)? 1: 0; 248 + left = buf[0] & 0x04; 249 + middle = buf[0] & 0x02; 250 + right = buf[0] & 0x01; 246 251 247 - vsxxxaa_drop_bytes (mouse, 3); 252 + vsxxxaa_drop_bytes(mouse, 3); 248 253 249 - DBG (KERN_INFO "%s on %s: dx=%d, dy=%d, buttons=%s%s%s\n", 250 - mouse->name, mouse->phys, dx, dy, 251 - left? "L": "l", middle? "M": "m", right? "R": "r"); 254 + DBG(KERN_INFO "%s on %s: dx=%d, dy=%d, buttons=%s%s%s\n", 255 + mouse->name, mouse->phys, dx, dy, 256 + left ? "L" : "l", middle ? "M" : "m", right ? "R" : "r"); 252 257 253 258 /* 254 259 * Report what we've found so far... 255 260 */ 256 - input_report_key (dev, BTN_LEFT, left); 257 - input_report_key (dev, BTN_MIDDLE, middle); 258 - input_report_key (dev, BTN_RIGHT, right); 259 - input_report_key (dev, BTN_TOUCH, 0); 260 - input_report_rel (dev, REL_X, dx); 261 - input_report_rel (dev, REL_Y, dy); 262 - input_sync (dev); 261 + input_report_key(dev, BTN_LEFT, left); 262 + input_report_key(dev, BTN_MIDDLE, middle); 263 + input_report_key(dev, BTN_RIGHT, right); 264 + input_report_key(dev, BTN_TOUCH, 0); 265 + input_report_rel(dev, REL_X, dx); 266 + input_report_rel(dev, REL_Y, dy); 267 + input_sync(dev); 263 268 } 264 269 265 - static void 266 - vsxxxaa_handle_ABS_packet (struct vsxxxaa *mouse) 270 + static void vsxxxaa_handle_ABS_packet(struct vsxxxaa *mouse) 267 271 { 268 272 struct input_dev *dev = mouse->dev; 269 273 unsigned char *buf = mouse->buf; ··· 290 296 /* 291 297 * Get button state. It's bits <4..1> of byte 0. 292 298 */ 293 - left = (buf[0] & 0x02)? 1: 0; 294 - middle = (buf[0] & 0x04)? 1: 0; 295 - right = (buf[0] & 0x08)? 1: 0; 296 - touch = (buf[0] & 0x10)? 1: 0; 299 + left = buf[0] & 0x02; 300 + middle = buf[0] & 0x04; 301 + right = buf[0] & 0x08; 302 + touch = buf[0] & 0x10; 297 303 298 - vsxxxaa_drop_bytes (mouse, 5); 304 + vsxxxaa_drop_bytes(mouse, 5); 299 305 300 - DBG (KERN_INFO "%s on %s: x=%d, y=%d, buttons=%s%s%s%s\n", 301 - mouse->name, mouse->phys, x, y, 302 - left? "L": "l", middle? "M": "m", 303 - right? "R": "r", touch? "T": "t"); 306 + DBG(KERN_INFO "%s on %s: x=%d, y=%d, buttons=%s%s%s%s\n", 307 + mouse->name, mouse->phys, x, y, 308 + left ? "L" : "l", middle ? "M" : "m", 309 + right ? "R" : "r", touch ? "T" : "t"); 304 310 305 311 /* 306 312 * Report what we've found so far... 307 313 */ 308 - input_report_key (dev, BTN_LEFT, left); 309 - input_report_key (dev, BTN_MIDDLE, middle); 310 - input_report_key (dev, BTN_RIGHT, right); 311 - input_report_key (dev, BTN_TOUCH, touch); 312 - input_report_abs (dev, ABS_X, x); 313 - input_report_abs (dev, ABS_Y, y); 314 - input_sync (dev); 314 + input_report_key(dev, BTN_LEFT, left); 315 + input_report_key(dev, BTN_MIDDLE, middle); 316 + input_report_key(dev, BTN_RIGHT, right); 317 + input_report_key(dev, BTN_TOUCH, touch); 318 + input_report_abs(dev, ABS_X, x); 319 + input_report_abs(dev, ABS_Y, y); 320 + input_sync(dev); 315 321 } 316 322 317 - static void 318 - vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse) 323 + static void vsxxxaa_handle_POR_packet(struct vsxxxaa *mouse) 319 324 { 320 325 struct input_dev *dev = mouse->dev; 321 326 unsigned char *buf = mouse->buf; ··· 349 356 * (for three buttons) of byte 0. Maybe even the bit <3> 350 357 * has some meaning if a tablet is attached. 351 358 */ 352 - left = (buf[0] & 0x04)? 1: 0; 353 - middle = (buf[0] & 0x02)? 1: 0; 354 - right = (buf[0] & 0x01)? 1: 0; 359 + left = buf[0] & 0x04; 360 + middle = buf[0] & 0x02; 361 + right = buf[0] & 0x01; 355 362 356 - vsxxxaa_drop_bytes (mouse, 4); 357 - vsxxxaa_detection_done (mouse); 363 + vsxxxaa_drop_bytes(mouse, 4); 364 + vsxxxaa_detection_done(mouse); 358 365 359 366 if (error <= 0x1f) { 360 367 /* No (serious) error. Report buttons */ 361 - input_report_key (dev, BTN_LEFT, left); 362 - input_report_key (dev, BTN_MIDDLE, middle); 363 - input_report_key (dev, BTN_RIGHT, right); 364 - input_report_key (dev, BTN_TOUCH, 0); 365 - input_sync (dev); 368 + input_report_key(dev, BTN_LEFT, left); 369 + input_report_key(dev, BTN_MIDDLE, middle); 370 + input_report_key(dev, BTN_RIGHT, right); 371 + input_report_key(dev, BTN_TOUCH, 0); 372 + input_sync(dev); 366 373 367 374 if (error != 0) 368 - printk (KERN_INFO "Your %s on %s reports error=0x%02x\n", 369 - mouse->name, mouse->phys, error); 375 + printk(KERN_INFO "Your %s on %s reports error=0x%02x\n", 376 + mouse->name, mouse->phys, error); 370 377 371 378 } 372 379 ··· 374 381 * If the mouse was hot-plugged, we need to force differential mode 375 382 * now... However, give it a second to recover from it's reset. 376 383 */ 377 - printk (KERN_NOTICE "%s on %s: Forceing standard packet format, " 378 - "incremental streaming mode and 72 samples/sec\n", 379 - mouse->name, mouse->phys); 380 - serio_write (mouse->serio, 'S'); /* Standard format */ 381 - mdelay (50); 382 - serio_write (mouse->serio, 'R'); /* Incremental */ 383 - mdelay (50); 384 - serio_write (mouse->serio, 'L'); /* 72 samples/sec */ 384 + printk(KERN_NOTICE 385 + "%s on %s: Forcing standard packet format, " 386 + "incremental streaming mode and 72 samples/sec\n", 387 + mouse->name, mouse->phys); 388 + serio_write(mouse->serio, 'S'); /* Standard format */ 389 + mdelay(50); 390 + serio_write(mouse->serio, 'R'); /* Incremental */ 391 + mdelay(50); 392 + serio_write(mouse->serio, 'L'); /* 72 samples/sec */ 385 393 } 386 394 387 - static void 388 - vsxxxaa_parse_buffer (struct vsxxxaa *mouse) 395 + static void vsxxxaa_parse_buffer(struct vsxxxaa *mouse) 389 396 { 390 397 unsigned char *buf = mouse->buf; 391 398 int stray_bytes; ··· 402 409 * activity on the mouse. 403 410 */ 404 411 while (mouse->count > 0 && !IS_HDR_BYTE(buf[0])) { 405 - printk (KERN_ERR "%s on %s: Dropping a byte to regain " 406 - "sync with mouse data stream...\n", 407 - mouse->name, mouse->phys); 408 - vsxxxaa_drop_bytes (mouse, 1); 412 + printk(KERN_ERR "%s on %s: Dropping a byte to regain " 413 + "sync with mouse data stream...\n", 414 + mouse->name, mouse->phys); 415 + vsxxxaa_drop_bytes(mouse, 1); 409 416 } 410 417 411 418 /* 412 419 * Check for packets we know about. 413 420 */ 414 421 415 - if (vsxxxaa_smells_like_packet (mouse, VSXXXAA_PACKET_REL, 3)) { 422 + if (vsxxxaa_smells_like_packet(mouse, VSXXXAA_PACKET_REL, 3)) { 416 423 /* Check for broken packet */ 417 - stray_bytes = vsxxxaa_check_packet (mouse, 3); 418 - if (stray_bytes > 0) { 419 - printk (KERN_ERR "Dropping %d bytes now...\n", 420 - stray_bytes); 421 - vsxxxaa_drop_bytes (mouse, stray_bytes); 422 - continue; 423 - } 424 + stray_bytes = vsxxxaa_check_packet(mouse, 3); 425 + if (!stray_bytes) 426 + vsxxxaa_handle_REL_packet(mouse); 424 427 425 - vsxxxaa_handle_REL_packet (mouse); 426 - continue; /* More to parse? */ 428 + } else if (vsxxxaa_smells_like_packet(mouse, 429 + VSXXXAA_PACKET_ABS, 5)) { 430 + /* Check for broken packet */ 431 + stray_bytes = vsxxxaa_check_packet(mouse, 5); 432 + if (!stray_bytes) 433 + vsxxxaa_handle_ABS_packet(mouse); 434 + 435 + } else if (vsxxxaa_smells_like_packet(mouse, 436 + VSXXXAA_PACKET_POR, 4)) { 437 + /* Check for broken packet */ 438 + stray_bytes = vsxxxaa_check_packet(mouse, 4); 439 + if (!stray_bytes) 440 + vsxxxaa_handle_POR_packet(mouse); 441 + 442 + } else { 443 + break; /* No REL, ABS or POR packet found */ 427 444 } 428 445 429 - if (vsxxxaa_smells_like_packet (mouse, VSXXXAA_PACKET_ABS, 5)) { 430 - /* Check for broken packet */ 431 - stray_bytes = vsxxxaa_check_packet (mouse, 5); 432 - if (stray_bytes > 0) { 433 - printk (KERN_ERR "Dropping %d bytes now...\n", 434 - stray_bytes); 435 - vsxxxaa_drop_bytes (mouse, stray_bytes); 436 - continue; 437 - } 438 - 439 - vsxxxaa_handle_ABS_packet (mouse); 440 - continue; /* More to parse? */ 446 + if (stray_bytes > 0) { 447 + printk(KERN_ERR "Dropping %d bytes now...\n", 448 + stray_bytes); 449 + vsxxxaa_drop_bytes(mouse, stray_bytes); 441 450 } 442 451 443 - if (vsxxxaa_smells_like_packet (mouse, VSXXXAA_PACKET_POR, 4)) { 444 - /* Check for broken packet */ 445 - stray_bytes = vsxxxaa_check_packet (mouse, 4); 446 - if (stray_bytes > 0) { 447 - printk (KERN_ERR "Dropping %d bytes now...\n", 448 - stray_bytes); 449 - vsxxxaa_drop_bytes (mouse, stray_bytes); 450 - continue; 451 - } 452 - 453 - vsxxxaa_handle_POR_packet (mouse); 454 - continue; /* More to parse? */ 455 - } 456 - 457 - break; /* No REL, ABS or POR packet found */ 458 452 } while (1); 459 453 } 460 454 461 - static irqreturn_t 462 - vsxxxaa_interrupt (struct serio *serio, unsigned char data, unsigned int flags) 455 + static irqreturn_t vsxxxaa_interrupt(struct serio *serio, 456 + unsigned char data, unsigned int flags) 463 457 { 464 - struct vsxxxaa *mouse = serio_get_drvdata (serio); 458 + struct vsxxxaa *mouse = serio_get_drvdata(serio); 465 459 466 - vsxxxaa_queue_byte (mouse, data); 467 - vsxxxaa_parse_buffer (mouse); 460 + vsxxxaa_queue_byte(mouse, data); 461 + vsxxxaa_parse_buffer(mouse); 468 462 469 463 return IRQ_HANDLED; 470 464 } 471 465 472 - static void 473 - vsxxxaa_disconnect (struct serio *serio) 466 + static void vsxxxaa_disconnect(struct serio *serio) 474 467 { 475 - struct vsxxxaa *mouse = serio_get_drvdata (serio); 468 + struct vsxxxaa *mouse = serio_get_drvdata(serio); 476 469 477 - serio_close (serio); 478 - serio_set_drvdata (serio, NULL); 479 - input_unregister_device (mouse->dev); 480 - kfree (mouse); 470 + serio_close(serio); 471 + serio_set_drvdata(serio, NULL); 472 + input_unregister_device(mouse->dev); 473 + kfree(mouse); 481 474 } 482 475 483 - static int 484 - vsxxxaa_connect (struct serio *serio, struct serio_driver *drv) 476 + static int vsxxxaa_connect(struct serio *serio, struct serio_driver *drv) 485 477 { 486 478 struct vsxxxaa *mouse; 487 479 struct input_dev *input_dev; 488 480 int err = -ENOMEM; 489 481 490 - mouse = kzalloc (sizeof (struct vsxxxaa), GFP_KERNEL); 491 - input_dev = input_allocate_device (); 482 + mouse = kzalloc(sizeof(struct vsxxxaa), GFP_KERNEL); 483 + input_dev = input_allocate_device(); 492 484 if (!mouse || !input_dev) 493 485 goto fail1; 494 486 495 487 mouse->dev = input_dev; 496 488 mouse->serio = serio; 497 - strlcat (mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer", 498 - sizeof (mouse->name)); 499 - snprintf (mouse->phys, sizeof (mouse->phys), "%s/input0", serio->phys); 489 + strlcat(mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer", 490 + sizeof(mouse->name)); 491 + snprintf(mouse->phys, sizeof(mouse->phys), "%s/input0", serio->phys); 500 492 501 493 input_dev->name = mouse->name; 502 494 input_dev->phys = mouse->phys; 503 495 input_dev->id.bustype = BUS_RS232; 504 496 input_dev->dev.parent = &serio->dev; 505 497 506 - set_bit (EV_KEY, input_dev->evbit); /* We have buttons */ 507 - set_bit (EV_REL, input_dev->evbit); 508 - set_bit (EV_ABS, input_dev->evbit); 509 - set_bit (BTN_LEFT, input_dev->keybit); /* We have 3 buttons */ 510 - set_bit (BTN_MIDDLE, input_dev->keybit); 511 - set_bit (BTN_RIGHT, input_dev->keybit); 512 - set_bit (BTN_TOUCH, input_dev->keybit); /* ...and Tablet */ 513 - set_bit (REL_X, input_dev->relbit); 514 - set_bit (REL_Y, input_dev->relbit); 515 - input_set_abs_params (input_dev, ABS_X, 0, 1023, 0, 0); 516 - input_set_abs_params (input_dev, ABS_Y, 0, 1023, 0, 0); 498 + __set_bit(EV_KEY, input_dev->evbit); /* We have buttons */ 499 + __set_bit(EV_REL, input_dev->evbit); 500 + __set_bit(EV_ABS, input_dev->evbit); 501 + __set_bit(BTN_LEFT, input_dev->keybit); /* We have 3 buttons */ 502 + __set_bit(BTN_MIDDLE, input_dev->keybit); 503 + __set_bit(BTN_RIGHT, input_dev->keybit); 504 + __set_bit(BTN_TOUCH, input_dev->keybit); /* ...and Tablet */ 505 + __set_bit(REL_X, input_dev->relbit); 506 + __set_bit(REL_Y, input_dev->relbit); 507 + input_set_abs_params(input_dev, ABS_X, 0, 1023, 0, 0); 508 + input_set_abs_params(input_dev, ABS_Y, 0, 1023, 0, 0); 517 509 518 - serio_set_drvdata (serio, mouse); 510 + serio_set_drvdata(serio, mouse); 519 511 520 - err = serio_open (serio, drv); 512 + err = serio_open(serio, drv); 521 513 if (err) 522 514 goto fail2; 523 515 ··· 510 532 * Request selftest. Standard packet format and differential 511 533 * mode will be requested after the device ID'ed successfully. 512 534 */ 513 - serio_write (serio, 'T'); /* Test */ 535 + serio_write(serio, 'T'); /* Test */ 514 536 515 - err = input_register_device (input_dev); 537 + err = input_register_device(input_dev); 516 538 if (err) 517 539 goto fail3; 518 540 519 541 return 0; 520 542 521 - fail3: serio_close (serio); 522 - fail2: serio_set_drvdata (serio, NULL); 523 - fail1: input_free_device (input_dev); 524 - kfree (mouse); 543 + fail3: serio_close(serio); 544 + fail2: serio_set_drvdata(serio, NULL); 545 + fail1: input_free_device(input_dev); 546 + kfree(mouse); 525 547 return err; 526 548 } 527 549 ··· 548 570 .disconnect = vsxxxaa_disconnect, 549 571 }; 550 572 551 - static int __init 552 - vsxxxaa_init (void) 573 + static int __init vsxxxaa_init(void) 553 574 { 554 575 return serio_register_driver(&vsxxxaa_drv); 555 576 } 556 577 557 - static void __exit 558 - vsxxxaa_exit (void) 578 + static void __exit vsxxxaa_exit(void) 559 579 { 560 580 serio_unregister_driver(&vsxxxaa_drv); 561 581 } 562 582 563 - module_init (vsxxxaa_init); 564 - module_exit (vsxxxaa_exit); 583 + module_init(vsxxxaa_init); 584 + module_exit(vsxxxaa_exit); 565 585
+8
drivers/input/serio/Kconfig
··· 201 201 To compile this driver as a module, choose M here: the 202 202 module will be called xilinx_ps2. 203 203 204 + config SERIO_ALTERA_PS2 205 + tristate "Altera UP PS/2 controller" 206 + help 207 + Say Y here if you have Altera University Program PS/2 ports. 208 + 209 + To compile this driver as a module, choose M here: the 210 + module will be called altera_ps2. 211 + 204 212 endif
+1
drivers/input/serio/Makefile
··· 22 22 obj-$(CONFIG_SERIO_LIBPS2) += libps2.o 23 23 obj-$(CONFIG_SERIO_RAW) += serio_raw.o 24 24 obj-$(CONFIG_SERIO_XILINX_XPS_PS2) += xilinx_ps2.o 25 + obj-$(CONFIG_SERIO_ALTERA_PS2) += altera_ps2.o
+200
drivers/input/serio/altera_ps2.c
··· 1 + /* 2 + * Altera University Program PS2 controller driver 3 + * 4 + * Copyright (C) 2008 Thomas Chou <thomas@wytron.com.tw> 5 + * 6 + * Based on sa1111ps2.c, which is: 7 + * Copyright (C) 2002 Russell King 8 + * 9 + * This program is free software; you can redistribute it and/or modify 10 + * it under the terms of the GNU General Public License version 2 as 11 + * published by the Free Software Foundation. 12 + */ 13 + 14 + #include <linux/module.h> 15 + #include <linux/init.h> 16 + #include <linux/input.h> 17 + #include <linux/serio.h> 18 + #include <linux/interrupt.h> 19 + #include <linux/platform_device.h> 20 + #include <linux/io.h> 21 + 22 + #define DRV_NAME "altera_ps2" 23 + 24 + struct ps2if { 25 + struct serio *io; 26 + struct resource *iomem_res; 27 + void __iomem *base; 28 + unsigned irq; 29 + }; 30 + 31 + /* 32 + * Read all bytes waiting in the PS2 port. There should be 33 + * at the most one, but we loop for safety. 34 + */ 35 + static irqreturn_t altera_ps2_rxint(int irq, void *dev_id) 36 + { 37 + struct ps2if *ps2if = dev_id; 38 + unsigned int status; 39 + int handled = IRQ_NONE; 40 + 41 + while ((status = readl(ps2if->base)) & 0xffff0000) { 42 + serio_interrupt(ps2if->io, status & 0xff, 0); 43 + handled = IRQ_HANDLED; 44 + } 45 + 46 + return handled; 47 + } 48 + 49 + /* 50 + * Write a byte to the PS2 port. 51 + */ 52 + static int altera_ps2_write(struct serio *io, unsigned char val) 53 + { 54 + struct ps2if *ps2if = io->port_data; 55 + 56 + writel(val, ps2if->base); 57 + return 0; 58 + } 59 + 60 + static int altera_ps2_open(struct serio *io) 61 + { 62 + struct ps2if *ps2if = io->port_data; 63 + 64 + /* clear fifo */ 65 + while (readl(ps2if->base) & 0xffff0000) 66 + /* empty */; 67 + 68 + writel(1, ps2if->base + 4); /* enable rx irq */ 69 + return 0; 70 + } 71 + 72 + static void altera_ps2_close(struct serio *io) 73 + { 74 + struct ps2if *ps2if = io->port_data; 75 + 76 + writel(0, ps2if->base); /* disable rx irq */ 77 + } 78 + 79 + /* 80 + * Add one device to this driver. 81 + */ 82 + static int altera_ps2_probe(struct platform_device *pdev) 83 + { 84 + struct ps2if *ps2if; 85 + struct serio *serio; 86 + int error; 87 + 88 + ps2if = kzalloc(sizeof(struct ps2if), GFP_KERNEL); 89 + serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 90 + if (!ps2if || !serio) { 91 + error = -ENOMEM; 92 + goto err_free_mem; 93 + } 94 + 95 + serio->id.type = SERIO_8042; 96 + serio->write = altera_ps2_write; 97 + serio->open = altera_ps2_open; 98 + serio->close = altera_ps2_close; 99 + strlcpy(serio->name, dev_name(&pdev->dev), sizeof(serio->name)); 100 + strlcpy(serio->phys, dev_name(&pdev->dev), sizeof(serio->phys)); 101 + serio->port_data = ps2if; 102 + serio->dev.parent = &pdev->dev; 103 + ps2if->io = serio; 104 + 105 + ps2if->iomem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 106 + if (ps2if->iomem_res == NULL) { 107 + error = -ENOENT; 108 + goto err_free_mem; 109 + } 110 + 111 + ps2if->irq = platform_get_irq(pdev, 0); 112 + if (ps2if->irq < 0) { 113 + error = -ENXIO; 114 + goto err_free_mem; 115 + } 116 + 117 + if (!request_mem_region(ps2if->iomem_res->start, 118 + resource_size(ps2if->iomem_res), pdev->name)) { 119 + error = -EBUSY; 120 + goto err_free_mem; 121 + } 122 + 123 + ps2if->base = ioremap(ps2if->iomem_res->start, 124 + resource_size(ps2if->iomem_res)); 125 + if (!ps2if->base) { 126 + error = -ENOMEM; 127 + goto err_free_res; 128 + } 129 + 130 + error = request_irq(ps2if->irq, altera_ps2_rxint, 0, pdev->name, ps2if); 131 + if (error) { 132 + dev_err(&pdev->dev, "could not allocate IRQ %d: %d\n", 133 + ps2if->irq, error); 134 + goto err_unmap; 135 + } 136 + 137 + dev_info(&pdev->dev, "base %p, irq %d\n", ps2if->base, ps2if->irq); 138 + 139 + serio_register_port(ps2if->io); 140 + platform_set_drvdata(pdev, ps2if); 141 + 142 + return 0; 143 + 144 + err_unmap: 145 + iounmap(ps2if->base); 146 + err_free_res: 147 + release_mem_region(ps2if->iomem_res->start, 148 + resource_size(ps2if->iomem_res)); 149 + err_free_mem: 150 + kfree(ps2if); 151 + kfree(serio); 152 + return error; 153 + } 154 + 155 + /* 156 + * Remove one device from this driver. 157 + */ 158 + static int altera_ps2_remove(struct platform_device *pdev) 159 + { 160 + struct ps2if *ps2if = platform_get_drvdata(pdev); 161 + 162 + platform_set_drvdata(pdev, NULL); 163 + serio_unregister_port(ps2if->io); 164 + free_irq(ps2if->irq, ps2if); 165 + iounmap(ps2if->base); 166 + release_mem_region(ps2if->iomem_res->start, 167 + resource_size(ps2if->iomem_res)); 168 + kfree(ps2if); 169 + 170 + return 0; 171 + } 172 + 173 + /* 174 + * Our device driver structure 175 + */ 176 + static struct platform_driver altera_ps2_driver = { 177 + .probe = altera_ps2_probe, 178 + .remove = altera_ps2_remove, 179 + .driver = { 180 + .name = DRV_NAME, 181 + }, 182 + }; 183 + 184 + static int __init altera_ps2_init(void) 185 + { 186 + return platform_driver_register(&altera_ps2_driver); 187 + } 188 + 189 + static void __exit altera_ps2_exit(void) 190 + { 191 + platform_driver_unregister(&altera_ps2_driver); 192 + } 193 + 194 + module_init(altera_ps2_init); 195 + module_exit(altera_ps2_exit); 196 + 197 + MODULE_DESCRIPTION("Altera University Program PS2 controller driver"); 198 + MODULE_AUTHOR("Thomas Chou <thomas@wytron.com.tw>"); 199 + MODULE_LICENSE("GPL"); 200 + MODULE_ALIAS("platform:" DRV_NAME);
+66 -77
drivers/input/serio/i8042-x86ia64io.h
··· 67 67 68 68 #include <linux/dmi.h> 69 69 70 - static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = { 70 + static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = { 71 71 { 72 - /* AUX LOOP command does not raise AUX IRQ */ 73 - .ident = "Arima-Rioworks HDAMB", 72 + /* 73 + * Arima-Rioworks HDAMB - 74 + * AUX LOOP command does not raise AUX IRQ 75 + */ 74 76 .matches = { 75 77 DMI_MATCH(DMI_BOARD_VENDOR, "RIOWORKS"), 76 78 DMI_MATCH(DMI_BOARD_NAME, "HDAMB"), ··· 80 78 }, 81 79 }, 82 80 { 83 - .ident = "ASUS G1S", 81 + /* ASUS G1S */ 84 82 .matches = { 85 83 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."), 86 84 DMI_MATCH(DMI_BOARD_NAME, "G1S"), ··· 88 86 }, 89 87 }, 90 88 { 91 - /* AUX LOOP command does not raise AUX IRQ */ 92 - .ident = "ASUS P65UP5", 89 + /* ASUS P65UP5 - AUX LOOP command does not raise AUX IRQ */ 93 90 .matches = { 94 91 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), 95 92 DMI_MATCH(DMI_BOARD_NAME, "P/I-P65UP5"), ··· 96 95 }, 97 96 }, 98 97 { 99 - .ident = "Compaq Proliant 8500", 100 98 .matches = { 101 99 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), 102 100 DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"), ··· 103 103 }, 104 104 }, 105 105 { 106 - .ident = "Compaq Proliant DL760", 107 106 .matches = { 108 107 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), 109 108 DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"), ··· 110 111 }, 111 112 }, 112 113 { 113 - .ident = "OQO Model 01", 114 + /* OQO Model 01 */ 114 115 .matches = { 115 116 DMI_MATCH(DMI_SYS_VENDOR, "OQO"), 116 117 DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"), ··· 118 119 }, 119 120 }, 120 121 { 121 - /* AUX LOOP does not work properly */ 122 - .ident = "ULI EV4873", 122 + /* ULI EV4873 - AUX LOOP does not work properly */ 123 123 .matches = { 124 124 DMI_MATCH(DMI_SYS_VENDOR, "ULI"), 125 125 DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"), ··· 126 128 }, 127 129 }, 128 130 { 129 - .ident = "Microsoft Virtual Machine", 131 + /* Microsoft Virtual Machine */ 130 132 .matches = { 131 133 DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), 132 134 DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"), ··· 134 136 }, 135 137 }, 136 138 { 137 - .ident = "Medion MAM 2070", 139 + /* Medion MAM 2070 */ 138 140 .matches = { 139 141 DMI_MATCH(DMI_SYS_VENDOR, "Notebook"), 140 142 DMI_MATCH(DMI_PRODUCT_NAME, "MAM 2070"), ··· 142 144 }, 143 145 }, 144 146 { 145 - .ident = "Blue FB5601", 147 + /* Blue FB5601 */ 146 148 .matches = { 147 149 DMI_MATCH(DMI_SYS_VENDOR, "blue"), 148 150 DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"), ··· 150 152 }, 151 153 }, 152 154 { 153 - .ident = "Gigabyte M912", 155 + /* Gigabyte M912 */ 154 156 .matches = { 155 157 DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"), 156 158 DMI_MATCH(DMI_PRODUCT_NAME, "M912"), ··· 158 160 }, 159 161 }, 160 162 { 161 - .ident = "HP DV9700", 162 163 .matches = { 163 164 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 164 165 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv9700"), ··· 174 177 * ... apparently some Toshibas don't like MUX mode either and 175 178 * die horrible death on reboot. 176 179 */ 177 - static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = { 180 + static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { 178 181 { 179 - .ident = "Fujitsu Lifebook P7010/P7010D", 182 + /* Fujitsu Lifebook P7010/P7010D */ 180 183 .matches = { 181 184 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), 182 185 DMI_MATCH(DMI_PRODUCT_NAME, "P7010"), 183 186 }, 184 187 }, 185 188 { 186 - .ident = "Fujitsu Lifebook P7010", 189 + /* Fujitsu Lifebook P7010 */ 187 190 .matches = { 188 191 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 189 192 DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"), 190 193 }, 191 194 }, 192 195 { 193 - .ident = "Fujitsu Lifebook P5020D", 196 + /* Fujitsu Lifebook P5020D */ 194 197 .matches = { 195 198 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), 196 199 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"), 197 200 }, 198 201 }, 199 202 { 200 - .ident = "Fujitsu Lifebook S2000", 203 + /* Fujitsu Lifebook S2000 */ 201 204 .matches = { 202 205 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), 203 206 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"), 204 207 }, 205 208 }, 206 209 { 207 - .ident = "Fujitsu Lifebook S6230", 210 + /* Fujitsu Lifebook S6230 */ 208 211 .matches = { 209 212 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), 210 213 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"), 211 214 }, 212 215 }, 213 216 { 214 - .ident = "Fujitsu T70H", 217 + /* Fujitsu T70H */ 215 218 .matches = { 216 219 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), 217 220 DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"), 218 221 }, 219 222 }, 220 223 { 221 - .ident = "Fujitsu-Siemens Lifebook T3010", 224 + /* Fujitsu-Siemens Lifebook T3010 */ 222 225 .matches = { 223 226 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 224 227 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"), 225 228 }, 226 229 }, 227 230 { 228 - .ident = "Fujitsu-Siemens Lifebook E4010", 231 + /* Fujitsu-Siemens Lifebook E4010 */ 229 232 .matches = { 230 233 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 231 234 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"), 232 235 }, 233 236 }, 234 237 { 235 - .ident = "Fujitsu-Siemens Amilo Pro 2010", 238 + /* Fujitsu-Siemens Amilo Pro 2010 */ 236 239 .matches = { 237 240 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 238 241 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"), 239 242 }, 240 243 }, 241 244 { 242 - .ident = "Fujitsu-Siemens Amilo Pro 2030", 245 + /* Fujitsu-Siemens Amilo Pro 2030 */ 243 246 .matches = { 244 247 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 245 248 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"), ··· 250 253 * No data is coming from the touchscreen unless KBC 251 254 * is in legacy mode. 252 255 */ 253 - .ident = "Panasonic CF-29", 256 + /* Panasonic CF-29 */ 254 257 .matches = { 255 258 DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"), 256 259 DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"), ··· 258 261 }, 259 262 { 260 263 /* 261 - * Errors on MUX ports are reported without raising AUXDATA 264 + * HP Pavilion DV4017EA - 265 + * errors on MUX ports are reported without raising AUXDATA 262 266 * causing "spurious NAK" messages. 263 267 */ 264 - .ident = "HP Pavilion DV4017EA", 265 268 .matches = { 266 269 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 267 270 DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"), ··· 269 272 }, 270 273 { 271 274 /* 272 - * Like DV4017EA does not raise AUXERR for errors on MUX ports. 275 + * HP Pavilion ZT1000 - 276 + * like DV4017EA does not raise AUXERR for errors on MUX ports. 273 277 */ 274 - .ident = "HP Pavilion ZT1000", 275 278 .matches = { 276 279 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 277 280 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Notebook PC"), ··· 280 283 }, 281 284 { 282 285 /* 283 - * Like DV4017EA does not raise AUXERR for errors on MUX ports. 286 + * HP Pavilion DV4270ca - 287 + * like DV4017EA does not raise AUXERR for errors on MUX ports. 284 288 */ 285 - .ident = "HP Pavilion DV4270ca", 286 289 .matches = { 287 290 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 288 291 DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"), 289 292 }, 290 293 }, 291 294 { 292 - .ident = "Toshiba P10", 293 295 .matches = { 294 296 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 295 297 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"), 296 298 }, 297 299 }, 298 300 { 299 - .ident = "Toshiba Equium A110", 300 301 .matches = { 301 302 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 302 303 DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"), 303 304 }, 304 305 }, 305 306 { 306 - .ident = "Alienware Sentia", 307 307 .matches = { 308 308 DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"), 309 309 DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"), 310 310 }, 311 311 }, 312 312 { 313 - .ident = "Sharp Actius MM20", 313 + /* Sharp Actius MM20 */ 314 314 .matches = { 315 315 DMI_MATCH(DMI_SYS_VENDOR, "SHARP"), 316 316 DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"), 317 317 }, 318 318 }, 319 319 { 320 - .ident = "Sony Vaio FS-115b", 320 + /* Sony Vaio FS-115b */ 321 321 .matches = { 322 322 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), 323 323 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"), ··· 322 328 }, 323 329 { 324 330 /* 325 - * Reset and GET ID commands issued via KBD port are 331 + * Sony Vaio FZ-240E - 332 + * reset and GET ID commands issued via KBD port are 326 333 * sometimes being delivered to AUX3. 327 334 */ 328 - .ident = "Sony Vaio FZ-240E", 329 335 .matches = { 330 336 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), 331 337 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ240E"), 332 338 }, 333 339 }, 334 340 { 335 - .ident = "Amoi M636/A737", 341 + /* Amoi M636/A737 */ 336 342 .matches = { 337 343 DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."), 338 344 DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"), 339 345 }, 340 346 }, 341 347 { 342 - .ident = "Lenovo 3000 n100", 348 + /* Lenovo 3000 n100 */ 343 349 .matches = { 344 350 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 345 351 DMI_MATCH(DMI_PRODUCT_NAME, "076804U"), 346 352 }, 347 353 }, 348 354 { 349 - .ident = "Acer Aspire 1360", 350 355 .matches = { 351 356 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 352 357 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"), 353 358 }, 354 359 }, 355 360 { 356 - .ident = "Gericom Bellagio", 361 + /* Gericom Bellagio */ 357 362 .matches = { 358 363 DMI_MATCH(DMI_SYS_VENDOR, "Gericom"), 359 364 DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"), 360 365 }, 361 366 }, 362 367 { 363 - .ident = "IBM 2656", 368 + /* IBM 2656 */ 364 369 .matches = { 365 370 DMI_MATCH(DMI_SYS_VENDOR, "IBM"), 366 371 DMI_MATCH(DMI_PRODUCT_NAME, "2656"), 367 372 }, 368 373 }, 369 374 { 370 - .ident = "Dell XPS M1530", 375 + /* Dell XPS M1530 */ 371 376 .matches = { 372 377 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 373 378 DMI_MATCH(DMI_PRODUCT_NAME, "XPS M1530"), 374 379 }, 375 380 }, 376 381 { 377 - .ident = "Compal HEL80I", 382 + /* Compal HEL80I */ 378 383 .matches = { 379 384 DMI_MATCH(DMI_SYS_VENDOR, "COMPAL"), 380 385 DMI_MATCH(DMI_PRODUCT_NAME, "HEL80I"), 381 386 }, 382 387 }, 383 388 { 384 - .ident = "Dell Vostro 1510", 389 + /* Dell Vostro 1510 */ 385 390 .matches = { 386 391 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 387 392 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"), 388 393 }, 389 394 }, 390 395 { 391 - .ident = "Acer Aspire 5536", 396 + /* Acer Aspire 5536 */ 392 397 .matches = { 393 398 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 394 399 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5536"), ··· 397 404 { } 398 405 }; 399 406 400 - static struct dmi_system_id __initdata i8042_dmi_reset_table[] = { 407 + static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = { 401 408 { 402 - .ident = "MSI Wind U-100", 409 + /* MSI Wind U-100 */ 403 410 .matches = { 404 411 DMI_MATCH(DMI_BOARD_NAME, "U-100"), 405 412 DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"), 406 413 }, 407 414 }, 408 415 { 409 - .ident = "LG Electronics X110", 416 + /* LG Electronics X110 */ 410 417 .matches = { 411 418 DMI_MATCH(DMI_BOARD_NAME, "X110"), 412 419 DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."), 413 420 }, 414 421 }, 415 422 { 416 - .ident = "Acer Aspire One 150", 423 + /* Acer Aspire One 150 */ 417 424 .matches = { 418 425 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 419 426 DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"), 420 427 }, 421 428 }, 422 429 { 423 - .ident = "Advent 4211", 430 + /* Advent 4211 */ 424 431 .matches = { 425 432 DMI_MATCH(DMI_SYS_VENDOR, "DIXONSXP"), 426 433 DMI_MATCH(DMI_PRODUCT_NAME, "Advent 4211"), 427 434 }, 428 435 }, 429 436 { 430 - .ident = "Medion Akoya Mini E1210", 437 + /* Medion Akoya Mini E1210 */ 431 438 .matches = { 432 439 DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), 433 440 DMI_MATCH(DMI_PRODUCT_NAME, "E1210"), 434 441 }, 435 442 }, 436 443 { 437 - .ident = "Mivvy M310", 444 + /* Mivvy M310 */ 438 445 .matches = { 439 446 DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"), 440 447 DMI_MATCH(DMI_PRODUCT_NAME, "N10"), 441 448 }, 442 449 }, 443 450 { 444 - .ident = "Dell Vostro 1320", 451 + /* Dell Vostro 1320 */ 445 452 .matches = { 446 453 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 447 454 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1320"), 448 455 }, 449 456 }, 450 457 { 451 - .ident = "Dell Vostro 1520", 458 + /* Dell Vostro 1520 */ 452 459 .matches = { 453 460 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 454 461 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1520"), 455 462 }, 456 463 }, 457 464 { 458 - .ident = "Dell Vostro 1720", 465 + /* Dell Vostro 1720 */ 459 466 .matches = { 460 467 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 461 468 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1720"), ··· 465 472 }; 466 473 467 474 #ifdef CONFIG_PNP 468 - static struct dmi_system_id __initdata i8042_dmi_nopnp_table[] = { 475 + static const struct dmi_system_id __initconst i8042_dmi_nopnp_table[] = { 469 476 { 470 - .ident = "Intel MBO Desktop D845PESV", 477 + /* Intel MBO Desktop D845PESV */ 471 478 .matches = { 472 479 DMI_MATCH(DMI_BOARD_NAME, "D845PESV"), 473 480 DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"), 474 481 }, 475 482 }, 476 483 { 477 - .ident = "MSI Wind U-100", 484 + /* MSI Wind U-100 */ 478 485 .matches = { 479 486 DMI_MATCH(DMI_BOARD_NAME, "U-100"), 480 487 DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"), ··· 483 490 { } 484 491 }; 485 492 486 - static struct dmi_system_id __initdata i8042_dmi_laptop_table[] = { 493 + static const struct dmi_system_id __initconst i8042_dmi_laptop_table[] = { 487 494 { 488 - .ident = "Portable", 489 495 .matches = { 490 496 DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */ 491 497 }, 492 498 }, 493 499 { 494 - .ident = "Laptop", 495 500 .matches = { 496 501 DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */ 497 502 }, 498 503 }, 499 504 { 500 - .ident = "Notebook", 501 505 .matches = { 502 506 DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */ 503 507 }, 504 508 }, 505 509 { 506 - .ident = "Sub-Notebook", 507 510 .matches = { 508 511 DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */ 509 512 }, ··· 514 525 * Originally, this was just confined to older laptops, but a few Acer laptops 515 526 * have turned up in 2007 that also need this again. 516 527 */ 517 - static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = { 528 + static const struct dmi_system_id __initconst i8042_dmi_dritek_table[] = { 518 529 { 519 - .ident = "Acer Aspire 5630", 530 + /* Acer Aspire 5630 */ 520 531 .matches = { 521 532 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 522 533 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"), 523 534 }, 524 535 }, 525 536 { 526 - .ident = "Acer Aspire 5650", 537 + /* Acer Aspire 5650 */ 527 538 .matches = { 528 539 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 529 540 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"), 530 541 }, 531 542 }, 532 543 { 533 - .ident = "Acer Aspire 5680", 544 + /* Acer Aspire 5680 */ 534 545 .matches = { 535 546 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 536 547 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"), 537 548 }, 538 549 }, 539 550 { 540 - .ident = "Acer Aspire 5720", 551 + /* Acer Aspire 5720 */ 541 552 .matches = { 542 553 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 543 554 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"), 544 555 }, 545 556 }, 546 557 { 547 - .ident = "Acer Aspire 9110", 558 + /* Acer Aspire 9110 */ 548 559 .matches = { 549 560 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 550 561 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"), 551 562 }, 552 563 }, 553 564 { 554 - .ident = "Acer TravelMate 660", 565 + /* Acer TravelMate 660 */ 555 566 .matches = { 556 567 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 557 568 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"), 558 569 }, 559 570 }, 560 571 { 561 - .ident = "Acer TravelMate 2490", 572 + /* Acer TravelMate 2490 */ 562 573 .matches = { 563 574 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 564 575 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"), 565 576 }, 566 577 }, 567 578 { 568 - .ident = "Acer TravelMate 4280", 579 + /* Acer TravelMate 4280 */ 569 580 .matches = { 570 581 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 571 582 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4280"),
+250
drivers/input/sparse-keymap.c
··· 1 + /* 2 + * Generic support for sparse keymaps 3 + * 4 + * Copyright (c) 2009 Dmitry Torokhov 5 + * 6 + * Derived from wistron button driver: 7 + * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz> 8 + * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org> 9 + * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru> 10 + * 11 + * This program is free software; you can redistribute it and/or modify it 12 + * under the terms of the GNU General Public License version 2 as published by 13 + * the Free Software Foundation. 14 + */ 15 + 16 + #include <linux/input.h> 17 + #include <linux/input/sparse-keymap.h> 18 + 19 + MODULE_AUTHOR("Dmitry Torokhov <dtor@mail.ru>"); 20 + MODULE_DESCRIPTION("Generic support for sparse keymaps"); 21 + MODULE_LICENSE("GPL v2"); 22 + MODULE_VERSION("0.1"); 23 + 24 + /** 25 + * sparse_keymap_entry_from_scancode - perform sparse keymap lookup 26 + * @dev: Input device using sparse keymap 27 + * @code: Scan code 28 + * 29 + * This function is used to perform &struct key_entry lookup in an 30 + * input device using sparse keymap. 31 + */ 32 + struct key_entry *sparse_keymap_entry_from_scancode(struct input_dev *dev, 33 + unsigned int code) 34 + { 35 + struct key_entry *key; 36 + 37 + for (key = dev->keycode; key->type != KE_END; key++) 38 + if (code == key->code) 39 + return key; 40 + 41 + return NULL; 42 + } 43 + EXPORT_SYMBOL(sparse_keymap_entry_from_scancode); 44 + 45 + /** 46 + * sparse_keymap_entry_from_keycode - perform sparse keymap lookup 47 + * @dev: Input device using sparse keymap 48 + * @keycode: Key code 49 + * 50 + * This function is used to perform &struct key_entry lookup in an 51 + * input device using sparse keymap. 52 + */ 53 + struct key_entry *sparse_keymap_entry_from_keycode(struct input_dev *dev, 54 + unsigned int keycode) 55 + { 56 + struct key_entry *key; 57 + 58 + for (key = dev->keycode; key->type != KE_END; key++) 59 + if (key->type == KE_KEY && keycode == key->keycode) 60 + return key; 61 + 62 + return NULL; 63 + } 64 + EXPORT_SYMBOL(sparse_keymap_entry_from_keycode); 65 + 66 + static int sparse_keymap_getkeycode(struct input_dev *dev, 67 + int scancode, int *keycode) 68 + { 69 + const struct key_entry *key = 70 + sparse_keymap_entry_from_scancode(dev, scancode); 71 + 72 + if (key && key->type == KE_KEY) { 73 + *keycode = key->keycode; 74 + return 0; 75 + } 76 + 77 + return -EINVAL; 78 + } 79 + 80 + static int sparse_keymap_setkeycode(struct input_dev *dev, 81 + int scancode, int keycode) 82 + { 83 + struct key_entry *key; 84 + int old_keycode; 85 + 86 + if (keycode < 0 || keycode > KEY_MAX) 87 + return -EINVAL; 88 + 89 + key = sparse_keymap_entry_from_scancode(dev, scancode); 90 + if (key && key->type == KE_KEY) { 91 + old_keycode = key->keycode; 92 + key->keycode = keycode; 93 + set_bit(keycode, dev->keybit); 94 + if (!sparse_keymap_entry_from_keycode(dev, old_keycode)) 95 + clear_bit(old_keycode, dev->keybit); 96 + return 0; 97 + } 98 + 99 + return -EINVAL; 100 + } 101 + 102 + /** 103 + * sparse_keymap_setup - set up sparse keymap for an input device 104 + * @dev: Input device 105 + * @keymap: Keymap in form of array of &key_entry structures ending 106 + * with %KE_END type entry 107 + * @setup: Function that can be used to adjust keymap entries 108 + * depending on device's deeds, may be %NULL 109 + * 110 + * The function calculates size and allocates copy of the original 111 + * keymap after which sets up input device event bits appropriately. 112 + * Before destroying input device allocated keymap should be freed 113 + * with a call to sparse_keymap_free(). 114 + */ 115 + int sparse_keymap_setup(struct input_dev *dev, 116 + const struct key_entry *keymap, 117 + int (*setup)(struct input_dev *, struct key_entry *)) 118 + { 119 + size_t map_size = 1; /* to account for the last KE_END entry */ 120 + const struct key_entry *e; 121 + struct key_entry *map, *entry; 122 + int i; 123 + int error; 124 + 125 + for (e = keymap; e->type != KE_END; e++) 126 + map_size++; 127 + 128 + map = kcalloc(map_size, sizeof (struct key_entry), GFP_KERNEL); 129 + if (!map) 130 + return -ENOMEM; 131 + 132 + memcpy(map, keymap, map_size * sizeof (struct key_entry)); 133 + 134 + for (i = 0; i < map_size; i++) { 135 + entry = &map[i]; 136 + 137 + if (setup) { 138 + error = setup(dev, entry); 139 + if (error) 140 + goto err_out; 141 + } 142 + 143 + switch (entry->type) { 144 + case KE_KEY: 145 + __set_bit(EV_KEY, dev->evbit); 146 + __set_bit(entry->keycode, dev->keybit); 147 + break; 148 + 149 + case KE_SW: 150 + __set_bit(EV_SW, dev->evbit); 151 + __set_bit(entry->sw.code, dev->swbit); 152 + break; 153 + } 154 + } 155 + 156 + dev->keycode = map; 157 + dev->keycodemax = map_size; 158 + dev->getkeycode = sparse_keymap_getkeycode; 159 + dev->setkeycode = sparse_keymap_setkeycode; 160 + 161 + return 0; 162 + 163 + err_out: 164 + kfree(keymap); 165 + return error; 166 + 167 + } 168 + EXPORT_SYMBOL(sparse_keymap_setup); 169 + 170 + /** 171 + * sparse_keymap_free - free memory allocated for sparse keymap 172 + * @dev: Input device using sparse keymap 173 + * 174 + * This function is used to free memory allocated by sparse keymap 175 + * in an input device that was set up by sparse_keymap_setup(). 176 + */ 177 + void sparse_keymap_free(struct input_dev *dev) 178 + { 179 + kfree(dev->keycode); 180 + dev->keycode = NULL; 181 + dev->keycodemax = 0; 182 + dev->getkeycode = NULL; 183 + dev->setkeycode = NULL; 184 + } 185 + EXPORT_SYMBOL(sparse_keymap_free); 186 + 187 + /** 188 + * sparse_keymap_report_entry - report event corresponding to given key entry 189 + * @dev: Input device for which event should be reported 190 + * @ke: key entry describing event 191 + * @value: Value that should be reported (ignored by %KE_SW entries) 192 + * @autorelease: Signals whether release event should be emitted for %KE_KEY 193 + * entries right after reporting press event, ignored by all other 194 + * entries 195 + * 196 + * This function is used to report input event described by given 197 + * &struct key_entry. 198 + */ 199 + void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *ke, 200 + unsigned int value, bool autorelease) 201 + { 202 + switch (ke->type) { 203 + case KE_KEY: 204 + input_report_key(dev, ke->keycode, value); 205 + input_sync(dev); 206 + if (value && autorelease) { 207 + input_report_key(dev, ke->keycode, 0); 208 + input_sync(dev); 209 + } 210 + break; 211 + 212 + case KE_SW: 213 + value = ke->sw.value; 214 + /* fall through */ 215 + 216 + case KE_VSW: 217 + input_report_switch(dev, ke->sw.code, value); 218 + break; 219 + } 220 + } 221 + EXPORT_SYMBOL(sparse_keymap_report_entry); 222 + 223 + /** 224 + * sparse_keymap_report_event - report event corresponding to given scancode 225 + * @dev: Input device using sparse keymap 226 + * @code: Scan code 227 + * @value: Value that should be reported (ignored by %KE_SW entries) 228 + * @autorelease: Signals whether release event should be emitted for %KE_KEY 229 + * entries right after reporting press event, ignored by all other 230 + * entries 231 + * 232 + * This function is used to perform lookup in an input device using sparse 233 + * keymap and report corresponding event. Returns %true if lookup was 234 + * successful and %false otherwise. 235 + */ 236 + bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code, 237 + unsigned int value, bool autorelease) 238 + { 239 + const struct key_entry *ke = 240 + sparse_keymap_entry_from_scancode(dev, code); 241 + 242 + if (ke) { 243 + sparse_keymap_report_entry(dev, ke, value, autorelease); 244 + return true; 245 + } 246 + 247 + return false; 248 + } 249 + EXPORT_SYMBOL(sparse_keymap_report_event); 250 +
+36 -1
drivers/input/touchscreen/Kconfig
··· 111 111 Say Y here to enable the support for the touchscreen found 112 112 on Dialog Semiconductor DA9034 PMIC. 113 113 114 + config TOUCHSCREEN_DYNAPRO 115 + tristate "Dynapro serial touchscreen" 116 + select SERIO 117 + help 118 + Say Y here if you have a Dynapro serial touchscreen connected to 119 + your system. 120 + 121 + If unsure, say N. 122 + 123 + To compile this driver as a module, choose M here: the 124 + module will be called dynapro. 125 + 114 126 config TOUCHSCREEN_EETI 115 127 tristate "EETI touchscreen panel support" 116 128 depends on I2C ··· 144 132 145 133 To compile this driver as a module, choose M here: the 146 134 module will be called fujitsu-ts. 135 + 136 + config TOUCHSCREEN_S3C2410 137 + tristate "Samsung S3C2410 touchscreen input driver" 138 + depends on ARCH_S3C2410 139 + select S3C24XX_ADC 140 + help 141 + Say Y here if you have the s3c2410 touchscreen. 142 + 143 + If unsure, say N. 144 + 145 + To compile this driver as a module, choose M here: the 146 + module will be called s3c2410_ts. 147 147 148 148 config TOUCHSCREEN_GUNZE 149 149 tristate "Gunze AHL-51S touchscreen" ··· 321 297 322 298 config TOUCHSCREEN_ATMEL_TSADCC 323 299 tristate "Atmel Touchscreen Interface" 324 - depends on ARCH_AT91SAM9RL 300 + depends on ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 325 301 help 326 302 Say Y here if you have a 4-wire touchscreen connected to the 327 303 ADC Controller on your Atmel SoC (such as the AT91SAM9RL). ··· 442 418 - IdealTEK URTC1000 443 419 - GoTop Super_Q2/GogoPen/PenPower tablets 444 420 - JASTEC USB Touch Controller/DigiTech DTR-02U 421 + - Zytronic controllers 445 422 446 423 Have a look at <http://linux.chapter7.ch/touchkit/> for 447 424 a usage description and the required user-space stuff. ··· 513 488 config TOUCHSCREEN_USB_E2I 514 489 default y 515 490 bool "e2i Touchscreen controller (e.g. from Mimo 740)" 491 + depends on TOUCHSCREEN_USB_COMPOSITE 492 + 493 + config TOUCHSCREEN_USB_ZYTRONIC 494 + default y 495 + bool "Zytronic controller" if EMBEDDED 496 + depends on TOUCHSCREEN_USB_COMPOSITE 497 + 498 + config TOUCHSCREEN_USB_ETT_TC5UH 499 + default y 500 + bool "ET&T TC5UH touchscreen controler support" if EMBEDDED 516 501 depends on TOUCHSCREEN_USB_COMPOSITE 517 502 518 503 config TOUCHSCREEN_TOUCHIT213
+3 -1
drivers/input/touchscreen/Makefile
··· 12 12 obj-$(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) += atmel_tsadcc.o 13 13 obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o 14 14 obj-$(CONFIG_TOUCHSCREEN_CORGI) += corgi_ts.o 15 + obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o 15 16 obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o 16 17 obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o 17 18 obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o ··· 26 25 obj-$(CONFIG_TOUCHSCREEN_HP7XX) += jornada720_ts.o 27 26 obj-$(CONFIG_TOUCHSCREEN_HTCPEN) += htcpen.o 28 27 obj-$(CONFIG_TOUCHSCREEN_USB_COMPOSITE) += usbtouchscreen.o 28 + obj-$(CONFIG_TOUCHSCREEN_PCAP) += pcap_ts.o 29 29 obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o 30 + obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o 30 31 obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213) += touchit213.o 31 32 obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o 32 33 obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o ··· 44 41 obj-$(CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE) += mainstone-wm97xx.o 45 42 obj-$(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE) += zylonite-wm97xx.o 46 43 obj-$(CONFIG_TOUCHSCREEN_W90X900) += w90p910_ts.o 47 - obj-$(CONFIG_TOUCHSCREEN_PCAP) += pcap_ts.o
+8 -17
drivers/input/touchscreen/ads7846.c
··· 29 29 #include <linux/spi/ads7846.h> 30 30 #include <asm/irq.h> 31 31 32 - 33 32 /* 34 33 * This code has been heavily tested on a Nokia 770, and lightly 35 - * tested on other ads7846 devices (OSK/Mistral, Lubbock). 34 + * tested on other ads7846 devices (OSK/Mistral, Lubbock, Spitz). 36 35 * TSC2046 is just newer ads7846 silicon. 37 36 * Support for ads7843 tested on Atmel at91sam926x-EK. 38 37 * Support for ads7845 has only been stubbed in. ··· 42 43 * have to maintain our own SW IRQ disabled status. This should be 43 44 * removed as soon as the affected platform's IRQ handling is fixed. 44 45 * 45 - * app note sbaa036 talks in more detail about accurate sampling... 46 + * App note sbaa036 talks in more detail about accurate sampling... 46 47 * that ought to help in situations like LCDs inducing noise (which 47 48 * can also be helped by using synch signals) and more generally. 48 49 * This driver tries to utilize the measures described in the app ··· 565 566 * once more the measurement 566 567 */ 567 568 if (packet->tc.ignore || Rt > ts->pressure_max) { 568 - #ifdef VERBOSE 569 - pr_debug("%s: ignored %d pressure %d\n", 570 - dev_name(&ts->spi->dev), packet->tc.ignore, Rt); 571 - #endif 569 + dev_vdbg(&ts->spi->dev, "ignored %d pressure %d\n", 570 + packet->tc.ignore, Rt); 572 571 hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD), 573 572 HRTIMER_MODE_REL); 574 573 return; ··· 595 598 if (!ts->pendown) { 596 599 input_report_key(input, BTN_TOUCH, 1); 597 600 ts->pendown = 1; 598 - #ifdef VERBOSE 599 - dev_dbg(&ts->spi->dev, "DOWN\n"); 600 - #endif 601 + dev_vdbg(&ts->spi->dev, "DOWN\n"); 601 602 } 602 603 603 604 if (ts->swap_xy) ··· 603 608 604 609 input_report_abs(input, ABS_X, x); 605 610 input_report_abs(input, ABS_Y, y); 606 - input_report_abs(input, ABS_PRESSURE, Rt); 611 + input_report_abs(input, ABS_PRESSURE, ts->pressure_max - Rt); 607 612 608 613 input_sync(input); 609 - #ifdef VERBOSE 610 - dev_dbg(&ts->spi->dev, "%4d/%4d/%4d\n", x, y, Rt); 611 - #endif 614 + dev_vdbg(&ts->spi->dev, "%4d/%4d/%4d\n", x, y, Rt); 612 615 } 613 616 614 617 hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD), ··· 716 723 input_sync(input); 717 724 718 725 ts->pendown = 0; 719 - #ifdef VERBOSE 720 - dev_dbg(&ts->spi->dev, "UP\n"); 721 - #endif 726 + dev_vdbg(&ts->spi->dev, "UP\n"); 722 727 } 723 728 724 729 /* measurement cycle ended */
+38 -9
drivers/input/touchscreen/atmel_tsadcc.c
··· 22 22 #include <linux/clk.h> 23 23 #include <linux/platform_device.h> 24 24 #include <linux/io.h> 25 + #include <mach/board.h> 26 + #include <mach/cpu.h> 25 27 26 28 /* Register definitions based on AT91SAM9RL64 preliminary draft datasheet */ 27 29 ··· 38 36 #define ATMEL_TSADCC_LOWRES (1 << 4) /* Resolution selection */ 39 37 #define ATMEL_TSADCC_SLEEP (1 << 5) /* Sleep mode */ 40 38 #define ATMEL_TSADCC_PENDET (1 << 6) /* Pen Detect selection */ 39 + #define ATMEL_TSADCC_PRES (1 << 7) /* Pressure Measurement Selection */ 41 40 #define ATMEL_TSADCC_PRESCAL (0x3f << 8) /* Prescalar Rate Selection */ 41 + #define ATMEL_TSADCC_EPRESCAL (0xff << 8) /* Prescalar Rate Selection (Extended) */ 42 42 #define ATMEL_TSADCC_STARTUP (0x7f << 16) /* Start Up time */ 43 43 #define ATMEL_TSADCC_SHTIM (0xf << 24) /* Sample & Hold time */ 44 44 #define ATMEL_TSADCC_PENDBC (0xf << 28) /* Pen Detect debouncing time */ ··· 88 84 #define ATMEL_TSADCC_CDR4 0x40 /* Channel Data 4 */ 89 85 #define ATMEL_TSADCC_CDR5 0x44 /* Channel Data 5 */ 90 86 91 - #define ADC_CLOCK 1000000 87 + #define ATMEL_TSADCC_XPOS 0x50 88 + #define ATMEL_TSADCC_Z1DAT 0x54 89 + #define ATMEL_TSADCC_Z2DAT 0x58 90 + 91 + #define PRESCALER_VAL(x) ((x) >> 8) 92 + 93 + #define ADC_DEFAULT_CLOCK 100000 92 94 93 95 struct atmel_tsadcc { 94 96 struct input_dev *input; ··· 182 172 struct atmel_tsadcc *ts_dev; 183 173 struct input_dev *input_dev; 184 174 struct resource *res; 175 + struct at91_tsadcc_data *pdata = pdev->dev.platform_data; 185 176 int err = 0; 186 177 unsigned int prsc; 187 178 unsigned int reg; ··· 253 242 input_dev->phys = ts_dev->phys; 254 243 input_dev->dev.parent = &pdev->dev; 255 244 256 - input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); 257 - input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); 258 - 245 + __set_bit(EV_ABS, input_dev->evbit); 259 246 input_set_abs_params(input_dev, ABS_X, 0, 0x3FF, 0, 0); 260 247 input_set_abs_params(input_dev, ABS_Y, 0, 0x3FF, 0, 0); 248 + 249 + input_set_capability(input_dev, EV_KEY, BTN_TOUCH); 261 250 262 251 /* clk_enable() always returns 0, no need to check it */ 263 252 clk_enable(ts_dev->clk); ··· 265 254 prsc = clk_get_rate(ts_dev->clk); 266 255 dev_info(&pdev->dev, "Master clock is set at: %d Hz\n", prsc); 267 256 268 - prsc = prsc / ADC_CLOCK / 2 - 1; 257 + if (!pdata) 258 + goto err_fail; 259 + 260 + if (!pdata->adc_clock) 261 + pdata->adc_clock = ADC_DEFAULT_CLOCK; 262 + 263 + prsc = (prsc / (2 * pdata->adc_clock)) - 1; 264 + 265 + /* saturate if this value is too high */ 266 + if (cpu_is_at91sam9rl()) { 267 + if (prsc > PRESCALER_VAL(ATMEL_TSADCC_PRESCAL)) 268 + prsc = PRESCALER_VAL(ATMEL_TSADCC_PRESCAL); 269 + } else { 270 + if (prsc > PRESCALER_VAL(ATMEL_TSADCC_EPRESCAL)) 271 + prsc = PRESCALER_VAL(ATMEL_TSADCC_EPRESCAL); 272 + } 273 + 274 + dev_info(&pdev->dev, "Prescaler is set at: %d\n", prsc); 269 275 270 276 reg = ATMEL_TSADCC_TSAMOD_TS_ONLY_MODE | 271 277 ((0x00 << 5) & ATMEL_TSADCC_SLEEP) | /* Normal Mode */ 272 278 ((0x01 << 6) & ATMEL_TSADCC_PENDET) | /* Enable Pen Detect */ 273 - ((prsc << 8) & ATMEL_TSADCC_PRESCAL) | /* PRESCAL */ 274 - ((0x13 << 16) & ATMEL_TSADCC_STARTUP) | /* STARTUP */ 275 - ((0x0F << 28) & ATMEL_TSADCC_PENDBC); /* PENDBC */ 279 + (prsc << 8) | 280 + ((0x26 << 16) & ATMEL_TSADCC_STARTUP) | 281 + ((pdata->pendet_debounce << 28) & ATMEL_TSADCC_PENDBC); 276 282 277 283 atmel_tsadcc_write(ATMEL_TSADCC_CR, ATMEL_TSADCC_SWRST); 278 284 atmel_tsadcc_write(ATMEL_TSADCC_MR, reg); 279 285 atmel_tsadcc_write(ATMEL_TSADCC_TRGR, ATMEL_TSADCC_TRGMOD_NONE); 280 - atmel_tsadcc_write(ATMEL_TSADCC_TSR, (0x3 << 24) & ATMEL_TSADCC_TSSHTIM); 286 + atmel_tsadcc_write(ATMEL_TSADCC_TSR, 287 + (pdata->ts_sample_hold_time << 24) & ATMEL_TSADCC_TSSHTIM); 281 288 282 289 atmel_tsadcc_read(ATMEL_TSADCC_SR); 283 290 atmel_tsadcc_write(ATMEL_TSADCC_IER, ATMEL_TSADCC_PENCNT);
+206
drivers/input/touchscreen/dynapro.c
··· 1 + /* 2 + * Dynapro serial touchscreen driver 3 + * 4 + * Copyright (c) 2009 Tias Guns 5 + * Based on the inexio driver (c) Vojtech Pavlik and Dan Streetman and 6 + * Richard Lemon 7 + * 8 + */ 9 + 10 + /* 11 + * This program is free software; you can redistribute it and/or modify it 12 + * under the terms of the GNU General Public License version 2 as published by 13 + * the Free Software Foundation. 14 + */ 15 + 16 + /* 17 + * 2009/09/19 Tias Guns <tias@ulyssis.org> 18 + * Copied inexio.c and edited for Dynapro protocol (from retired Xorg module) 19 + */ 20 + 21 + #include <linux/errno.h> 22 + #include <linux/kernel.h> 23 + #include <linux/module.h> 24 + #include <linux/slab.h> 25 + #include <linux/input.h> 26 + #include <linux/serio.h> 27 + #include <linux/init.h> 28 + 29 + #define DRIVER_DESC "Dynapro serial touchscreen driver" 30 + 31 + MODULE_AUTHOR("Tias Guns <tias@ulyssis.org>"); 32 + MODULE_DESCRIPTION(DRIVER_DESC); 33 + MODULE_LICENSE("GPL"); 34 + 35 + /* 36 + * Definitions & global arrays. 37 + */ 38 + 39 + #define DYNAPRO_FORMAT_TOUCH_BIT 0x40 40 + #define DYNAPRO_FORMAT_LENGTH 3 41 + #define DYNAPRO_RESPONSE_BEGIN_BYTE 0x80 42 + 43 + #define DYNAPRO_MIN_XC 0 44 + #define DYNAPRO_MAX_XC 0x3ff 45 + #define DYNAPRO_MIN_YC 0 46 + #define DYNAPRO_MAX_YC 0x3ff 47 + 48 + #define DYNAPRO_GET_XC(data) (data[1] | ((data[0] & 0x38) << 4)) 49 + #define DYNAPRO_GET_YC(data) (data[2] | ((data[0] & 0x07) << 7)) 50 + #define DYNAPRO_GET_TOUCHED(data) (DYNAPRO_FORMAT_TOUCH_BIT & data[0]) 51 + 52 + /* 53 + * Per-touchscreen data. 54 + */ 55 + 56 + struct dynapro { 57 + struct input_dev *dev; 58 + struct serio *serio; 59 + int idx; 60 + unsigned char data[DYNAPRO_FORMAT_LENGTH]; 61 + char phys[32]; 62 + }; 63 + 64 + static void dynapro_process_data(struct dynapro *pdynapro) 65 + { 66 + struct input_dev *dev = pdynapro->dev; 67 + 68 + if (DYNAPRO_FORMAT_LENGTH == ++pdynapro->idx) { 69 + input_report_abs(dev, ABS_X, DYNAPRO_GET_XC(pdynapro->data)); 70 + input_report_abs(dev, ABS_Y, DYNAPRO_GET_YC(pdynapro->data)); 71 + input_report_key(dev, BTN_TOUCH, 72 + DYNAPRO_GET_TOUCHED(pdynapro->data)); 73 + input_sync(dev); 74 + 75 + pdynapro->idx = 0; 76 + } 77 + } 78 + 79 + static irqreturn_t dynapro_interrupt(struct serio *serio, 80 + unsigned char data, unsigned int flags) 81 + { 82 + struct dynapro *pdynapro = serio_get_drvdata(serio); 83 + 84 + pdynapro->data[pdynapro->idx] = data; 85 + 86 + if (DYNAPRO_RESPONSE_BEGIN_BYTE & pdynapro->data[0]) 87 + dynapro_process_data(pdynapro); 88 + else 89 + dev_dbg(&serio->dev, "unknown/unsynchronized data: %x\n", 90 + pdynapro->data[0]); 91 + 92 + return IRQ_HANDLED; 93 + } 94 + 95 + static void dynapro_disconnect(struct serio *serio) 96 + { 97 + struct dynapro *pdynapro = serio_get_drvdata(serio); 98 + 99 + input_get_device(pdynapro->dev); 100 + input_unregister_device(pdynapro->dev); 101 + serio_close(serio); 102 + serio_set_drvdata(serio, NULL); 103 + input_put_device(pdynapro->dev); 104 + kfree(pdynapro); 105 + } 106 + 107 + /* 108 + * dynapro_connect() is the routine that is called when someone adds a 109 + * new serio device that supports dynapro protocol and registers it as 110 + * an input device. This is usually accomplished using inputattach. 111 + */ 112 + 113 + static int dynapro_connect(struct serio *serio, struct serio_driver *drv) 114 + { 115 + struct dynapro *pdynapro; 116 + struct input_dev *input_dev; 117 + int err; 118 + 119 + pdynapro = kzalloc(sizeof(struct dynapro), GFP_KERNEL); 120 + input_dev = input_allocate_device(); 121 + if (!pdynapro || !input_dev) { 122 + err = -ENOMEM; 123 + goto fail1; 124 + } 125 + 126 + pdynapro->serio = serio; 127 + pdynapro->dev = input_dev; 128 + snprintf(pdynapro->phys, sizeof(pdynapro->phys), 129 + "%s/input0", serio->phys); 130 + 131 + input_dev->name = "Dynapro Serial TouchScreen"; 132 + input_dev->phys = pdynapro->phys; 133 + input_dev->id.bustype = BUS_RS232; 134 + input_dev->id.vendor = SERIO_DYNAPRO; 135 + input_dev->id.product = 0; 136 + input_dev->id.version = 0x0001; 137 + input_dev->dev.parent = &serio->dev; 138 + input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); 139 + input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); 140 + input_set_abs_params(pdynapro->dev, ABS_X, 141 + DYNAPRO_MIN_XC, DYNAPRO_MAX_XC, 0, 0); 142 + input_set_abs_params(pdynapro->dev, ABS_Y, 143 + DYNAPRO_MIN_YC, DYNAPRO_MAX_YC, 0, 0); 144 + 145 + serio_set_drvdata(serio, pdynapro); 146 + 147 + err = serio_open(serio, drv); 148 + if (err) 149 + goto fail2; 150 + 151 + err = input_register_device(pdynapro->dev); 152 + if (err) 153 + goto fail3; 154 + 155 + return 0; 156 + 157 + fail3: serio_close(serio); 158 + fail2: serio_set_drvdata(serio, NULL); 159 + fail1: input_free_device(input_dev); 160 + kfree(pdynapro); 161 + return err; 162 + } 163 + 164 + /* 165 + * The serio driver structure. 166 + */ 167 + 168 + static struct serio_device_id dynapro_serio_ids[] = { 169 + { 170 + .type = SERIO_RS232, 171 + .proto = SERIO_DYNAPRO, 172 + .id = SERIO_ANY, 173 + .extra = SERIO_ANY, 174 + }, 175 + { 0 } 176 + }; 177 + 178 + MODULE_DEVICE_TABLE(serio, dynapro_serio_ids); 179 + 180 + static struct serio_driver dynapro_drv = { 181 + .driver = { 182 + .name = "dynapro", 183 + }, 184 + .description = DRIVER_DESC, 185 + .id_table = dynapro_serio_ids, 186 + .interrupt = dynapro_interrupt, 187 + .connect = dynapro_connect, 188 + .disconnect = dynapro_disconnect, 189 + }; 190 + 191 + /* 192 + * The functions for inserting/removing us as a module. 193 + */ 194 + 195 + static int __init dynapro_init(void) 196 + { 197 + return serio_register_driver(&dynapro_drv); 198 + } 199 + 200 + static void __exit dynapro_exit(void) 201 + { 202 + serio_unregister_driver(&dynapro_drv); 203 + } 204 + 205 + module_init(dynapro_init); 206 + module_exit(dynapro_exit);
+457
drivers/input/touchscreen/s3c2410_ts.c
··· 1 + /* 2 + * Samsung S3C24XX touchscreen driver 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the term of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + * This program is distributed in the hope that it will be useful, 10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 + * GNU General Public License for more details. 13 + * 14 + * You should have received a copy of the GNU General Public License 15 + * along with this program; if not, write to the Free Software 16 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 + * 18 + * Copyright 2004 Arnaud Patard <arnaud.patard@rtp-net.org> 19 + * Copyright 2008 Ben Dooks <ben-linux@fluff.org> 20 + * Copyright 2009 Simtec Electronics <linux@simtec.co.uk> 21 + * 22 + * Additional work by Herbert Pötzl <herbert@13thfloor.at> and 23 + * Harald Welte <laforge@openmoko.org> 24 + */ 25 + 26 + #include <linux/errno.h> 27 + #include <linux/kernel.h> 28 + #include <linux/module.h> 29 + #include <linux/slab.h> 30 + #include <linux/gpio.h> 31 + #include <linux/input.h> 32 + #include <linux/init.h> 33 + #include <linux/delay.h> 34 + #include <linux/interrupt.h> 35 + #include <linux/platform_device.h> 36 + #include <linux/clk.h> 37 + #include <linux/io.h> 38 + 39 + #include <plat/adc.h> 40 + #include <plat/regs-adc.h> 41 + 42 + #include <mach/regs-gpio.h> 43 + #include <mach/ts.h> 44 + 45 + #define TSC_SLEEP (S3C2410_ADCTSC_PULL_UP_DISABLE | S3C2410_ADCTSC_XY_PST(0)) 46 + 47 + #define INT_DOWN (0) 48 + #define INT_UP (1 << 8) 49 + 50 + #define WAIT4INT (S3C2410_ADCTSC_YM_SEN | \ 51 + S3C2410_ADCTSC_YP_SEN | \ 52 + S3C2410_ADCTSC_XP_SEN | \ 53 + S3C2410_ADCTSC_XY_PST(3)) 54 + 55 + #define AUTOPST (S3C2410_ADCTSC_YM_SEN | \ 56 + S3C2410_ADCTSC_YP_SEN | \ 57 + S3C2410_ADCTSC_XP_SEN | \ 58 + S3C2410_ADCTSC_AUTO_PST | \ 59 + S3C2410_ADCTSC_XY_PST(0)) 60 + 61 + /* Per-touchscreen data. */ 62 + 63 + /** 64 + * struct s3c2410ts - driver touchscreen state. 65 + * @client: The ADC client we registered with the core driver. 66 + * @dev: The device we are bound to. 67 + * @input: The input device we registered with the input subsystem. 68 + * @clock: The clock for the adc. 69 + * @io: Pointer to the IO base. 70 + * @xp: The accumulated X position data. 71 + * @yp: The accumulated Y position data. 72 + * @irq_tc: The interrupt number for pen up/down interrupt 73 + * @count: The number of samples collected. 74 + * @shift: The log2 of the maximum count to read in one go. 75 + */ 76 + struct s3c2410ts { 77 + struct s3c_adc_client *client; 78 + struct device *dev; 79 + struct input_dev *input; 80 + struct clk *clock; 81 + void __iomem *io; 82 + unsigned long xp; 83 + unsigned long yp; 84 + int irq_tc; 85 + int count; 86 + int shift; 87 + }; 88 + 89 + static struct s3c2410ts ts; 90 + 91 + /** 92 + * s3c2410_ts_connect - configure gpio for s3c2410 systems 93 + * 94 + * Configure the GPIO for the S3C2410 system, where we have external FETs 95 + * connected to the device (later systems such as the S3C2440 integrate 96 + * these into the device). 97 + */ 98 + static inline void s3c2410_ts_connect(void) 99 + { 100 + s3c2410_gpio_cfgpin(S3C2410_GPG(12), S3C2410_GPG12_XMON); 101 + s3c2410_gpio_cfgpin(S3C2410_GPG(13), S3C2410_GPG13_nXPON); 102 + s3c2410_gpio_cfgpin(S3C2410_GPG(14), S3C2410_GPG14_YMON); 103 + s3c2410_gpio_cfgpin(S3C2410_GPG(15), S3C2410_GPG15_nYPON); 104 + } 105 + 106 + /** 107 + * get_down - return the down state of the pen 108 + * @data0: The data read from ADCDAT0 register. 109 + * @data1: The data read from ADCDAT1 register. 110 + * 111 + * Return non-zero if both readings show that the pen is down. 112 + */ 113 + static inline bool get_down(unsigned long data0, unsigned long data1) 114 + { 115 + /* returns true if both data values show stylus down */ 116 + return (!(data0 & S3C2410_ADCDAT0_UPDOWN) && 117 + !(data1 & S3C2410_ADCDAT0_UPDOWN)); 118 + } 119 + 120 + static void touch_timer_fire(unsigned long data) 121 + { 122 + unsigned long data0; 123 + unsigned long data1; 124 + bool down; 125 + 126 + data0 = readl(ts.io + S3C2410_ADCDAT0); 127 + data1 = readl(ts.io + S3C2410_ADCDAT1); 128 + 129 + down = get_down(data0, data1); 130 + 131 + if (ts.count == (1 << ts.shift)) { 132 + ts.xp >>= ts.shift; 133 + ts.yp >>= ts.shift; 134 + 135 + dev_dbg(ts.dev, "%s: X=%lu, Y=%lu, count=%d\n", 136 + __func__, ts.xp, ts.yp, ts.count); 137 + 138 + input_report_abs(ts.input, ABS_X, ts.xp); 139 + input_report_abs(ts.input, ABS_Y, ts.yp); 140 + 141 + input_report_key(ts.input, BTN_TOUCH, 1); 142 + input_sync(ts.input); 143 + 144 + ts.xp = 0; 145 + ts.yp = 0; 146 + ts.count = 0; 147 + } 148 + 149 + if (down) { 150 + s3c_adc_start(ts.client, 0, 1 << ts.shift); 151 + } else { 152 + ts.count = 0; 153 + 154 + input_report_key(ts.input, BTN_TOUCH, 0); 155 + input_sync(ts.input); 156 + 157 + writel(WAIT4INT | INT_DOWN, ts.io + S3C2410_ADCTSC); 158 + } 159 + } 160 + 161 + static DEFINE_TIMER(touch_timer, touch_timer_fire, 0, 0); 162 + 163 + /** 164 + * stylus_irq - touchscreen stylus event interrupt 165 + * @irq: The interrupt number 166 + * @dev_id: The device ID. 167 + * 168 + * Called when the IRQ_TC is fired for a pen up or down event. 169 + */ 170 + static irqreturn_t stylus_irq(int irq, void *dev_id) 171 + { 172 + unsigned long data0; 173 + unsigned long data1; 174 + bool down; 175 + 176 + data0 = readl(ts.io + S3C2410_ADCDAT0); 177 + data1 = readl(ts.io + S3C2410_ADCDAT1); 178 + 179 + down = get_down(data0, data1); 180 + 181 + /* TODO we should never get an interrupt with down set while 182 + * the timer is running, but maybe we ought to verify that the 183 + * timer isn't running anyways. */ 184 + 185 + if (down) 186 + s3c_adc_start(ts.client, 0, 1 << ts.shift); 187 + else 188 + dev_info(ts.dev, "%s: count=%d\n", __func__, ts.count); 189 + 190 + return IRQ_HANDLED; 191 + } 192 + 193 + /** 194 + * s3c24xx_ts_conversion - ADC conversion callback 195 + * @client: The client that was registered with the ADC core. 196 + * @data0: The reading from ADCDAT0. 197 + * @data1: The reading from ADCDAT1. 198 + * @left: The number of samples left. 199 + * 200 + * Called when a conversion has finished. 201 + */ 202 + static void s3c24xx_ts_conversion(struct s3c_adc_client *client, 203 + unsigned data0, unsigned data1, 204 + unsigned *left) 205 + { 206 + dev_dbg(ts.dev, "%s: %d,%d\n", __func__, data0, data1); 207 + 208 + ts.xp += data0; 209 + ts.yp += data1; 210 + 211 + ts.count++; 212 + 213 + /* From tests, it seems that it is unlikely to get a pen-up 214 + * event during the conversion process which means we can 215 + * ignore any pen-up events with less than the requisite 216 + * count done. 217 + * 218 + * In several thousand conversions, no pen-ups where detected 219 + * before count completed. 220 + */ 221 + } 222 + 223 + /** 224 + * s3c24xx_ts_select - ADC selection callback. 225 + * @client: The client that was registered with the ADC core. 226 + * @select: The reason for select. 227 + * 228 + * Called when the ADC core selects (or deslects) us as a client. 229 + */ 230 + static void s3c24xx_ts_select(struct s3c_adc_client *client, unsigned select) 231 + { 232 + if (select) { 233 + writel(S3C2410_ADCTSC_PULL_UP_DISABLE | AUTOPST, 234 + ts.io + S3C2410_ADCTSC); 235 + } else { 236 + mod_timer(&touch_timer, jiffies+1); 237 + writel(WAIT4INT | INT_UP, ts.io + S3C2410_ADCTSC); 238 + } 239 + } 240 + 241 + /** 242 + * s3c2410ts_probe - device core probe entry point 243 + * @pdev: The device we are being bound to. 244 + * 245 + * Initialise, find and allocate any resources we need to run and then 246 + * register with the ADC and input systems. 247 + */ 248 + static int __devinit s3c2410ts_probe(struct platform_device *pdev) 249 + { 250 + struct s3c2410_ts_mach_info *info; 251 + struct device *dev = &pdev->dev; 252 + struct input_dev *input_dev; 253 + struct resource *res; 254 + int ret = -EINVAL; 255 + 256 + /* Initialise input stuff */ 257 + memset(&ts, 0, sizeof(struct s3c2410ts)); 258 + 259 + ts.dev = dev; 260 + 261 + info = pdev->dev.platform_data; 262 + if (!info) { 263 + dev_err(dev, "no platform data, cannot attach\n"); 264 + return -EINVAL; 265 + } 266 + 267 + dev_dbg(dev, "initialising touchscreen\n"); 268 + 269 + ts.clock = clk_get(dev, "adc"); 270 + if (IS_ERR(ts.clock)) { 271 + dev_err(dev, "cannot get adc clock source\n"); 272 + return -ENOENT; 273 + } 274 + 275 + clk_enable(ts.clock); 276 + dev_dbg(dev, "got and enabled clocks\n"); 277 + 278 + ts.irq_tc = ret = platform_get_irq(pdev, 0); 279 + if (ret < 0) { 280 + dev_err(dev, "no resource for interrupt\n"); 281 + goto err_clk; 282 + } 283 + 284 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 285 + if (!res) { 286 + dev_err(dev, "no resource for registers\n"); 287 + ret = -ENOENT; 288 + goto err_clk; 289 + } 290 + 291 + ts.io = ioremap(res->start, resource_size(res)); 292 + if (ts.io == NULL) { 293 + dev_err(dev, "cannot map registers\n"); 294 + ret = -ENOMEM; 295 + goto err_clk; 296 + } 297 + 298 + /* Configure the touchscreen external FETs on the S3C2410 */ 299 + if (!platform_get_device_id(pdev)->driver_data) 300 + s3c2410_ts_connect(); 301 + 302 + ts.client = s3c_adc_register(pdev, s3c24xx_ts_select, 303 + s3c24xx_ts_conversion, 1); 304 + if (IS_ERR(ts.client)) { 305 + dev_err(dev, "failed to register adc client\n"); 306 + ret = PTR_ERR(ts.client); 307 + goto err_iomap; 308 + } 309 + 310 + /* Initialise registers */ 311 + if ((info->delay & 0xffff) > 0) 312 + writel(info->delay & 0xffff, ts.io + S3C2410_ADCDLY); 313 + 314 + writel(WAIT4INT | INT_DOWN, ts.io + S3C2410_ADCTSC); 315 + 316 + input_dev = input_allocate_device(); 317 + if (!input_dev) { 318 + dev_err(dev, "Unable to allocate the input device !!\n"); 319 + ret = -ENOMEM; 320 + goto err_iomap; 321 + } 322 + 323 + ts.input = input_dev; 324 + ts.input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); 325 + ts.input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); 326 + input_set_abs_params(ts.input, ABS_X, 0, 0x3FF, 0, 0); 327 + input_set_abs_params(ts.input, ABS_Y, 0, 0x3FF, 0, 0); 328 + 329 + ts.input->name = "S3C24XX TouchScreen"; 330 + ts.input->id.bustype = BUS_HOST; 331 + ts.input->id.vendor = 0xDEAD; 332 + ts.input->id.product = 0xBEEF; 333 + ts.input->id.version = 0x0102; 334 + 335 + ts.shift = info->oversampling_shift; 336 + 337 + ret = request_irq(ts.irq_tc, stylus_irq, IRQF_DISABLED, 338 + "s3c2410_ts_pen", ts.input); 339 + if (ret) { 340 + dev_err(dev, "cannot get TC interrupt\n"); 341 + goto err_inputdev; 342 + } 343 + 344 + dev_info(dev, "driver attached, registering input device\n"); 345 + 346 + /* All went ok, so register to the input system */ 347 + ret = input_register_device(ts.input); 348 + if (ret < 0) { 349 + dev_err(dev, "failed to register input device\n"); 350 + ret = -EIO; 351 + goto err_tcirq; 352 + } 353 + 354 + return 0; 355 + 356 + err_tcirq: 357 + free_irq(ts.irq_tc, ts.input); 358 + err_inputdev: 359 + input_unregister_device(ts.input); 360 + err_iomap: 361 + iounmap(ts.io); 362 + err_clk: 363 + del_timer_sync(&touch_timer); 364 + clk_put(ts.clock); 365 + return ret; 366 + } 367 + 368 + /** 369 + * s3c2410ts_remove - device core removal entry point 370 + * @pdev: The device we are being removed from. 371 + * 372 + * Free up our state ready to be removed. 373 + */ 374 + static int __devexit s3c2410ts_remove(struct platform_device *pdev) 375 + { 376 + free_irq(ts.irq_tc, ts.input); 377 + del_timer_sync(&touch_timer); 378 + 379 + clk_disable(ts.clock); 380 + clk_put(ts.clock); 381 + 382 + input_unregister_device(ts.input); 383 + iounmap(ts.io); 384 + 385 + return 0; 386 + } 387 + 388 + #ifdef CONFIG_PM 389 + static int s3c2410ts_suspend(struct device *dev) 390 + { 391 + writel(TSC_SLEEP, ts.io + S3C2410_ADCTSC); 392 + disable_irq(ts.irq_tc); 393 + clk_disable(ts.clock); 394 + 395 + return 0; 396 + } 397 + 398 + static int s3c2410ts_resume(struct device *dev) 399 + { 400 + struct platform_device *pdev = to_platform_device(dev); 401 + struct s3c2410_ts_mach_info *info = pdev->dev.platform_data; 402 + 403 + clk_enable(ts.clock); 404 + 405 + /* Initialise registers */ 406 + if ((info->delay & 0xffff) > 0) 407 + writel(info->delay & 0xffff, ts.io + S3C2410_ADCDLY); 408 + 409 + writel(WAIT4INT | INT_DOWN, ts.io + S3C2410_ADCTSC); 410 + 411 + return 0; 412 + } 413 + 414 + static struct dev_pm_ops s3c_ts_pmops = { 415 + .suspend = s3c2410ts_suspend, 416 + .resume = s3c2410ts_resume, 417 + }; 418 + #endif 419 + 420 + static struct platform_device_id s3cts_driver_ids[] = { 421 + { "s3c2410-ts", 0 }, 422 + { "s3c2440-ts", 1 }, 423 + { } 424 + }; 425 + MODULE_DEVICE_TABLE(platform, s3cts_driver_ids); 426 + 427 + static struct platform_driver s3c_ts_driver = { 428 + .driver = { 429 + .name = "s3c24xx-ts", 430 + .owner = THIS_MODULE, 431 + #ifdef CONFIG_PM 432 + .pm = &s3c_ts_pmops, 433 + #endif 434 + }, 435 + .id_table = s3cts_driver_ids, 436 + .probe = s3c2410ts_probe, 437 + .remove = __devexit_p(s3c2410ts_remove), 438 + }; 439 + 440 + static int __init s3c2410ts_init(void) 441 + { 442 + return platform_driver_register(&s3c_ts_driver); 443 + } 444 + 445 + static void __exit s3c2410ts_exit(void) 446 + { 447 + platform_driver_unregister(&s3c_ts_driver); 448 + } 449 + 450 + module_init(s3c2410ts_init); 451 + module_exit(s3c2410ts_exit); 452 + 453 + MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>, " 454 + "Ben Dooks <ben@simtec.co.uk>, " 455 + "Simtec Electronics <linux@simtec.co.uk>"); 456 + MODULE_DESCRIPTION("S3C24XX Touchscreen driver"); 457 + MODULE_LICENSE("GPL v2");
+7 -4
drivers/input/touchscreen/ucb1400_ts.c
··· 355 355 goto err; 356 356 } 357 357 358 - error = ucb1400_ts_detect_irq(ucb); 359 - if (error) { 360 - printk(KERN_ERR "UCB1400: IRQ probe failed\n"); 361 - goto err_free_devs; 358 + /* Only in case the IRQ line wasn't supplied, try detecting it */ 359 + if (ucb->irq < 0) { 360 + error = ucb1400_ts_detect_irq(ucb); 361 + if (error) { 362 + printk(KERN_ERR "UCB1400: IRQ probe failed\n"); 363 + goto err_free_devs; 364 + } 362 365 } 363 366 364 367 init_waitqueue_head(&ucb->ts_wait);
+100 -4
drivers/input/touchscreen/usbtouchscreen.c
··· 14 14 * - General Touch 15 15 * - GoTop Super_Q2/GogoPen/PenPower tablets 16 16 * - JASTEC USB touch controller/DigiTech DTR-02U 17 + * - Zytronic capacitive touchscreen 17 18 * 18 19 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> 19 20 * Copyright (C) by Todd E. Johnson (mtouchusb.c) ··· 74 73 int min_press, max_press; 75 74 int rept_size; 76 75 76 + /* 77 + * Always service the USB devices irq not just when the input device is 78 + * open. This is useful when devices have a watchdog which prevents us 79 + * from periodically polling the device. Leave this unset unless your 80 + * touchscreen device requires it, as it does consume more of the USB 81 + * bandwidth. 82 + */ 83 + bool irq_always; 84 + 77 85 void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len); 78 86 79 87 /* ··· 131 121 DEVTYPE_GOTOP, 132 122 DEVTYPE_JASTEC, 133 123 DEVTYPE_E2I, 124 + DEVTYPE_ZYTRONIC, 125 + DEVTYPE_TC5UH, 134 126 }; 135 127 136 128 #define USB_DEVICE_HID_CLASS(vend, prod) \ ··· 213 201 #ifdef CONFIG_TOUCHSCREEN_USB_E2I 214 202 {USB_DEVICE(0x1ac7, 0x0001), .driver_info = DEVTYPE_E2I}, 215 203 #endif 204 + 205 + #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC 206 + {USB_DEVICE(0x14c8, 0x0003), .driver_info = DEVTYPE_ZYTRONIC}, 207 + #endif 208 + 209 + #ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC5UH 210 + {USB_DEVICE(0x0664, 0x0309), .driver_info = DEVTYPE_TC5UH}, 211 + #endif 212 + 216 213 {} 217 214 }; 218 215 ··· 559 538 } 560 539 #endif 561 540 541 + /***************************************************************************** 542 + * ET&T TC5UH part 543 + */ 544 + #ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC5UH 545 + static int tc5uh_read_data(struct usbtouch_usb *dev, unsigned char *pkt) 546 + { 547 + dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1]; 548 + dev->y = ((pkt[4] & 0x0F) << 8) | pkt[3]; 549 + dev->touch = pkt[0] & 0x01; 550 + 551 + return 1; 552 + } 553 + #endif 562 554 563 555 /***************************************************************************** 564 556 * IdealTEK URTC1000 Part ··· 655 621 } 656 622 #endif 657 623 624 + /***************************************************************************** 625 + * Zytronic Part 626 + */ 627 + #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC 628 + static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt) 629 + { 630 + switch (pkt[0]) { 631 + case 0x3A: /* command response */ 632 + dbg("%s: Command response %d", __func__, pkt[1]); 633 + break; 634 + 635 + case 0xC0: /* down */ 636 + dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); 637 + dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); 638 + dev->touch = 1; 639 + dbg("%s: down %d,%d", __func__, dev->x, dev->y); 640 + return 1; 641 + 642 + case 0x80: /* up */ 643 + dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); 644 + dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); 645 + dev->touch = 0; 646 + dbg("%s: up %d,%d", __func__, dev->x, dev->y); 647 + return 1; 648 + 649 + default: 650 + dbg("%s: Unknown return %d", __func__, pkt[0]); 651 + break; 652 + } 653 + 654 + return 0; 655 + } 656 + #endif 658 657 659 658 /***************************************************************************** 660 659 * the different device descriptors ··· 850 783 .read_data = e2i_read_data, 851 784 }, 852 785 #endif 786 + 787 + #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC 788 + [DEVTYPE_ZYTRONIC] = { 789 + .min_xc = 0x0, 790 + .max_xc = 0x03ff, 791 + .min_yc = 0x0, 792 + .max_yc = 0x03ff, 793 + .rept_size = 5, 794 + .read_data = zytronic_read_data, 795 + .irq_always = true, 796 + }, 797 + #endif 798 + 799 + #ifdef CONFIG_TOUCHSCREEN_USB_ETT_TC5UH 800 + [DEVTYPE_TC5UH] = { 801 + .min_xc = 0x0, 802 + .max_xc = 0x0fff, 803 + .min_yc = 0x0, 804 + .max_yc = 0x0fff, 805 + .rept_size = 5, 806 + .read_data = tc5uh_read_data, 807 + }, 808 + #endif 853 809 }; 854 810 855 811 ··· 1023 933 1024 934 usbtouch->irq->dev = usbtouch->udev; 1025 935 1026 - if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) 1027 - return -EIO; 936 + if (!usbtouch->type->irq_always) { 937 + if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) 938 + return -EIO; 939 + } 1028 940 1029 941 return 0; 1030 942 } ··· 1035 943 { 1036 944 struct usbtouch_usb *usbtouch = input_get_drvdata(input); 1037 945 1038 - usb_kill_urb(usbtouch->irq); 946 + if (!usbtouch->type->irq_always) 947 + usb_kill_urb(usbtouch->irq); 1039 948 } 1040 949 1041 950 ··· 1159 1066 1160 1067 usb_set_intfdata(intf, usbtouch); 1161 1068 1069 + if (usbtouch->type->irq_always) 1070 + usb_submit_urb(usbtouch->irq, GFP_KERNEL); 1071 + 1162 1072 return 0; 1163 1073 1164 1074 out_free_buffers: ··· 1183 1087 1184 1088 dbg("%s - usbtouch is initialized, cleaning up", __func__); 1185 1089 usb_set_intfdata(intf, NULL); 1186 - usb_kill_urb(usbtouch->irq); 1090 + /* this will stop IO via close */ 1187 1091 input_unregister_device(usbtouch->input); 1188 1092 usb_free_urb(usbtouch->irq); 1189 1093 usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch);
+7
drivers/mfd/ucb1400_core.c
··· 51 51 struct ucb1400_ts ucb_ts; 52 52 struct ucb1400_gpio ucb_gpio; 53 53 struct snd_ac97 *ac97; 54 + struct ucb1400_pdata *pdata = dev->platform_data; 54 55 55 56 memset(&ucb_ts, 0, sizeof(ucb_ts)); 56 57 memset(&ucb_gpio, 0, sizeof(ucb_gpio)); ··· 89 88 90 89 /* TOUCHSCREEN */ 91 90 ucb_ts.ac97 = ac97; 91 + 92 + if (pdata != NULL && pdata->irq >= 0) 93 + ucb_ts.irq = pdata->irq; 94 + else 95 + ucb_ts.irq = -1; 96 + 92 97 ucb->ucb1400_ts = platform_device_alloc("ucb1400_ts", -1); 93 98 if (!ucb->ucb1400_ts) { 94 99 err = -ENOMEM;
+17 -5
include/linux/input-polldev.h
··· 14 14 15 15 /** 16 16 * struct input_polled_dev - simple polled input device 17 - * @private: private driver data 18 - * @flush: driver-supplied method that flushes device's state upon 19 - * opening (optional) 17 + * @private: private driver data. 18 + * @open: driver-supplied method that prepares device for polling 19 + * (enabled the device and maybe flushes device state). 20 + * @close: driver-supplied method that is called when device is no 21 + * longer being polled. Used to put device into low power mode. 20 22 * @poll: driver-supplied method that polls the device and posts 21 23 * input events (mandatory). 22 - * @poll_interval: specifies how often the poll() method shoudl be called. 24 + * @poll_interval: specifies how often the poll() method should be called. 25 + * Defaults to 500 msec unless overriden when registering the device. 26 + * @poll_interval_max: specifies upper bound for the poll interval. 27 + * Defaults to the initial value of @poll_interval. 28 + * @poll_interval_min: specifies lower bound for the poll interval. 29 + * Defaults to 0. 23 30 * @input: input device structire associated with the polled device. 24 31 * Must be properly initialized by the driver (id, name, phys, bits). 25 32 * ··· 37 30 struct input_polled_dev { 38 31 void *private; 39 32 40 - void (*flush)(struct input_polled_dev *dev); 33 + void (*open)(struct input_polled_dev *dev); 34 + void (*close)(struct input_polled_dev *dev); 41 35 void (*poll)(struct input_polled_dev *dev); 42 36 unsigned int poll_interval; /* msec */ 37 + unsigned int poll_interval_max; /* msec */ 38 + unsigned int poll_interval_min; /* msec */ 43 39 44 40 struct input_dev *input; 41 + 42 + /* private: */ 45 43 struct delayed_work work; 46 44 }; 47 45
+10 -3
include/linux/input.h
··· 895 895 struct ff_envelope envelope; 896 896 897 897 __u32 custom_len; 898 - __s16 *custom_data; 898 + __s16 __user *custom_data; 899 899 }; 900 900 901 901 /** ··· 1021 1021 * @keycodesize: size of elements in keycode table 1022 1022 * @keycode: map of scancodes to keycodes for this device 1023 1023 * @setkeycode: optional method to alter current keymap, used to implement 1024 - * sparse keymaps. If not supplied default mechanism will be used 1024 + * sparse keymaps. If not supplied default mechanism will be used. 1025 + * The method is being called while holding event_lock and thus must 1026 + * not sleep 1025 1027 * @getkeycode: optional method to retrieve current keymap. If not supplied 1026 - * default mechanism will be used 1028 + * default mechanism will be used. The method is being called while 1029 + * holding event_lock and thus must not sleep 1027 1030 * @ff: force feedback structure associated with the device if device 1028 1031 * supports force feedback effects 1029 1032 * @repeat_key: stores key code of the last key pressed; used to implement ··· 1043 1040 * @absmin: minimum values for events coming from absolute axes 1044 1041 * @absfuzz: describes noisiness for axes 1045 1042 * @absflat: size of the center flat position (used by joydev) 1043 + * @absres: resolution used for events coming form absolute axes 1046 1044 * @open: this method is called when the very first user calls 1047 1045 * input_open_device(). The driver must prepare the device 1048 1046 * to start generating events (start polling thread, ··· 1297 1293 1298 1294 int __must_check input_register_handler(struct input_handler *); 1299 1295 void input_unregister_handler(struct input_handler *); 1296 + 1297 + int input_handler_for_each_handle(struct input_handler *, void *data, 1298 + int (*fn)(struct input_handle *, void *)); 1300 1299 1301 1300 int input_register_handle(struct input_handle *); 1302 1301 void input_unregister_handle(struct input_handle *);
+3
include/linux/input/matrix_keypad.h
··· 41 41 * @col_scan_delay_us: delay, measured in microseconds, that is 42 42 * needed before we can keypad after activating column gpio 43 43 * @debounce_ms: debounce interval in milliseconds 44 + * @active_low: gpio polarity 45 + * @wakeup: controls whether the device should be set up as wakeup 46 + * source 44 47 * 45 48 * This structure represents platform-specific data that use used by 46 49 * matrix_keypad driver to perform proper initialization.
+62
include/linux/input/sparse-keymap.h
··· 1 + #ifndef _SPARSE_KEYMAP_H 2 + #define _SPARSE_KEYMAP_H 3 + 4 + /* 5 + * Copyright (c) 2009 Dmitry Torokhov 6 + * 7 + * This program is free software; you can redistribute it and/or modify it 8 + * under the terms of the GNU General Public License version 2 as published by 9 + * the Free Software Foundation. 10 + */ 11 + 12 + #define KE_END 0 /* Indicates end of keymap */ 13 + #define KE_KEY 1 /* Ordinary key/button */ 14 + #define KE_SW 2 /* Switch (predetermined value) */ 15 + #define KE_VSW 3 /* Switch (value supplied at runtime) */ 16 + #define KE_IGNORE 4 /* Known entry that should be ignored */ 17 + #define KE_LAST KE_IGNORE 18 + 19 + /** 20 + * struct key_entry - keymap entry for use in sparse keymap 21 + * @type: Type of the key entry (KE_KEY, KE_SW, KE_VSW, KE_END); 22 + * drivers are allowed to extend the list with their own 23 + * private definitions. 24 + * @code: Device-specific data identifying the button/switch 25 + * @keycode: KEY_* code assigned to a key/button 26 + * @sw.code: SW_* code assigned to a switch 27 + * @sw.value: Value that should be sent in an input even when KE_SW 28 + * switch is toggled. KE_VSW switches ignore this field and 29 + * expect driver to supply value for the event. 30 + * 31 + * This structure defines an entry in a sparse keymap used by some 32 + * input devices for which traditional table-based approach is not 33 + * suitable. 34 + */ 35 + struct key_entry { 36 + int type; /* See KE_* above */ 37 + u32 code; 38 + union { 39 + u16 keycode; /* For KE_KEY */ 40 + struct { /* For KE_SW, KE_VSW */ 41 + u8 code; 42 + u8 value; /* For KE_SW, ignored by KE_VSW */ 43 + } sw; 44 + }; 45 + }; 46 + 47 + struct key_entry *sparse_keymap_entry_from_scancode(struct input_dev *dev, 48 + unsigned int code); 49 + struct key_entry *sparse_keymap_entry_from_keycode(struct input_dev *dev, 50 + unsigned int code); 51 + int sparse_keymap_setup(struct input_dev *dev, 52 + const struct key_entry *keymap, 53 + int (*setup)(struct input_dev *, struct key_entry *)); 54 + void sparse_keymap_free(struct input_dev *dev); 55 + 56 + void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *ke, 57 + unsigned int value, bool autorelease); 58 + 59 + bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code, 60 + unsigned int value, bool autorelease); 61 + 62 + #endif /* _SPARSE_KEYMAP_H */
+1
include/linux/serio.h
··· 215 215 #define SERIO_INEXIO 0x37 216 216 #define SERIO_TOUCHIT213 0x38 217 217 #define SERIO_W8001 0x39 218 + #define SERIO_DYNAPRO 0x3a 218 219 219 220 #endif
+4
include/linux/ucb1400.h
··· 110 110 struct platform_device *ucb1400_gpio; 111 111 }; 112 112 113 + struct ucb1400_pdata { 114 + int irq; 115 + }; 116 + 113 117 static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg) 114 118 { 115 119 return ac97->bus->ops->read(ac97, reg);