Merge master.kernel.org:/pub/scm/linux/kernel/git/dtor/input

+109 -67
-1
drivers/input/keyboard/Makefile
··· 11 11 obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o 12 12 obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o 13 13 obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o 14 - obj-$(CONFIG_KEYBOARD_98KBD) += 98kbd.o 15 14 obj-$(CONFIG_KEYBOARD_CORGI) += corgikbd.o 16 15 obj-$(CONFIG_KEYBOARD_SPITZ) += spitzkbd.o 17 16 obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o
-1
drivers/input/misc/Makefile
··· 7 7 obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o 8 8 obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o 9 9 obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o 10 - obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o 11 10 obj-$(CONFIG_INPUT_UINPUT) += uinput.o 12 11 obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o 13 12 obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
+1
drivers/input/misc/ixp4xx-beeper.c
··· 19 19 #include <linux/input.h> 20 20 #include <linux/delay.h> 21 21 #include <linux/platform_device.h> 22 + #include <linux/interrupt.h> 22 23 #include <asm/hardware.h> 23 24 24 25 MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
+1
drivers/input/mouse/logips2pp.c
··· 232 232 { 88, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, 233 233 { 96, 0, 0 }, 234 234 { 97, PS2PP_KIND_TP3, PS2PP_WHEEL | PS2PP_HWHEEL }, 235 + { 99, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, 235 236 { 100, PS2PP_KIND_MX, /* MX510 */ 236 237 PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | 237 238 PS2PP_EXTRA_BTN | PS2PP_NAV_BTN },
+14 -6
drivers/input/mouse/trackpoint.c
··· 68 68 size_t field_offset; 69 69 unsigned char command; 70 70 unsigned char mask; 71 + unsigned char inverted; 71 72 }; 72 73 73 74 static ssize_t trackpoint_show_int_attr(struct psmouse *psmouse, void *data, char *buf) 74 75 { 75 76 struct trackpoint_data *tp = psmouse->private; 76 77 struct trackpoint_attr_data *attr = data; 77 - unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); 78 + unsigned char value = *(unsigned char *)((char *)tp + attr->field_offset); 78 79 79 - return sprintf(buf, "%u\n", *field); 80 + if (attr->inverted) 81 + value = !value; 82 + 83 + return sprintf(buf, "%u\n", value); 80 84 } 81 85 82 86 static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data, ··· 124 120 if (*rest || value > 1) 125 121 return -EINVAL; 126 122 123 + if (attr->inverted) 124 + value = !value; 125 + 127 126 if (*field != value) { 128 127 *field = value; 129 128 trackpoint_toggle_bit(&psmouse->ps2dev, attr->command, attr->mask); ··· 136 129 } 137 130 138 131 139 - #define TRACKPOINT_BIT_ATTR(_name, _command, _mask) \ 132 + #define TRACKPOINT_BIT_ATTR(_name, _command, _mask, _inv) \ 140 133 static struct trackpoint_attr_data trackpoint_attr_##_name = { \ 141 134 .field_offset = offsetof(struct trackpoint_data, _name), \ 142 135 .command = _command, \ 143 136 .mask = _mask, \ 137 + .inverted = _inv, \ 144 138 }; \ 145 139 PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \ 146 140 &trackpoint_attr_##_name, \ ··· 158 150 TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME); 159 151 TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV); 160 152 161 - TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON); 162 - TRACKPOINT_BIT_ATTR(skipback, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK); 163 - TRACKPOINT_BIT_ATTR(ext_dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV); 153 + TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0); 154 + TRACKPOINT_BIT_ATTR(skipback, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK, 0); 155 + TRACKPOINT_BIT_ATTR(ext_dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV, 1); 164 156 165 157 static struct attribute *trackpoint_attrs[] = { 166 158 &psmouse_attr_sensitivity.dattr.attr,
+2 -2
drivers/input/mouse/trackpoint.h
··· 78 78 79 79 #define TP_TOGGLE_MB 0x23 /* Disable/Enable Middle Button */ 80 80 #define TP_MASK_MB 0x01 81 - #define TP_TOGGLE_EXT_DEV 0x23 /* Toggle external device */ 81 + #define TP_TOGGLE_EXT_DEV 0x23 /* Disable external device */ 82 82 #define TP_MASK_EXT_DEV 0x02 83 83 #define TP_TOGGLE_DRIFT 0x23 /* Drift Correction */ 84 84 #define TP_MASK_DRIFT 0x80 ··· 125 125 #define TP_DEF_MB 0x00 126 126 #define TP_DEF_PTSON 0x00 127 127 #define TP_DEF_SKIPBACK 0x00 128 - #define TP_DEF_EXT_DEV 0x01 128 + #define TP_DEF_EXT_DEV 0x00 /* 0 means enabled */ 129 129 130 130 #define MAKE_PS2_CMD(params, results, cmd) ((params<<12) | (results<<8) | (cmd)) 131 131
-1
drivers/input/serio/Makefile
··· 13 13 obj-$(CONFIG_SERIO_SA1111) += sa1111ps2.o 14 14 obj-$(CONFIG_SERIO_AMBAKMI) += ambakmi.o 15 15 obj-$(CONFIG_SERIO_Q40KBD) += q40kbd.o 16 - obj-$(CONFIG_SERIO_98KBD) += 98kbd-io.o 17 16 obj-$(CONFIG_SERIO_GSCPS2) += gscps2.o 18 17 obj-$(CONFIG_HP_SDC) += hp_sdc.o 19 18 obj-$(CONFIG_HIL_MLC) += hp_sdc_mlc.o hil_mlc.o
+91 -56
drivers/input/touchscreen/ads7846.c
··· 48 48 49 49 #define TS_POLL_PERIOD msecs_to_jiffies(10) 50 50 51 + /* this driver doesn't aim at the peak continuous sample rate */ 52 + #define SAMPLE_BITS (8 /*cmd*/ + 16 /*sample*/ + 2 /* before, after */) 53 + 51 54 struct ts_event { 52 55 /* For portability, we can't read 12 bit values using SPI (which 53 56 * would make the controller deliver them as native byteorder u16 54 - * with msbs zeroed). Instead, we read them as two 8-byte values, 57 + * with msbs zeroed). Instead, we read them as two 8-bit values, 55 58 * which need byteswapping then range adjustment. 56 59 */ 57 60 __be16 x; ··· 63 60 }; 64 61 65 62 struct ads7846 { 66 - struct input_dev input; 63 + struct input_dev *input; 67 64 char phys[32]; 68 65 69 66 struct spi_device *spi; ··· 71 68 u16 vref_delay_usecs; 72 69 u16 x_plate_ohms; 73 70 71 + u8 read_x, read_y, read_z1, read_z2; 74 72 struct ts_event tc; 75 73 76 74 struct spi_transfer xfer[8]; ··· 121 117 #define READ_12BIT_DFR(x) (ADS_START | ADS_A2A1A0_d_ ## x \ 122 118 | ADS_12_BIT | ADS_DFR) 123 119 124 - static const u8 read_y = READ_12BIT_DFR(y) | ADS_PD10_ADC_ON; 125 - static const u8 read_z1 = READ_12BIT_DFR(z1) | ADS_PD10_ADC_ON; 126 - static const u8 read_z2 = READ_12BIT_DFR(z2) | ADS_PD10_ADC_ON; 127 - static const u8 read_x = READ_12BIT_DFR(x) | ADS_PD10_PDOWN; /* LAST */ 120 + #define READ_Y (READ_12BIT_DFR(y) | ADS_PD10_ADC_ON) 121 + #define READ_Z1 (READ_12BIT_DFR(z1) | ADS_PD10_ADC_ON) 122 + #define READ_Z2 (READ_12BIT_DFR(z2) | ADS_PD10_ADC_ON) 123 + #define READ_X (READ_12BIT_DFR(x) | ADS_PD10_PDOWN) /* LAST */ 128 124 129 125 /* single-ended samples need to first power up reference voltage; 130 126 * we leave both ADC and VREF powered ··· 132 128 #define READ_12BIT_SER(x) (ADS_START | ADS_A2A1A0_ ## x \ 133 129 | ADS_12_BIT | ADS_SER) 134 130 135 - static const u8 ref_on = READ_12BIT_DFR(x) | ADS_PD10_ALL_ON; 136 - static const u8 ref_off = READ_12BIT_DFR(y) | ADS_PD10_PDOWN; 131 + #define REF_ON (READ_12BIT_DFR(x) | ADS_PD10_ALL_ON) 132 + #define REF_OFF (READ_12BIT_DFR(y) | ADS_PD10_PDOWN) 137 133 138 134 /*--------------------------------------------------------------------------*/ 139 135 ··· 142 138 */ 143 139 144 140 struct ser_req { 141 + u8 ref_on; 145 142 u8 command; 143 + u8 ref_off; 146 144 u16 scratch; 147 145 __be16 sample; 148 146 struct spi_message msg; ··· 158 152 struct ser_req *req = kzalloc(sizeof *req, SLAB_KERNEL); 159 153 int status; 160 154 int sample; 161 - int i; 155 + int i; 162 156 163 157 if (!req) 164 158 return -ENOMEM; ··· 166 160 INIT_LIST_HEAD(&req->msg.transfers); 167 161 168 162 /* activate reference, so it has time to settle; */ 169 - req->xfer[0].tx_buf = &ref_on; 163 + req->ref_on = REF_ON; 164 + req->xfer[0].tx_buf = &req->ref_on; 170 165 req->xfer[0].len = 1; 171 166 req->xfer[1].rx_buf = &req->scratch; 172 167 req->xfer[1].len = 2; ··· 189 182 /* REVISIT: take a few more samples, and compare ... */ 190 183 191 184 /* turn off reference */ 192 - req->xfer[4].tx_buf = &ref_off; 185 + req->ref_off = REF_OFF; 186 + req->xfer[4].tx_buf = &req->ref_off; 193 187 req->xfer[4].len = 1; 194 188 req->xfer[5].rx_buf = &req->scratch; 195 189 req->xfer[5].len = 2; ··· 244 236 245 237 static void ads7846_rx(void *ads) 246 238 { 247 - struct ads7846 *ts = ads; 248 - unsigned Rt; 249 - unsigned sync = 0; 250 - u16 x, y, z1, z2; 251 - unsigned long flags; 239 + struct ads7846 *ts = ads; 240 + struct input_dev *input_dev = ts->input; 241 + unsigned Rt; 242 + unsigned sync = 0; 243 + u16 x, y, z1, z2; 244 + unsigned long flags; 252 245 253 246 /* adjust: 12 bit samples (left aligned), built from 254 247 * two 8 bit values writen msb-first. ··· 285 276 * won't notice that, even if nPENIRQ never fires ... 286 277 */ 287 278 if (!ts->pendown && Rt != 0) { 288 - input_report_key(&ts->input, BTN_TOUCH, 1); 279 + input_report_key(input_dev, BTN_TOUCH, 1); 289 280 sync = 1; 290 281 } else if (ts->pendown && Rt == 0) { 291 - input_report_key(&ts->input, BTN_TOUCH, 0); 282 + input_report_key(input_dev, BTN_TOUCH, 0); 292 283 sync = 1; 293 284 } 294 285 295 286 if (Rt) { 296 - input_report_abs(&ts->input, ABS_X, x); 297 - input_report_abs(&ts->input, ABS_Y, y); 298 - input_report_abs(&ts->input, ABS_PRESSURE, Rt); 287 + input_report_abs(input_dev, ABS_X, x); 288 + input_report_abs(input_dev, ABS_Y, y); 289 + input_report_abs(input_dev, ABS_PRESSURE, Rt); 299 290 sync = 1; 300 291 } 301 292 if (sync) 302 - input_sync(&ts->input); 293 + input_sync(input_dev); 303 294 304 295 #ifdef VERBOSE 305 296 if (Rt || ts->pendown) ··· 405 396 static int __devinit ads7846_probe(struct spi_device *spi) 406 397 { 407 398 struct ads7846 *ts; 399 + struct input_dev *input_dev; 408 400 struct ads7846_platform_data *pdata = spi->dev.platform_data; 409 401 struct spi_transfer *x; 410 - int i; 402 + int err; 411 403 412 404 if (!spi->irq) { 413 405 dev_dbg(&spi->dev, "no IRQ?\n"); ··· 421 411 } 422 412 423 413 /* don't exceed max specified sample rate */ 424 - if (spi->max_speed_hz > (125000 * 16)) { 414 + if (spi->max_speed_hz > (125000 * SAMPLE_BITS)) { 425 415 dev_dbg(&spi->dev, "f(sample) %d KHz?\n", 426 - (spi->max_speed_hz/16)/1000); 416 + (spi->max_speed_hz/SAMPLE_BITS)/1000); 427 417 return -EINVAL; 428 418 } 429 419 ··· 433 423 * to discard the four garbage LSBs. 434 424 */ 435 425 436 - if (!(ts = kzalloc(sizeof(struct ads7846), GFP_KERNEL))) 437 - return -ENOMEM; 426 + ts = kzalloc(sizeof(struct ads7846), GFP_KERNEL); 427 + input_dev = input_allocate_device(); 428 + if (!ts || !input_dev) { 429 + err = -ENOMEM; 430 + goto err_free_mem; 431 + } 438 432 439 433 dev_set_drvdata(&spi->dev, ts); 434 + spi->dev.power.power_state = PMSG_ON; 440 435 441 436 ts->spi = spi; 442 - spi->dev.power.power_state = PMSG_ON; 437 + ts->input = input_dev; 443 438 444 439 init_timer(&ts->timer); 445 440 ts->timer.data = (unsigned long) ts; ··· 454 439 ts->vref_delay_usecs = pdata->vref_delay_usecs ? : 100; 455 440 ts->x_plate_ohms = pdata->x_plate_ohms ? : 400; 456 441 457 - init_input_dev(&ts->input); 442 + snprintf(ts->phys, sizeof(ts->phys), "%s/input0", spi->dev.bus_id); 458 443 459 - ts->input.dev = &spi->dev; 460 - ts->input.name = "ADS784x Touchscreen"; 461 - snprintf(ts->phys, sizeof ts->phys, "%s/input0", spi->dev.bus_id); 462 - ts->input.phys = ts->phys; 444 + input_dev->name = "ADS784x Touchscreen"; 445 + input_dev->phys = ts->phys; 446 + input_dev->cdev.dev = &spi->dev; 463 447 464 - ts->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 465 - ts->input.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 466 - input_set_abs_params(&ts->input, ABS_X, 448 + input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 449 + input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 450 + input_set_abs_params(input_dev, ABS_X, 467 451 pdata->x_min ? : 0, 468 452 pdata->x_max ? : MAX_12BIT, 469 453 0, 0); 470 - input_set_abs_params(&ts->input, ABS_Y, 454 + input_set_abs_params(input_dev, ABS_Y, 471 455 pdata->y_min ? : 0, 472 456 pdata->y_max ? : MAX_12BIT, 473 457 0, 0); 474 - input_set_abs_params(&ts->input, ABS_PRESSURE, 458 + input_set_abs_params(input_dev, ABS_PRESSURE, 475 459 pdata->pressure_min, pdata->pressure_max, 0, 0); 476 - 477 - input_register_device(&ts->input); 478 460 479 461 /* set up the transfers to read touchscreen state; this assumes we 480 462 * use formula #2 for pressure, not #3. 481 463 */ 464 + INIT_LIST_HEAD(&ts->msg.transfers); 482 465 x = ts->xfer; 483 466 484 467 /* y- still on; turn on only y+ (and ADC) */ 485 - x->tx_buf = &read_y; 468 + ts->read_y = READ_Y; 469 + x->tx_buf = &ts->read_y; 486 470 x->len = 1; 471 + spi_message_add_tail(x, &ts->msg); 472 + 487 473 x++; 488 474 x->rx_buf = &ts->tc.y; 489 475 x->len = 2; 490 - x++; 476 + spi_message_add_tail(x, &ts->msg); 491 477 492 478 /* turn y+ off, x- on; we'll use formula #2 */ 493 479 if (ts->model == 7846) { 494 - x->tx_buf = &read_z1; 480 + x++; 481 + ts->read_z1 = READ_Z1; 482 + x->tx_buf = &ts->read_z1; 495 483 x->len = 1; 484 + spi_message_add_tail(x, &ts->msg); 485 + 496 486 x++; 497 487 x->rx_buf = &ts->tc.z1; 498 488 x->len = 2; 499 - x++; 489 + spi_message_add_tail(x, &ts->msg); 500 490 501 - x->tx_buf = &read_z2; 491 + x++; 492 + ts->read_z2 = READ_Z2; 493 + x->tx_buf = &ts->read_z2; 502 494 x->len = 1; 495 + spi_message_add_tail(x, &ts->msg); 496 + 503 497 x++; 504 498 x->rx_buf = &ts->tc.z2; 505 499 x->len = 2; 506 - x++; 500 + spi_message_add_tail(x, &ts->msg); 507 501 } 508 502 509 503 /* turn y- off, x+ on, then leave in lowpower */ 510 - x->tx_buf = &read_x; 504 + x++; 505 + ts->read_x = READ_X; 506 + x->tx_buf = &ts->read_x; 511 507 x->len = 1; 508 + spi_message_add_tail(x, &ts->msg); 509 + 512 510 x++; 513 511 x->rx_buf = &ts->tc.x; 514 512 x->len = 2; 515 - x++; 513 + CS_CHANGE(*x); 514 + spi_message_add_tail(x, &ts->msg); 516 515 517 - CS_CHANGE(x[-1]); 518 - 519 - for (i = 0; i < x - ts->xfer; i++) 520 - spi_message_add_tail(&ts->xfer[i], &ts->msg); 521 516 ts->msg.complete = ads7846_rx; 522 517 ts->msg.context = ts; 523 518 ··· 535 510 SA_SAMPLE_RANDOM | SA_TRIGGER_FALLING, 536 511 spi->dev.bus_id, ts)) { 537 512 dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); 538 - input_unregister_device(&ts->input); 539 - kfree(ts); 540 - return -EBUSY; 513 + err = -EBUSY; 514 + goto err_free_mem; 541 515 } 542 516 543 517 dev_info(&spi->dev, "touchscreen, irq %d\n", spi->irq); ··· 558 534 device_create_file(&spi->dev, &dev_attr_vbatt); 559 535 device_create_file(&spi->dev, &dev_attr_vaux); 560 536 537 + err = input_register_device(input_dev); 538 + if (err) 539 + goto err_free_irq; 540 + 561 541 return 0; 542 + 543 + err_free_irq: 544 + free_irq(spi->irq, ts); 545 + err_free_mem: 546 + input_free_device(input_dev); 547 + kfree(ts); 548 + return err; 562 549 } 563 550 564 551 static int __devexit ads7846_remove(struct spi_device *spi) ··· 589 554 device_remove_file(&spi->dev, &dev_attr_vbatt); 590 555 device_remove_file(&spi->dev, &dev_attr_vaux); 591 556 592 - input_unregister_device(&ts->input); 557 + input_unregister_device(ts->input); 593 558 kfree(ts); 594 559 595 560 dev_dbg(&spi->dev, "unregistered touchscreen\n");