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

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