diff options
Diffstat (limited to 'drivers/input/touchscreen/ads7846.c')
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 907a45fe9d40..ce6f48c695f5 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -517,7 +517,9 @@ static void ads7846_rx(void *ads) | |||
517 | if (x == MAX_12BIT) | 517 | if (x == MAX_12BIT) |
518 | x = 0; | 518 | x = 0; |
519 | 519 | ||
520 | if (likely(x && z1)) { | 520 | if (ts->model == 7843) { |
521 | Rt = ts->pressure_max / 2; | ||
522 | } else if (likely(x && z1)) { | ||
521 | /* compute touch pressure resistance using equation #2 */ | 523 | /* compute touch pressure resistance using equation #2 */ |
522 | Rt = z2; | 524 | Rt = z2; |
523 | Rt -= z1; | 525 | Rt -= z1; |
@@ -525,11 +527,9 @@ static void ads7846_rx(void *ads) | |||
525 | Rt *= ts->x_plate_ohms; | 527 | Rt *= ts->x_plate_ohms; |
526 | Rt /= z1; | 528 | Rt /= z1; |
527 | Rt = (Rt + 2047) >> 12; | 529 | Rt = (Rt + 2047) >> 12; |
528 | } else | 530 | } else { |
529 | Rt = 0; | 531 | Rt = 0; |
530 | 532 | } | |
531 | if (ts->model == 7843) | ||
532 | Rt = ts->pressure_max / 2; | ||
533 | 533 | ||
534 | /* Sample found inconsistent by debouncing or pressure is beyond | 534 | /* Sample found inconsistent by debouncing or pressure is beyond |
535 | * the maximum. Don't report it to user space, repeat at least | 535 | * the maximum. Don't report it to user space, repeat at least |
@@ -633,19 +633,17 @@ static void ads7846_rx_val(void *ads) | |||
633 | struct ads7846 *ts = ads; | 633 | struct ads7846 *ts = ads; |
634 | struct spi_message *m; | 634 | struct spi_message *m; |
635 | struct spi_transfer *t; | 635 | struct spi_transfer *t; |
636 | u16 *rx_val; | ||
637 | int val; | 636 | int val; |
638 | int action; | 637 | int action; |
639 | int status; | 638 | int status; |
640 | 639 | ||
641 | m = &ts->msg[ts->msg_idx]; | 640 | m = &ts->msg[ts->msg_idx]; |
642 | t = list_entry(m->transfers.prev, struct spi_transfer, transfer_list); | 641 | t = list_entry(m->transfers.prev, struct spi_transfer, transfer_list); |
643 | rx_val = t->rx_buf; | ||
644 | 642 | ||
645 | /* adjust: on-wire is a must-ignore bit, a BE12 value, then padding; | 643 | /* adjust: on-wire is a must-ignore bit, a BE12 value, then padding; |
646 | * built from two 8 bit values written msb-first. | 644 | * built from two 8 bit values written msb-first. |
647 | */ | 645 | */ |
648 | val = be16_to_cpu(*rx_val) >> 3; | 646 | val = be16_to_cpup((__be16 *)t->rx_buf) >> 3; |
649 | 647 | ||
650 | action = ts->filter(ts->filter_data, ts->msg_idx, &val); | 648 | action = ts->filter(ts->filter_data, ts->msg_idx, &val); |
651 | switch (action) { | 649 | switch (action) { |
@@ -659,7 +657,7 @@ static void ads7846_rx_val(void *ads) | |||
659 | m = ts->last_msg; | 657 | m = ts->last_msg; |
660 | break; | 658 | break; |
661 | case ADS7846_FILTER_OK: | 659 | case ADS7846_FILTER_OK: |
662 | *rx_val = val; | 660 | *(u16 *)t->rx_buf = val; |
663 | ts->tc.ignore = 0; | 661 | ts->tc.ignore = 0; |
664 | m = &ts->msg[++ts->msg_idx]; | 662 | m = &ts->msg[++ts->msg_idx]; |
665 | break; | 663 | break; |