diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-24 13:34:29 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-24 13:34:29 -0400 |
| commit | 2c01e7bc46f10e9190818437e564f7e0db875ae9 (patch) | |
| tree | 8b06c85d69754f7df27f7fb42520f6e2ceaea907 /drivers/input/mouse | |
| parent | ab11ca34eea8fda7a1a9302d86f6ef6108ffd68f (diff) | |
| parent | e644dae645e167d154c0526358940986682a72b0 (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input layer updates from Dmitry Torokhov:
- a bunch of new drivers (DA9052/53 touchscreenn controller, Synaptics
Navpoint, LM8333 keypads, Wacom I2C touhscreen);
- updates to existing touchpad drivers (ALPS, Sntelic);
- Wacom driver now supports Intuos5;
- device-tree bindings in numerous drivers;
- other cleanups and fixes.
Fix annoying conflict in drivers/input/tablet/wacom_wac.c that I think
implies that the input layer device naming is broken, but let's see. I
brough it up with Dmitry.
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (57 commits)
Input: matrix-keymap - fix building keymaps
Input: spear-keyboard - document DT bindings
Input: spear-keyboard - add device tree bindings
Input: matrix-keymap - wire up device tree support
Input: matrix-keymap - uninline and prepare for device tree support
Input: adp5588 - add support for gpio names
Input: omap-keypad - dynamically handle register offsets
Input: synaptics - fix compile warning
MAINTAINERS: adjust input-related patterns
Input: ALPS - switch to using input_mt_report_finger_count
Input: ALPS - add semi-MT support for v4 protocol
Input: Add Synaptics NavPoint (PXA27x SSP/SPI) driver
Input: atmel_mxt_ts - dump each message on just 1 line
Input: atmel_mxt_ts - do not read extra (checksum) byte
Input: atmel_mxt_ts - verify object size in mxt_write_object
Input: atmel_mxt_ts - only allow root to update firmware
Input: atmel_mxt_ts - use CONFIG_PM_SLEEP
Input: sentelic - report device's production serial number
Input: tl6040-vibra - Device Tree support
Input: evdev - properly handle read/write with count 0
...
Diffstat (limited to 'drivers/input/mouse')
| -rw-r--r-- | drivers/input/mouse/Kconfig | 12 | ||||
| -rw-r--r-- | drivers/input/mouse/Makefile | 1 | ||||
| -rw-r--r-- | drivers/input/mouse/alps.c | 81 | ||||
| -rw-r--r-- | drivers/input/mouse/alps.h | 2 | ||||
| -rw-r--r-- | drivers/input/mouse/navpoint.c | 369 | ||||
| -rw-r--r-- | drivers/input/mouse/sentelic.c | 34 | ||||
| -rw-r--r-- | drivers/input/mouse/sentelic.h | 8 | ||||
| -rw-r--r-- | drivers/input/mouse/sermouse.c | 13 | ||||
| -rw-r--r-- | drivers/input/mouse/synaptics.c | 20 | ||||
| -rw-r--r-- | drivers/input/mouse/vsxxxaa.c | 14 |
10 files changed, 505 insertions, 49 deletions
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig index 9b8db821d5f0..cd6268cf7cd5 100644 --- a/drivers/input/mouse/Kconfig +++ b/drivers/input/mouse/Kconfig | |||
| @@ -339,4 +339,16 @@ config MOUSE_SYNAPTICS_USB | |||
| 339 | To compile this driver as a module, choose M here: the | 339 | To compile this driver as a module, choose M here: the |
| 340 | module will be called synaptics_usb. | 340 | module will be called synaptics_usb. |
| 341 | 341 | ||
| 342 | config MOUSE_NAVPOINT_PXA27x | ||
| 343 | tristate "Synaptics NavPoint (PXA27x SSP/SPI)" | ||
| 344 | depends on PXA27x && PXA_SSP | ||
| 345 | help | ||
| 346 | This driver adds support for the Synaptics NavPoint touchpad connected | ||
| 347 | to a PXA27x SSP port in SPI slave mode. The device emulates a mouse; | ||
| 348 | a tap or tap-and-a-half drag gesture emulates the left mouse button. | ||
| 349 | For example, use the xf86-input-evdev driver for an X pointing device. | ||
| 350 | |||
| 351 | To compile this driver as a module, choose M here: the | ||
| 352 | module will be called navpoint. | ||
| 353 | |||
| 342 | endif | 354 | endif |
diff --git a/drivers/input/mouse/Makefile b/drivers/input/mouse/Makefile index 4718effeb8d9..46ba7556fd4f 100644 --- a/drivers/input/mouse/Makefile +++ b/drivers/input/mouse/Makefile | |||
| @@ -12,6 +12,7 @@ obj-$(CONFIG_MOUSE_GPIO) += gpio_mouse.o | |||
| 12 | obj-$(CONFIG_MOUSE_INPORT) += inport.o | 12 | obj-$(CONFIG_MOUSE_INPORT) += inport.o |
| 13 | obj-$(CONFIG_MOUSE_LOGIBM) += logibm.o | 13 | obj-$(CONFIG_MOUSE_LOGIBM) += logibm.o |
| 14 | obj-$(CONFIG_MOUSE_MAPLE) += maplemouse.o | 14 | obj-$(CONFIG_MOUSE_MAPLE) += maplemouse.o |
| 15 | obj-$(CONFIG_MOUSE_NAVPOINT_PXA27x) += navpoint.o | ||
| 15 | obj-$(CONFIG_MOUSE_PC110PAD) += pc110pad.o | 16 | obj-$(CONFIG_MOUSE_PC110PAD) += pc110pad.o |
| 16 | obj-$(CONFIG_MOUSE_PS2) += psmouse.o | 17 | obj-$(CONFIG_MOUSE_PS2) += psmouse.o |
| 17 | obj-$(CONFIG_MOUSE_PXA930_TRKBALL) += pxa930_trkball.o | 18 | obj-$(CONFIG_MOUSE_PXA930_TRKBALL) += pxa930_trkball.o |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 4c6a72d3d48c..4a1347e91bdc 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
| @@ -553,10 +553,7 @@ static void alps_process_touchpad_packet_v3(struct psmouse *psmouse) | |||
| 553 | 553 | ||
| 554 | alps_report_semi_mt_data(dev, fingers, x1, y1, x2, y2); | 554 | alps_report_semi_mt_data(dev, fingers, x1, y1, x2, y2); |
| 555 | 555 | ||
| 556 | input_report_key(dev, BTN_TOOL_FINGER, fingers == 1); | 556 | input_mt_report_finger_count(dev, fingers); |
| 557 | input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2); | ||
| 558 | input_report_key(dev, BTN_TOOL_TRIPLETAP, fingers == 3); | ||
| 559 | input_report_key(dev, BTN_TOOL_QUADTAP, fingers == 4); | ||
| 560 | 557 | ||
| 561 | input_report_key(dev, BTN_LEFT, left); | 558 | input_report_key(dev, BTN_LEFT, left); |
| 562 | input_report_key(dev, BTN_RIGHT, right); | 559 | input_report_key(dev, BTN_RIGHT, right); |
| @@ -604,10 +601,54 @@ static void alps_process_packet_v3(struct psmouse *psmouse) | |||
| 604 | 601 | ||
| 605 | static void alps_process_packet_v4(struct psmouse *psmouse) | 602 | static void alps_process_packet_v4(struct psmouse *psmouse) |
| 606 | { | 603 | { |
| 604 | struct alps_data *priv = psmouse->private; | ||
| 607 | unsigned char *packet = psmouse->packet; | 605 | unsigned char *packet = psmouse->packet; |
| 608 | struct input_dev *dev = psmouse->dev; | 606 | struct input_dev *dev = psmouse->dev; |
| 607 | int offset; | ||
| 609 | int x, y, z; | 608 | int x, y, z; |
| 610 | int left, right; | 609 | int left, right; |
| 610 | int x1, y1, x2, y2; | ||
| 611 | int fingers = 0; | ||
| 612 | unsigned int x_bitmap, y_bitmap; | ||
| 613 | |||
| 614 | /* | ||
| 615 | * v4 has a 6-byte encoding for bitmap data, but this data is | ||
| 616 | * broken up between 3 normal packets. Use priv->multi_packet to | ||
| 617 | * track our position in the bitmap packet. | ||
| 618 | */ | ||
| 619 | if (packet[6] & 0x40) { | ||
| 620 | /* sync, reset position */ | ||
| 621 | priv->multi_packet = 0; | ||
| 622 | } | ||
| 623 | |||
| 624 | if (WARN_ON_ONCE(priv->multi_packet > 2)) | ||
| 625 | return; | ||
| 626 | |||
| 627 | offset = 2 * priv->multi_packet; | ||
| 628 | priv->multi_data[offset] = packet[6]; | ||
| 629 | priv->multi_data[offset + 1] = packet[7]; | ||
| 630 | |||
| 631 | if (++priv->multi_packet > 2) { | ||
| 632 | priv->multi_packet = 0; | ||
| 633 | |||
| 634 | x_bitmap = ((priv->multi_data[2] & 0x1f) << 10) | | ||
| 635 | ((priv->multi_data[3] & 0x60) << 3) | | ||
| 636 | ((priv->multi_data[0] & 0x3f) << 2) | | ||
| 637 | ((priv->multi_data[1] & 0x60) >> 5); | ||
| 638 | y_bitmap = ((priv->multi_data[5] & 0x01) << 10) | | ||
| 639 | ((priv->multi_data[3] & 0x1f) << 5) | | ||
| 640 | (priv->multi_data[1] & 0x1f); | ||
| 641 | |||
| 642 | fingers = alps_process_bitmap(x_bitmap, y_bitmap, | ||
| 643 | &x1, &y1, &x2, &y2); | ||
| 644 | |||
| 645 | /* Store MT data.*/ | ||
| 646 | priv->fingers = fingers; | ||
| 647 | priv->x1 = x1; | ||
| 648 | priv->x2 = x2; | ||
| 649 | priv->y1 = y1; | ||
| 650 | priv->y2 = y2; | ||
| 651 | } | ||
| 611 | 652 | ||
| 612 | left = packet[4] & 0x01; | 653 | left = packet[4] & 0x01; |
| 613 | right = packet[4] & 0x02; | 654 | right = packet[4] & 0x02; |
| @@ -617,21 +658,41 @@ static void alps_process_packet_v4(struct psmouse *psmouse) | |||
| 617 | y = ((packet[2] & 0x7f) << 4) | (packet[3] & 0x0f); | 658 | y = ((packet[2] & 0x7f) << 4) | (packet[3] & 0x0f); |
| 618 | z = packet[5] & 0x7f; | 659 | z = packet[5] & 0x7f; |
| 619 | 660 | ||
| 661 | /* | ||
| 662 | * If there were no contacts in the bitmap, use ST | ||
| 663 | * points in MT reports. | ||
| 664 | * If there were two contacts or more, report MT data. | ||
| 665 | */ | ||
| 666 | if (priv->fingers < 2) { | ||
| 667 | x1 = x; | ||
| 668 | y1 = y; | ||
| 669 | fingers = z > 0 ? 1 : 0; | ||
| 670 | } else { | ||
| 671 | fingers = priv->fingers; | ||
| 672 | x1 = priv->x1; | ||
| 673 | x2 = priv->x2; | ||
| 674 | y1 = priv->y1; | ||
| 675 | y2 = priv->y2; | ||
| 676 | } | ||
| 677 | |||
| 620 | if (z >= 64) | 678 | if (z >= 64) |
| 621 | input_report_key(dev, BTN_TOUCH, 1); | 679 | input_report_key(dev, BTN_TOUCH, 1); |
| 622 | else | 680 | else |
| 623 | input_report_key(dev, BTN_TOUCH, 0); | 681 | input_report_key(dev, BTN_TOUCH, 0); |
| 624 | 682 | ||
| 683 | alps_report_semi_mt_data(dev, fingers, x1, y1, x2, y2); | ||
| 684 | |||
| 685 | input_mt_report_finger_count(dev, fingers); | ||
| 686 | |||
| 687 | input_report_key(dev, BTN_LEFT, left); | ||
| 688 | input_report_key(dev, BTN_RIGHT, right); | ||
| 689 | |||
| 625 | if (z > 0) { | 690 | if (z > 0) { |
| 626 | input_report_abs(dev, ABS_X, x); | 691 | input_report_abs(dev, ABS_X, x); |
| 627 | input_report_abs(dev, ABS_Y, y); | 692 | input_report_abs(dev, ABS_Y, y); |
| 628 | } | 693 | } |
| 629 | input_report_abs(dev, ABS_PRESSURE, z); | 694 | input_report_abs(dev, ABS_PRESSURE, z); |
| 630 | 695 | ||
| 631 | input_report_key(dev, BTN_TOOL_FINGER, z > 0); | ||
| 632 | input_report_key(dev, BTN_LEFT, left); | ||
| 633 | input_report_key(dev, BTN_RIGHT, right); | ||
| 634 | |||
| 635 | input_sync(dev); | 696 | input_sync(dev); |
| 636 | } | 697 | } |
| 637 | 698 | ||
| @@ -1557,6 +1618,7 @@ int alps_init(struct psmouse *psmouse) | |||
| 1557 | input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0); | 1618 | input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0); |
| 1558 | break; | 1619 | break; |
| 1559 | case ALPS_PROTO_V3: | 1620 | case ALPS_PROTO_V3: |
| 1621 | case ALPS_PROTO_V4: | ||
| 1560 | set_bit(INPUT_PROP_SEMI_MT, dev1->propbit); | 1622 | set_bit(INPUT_PROP_SEMI_MT, dev1->propbit); |
| 1561 | input_mt_init_slots(dev1, 2); | 1623 | input_mt_init_slots(dev1, 2); |
| 1562 | input_set_abs_params(dev1, ABS_MT_POSITION_X, 0, ALPS_V3_X_MAX, 0, 0); | 1624 | input_set_abs_params(dev1, ABS_MT_POSITION_X, 0, ALPS_V3_X_MAX, 0, 0); |
| @@ -1565,8 +1627,7 @@ int alps_init(struct psmouse *psmouse) | |||
| 1565 | set_bit(BTN_TOOL_DOUBLETAP, dev1->keybit); | 1627 | set_bit(BTN_TOOL_DOUBLETAP, dev1->keybit); |
| 1566 | set_bit(BTN_TOOL_TRIPLETAP, dev1->keybit); | 1628 | set_bit(BTN_TOOL_TRIPLETAP, dev1->keybit); |
| 1567 | set_bit(BTN_TOOL_QUADTAP, dev1->keybit); | 1629 | set_bit(BTN_TOOL_QUADTAP, dev1->keybit); |
| 1568 | /* fall through */ | 1630 | |
| 1569 | case ALPS_PROTO_V4: | ||
| 1570 | input_set_abs_params(dev1, ABS_X, 0, ALPS_V3_X_MAX, 0, 0); | 1631 | input_set_abs_params(dev1, ABS_X, 0, ALPS_V3_X_MAX, 0, 0); |
| 1571 | input_set_abs_params(dev1, ABS_Y, 0, ALPS_V3_Y_MAX, 0, 0); | 1632 | input_set_abs_params(dev1, ABS_Y, 0, ALPS_V3_Y_MAX, 0, 0); |
| 1572 | break; | 1633 | break; |
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h index a00a4ab92a0f..ae1ac354c778 100644 --- a/drivers/input/mouse/alps.h +++ b/drivers/input/mouse/alps.h | |||
| @@ -39,6 +39,8 @@ struct alps_data { | |||
| 39 | int prev_fin; /* Finger bit from previous packet */ | 39 | int prev_fin; /* Finger bit from previous packet */ |
| 40 | int multi_packet; /* Multi-packet data in progress */ | 40 | int multi_packet; /* Multi-packet data in progress */ |
| 41 | unsigned char multi_data[6]; /* Saved multi-packet data */ | 41 | unsigned char multi_data[6]; /* Saved multi-packet data */ |
| 42 | int x1, x2, y1, y2; /* Coordinates from last MT report */ | ||
| 43 | int fingers; /* Number of fingers from MT report */ | ||
| 42 | u8 quirks; | 44 | u8 quirks; |
| 43 | struct timer_list timer; | 45 | struct timer_list timer; |
| 44 | }; | 46 | }; |
diff --git a/drivers/input/mouse/navpoint.c b/drivers/input/mouse/navpoint.c new file mode 100644 index 000000000000..c29ae7654d5e --- /dev/null +++ b/drivers/input/mouse/navpoint.c | |||
| @@ -0,0 +1,369 @@ | |||
| 1 | /* | ||
| 2 | * Synaptics NavPoint (PXA27x SSP/SPI) driver. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2012 Paul Parsons <lost.distance@yahoo.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 version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #include <linux/kernel.h> | ||
| 12 | #include <linux/init.h> | ||
| 13 | #include <linux/module.h> | ||
| 14 | #include <linux/platform_device.h> | ||
| 15 | #include <linux/clk.h> | ||
| 16 | #include <linux/delay.h> | ||
| 17 | #include <linux/gpio.h> | ||
| 18 | #include <linux/input.h> | ||
| 19 | #include <linux/input/navpoint.h> | ||
| 20 | #include <linux/interrupt.h> | ||
| 21 | #include <linux/mutex.h> | ||
| 22 | #include <linux/pxa2xx_ssp.h> | ||
| 23 | #include <linux/slab.h> | ||
| 24 | |||
| 25 | /* | ||
| 26 | * Synaptics Modular Embedded Protocol: Module Packet Format. | ||
| 27 | * Module header byte 2:0 = Length (# bytes that follow) | ||
| 28 | * Module header byte 4:3 = Control | ||
| 29 | * Module header byte 7:5 = Module Address | ||
| 30 | */ | ||
| 31 | #define HEADER_LENGTH(byte) ((byte) & 0x07) | ||
| 32 | #define HEADER_CONTROL(byte) (((byte) >> 3) & 0x03) | ||
| 33 | #define HEADER_ADDRESS(byte) ((byte) >> 5) | ||
| 34 | |||
| 35 | struct navpoint { | ||
| 36 | struct ssp_device *ssp; | ||
| 37 | struct input_dev *input; | ||
| 38 | struct device *dev; | ||
| 39 | int gpio; | ||
| 40 | int index; | ||
| 41 | u8 data[1 + HEADER_LENGTH(0xff)]; | ||
| 42 | }; | ||
| 43 | |||
| 44 | /* | ||
| 45 | * Initialization values for SSCR0_x, SSCR1_x, SSSR_x. | ||
| 46 | */ | ||
| 47 | static const u32 sscr0 = 0 | ||
| 48 | | SSCR0_TUM /* TIM = 1; No TUR interrupts */ | ||
| 49 | | SSCR0_RIM /* RIM = 1; No ROR interrupts */ | ||
| 50 | | SSCR0_SSE /* SSE = 1; SSP enabled */ | ||
| 51 | | SSCR0_Motorola /* FRF = 0; Motorola SPI */ | ||
| 52 | | SSCR0_DataSize(16) /* DSS = 15; Data size = 16-bit */ | ||
| 53 | ; | ||
| 54 | static const u32 sscr1 = 0 | ||
| 55 | | SSCR1_SCFR /* SCFR = 1; SSPSCLK only during transfers */ | ||
| 56 | | SSCR1_SCLKDIR /* SCLKDIR = 1; Slave mode */ | ||
| 57 | | SSCR1_SFRMDIR /* SFRMDIR = 1; Slave mode */ | ||
| 58 | | SSCR1_RWOT /* RWOT = 1; Receive without transmit mode */ | ||
| 59 | | SSCR1_RxTresh(1) /* RFT = 0; Receive FIFO threshold = 1 */ | ||
| 60 | | SSCR1_SPH /* SPH = 1; SSPSCLK inactive 0.5 + 1 cycles */ | ||
| 61 | | SSCR1_RIE /* RIE = 1; Receive FIFO interrupt enabled */ | ||
| 62 | ; | ||
| 63 | static const u32 sssr = 0 | ||
| 64 | | SSSR_BCE /* BCE = 1; Clear BCE */ | ||
| 65 | | SSSR_TUR /* TUR = 1; Clear TUR */ | ||
| 66 | | SSSR_EOC /* EOC = 1; Clear EOC */ | ||
| 67 | | SSSR_TINT /* TINT = 1; Clear TINT */ | ||
| 68 | | SSSR_PINT /* PINT = 1; Clear PINT */ | ||
| 69 | | SSSR_ROR /* ROR = 1; Clear ROR */ | ||
| 70 | ; | ||
| 71 | |||
| 72 | /* | ||
| 73 | * MEP Query $22: Touchpad Coordinate Range Query is not supported by | ||
| 74 | * the NavPoint module, so sampled values provide the default limits. | ||
| 75 | */ | ||
| 76 | #define NAVPOINT_X_MIN 1278 | ||
| 77 | #define NAVPOINT_X_MAX 5340 | ||
| 78 | #define NAVPOINT_Y_MIN 1572 | ||
| 79 | #define NAVPOINT_Y_MAX 4396 | ||
| 80 | #define NAVPOINT_PRESSURE_MIN 0 | ||
| 81 | #define NAVPOINT_PRESSURE_MAX 255 | ||
| 82 | |||
| 83 | static void navpoint_packet(struct navpoint *navpoint) | ||
| 84 | { | ||
| 85 | int finger; | ||
| 86 | int gesture; | ||
| 87 | int x, y, z; | ||
| 88 | |||
| 89 | switch (navpoint->data[0]) { | ||
| 90 | case 0xff: /* Garbage (packet?) between reset and Hello packet */ | ||
| 91 | case 0x00: /* Module 0, NULL packet */ | ||
| 92 | break; | ||
| 93 | |||
| 94 | case 0x0e: /* Module 0, Absolute packet */ | ||
| 95 | finger = (navpoint->data[1] & 0x01); | ||
| 96 | gesture = (navpoint->data[1] & 0x02); | ||
| 97 | x = ((navpoint->data[2] & 0x1f) << 8) | navpoint->data[3]; | ||
| 98 | y = ((navpoint->data[4] & 0x1f) << 8) | navpoint->data[5]; | ||
| 99 | z = navpoint->data[6]; | ||
| 100 | input_report_key(navpoint->input, BTN_TOUCH, finger); | ||
| 101 | input_report_abs(navpoint->input, ABS_X, x); | ||
| 102 | input_report_abs(navpoint->input, ABS_Y, y); | ||
| 103 | input_report_abs(navpoint->input, ABS_PRESSURE, z); | ||
| 104 | input_report_key(navpoint->input, BTN_TOOL_FINGER, finger); | ||
| 105 | input_report_key(navpoint->input, BTN_LEFT, gesture); | ||
| 106 | input_sync(navpoint->input); | ||
| 107 | break; | ||
| 108 | |||
| 109 | case 0x19: /* Module 0, Hello packet */ | ||
| 110 | if ((navpoint->data[1] & 0xf0) == 0x10) | ||
| 111 | break; | ||
| 112 | /* FALLTHROUGH */ | ||
| 113 | default: | ||
| 114 | dev_warn(navpoint->dev, | ||
| 115 | "spurious packet: data=0x%02x,0x%02x,...\n", | ||
| 116 | navpoint->data[0], navpoint->data[1]); | ||
| 117 | break; | ||
| 118 | } | ||
| 119 | } | ||
| 120 | |||
| 121 | static irqreturn_t navpoint_irq(int irq, void *dev_id) | ||
| 122 | { | ||
| 123 | struct navpoint *navpoint = dev_id; | ||
| 124 | struct ssp_device *ssp = navpoint->ssp; | ||
| 125 | irqreturn_t ret = IRQ_NONE; | ||
| 126 | u32 status; | ||
| 127 | |||
| 128 | status = pxa_ssp_read_reg(ssp, SSSR); | ||
| 129 | if (status & sssr) { | ||
| 130 | dev_warn(navpoint->dev, | ||
| 131 | "unexpected interrupt: status=0x%08x\n", status); | ||
| 132 | pxa_ssp_write_reg(ssp, SSSR, (status & sssr)); | ||
| 133 | ret = IRQ_HANDLED; | ||
| 134 | } | ||
| 135 | |||
| 136 | while (status & SSSR_RNE) { | ||
| 137 | u32 data; | ||
| 138 | |||
| 139 | data = pxa_ssp_read_reg(ssp, SSDR); | ||
| 140 | navpoint->data[navpoint->index + 0] = (data >> 8); | ||
| 141 | navpoint->data[navpoint->index + 1] = data; | ||
| 142 | navpoint->index += 2; | ||
| 143 | if (HEADER_LENGTH(navpoint->data[0]) < navpoint->index) { | ||
| 144 | navpoint_packet(navpoint); | ||
| 145 | navpoint->index = 0; | ||
| 146 | } | ||
| 147 | status = pxa_ssp_read_reg(ssp, SSSR); | ||
| 148 | ret = IRQ_HANDLED; | ||
| 149 | } | ||
| 150 | |||
| 151 | return ret; | ||
| 152 | } | ||
| 153 | |||
| 154 | static void navpoint_up(struct navpoint *navpoint) | ||
| 155 | { | ||
| 156 | struct ssp_device *ssp = navpoint->ssp; | ||
| 157 | int timeout; | ||
| 158 | |||
| 159 | clk_prepare_enable(ssp->clk); | ||
| 160 | |||
| 161 | pxa_ssp_write_reg(ssp, SSCR1, sscr1); | ||
| 162 | pxa_ssp_write_reg(ssp, SSSR, sssr); | ||
| 163 | pxa_ssp_write_reg(ssp, SSTO, 0); | ||
| 164 | pxa_ssp_write_reg(ssp, SSCR0, sscr0); /* SSCR0_SSE written last */ | ||
| 165 | |||
| 166 | /* Wait until SSP port is ready for slave clock operations */ | ||
| 167 | for (timeout = 100; timeout != 0; --timeout) { | ||
| 168 | if (!(pxa_ssp_read_reg(ssp, SSSR) & SSSR_CSS)) | ||
| 169 | break; | ||
| 170 | msleep(1); | ||
| 171 | } | ||
| 172 | |||
| 173 | if (timeout == 0) | ||
| 174 | dev_err(navpoint->dev, | ||
| 175 | "timeout waiting for SSSR[CSS] to clear\n"); | ||
| 176 | |||
| 177 | if (gpio_is_valid(navpoint->gpio)) | ||
| 178 | gpio_set_value(navpoint->gpio, 1); | ||
| 179 | } | ||
| 180 | |||
| 181 | static void navpoint_down(struct navpoint *navpoint) | ||
| 182 | { | ||
| 183 | struct ssp_device *ssp = navpoint->ssp; | ||
| 184 | |||
| 185 | if (gpio_is_valid(navpoint->gpio)) | ||
| 186 | gpio_set_value(navpoint->gpio, 0); | ||
| 187 | |||
| 188 | pxa_ssp_write_reg(ssp, SSCR0, 0); | ||
| 189 | |||
| 190 | clk_disable_unprepare(ssp->clk); | ||
| 191 | } | ||
| 192 | |||
| 193 | static int navpoint_open(struct input_dev *input) | ||
| 194 | { | ||
| 195 | struct navpoint *navpoint = input_get_drvdata(input); | ||
| 196 | |||
| 197 | navpoint_up(navpoint); | ||
| 198 | |||
| 199 | return 0; | ||
| 200 | } | ||
| 201 | |||
| 202 | static void navpoint_close(struct input_dev *input) | ||
| 203 | { | ||
| 204 | struct navpoint *navpoint = input_get_drvdata(input); | ||
| 205 | |||
| 206 | navpoint_down(navpoint); | ||
| 207 | } | ||
| 208 | |||
| 209 | static int __devinit navpoint_probe(struct platform_device *pdev) | ||
| 210 | { | ||
| 211 | const struct navpoint_platform_data *pdata = | ||
| 212 | dev_get_platdata(&pdev->dev); | ||
| 213 | struct ssp_device *ssp; | ||
| 214 | struct input_dev *input; | ||
| 215 | struct navpoint *navpoint; | ||
| 216 | int error; | ||
| 217 | |||
| 218 | if (!pdata) { | ||
| 219 | dev_err(&pdev->dev, "no platform data\n"); | ||
| 220 | return -EINVAL; | ||
| 221 | } | ||
| 222 | |||
| 223 | if (gpio_is_valid(pdata->gpio)) { | ||
| 224 | error = gpio_request_one(pdata->gpio, GPIOF_OUT_INIT_LOW, | ||
| 225 | "SYNAPTICS_ON"); | ||
| 226 | if (error) | ||
| 227 | return error; | ||
| 228 | } | ||
| 229 | |||
| 230 | ssp = pxa_ssp_request(pdata->port, pdev->name); | ||
| 231 | if (!ssp) { | ||
| 232 | error = -ENODEV; | ||
| 233 | goto err_free_gpio; | ||
| 234 | } | ||
| 235 | |||
| 236 | /* HaRET does not disable devices before jumping into Linux */ | ||
| 237 | if (pxa_ssp_read_reg(ssp, SSCR0) & SSCR0_SSE) { | ||
| 238 | pxa_ssp_write_reg(ssp, SSCR0, 0); | ||
| 239 | dev_warn(&pdev->dev, "ssp%d already enabled\n", pdata->port); | ||
| 240 | } | ||
| 241 | |||
| 242 | navpoint = kzalloc(sizeof(*navpoint), GFP_KERNEL); | ||
| 243 | input = input_allocate_device(); | ||
| 244 | if (!navpoint || !input) { | ||
| 245 | error = -ENOMEM; | ||
| 246 | goto err_free_mem; | ||
| 247 | } | ||
| 248 | |||
| 249 | navpoint->ssp = ssp; | ||
| 250 | navpoint->input = input; | ||
| 251 | navpoint->dev = &pdev->dev; | ||
| 252 | navpoint->gpio = pdata->gpio; | ||
| 253 | |||
| 254 | input->name = pdev->name; | ||
| 255 | input->dev.parent = &pdev->dev; | ||
| 256 | |||
| 257 | __set_bit(EV_KEY, input->evbit); | ||
| 258 | __set_bit(EV_ABS, input->evbit); | ||
| 259 | __set_bit(BTN_LEFT, input->keybit); | ||
| 260 | __set_bit(BTN_TOUCH, input->keybit); | ||
| 261 | __set_bit(BTN_TOOL_FINGER, input->keybit); | ||
| 262 | |||
| 263 | input_set_abs_params(input, ABS_X, | ||
| 264 | NAVPOINT_X_MIN, NAVPOINT_X_MAX, 0, 0); | ||
| 265 | input_set_abs_params(input, ABS_Y, | ||
| 266 | NAVPOINT_Y_MIN, NAVPOINT_Y_MAX, 0, 0); | ||
| 267 | input_set_abs_params(input, ABS_PRESSURE, | ||
| 268 | NAVPOINT_PRESSURE_MIN, NAVPOINT_PRESSURE_MAX, | ||
| 269 | 0, 0); | ||
| 270 | |||
| 271 | input->open = navpoint_open; | ||
| 272 | input->close = navpoint_close; | ||
| 273 | |||
| 274 | input_set_drvdata(input, navpoint); | ||
| 275 | |||
| 276 | error = request_irq(ssp->irq, navpoint_irq, 0, pdev->name, navpoint); | ||
| 277 | if (error) | ||
| 278 | goto err_free_mem; | ||
| 279 | |||
| 280 | error = input_register_device(input); | ||
| 281 | if (error) | ||
| 282 | goto err_free_irq; | ||
| 283 | |||
| 284 | platform_set_drvdata(pdev, navpoint); | ||
| 285 | dev_dbg(&pdev->dev, "ssp%d, irq %d\n", pdata->port, ssp->irq); | ||
| 286 | |||
| 287 | return 0; | ||
| 288 | |||
| 289 | err_free_irq: | ||
| 290 | free_irq(ssp->irq, &pdev->dev); | ||
| 291 | err_free_mem: | ||
| 292 | input_free_device(input); | ||
| 293 | kfree(navpoint); | ||
| 294 | pxa_ssp_free(ssp); | ||
| 295 | err_free_gpio: | ||
| 296 | if (gpio_is_valid(pdata->gpio)) | ||
| 297 | gpio_free(pdata->gpio); | ||
| 298 | |||
| 299 | return error; | ||
| 300 | } | ||
| 301 | |||
| 302 | static int __devexit navpoint_remove(struct platform_device *pdev) | ||
| 303 | { | ||
| 304 | const struct navpoint_platform_data *pdata = | ||
| 305 | dev_get_platdata(&pdev->dev); | ||
| 306 | struct navpoint *navpoint = platform_get_drvdata(pdev); | ||
| 307 | struct ssp_device *ssp = navpoint->ssp; | ||
| 308 | |||
| 309 | free_irq(ssp->irq, navpoint); | ||
| 310 | |||
| 311 | input_unregister_device(navpoint->input); | ||
| 312 | kfree(navpoint); | ||
| 313 | |||
| 314 | pxa_ssp_free(ssp); | ||
| 315 | |||
| 316 | if (gpio_is_valid(pdata->gpio)) | ||
| 317 | gpio_free(pdata->gpio); | ||
| 318 | |||
| 319 | return 0; | ||
| 320 | } | ||
| 321 | |||
| 322 | #ifdef CONFIG_PM_SLEEP | ||
| 323 | static int navpoint_suspend(struct device *dev) | ||
| 324 | { | ||
| 325 | struct platform_device *pdev = to_platform_device(dev); | ||
| 326 | struct navpoint *navpoint = platform_get_drvdata(pdev); | ||
| 327 | struct input_dev *input = navpoint->input; | ||
| 328 | |||
| 329 | mutex_lock(&input->mutex); | ||
| 330 | if (input->users) | ||
| 331 | navpoint_down(navpoint); | ||
| 332 | mutex_unlock(&input->mutex); | ||
| 333 | |||
| 334 | return 0; | ||
| 335 | } | ||
| 336 | |||
| 337 | static int navpoint_resume(struct device *dev) | ||
| 338 | { | ||
| 339 | struct platform_device *pdev = to_platform_device(dev); | ||
| 340 | struct navpoint *navpoint = platform_get_drvdata(pdev); | ||
| 341 | struct input_dev *input = navpoint->input; | ||
| 342 | |||
| 343 | mutex_lock(&input->mutex); | ||
| 344 | if (input->users) | ||
| 345 | navpoint_up(navpoint); | ||
| 346 | mutex_unlock(&input->mutex); | ||
| 347 | |||
| 348 | return 0; | ||
| 349 | } | ||
| 350 | #endif | ||
| 351 | |||
| 352 | static SIMPLE_DEV_PM_OPS(navpoint_pm_ops, navpoint_suspend, navpoint_resume); | ||
| 353 | |||
| 354 | static struct platform_driver navpoint_driver = { | ||
| 355 | .probe = navpoint_probe, | ||
| 356 | .remove = __devexit_p(navpoint_remove), | ||
| 357 | .driver = { | ||
| 358 | .name = "navpoint", | ||
| 359 | .owner = THIS_MODULE, | ||
| 360 | .pm = &navpoint_pm_ops, | ||
| 361 | }, | ||
| 362 | }; | ||
| 363 | |||
| 364 | module_platform_driver(navpoint_driver); | ||
| 365 | |||
| 366 | MODULE_AUTHOR("Paul Parsons <lost.distance@yahoo.com>"); | ||
| 367 | MODULE_DESCRIPTION("Synaptics NavPoint (PXA27x SSP/SPI) driver"); | ||
| 368 | MODULE_LICENSE("GPL"); | ||
| 369 | MODULE_ALIAS("platform:navpoint"); | ||
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c index 661a0ca3b3d6..3f5649f19082 100644 --- a/drivers/input/mouse/sentelic.c +++ b/drivers/input/mouse/sentelic.c | |||
| @@ -41,7 +41,7 @@ | |||
| 41 | #define GET_ABS_Y(packet) ((packet[2] << 2) | (packet[3] & 0x03)) | 41 | #define GET_ABS_Y(packet) ((packet[2] << 2) | (packet[3] & 0x03)) |
| 42 | 42 | ||
| 43 | /** Driver version. */ | 43 | /** Driver version. */ |
| 44 | static const char fsp_drv_ver[] = "1.0.0-K"; | 44 | static const char fsp_drv_ver[] = "1.1.0-K"; |
| 45 | 45 | ||
| 46 | /* | 46 | /* |
| 47 | * Make sure that the value being sent to FSP will not conflict with | 47 | * Make sure that the value being sent to FSP will not conflict with |
| @@ -303,6 +303,27 @@ static int fsp_get_revision(struct psmouse *psmouse, int *rev) | |||
| 303 | return 0; | 303 | return 0; |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | static int fsp_get_sn(struct psmouse *psmouse, int *sn) | ||
| 307 | { | ||
| 308 | int v0, v1, v2; | ||
| 309 | int rc = -EIO; | ||
| 310 | |||
| 311 | /* production number since Cx is available at: 0x0b40 ~ 0x0b42 */ | ||
| 312 | if (fsp_page_reg_write(psmouse, FSP_PAGE_0B)) | ||
| 313 | goto out; | ||
| 314 | if (fsp_reg_read(psmouse, FSP_REG_SN0, &v0)) | ||
| 315 | goto out; | ||
| 316 | if (fsp_reg_read(psmouse, FSP_REG_SN1, &v1)) | ||
| 317 | goto out; | ||
| 318 | if (fsp_reg_read(psmouse, FSP_REG_SN2, &v2)) | ||
| 319 | goto out; | ||
| 320 | *sn = (v0 << 16) | (v1 << 8) | v2; | ||
| 321 | rc = 0; | ||
| 322 | out: | ||
| 323 | fsp_page_reg_write(psmouse, FSP_PAGE_DEFAULT); | ||
| 324 | return rc; | ||
| 325 | } | ||
| 326 | |||
| 306 | static int fsp_get_buttons(struct psmouse *psmouse, int *btn) | 327 | static int fsp_get_buttons(struct psmouse *psmouse, int *btn) |
| 307 | { | 328 | { |
| 308 | static const int buttons[] = { | 329 | static const int buttons[] = { |
| @@ -1000,16 +1021,21 @@ static int fsp_reconnect(struct psmouse *psmouse) | |||
| 1000 | int fsp_init(struct psmouse *psmouse) | 1021 | int fsp_init(struct psmouse *psmouse) |
| 1001 | { | 1022 | { |
| 1002 | struct fsp_data *priv; | 1023 | struct fsp_data *priv; |
| 1003 | int ver, rev; | 1024 | int ver, rev, sn = 0; |
| 1004 | int error; | 1025 | int error; |
| 1005 | 1026 | ||
| 1006 | if (fsp_get_version(psmouse, &ver) || | 1027 | if (fsp_get_version(psmouse, &ver) || |
| 1007 | fsp_get_revision(psmouse, &rev)) { | 1028 | fsp_get_revision(psmouse, &rev)) { |
| 1008 | return -ENODEV; | 1029 | return -ENODEV; |
| 1009 | } | 1030 | } |
| 1031 | if (ver >= FSP_VER_STL3888_C0) { | ||
| 1032 | /* firmware information is only available since C0 */ | ||
| 1033 | fsp_get_sn(psmouse, &sn); | ||
| 1034 | } | ||
| 1010 | 1035 | ||
| 1011 | psmouse_info(psmouse, "Finger Sensing Pad, hw: %d.%d.%d, sw: %s\n", | 1036 | psmouse_info(psmouse, |
| 1012 | ver >> 4, ver & 0x0F, rev, fsp_drv_ver); | 1037 | "Finger Sensing Pad, hw: %d.%d.%d, sn: %x, sw: %s\n", |
| 1038 | ver >> 4, ver & 0x0F, rev, sn, fsp_drv_ver); | ||
| 1013 | 1039 | ||
| 1014 | psmouse->private = priv = kzalloc(sizeof(struct fsp_data), GFP_KERNEL); | 1040 | psmouse->private = priv = kzalloc(sizeof(struct fsp_data), GFP_KERNEL); |
| 1015 | if (!priv) | 1041 | if (!priv) |
diff --git a/drivers/input/mouse/sentelic.h b/drivers/input/mouse/sentelic.h index 334de19e5ddb..aa697ece405b 100644 --- a/drivers/input/mouse/sentelic.h +++ b/drivers/input/mouse/sentelic.h | |||
| @@ -65,6 +65,14 @@ | |||
| 65 | #define FSP_BIT_SWC1_GST_GRP1 BIT(6) | 65 | #define FSP_BIT_SWC1_GST_GRP1 BIT(6) |
| 66 | #define FSP_BIT_SWC1_BX_COMPAT BIT(7) | 66 | #define FSP_BIT_SWC1_BX_COMPAT BIT(7) |
| 67 | 67 | ||
| 68 | #define FSP_PAGE_0B (0x0b) | ||
| 69 | #define FSP_PAGE_82 (0x82) | ||
| 70 | #define FSP_PAGE_DEFAULT FSP_PAGE_82 | ||
| 71 | |||
| 72 | #define FSP_REG_SN0 (0x40) | ||
| 73 | #define FSP_REG_SN1 (0x41) | ||
| 74 | #define FSP_REG_SN2 (0x42) | ||
| 75 | |||
| 68 | /* Finger-sensing Pad packet formating related definitions */ | 76 | /* Finger-sensing Pad packet formating related definitions */ |
| 69 | 77 | ||
| 70 | /* absolute packet type */ | 78 | /* absolute packet type */ |
diff --git a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c index 17ff137b9bd5..d5928fd0c914 100644 --- a/drivers/input/mouse/sermouse.c +++ b/drivers/input/mouse/sermouse.c | |||
| @@ -355,15 +355,4 @@ static struct serio_driver sermouse_drv = { | |||
| 355 | .disconnect = sermouse_disconnect, | 355 | .disconnect = sermouse_disconnect, |
| 356 | }; | 356 | }; |
| 357 | 357 | ||
| 358 | static int __init sermouse_init(void) | 358 | module_serio_driver(sermouse_drv); |
| 359 | { | ||
| 360 | return serio_register_driver(&sermouse_drv); | ||
| 361 | } | ||
| 362 | |||
| 363 | static void __exit sermouse_exit(void) | ||
| 364 | { | ||
| 365 | serio_unregister_driver(&sermouse_drv); | ||
| 366 | } | ||
| 367 | |||
| 368 | module_init(sermouse_init); | ||
| 369 | module_exit(sermouse_exit); | ||
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index a4b14a41cbf4..c703d53be3a0 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
| @@ -45,16 +45,6 @@ | |||
| 45 | #define YMIN_NOMINAL 1408 | 45 | #define YMIN_NOMINAL 1408 |
| 46 | #define YMAX_NOMINAL 4448 | 46 | #define YMAX_NOMINAL 4448 |
| 47 | 47 | ||
| 48 | /* | ||
| 49 | * Synaptics touchpads report the y coordinate from bottom to top, which is | ||
| 50 | * opposite from what userspace expects. | ||
| 51 | * This function is used to invert y before reporting. | ||
| 52 | */ | ||
| 53 | static int synaptics_invert_y(int y) | ||
| 54 | { | ||
| 55 | return YMAX_NOMINAL + YMIN_NOMINAL - y; | ||
| 56 | } | ||
| 57 | |||
| 58 | 48 | ||
| 59 | /***************************************************************************** | 49 | /***************************************************************************** |
| 60 | * Stuff we need even when we do not want native Synaptics support | 50 | * Stuff we need even when we do not want native Synaptics support |
| @@ -112,6 +102,16 @@ void synaptics_reset(struct psmouse *psmouse) | |||
| 112 | ****************************************************************************/ | 102 | ****************************************************************************/ |
| 113 | 103 | ||
| 114 | /* | 104 | /* |
| 105 | * Synaptics touchpads report the y coordinate from bottom to top, which is | ||
| 106 | * opposite from what userspace expects. | ||
| 107 | * This function is used to invert y before reporting. | ||
| 108 | */ | ||
| 109 | static int synaptics_invert_y(int y) | ||
| 110 | { | ||
| 111 | return YMAX_NOMINAL + YMIN_NOMINAL - y; | ||
| 112 | } | ||
| 113 | |||
| 114 | /* | ||
| 115 | * Send a command to the synpatics touchpad by special commands | 115 | * Send a command to the synpatics touchpad by special commands |
| 116 | */ | 116 | */ |
| 117 | static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, unsigned char *param) | 117 | static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, unsigned char *param) |
diff --git a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c index eb9a3cfbeefa..e900d465aaf6 100644 --- a/drivers/input/mouse/vsxxxaa.c +++ b/drivers/input/mouse/vsxxxaa.c | |||
| @@ -548,16 +548,4 @@ static struct serio_driver vsxxxaa_drv = { | |||
| 548 | .disconnect = vsxxxaa_disconnect, | 548 | .disconnect = vsxxxaa_disconnect, |
| 549 | }; | 549 | }; |
| 550 | 550 | ||
| 551 | static int __init vsxxxaa_init(void) | 551 | module_serio_driver(vsxxxaa_drv); |
| 552 | { | ||
| 553 | return serio_register_driver(&vsxxxaa_drv); | ||
| 554 | } | ||
| 555 | |||
| 556 | static void __exit vsxxxaa_exit(void) | ||
| 557 | { | ||
| 558 | serio_unregister_driver(&vsxxxaa_drv); | ||
| 559 | } | ||
| 560 | |||
| 561 | module_init(vsxxxaa_init); | ||
| 562 | module_exit(vsxxxaa_exit); | ||
| 563 | |||
