diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-10 13:55:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-10 13:55:52 -0500 |
commit | dbe950f201a8edd353b0bd9079e8d536ee4ce37c (patch) | |
tree | dffbada6b3d33cc67383758570de22b4f45693b6 | |
parent | f62f61917d72c1fb0101ad405664f6fc868d676b (diff) | |
parent | da733563be5a9da26fe81d9f007262d00b846e22 (diff) |
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: (64 commits)
Input: tc3589x-keypad - add missing kerneldoc
Input: ucb1400-ts - switch to using dev_xxx() for diagnostic messages
Input: ucb1400_ts - convert to threaded IRQ
Input: ucb1400_ts - drop inline annotations
Input: usb1400_ts - add __devinit/__devexit section annotations
Input: ucb1400_ts - set driver owner
Input: ucb1400_ts - convert to use dev_pm_ops
Input: psmouse - make sure we do not use stale methods
Input: evdev - do not block waiting for an event if fd is nonblock
Input: evdev - if no events and non-block, return EAGAIN not 0
Input: evdev - only allow reading events if a full packet is present
Input: add driver for pixcir i2c touchscreens
Input: samsung-keypad - implement runtime power management support
Input: tegra-kbc - report wakeup key for some platforms
Input: tegra-kbc - add device tree bindings
Input: add driver for AUO In-Cell touchscreens using pixcir ICs
Input: mpu3050 - configure the sampling method
Input: mpu3050 - ensure we enable interrupts
Input: mpu3050 - add of_match table for device-tree probing
Input: sentelic - document the latest hardware
...
Fix up fairly trivial conflicts (device tree matching conflicting with
some independent cleanups) in drivers/input/keyboard/samsung-keypad.c
132 files changed, 5550 insertions, 1645 deletions
diff --git a/Documentation/ABI/testing/sysfs-driver-wacom b/Documentation/ABI/testing/sysfs-driver-wacom index 82d4df136444..0130d6683c14 100644 --- a/Documentation/ABI/testing/sysfs-driver-wacom +++ b/Documentation/ABI/testing/sysfs-driver-wacom | |||
@@ -15,9 +15,9 @@ Contact: linux-input@vger.kernel.org | |||
15 | Description: | 15 | Description: |
16 | Attribute group for control of the status LEDs and the OLEDs. | 16 | Attribute group for control of the status LEDs and the OLEDs. |
17 | This attribute group is only available for Intuos 4 M, L, | 17 | This attribute group is only available for Intuos 4 M, L, |
18 | and XL (with LEDs and OLEDs) and Cintiq 21UX2 (LEDs only). | 18 | and XL (with LEDs and OLEDs) and Cintiq 21UX2 and Cintiq 24HD |
19 | Therefore its presence implicitly signifies the presence of | 19 | (LEDs only). Therefore its presence implicitly signifies the |
20 | said LEDs and OLEDs on the tablet device. | 20 | presence of said LEDs and OLEDs on the tablet device. |
21 | 21 | ||
22 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status0_luminance | 22 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status0_luminance |
23 | Date: August 2011 | 23 | Date: August 2011 |
@@ -41,16 +41,17 @@ Date: August 2011 | |||
41 | Contact: linux-input@vger.kernel.org | 41 | Contact: linux-input@vger.kernel.org |
42 | Description: | 42 | Description: |
43 | Writing to this file sets which one of the four (for Intuos 4) | 43 | Writing to this file sets which one of the four (for Intuos 4) |
44 | or of the right four (for Cintiq 21UX2) status LEDs is active (0..3). | 44 | or of the right four (for Cintiq 21UX2 and Cintiq 24HD) status |
45 | The other three LEDs on the same side are always inactive. | 45 | LEDs is active (0..3). The other three LEDs on the same side are |
46 | always inactive. | ||
46 | 47 | ||
47 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led1_select | 48 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led1_select |
48 | Date: September 2011 | 49 | Date: September 2011 |
49 | Contact: linux-input@vger.kernel.org | 50 | Contact: linux-input@vger.kernel.org |
50 | Description: | 51 | Description: |
51 | Writing to this file sets which one of the left four (for Cintiq 21UX2) | 52 | Writing to this file sets which one of the left four (for Cintiq 21UX2 |
52 | status LEDs is active (0..3). The other three LEDs on the left are always | 53 | and Cintiq 24HD) status LEDs is active (0..3). The other three LEDs on |
53 | inactive. | 54 | the left are always inactive. |
54 | 55 | ||
55 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/buttons_luminance | 56 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/buttons_luminance |
56 | Date: August 2011 | 57 | Date: August 2011 |
diff --git a/Documentation/devicetree/bindings/input/tegra-kbc.txt b/Documentation/devicetree/bindings/input/tegra-kbc.txt new file mode 100644 index 000000000000..5ecfa99089b4 --- /dev/null +++ b/Documentation/devicetree/bindings/input/tegra-kbc.txt | |||
@@ -0,0 +1,18 @@ | |||
1 | * Tegra keyboard controller | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: "nvidia,tegra20-kbc" | ||
5 | |||
6 | Optional properties: | ||
7 | - debounce-delay: delay in milliseconds per row scan for debouncing | ||
8 | - repeat-delay: delay in milliseconds before repeat starts | ||
9 | - ghost-filter: enable ghost filtering for this device | ||
10 | - wakeup-source: configure keyboard as a wakeup source for suspend/resume | ||
11 | |||
12 | Example: | ||
13 | |||
14 | keyboard: keyboard { | ||
15 | compatible = "nvidia,tegra20-kbc"; | ||
16 | reg = <0x7000e200 0x100>; | ||
17 | ghost-filter; | ||
18 | }; | ||
diff --git a/Documentation/input/alps.txt b/Documentation/input/alps.txt new file mode 100644 index 000000000000..f274c28b5103 --- /dev/null +++ b/Documentation/input/alps.txt | |||
@@ -0,0 +1,188 @@ | |||
1 | ALPS Touchpad Protocol | ||
2 | ---------------------- | ||
3 | |||
4 | Introduction | ||
5 | ------------ | ||
6 | |||
7 | Currently the ALPS touchpad driver supports four protocol versions in use by | ||
8 | ALPS touchpads, called versions 1, 2, 3, and 4. Information about the various | ||
9 | protocol versions is contained in the following sections. | ||
10 | |||
11 | Detection | ||
12 | --------- | ||
13 | |||
14 | All ALPS touchpads should respond to the "E6 report" command sequence: | ||
15 | E8-E6-E6-E6-E9. An ALPS touchpad should respond with either 00-00-0A or | ||
16 | 00-00-64. | ||
17 | |||
18 | If the E6 report is successful, the touchpad model is identified using the "E7 | ||
19 | report" sequence: E8-E7-E7-E7-E9. The response is the model signature and is | ||
20 | matched against known models in the alps_model_data_array. | ||
21 | |||
22 | With protocol versions 3 and 4, the E7 report model signature is always | ||
23 | 73-02-64. To differentiate between these versions, the response from the | ||
24 | "Enter Command Mode" sequence must be inspected as described below. | ||
25 | |||
26 | Command Mode | ||
27 | ------------ | ||
28 | |||
29 | Protocol versions 3 and 4 have a command mode that is used to read and write | ||
30 | one-byte device registers in a 16-bit address space. The command sequence | ||
31 | EC-EC-EC-E9 places the device in command mode, and the device will respond | ||
32 | with 88-07 followed by a third byte. This third byte can be used to determine | ||
33 | whether the devices uses the version 3 or 4 protocol. | ||
34 | |||
35 | To exit command mode, PSMOUSE_CMD_SETSTREAM (EA) is sent to the touchpad. | ||
36 | |||
37 | While in command mode, register addresses can be set by first sending a | ||
38 | specific command, either EC for v3 devices or F5 for v4 devices. Then the | ||
39 | address is sent one nibble at a time, where each nibble is encoded as a | ||
40 | command with optional data. This enoding differs slightly between the v3 and | ||
41 | v4 protocols. | ||
42 | |||
43 | Once an address has been set, the addressed register can be read by sending | ||
44 | PSMOUSE_CMD_GETINFO (E9). The first two bytes of the response contains the | ||
45 | address of the register being read, and the third contains the value of the | ||
46 | register. Registers are written by writing the value one nibble at a time | ||
47 | using the same encoding used for addresses. | ||
48 | |||
49 | Packet Format | ||
50 | ------------- | ||
51 | |||
52 | In the following tables, the following notation is used. | ||
53 | |||
54 | CAPITALS = stick, miniscules = touchpad | ||
55 | |||
56 | ?'s can have different meanings on different models, such as wheel rotation, | ||
57 | extra buttons, stick buttons on a dualpoint, etc. | ||
58 | |||
59 | PS/2 packet format | ||
60 | ------------------ | ||
61 | |||
62 | byte 0: 0 0 YSGN XSGN 1 M R L | ||
63 | byte 1: X7 X6 X5 X4 X3 X2 X1 X0 | ||
64 | byte 2: Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 | ||
65 | |||
66 | Note that the device never signals overflow condition. | ||
67 | |||
68 | ALPS Absolute Mode - Protocol Verion 1 | ||
69 | -------------------------------------- | ||
70 | |||
71 | byte 0: 1 0 0 0 1 x9 x8 x7 | ||
72 | byte 1: 0 x6 x5 x4 x3 x2 x1 x0 | ||
73 | byte 2: 0 ? ? l r ? fin ges | ||
74 | byte 3: 0 ? ? ? ? y9 y8 y7 | ||
75 | byte 4: 0 y6 y5 y4 y3 y2 y1 y0 | ||
76 | byte 5: 0 z6 z5 z4 z3 z2 z1 z0 | ||
77 | |||
78 | ALPS Absolute Mode - Protocol Version 2 | ||
79 | --------------------------------------- | ||
80 | |||
81 | byte 0: 1 ? ? ? 1 ? ? ? | ||
82 | byte 1: 0 x6 x5 x4 x3 x2 x1 x0 | ||
83 | byte 2: 0 x10 x9 x8 x7 ? fin ges | ||
84 | byte 3: 0 y9 y8 y7 1 M R L | ||
85 | byte 4: 0 y6 y5 y4 y3 y2 y1 y0 | ||
86 | byte 5: 0 z6 z5 z4 z3 z2 z1 z0 | ||
87 | |||
88 | Dualpoint device -- interleaved packet format | ||
89 | --------------------------------------------- | ||
90 | |||
91 | byte 0: 1 1 0 0 1 1 1 1 | ||
92 | byte 1: 0 x6 x5 x4 x3 x2 x1 x0 | ||
93 | byte 2: 0 x10 x9 x8 x7 0 fin ges | ||
94 | byte 3: 0 0 YSGN XSGN 1 1 1 1 | ||
95 | byte 4: X7 X6 X5 X4 X3 X2 X1 X0 | ||
96 | byte 5: Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 | ||
97 | byte 6: 0 y9 y8 y7 1 m r l | ||
98 | byte 7: 0 y6 y5 y4 y3 y2 y1 y0 | ||
99 | byte 8: 0 z6 z5 z4 z3 z2 z1 z0 | ||
100 | |||
101 | ALPS Absolute Mode - Protocol Version 3 | ||
102 | --------------------------------------- | ||
103 | |||
104 | ALPS protocol version 3 has three different packet formats. The first two are | ||
105 | associated with touchpad events, and the third is associatd with trackstick | ||
106 | events. | ||
107 | |||
108 | The first type is the touchpad position packet. | ||
109 | |||
110 | byte 0: 1 ? x1 x0 1 1 1 1 | ||
111 | byte 1: 0 x10 x9 x8 x7 x6 x5 x4 | ||
112 | byte 2: 0 y10 y9 y8 y7 y6 y5 y4 | ||
113 | byte 3: 0 M R L 1 m r l | ||
114 | byte 4: 0 mt x3 x2 y3 y2 y1 y0 | ||
115 | byte 5: 0 z6 z5 z4 z3 z2 z1 z0 | ||
116 | |||
117 | Note that for some devices the trackstick buttons are reported in this packet, | ||
118 | and on others it is reported in the trackstick packets. | ||
119 | |||
120 | The second packet type contains bitmaps representing the x and y axes. In the | ||
121 | bitmaps a given bit is set if there is a finger covering that position on the | ||
122 | given axis. Thus the bitmap packet can be used for low-resolution multi-touch | ||
123 | data, although finger tracking is not possible. This packet also encodes the | ||
124 | number of contacts (f1 and f0 in the table below). | ||
125 | |||
126 | byte 0: 1 1 x1 x0 1 1 1 1 | ||
127 | byte 1: 0 x8 x7 x6 x5 x4 x3 x2 | ||
128 | byte 2: 0 y7 y6 y5 y4 y3 y2 y1 | ||
129 | byte 3: 0 y10 y9 y8 1 1 1 1 | ||
130 | byte 4: 0 x14 x13 x12 x11 x10 x9 y0 | ||
131 | byte 5: 0 1 ? ? ? ? f1 f0 | ||
132 | |||
133 | This packet only appears after a position packet with the mt bit set, and | ||
134 | ususally only appears when there are two or more contacts (although | ||
135 | ocassionally it's seen with only a single contact). | ||
136 | |||
137 | The final v3 packet type is the trackstick packet. | ||
138 | |||
139 | byte 0: 1 1 x7 y7 1 1 1 1 | ||
140 | byte 1: 0 x6 x5 x4 x3 x2 x1 x0 | ||
141 | byte 2: 0 y6 y5 y4 y3 y2 y1 y0 | ||
142 | byte 3: 0 1 0 0 1 0 0 0 | ||
143 | byte 4: 0 z4 z3 z2 z1 z0 ? ? | ||
144 | byte 5: 0 0 1 1 1 1 1 1 | ||
145 | |||
146 | ALPS Absolute Mode - Protocol Version 4 | ||
147 | --------------------------------------- | ||
148 | |||
149 | Protocol version 4 has an 8-byte packet format. | ||
150 | |||
151 | byte 0: 1 ? x1 x0 1 1 1 1 | ||
152 | byte 1: 0 x10 x9 x8 x7 x6 x5 x4 | ||
153 | byte 2: 0 y10 y9 y8 y7 y6 y5 y4 | ||
154 | byte 3: 0 1 x3 x2 y3 y2 y1 y0 | ||
155 | byte 4: 0 ? ? ? 1 ? r l | ||
156 | byte 5: 0 z6 z5 z4 z3 z2 z1 z0 | ||
157 | byte 6: bitmap data (described below) | ||
158 | byte 7: bitmap data (described below) | ||
159 | |||
160 | The last two bytes represent a partial bitmap packet, with 3 full packets | ||
161 | required to construct a complete bitmap packet. Once assembled, the 6-byte | ||
162 | bitmap packet has the following format: | ||
163 | |||
164 | byte 0: 0 1 x7 x6 x5 x4 x3 x2 | ||
165 | byte 1: 0 x1 x0 y4 y3 y2 y1 y0 | ||
166 | byte 2: 0 0 ? x14 x13 x12 x11 x10 | ||
167 | byte 3: 0 x9 x8 y9 y8 y7 y6 y5 | ||
168 | byte 4: 0 0 0 0 0 0 0 0 | ||
169 | byte 5: 0 0 0 0 0 0 0 y10 | ||
170 | |||
171 | There are several things worth noting here. | ||
172 | |||
173 | 1) In the bitmap data, bit 6 of byte 0 serves as a sync byte to | ||
174 | identify the first fragment of a bitmap packet. | ||
175 | |||
176 | 2) The bitmaps represent the same data as in the v3 bitmap packets, although | ||
177 | the packet layout is different. | ||
178 | |||
179 | 3) There doesn't seem to be a count of the contact points anywhere in the v4 | ||
180 | protocol packets. Deriving a count of contact points must be done by | ||
181 | analyzing the bitmaps. | ||
182 | |||
183 | 4) There is a 3 to 1 ratio of position packets to bitmap packets. Therefore | ||
184 | MT position can only be updated for every third ST position update, and | ||
185 | the count of contact points can only be updated every third packet as | ||
186 | well. | ||
187 | |||
188 | So far no v4 devices with tracksticks have been encountered. | ||
diff --git a/Documentation/input/gpio-tilt.txt b/Documentation/input/gpio-tilt.txt new file mode 100644 index 000000000000..06d60c3ff5e7 --- /dev/null +++ b/Documentation/input/gpio-tilt.txt | |||
@@ -0,0 +1,103 @@ | |||
1 | Driver for tilt-switches connected via GPIOs | ||
2 | ============================================ | ||
3 | |||
4 | Generic driver to read data from tilt switches connected via gpios. | ||
5 | Orientation can be provided by one or more than one tilt switches, | ||
6 | i.e. each tilt switch providing one axis, and the number of axes | ||
7 | is also not limited. | ||
8 | |||
9 | |||
10 | Data structures: | ||
11 | ---------------- | ||
12 | |||
13 | The array of struct gpio in the gpios field is used to list the gpios | ||
14 | that represent the current tilt state. | ||
15 | |||
16 | The array of struct gpio_tilt_axis describes the axes that are reported | ||
17 | to the input system. The values set therein are used for the | ||
18 | input_set_abs_params calls needed to init the axes. | ||
19 | |||
20 | The array of struct gpio_tilt_state maps gpio states to the corresponding | ||
21 | values to report. The gpio state is represented as a bitfield where the | ||
22 | bit-index corresponds to the index of the gpio in the struct gpio array. | ||
23 | In the same manner the values stored in the axes array correspond to | ||
24 | the elements of the gpio_tilt_axis-array. | ||
25 | |||
26 | |||
27 | Example: | ||
28 | -------- | ||
29 | |||
30 | Example configuration for a single TS1003 tilt switch that rotates around | ||
31 | one axis in 4 steps and emitts the current tilt via two GPIOs. | ||
32 | |||
33 | static int sg060_tilt_enable(struct device *dev) { | ||
34 | /* code to enable the sensors */ | ||
35 | }; | ||
36 | |||
37 | static void sg060_tilt_disable(struct device *dev) { | ||
38 | /* code to disable the sensors */ | ||
39 | }; | ||
40 | |||
41 | static struct gpio sg060_tilt_gpios[] = { | ||
42 | { SG060_TILT_GPIO_SENSOR1, GPIOF_IN, "tilt_sensor1" }, | ||
43 | { SG060_TILT_GPIO_SENSOR2, GPIOF_IN, "tilt_sensor2" }, | ||
44 | }; | ||
45 | |||
46 | static struct gpio_tilt_state sg060_tilt_states[] = { | ||
47 | { | ||
48 | .gpios = (0 << 1) | (0 << 0), | ||
49 | .axes = (int[]) { | ||
50 | 0, | ||
51 | }, | ||
52 | }, { | ||
53 | .gpios = (0 << 1) | (1 << 0), | ||
54 | .axes = (int[]) { | ||
55 | 1, /* 90 degrees */ | ||
56 | }, | ||
57 | }, { | ||
58 | .gpios = (1 << 1) | (1 << 0), | ||
59 | .axes = (int[]) { | ||
60 | 2, /* 180 degrees */ | ||
61 | }, | ||
62 | }, { | ||
63 | .gpios = (1 << 1) | (0 << 0), | ||
64 | .axes = (int[]) { | ||
65 | 3, /* 270 degrees */ | ||
66 | }, | ||
67 | }, | ||
68 | }; | ||
69 | |||
70 | static struct gpio_tilt_axis sg060_tilt_axes[] = { | ||
71 | { | ||
72 | .axis = ABS_RY, | ||
73 | .min = 0, | ||
74 | .max = 3, | ||
75 | .fuzz = 0, | ||
76 | .flat = 0, | ||
77 | }, | ||
78 | }; | ||
79 | |||
80 | static struct gpio_tilt_platform_data sg060_tilt_pdata= { | ||
81 | .gpios = sg060_tilt_gpios, | ||
82 | .nr_gpios = ARRAY_SIZE(sg060_tilt_gpios), | ||
83 | |||
84 | .axes = sg060_tilt_axes, | ||
85 | .nr_axes = ARRAY_SIZE(sg060_tilt_axes), | ||
86 | |||
87 | .states = sg060_tilt_states, | ||
88 | .nr_states = ARRAY_SIZE(sg060_tilt_states), | ||
89 | |||
90 | .debounce_interval = 100, | ||
91 | |||
92 | .poll_interval = 1000, | ||
93 | .enable = sg060_tilt_enable, | ||
94 | .disable = sg060_tilt_disable, | ||
95 | }; | ||
96 | |||
97 | static struct platform_device sg060_device_tilt = { | ||
98 | .name = "gpio-tilt-polled", | ||
99 | .id = -1, | ||
100 | .dev = { | ||
101 | .platform_data = &sg060_tilt_pdata, | ||
102 | }, | ||
103 | }; | ||
diff --git a/Documentation/input/sentelic.txt b/Documentation/input/sentelic.txt index b2ef125b71f8..89251e2a3eba 100644 --- a/Documentation/input/sentelic.txt +++ b/Documentation/input/sentelic.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | Copyright (C) 2002-2010 Sentelic Corporation. | 1 | Copyright (C) 2002-2011 Sentelic Corporation. |
2 | Last update: Jan-13-2010 | 2 | Last update: Dec-07-2011 |
3 | 3 | ||
4 | ============================================================================== | 4 | ============================================================================== |
5 | * Finger Sensing Pad Intellimouse Mode(scrolling wheel, 4th and 5th buttons) | 5 | * Finger Sensing Pad Intellimouse Mode(scrolling wheel, 4th and 5th buttons) |
@@ -140,6 +140,7 @@ BYTE |---------------|BYTE |---------------|BYTE|---------------|BYTE|--------- | |||
140 | Byte 1: Bit7~Bit6 => 00, Normal data packet | 140 | Byte 1: Bit7~Bit6 => 00, Normal data packet |
141 | => 01, Absolute coordination packet | 141 | => 01, Absolute coordination packet |
142 | => 10, Notify packet | 142 | => 10, Notify packet |
143 | => 11, Normal data packet with on-pad click | ||
143 | Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up. | 144 | Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up. |
144 | When both fingers are up, the last two reports have zero valid | 145 | When both fingers are up, the last two reports have zero valid |
145 | bit. | 146 | bit. |
@@ -164,6 +165,7 @@ BYTE |---------------|BYTE |---------------|BYTE|---------------|BYTE|--------- | |||
164 | Byte 1: Bit7~Bit6 => 00, Normal data packet | 165 | Byte 1: Bit7~Bit6 => 00, Normal data packet |
165 | => 01, Absolute coordinates packet | 166 | => 01, Absolute coordinates packet |
166 | => 10, Notify packet | 167 | => 10, Notify packet |
168 | => 11, Normal data packet with on-pad click | ||
167 | Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up. | 169 | Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up. |
168 | When both fingers are up, the last two reports have zero valid | 170 | When both fingers are up, the last two reports have zero valid |
169 | bit. | 171 | bit. |
@@ -188,6 +190,7 @@ BYTE |---------------|BYTE |---------------|BYTE|---------------|BYTE|--------- | |||
188 | Byte 1: Bit7~Bit6 => 00, Normal data packet | 190 | Byte 1: Bit7~Bit6 => 00, Normal data packet |
189 | => 01, Absolute coordinates packet | 191 | => 01, Absolute coordinates packet |
190 | => 10, Notify packet | 192 | => 10, Notify packet |
193 | => 11, Normal data packet with on-pad click | ||
191 | Bit5 => 1 | 194 | Bit5 => 1 |
192 | Bit4 => when in absolute coordinates mode (valid when EN_PKT_GO is 1): | 195 | Bit4 => when in absolute coordinates mode (valid when EN_PKT_GO is 1): |
193 | 0: left button is generated by the on-pad command | 196 | 0: left button is generated by the on-pad command |
@@ -205,7 +208,7 @@ Byte 4: Bit7 => scroll right button | |||
205 | Bit6 => scroll left button | 208 | Bit6 => scroll left button |
206 | Bit5 => scroll down button | 209 | Bit5 => scroll down button |
207 | Bit4 => scroll up button | 210 | Bit4 => scroll up button |
208 | * Note that if gesture and additional buttoni (Bit4~Bit7) | 211 | * Note that if gesture and additional button (Bit4~Bit7) |
209 | happen at the same time, the button information will not | 212 | happen at the same time, the button information will not |
210 | be sent. | 213 | be sent. |
211 | Bit3~Bit0 => Reserved | 214 | Bit3~Bit0 => Reserved |
@@ -227,6 +230,7 @@ BYTE |---------------|BYTE |---------------|BYTE|---------------|BYTE|--------- | |||
227 | Byte 1: Bit7~Bit6 => 00, Normal data packet | 230 | Byte 1: Bit7~Bit6 => 00, Normal data packet |
228 | => 01, Absolute coordinates packet | 231 | => 01, Absolute coordinates packet |
229 | => 10, Notify packet | 232 | => 10, Notify packet |
233 | => 11, Normal data packet with on-pad click | ||
230 | Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up. | 234 | Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up. |
231 | When both fingers are up, the last two reports have zero valid | 235 | When both fingers are up, the last two reports have zero valid |
232 | bit. | 236 | bit. |
@@ -253,6 +257,7 @@ BYTE |---------------|BYTE |---------------|BYTE|---------------|BYTE|--------- | |||
253 | Byte 1: Bit7~Bit6 => 00, Normal data packet | 257 | Byte 1: Bit7~Bit6 => 00, Normal data packet |
254 | => 01, Absolute coordination packet | 258 | => 01, Absolute coordination packet |
255 | => 10, Notify packet | 259 | => 10, Notify packet |
260 | => 11, Normal data packet with on-pad click | ||
256 | Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up. | 261 | Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up. |
257 | When both fingers are up, the last two reports have zero valid | 262 | When both fingers are up, the last two reports have zero valid |
258 | bit. | 263 | bit. |
@@ -279,8 +284,9 @@ BYTE |---------------|BYTE |---------------|BYTE|---------------|BYTE|--------- | |||
279 | Byte 1: Bit7~Bit6 => 00, Normal data packet | 284 | Byte 1: Bit7~Bit6 => 00, Normal data packet |
280 | => 01, Absolute coordination packet | 285 | => 01, Absolute coordination packet |
281 | => 10, Notify packet | 286 | => 10, Notify packet |
287 | => 11, Normal data packet with on-pad click | ||
282 | Bit5 => 1 | 288 | Bit5 => 1 |
283 | Bit4 => when in absolute coordinate mode (valid when EN_PKT_GO is 1): | 289 | Bit4 => when in absolute coordinates mode (valid when EN_PKT_GO is 1): |
284 | 0: left button is generated by the on-pad command | 290 | 0: left button is generated by the on-pad command |
285 | 1: left button is generated by the external button | 291 | 1: left button is generated by the external button |
286 | Bit3 => 1 | 292 | Bit3 => 1 |
@@ -307,6 +313,110 @@ Sample sequence of Multi-finger, Multi-coordinate mode: | |||
307 | abs pkt 2, ..., notify packet (valid bit == 0) | 313 | abs pkt 2, ..., notify packet (valid bit == 0) |
308 | 314 | ||
309 | ============================================================================== | 315 | ============================================================================== |
316 | * Absolute position for STL3888-Cx and STL3888-Dx. | ||
317 | ============================================================================== | ||
318 | Single Finger, Absolute Coordinate Mode (SFAC) | ||
319 | Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 | ||
320 | BYTE |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------| | ||
321 | 1 |0|1|0|P|1|M|R|L| 2 |X|X|X|X|X|X|X|X| 3 |Y|Y|Y|Y|Y|Y|Y|Y| 4 |r|l|B|F|X|X|Y|Y| | ||
322 | |---------------| |---------------| |---------------| |---------------| | ||
323 | |||
324 | Byte 1: Bit7~Bit6 => 00, Normal data packet | ||
325 | => 01, Absolute coordinates packet | ||
326 | => 10, Notify packet | ||
327 | Bit5 => Coordinate mode(always 0 in SFAC mode): | ||
328 | 0: single-finger absolute coordinates (SFAC) mode | ||
329 | 1: multi-finger, multiple coordinates (MFMC) mode | ||
330 | Bit4 => 0: The LEFT button is generated by on-pad command (OPC) | ||
331 | 1: The LEFT button is generated by external button | ||
332 | Default is 1 even if the LEFT button is not pressed. | ||
333 | Bit3 => Always 1, as specified by PS/2 protocol. | ||
334 | Bit2 => Middle Button, 1 is pressed, 0 is not pressed. | ||
335 | Bit1 => Right Button, 1 is pressed, 0 is not pressed. | ||
336 | Bit0 => Left Button, 1 is pressed, 0 is not pressed. | ||
337 | Byte 2: X coordinate (xpos[9:2]) | ||
338 | Byte 3: Y coordinate (ypos[9:2]) | ||
339 | Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0]) | ||
340 | Bit3~Bit2 => X coordinate (ypos[1:0]) | ||
341 | Bit4 => 4th mouse button(forward one page) | ||
342 | Bit5 => 5th mouse button(backward one page) | ||
343 | Bit6 => scroll left button | ||
344 | Bit7 => scroll right button | ||
345 | |||
346 | Multi Finger, Multiple Coordinates Mode (MFMC): | ||
347 | Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 | ||
348 | BYTE |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------| | ||
349 | 1 |0|1|1|P|1|F|R|L| 2 |X|X|X|X|X|X|X|X| 3 |Y|Y|Y|Y|Y|Y|Y|Y| 4 |r|l|B|F|X|X|Y|Y| | ||
350 | |---------------| |---------------| |---------------| |---------------| | ||
351 | |||
352 | Byte 1: Bit7~Bit6 => 00, Normal data packet | ||
353 | => 01, Absolute coordination packet | ||
354 | => 10, Notify packet | ||
355 | Bit5 => Coordinate mode (always 1 in MFMC mode): | ||
356 | 0: single-finger absolute coordinates (SFAC) mode | ||
357 | 1: multi-finger, multiple coordinates (MFMC) mode | ||
358 | Bit4 => 0: The LEFT button is generated by on-pad command (OPC) | ||
359 | 1: The LEFT button is generated by external button | ||
360 | Default is 1 even if the LEFT button is not pressed. | ||
361 | Bit3 => Always 1, as specified by PS/2 protocol. | ||
362 | Bit2 => Finger index, 0 is the first finger, 1 is the second finger. | ||
363 | If bit 1 and 0 are all 1 and bit 4 is 0, the middle external | ||
364 | button is pressed. | ||
365 | Bit1 => Right Button, 1 is pressed, 0 is not pressed. | ||
366 | Bit0 => Left Button, 1 is pressed, 0 is not pressed. | ||
367 | Byte 2: X coordinate (xpos[9:2]) | ||
368 | Byte 3: Y coordinate (ypos[9:2]) | ||
369 | Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0]) | ||
370 | Bit3~Bit2 => X coordinate (ypos[1:0]) | ||
371 | Bit4 => 4th mouse button(forward one page) | ||
372 | Bit5 => 5th mouse button(backward one page) | ||
373 | Bit6 => scroll left button | ||
374 | Bit7 => scroll right button | ||
375 | |||
376 | When one of the two fingers is up, the device will output four consecutive | ||
377 | MFMC#0 report packets with zero X and Y to represent 1st finger is up or | ||
378 | four consecutive MFMC#1 report packets with zero X and Y to represent that | ||
379 | the 2nd finger is up. On the other hand, if both fingers are up, the device | ||
380 | will output four consecutive single-finger, absolute coordinate(SFAC) packets | ||
381 | with zero X and Y. | ||
382 | |||
383 | Notify Packet for STL3888-Cx/Dx | ||
384 | Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 | ||
385 | BYTE |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------| | ||
386 | 1 |1|0|0|P|1|M|R|L| 2 |C|C|C|C|C|C|C|C| 3 |0|0|F|F|0|0|0|i| 4 |r|l|u|d|0|0|0|0| | ||
387 | |---------------| |---------------| |---------------| |---------------| | ||
388 | |||
389 | Byte 1: Bit7~Bit6 => 00, Normal data packet | ||
390 | => 01, Absolute coordinates packet | ||
391 | => 10, Notify packet | ||
392 | Bit5 => Always 0 | ||
393 | Bit4 => 0: The LEFT button is generated by on-pad command(OPC) | ||
394 | 1: The LEFT button is generated by external button | ||
395 | Default is 1 even if the LEFT button is not pressed. | ||
396 | Bit3 => 1 | ||
397 | Bit2 => Middle Button, 1 is pressed, 0 is not pressed. | ||
398 | Bit1 => Right Button, 1 is pressed, 0 is not pressed. | ||
399 | Bit0 => Left Button, 1 is pressed, 0 is not pressed. | ||
400 | Byte 2: Message type: | ||
401 | 0xba => gesture information | ||
402 | 0xc0 => one finger hold-rotating gesture | ||
403 | Byte 3: The first parameter for the received message: | ||
404 | 0xba => gesture ID (refer to the 'Gesture ID' section) | ||
405 | 0xc0 => region ID | ||
406 | Byte 4: The second parameter for the received message: | ||
407 | 0xba => N/A | ||
408 | 0xc0 => finger up/down information | ||
409 | |||
410 | Sample sequence of Multi-finger, Multi-coordinates mode: | ||
411 | |||
412 | notify packet (valid bit == 1), MFMC packet 1 (byte 1, bit 2 == 0), | ||
413 | MFMC packet 2 (byte 1, bit 2 == 1), MFMC packet 1, MFMC packet 2, | ||
414 | ..., notify packet (valid bit == 0) | ||
415 | |||
416 | That is, when the device is in MFMC mode, the host will receive | ||
417 | interleaved absolute coordinate packets for each finger. | ||
418 | |||
419 | ============================================================================== | ||
310 | * FSP Enable/Disable packet | 420 | * FSP Enable/Disable packet |
311 | ============================================================================== | 421 | ============================================================================== |
312 | Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 | 422 | Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 |
@@ -348,9 +458,10 @@ http://www.computer-engineering.org/ps2mouse/ | |||
348 | ============================================================================== | 458 | ============================================================================== |
349 | 1. Identify FSP by reading device ID(0x00) and version(0x01) register | 459 | 1. Identify FSP by reading device ID(0x00) and version(0x01) register |
350 | 460 | ||
351 | 2. Determine number of buttons by reading status2 (0x0b) register | 461 | 2a. For FSP version < STL3888 Cx, determine number of buttons by reading |
462 | the 'test mode status' (0x20) register: | ||
352 | 463 | ||
353 | buttons = reg[0x0b] & 0x30 | 464 | buttons = reg[0x20] & 0x30 |
354 | 465 | ||
355 | if buttons == 0x30 or buttons == 0x20: | 466 | if buttons == 0x30 or buttons == 0x20: |
356 | # two/four buttons | 467 | # two/four buttons |
@@ -365,6 +476,10 @@ http://www.computer-engineering.org/ps2mouse/ | |||
365 | Refer to 'Finger Sensing Pad PS/2 Mouse Intellimouse' | 476 | Refer to 'Finger Sensing Pad PS/2 Mouse Intellimouse' |
366 | section A for packet parsing detail | 477 | section A for packet parsing detail |
367 | 478 | ||
479 | 2b. For FSP version >= STL3888 Cx: | ||
480 | Refer to 'Finger Sensing Pad PS/2 Mouse Intellimouse' | ||
481 | section A for packet parsing detail (ignore byte 4, bit ~ 7) | ||
482 | |||
368 | ============================================================================== | 483 | ============================================================================== |
369 | * Programming Sequence for Register Reading/Writing | 484 | * Programming Sequence for Register Reading/Writing |
370 | ============================================================================== | 485 | ============================================================================== |
@@ -374,7 +489,7 @@ Register inversion requirement: | |||
374 | Following values needed to be inverted(the '~' operator in C) before being | 489 | Following values needed to be inverted(the '~' operator in C) before being |
375 | sent to FSP: | 490 | sent to FSP: |
376 | 491 | ||
377 | 0xe9, 0xee, 0xf2 and 0xff. | 492 | 0xe8, 0xe9, 0xee, 0xf2, 0xf3 and 0xff. |
378 | 493 | ||
379 | Register swapping requirement: | 494 | Register swapping requirement: |
380 | 495 | ||
@@ -415,7 +530,18 @@ Register reading sequence: | |||
415 | 530 | ||
416 | 8. send 0xe9(status request) PS/2 command to FSP; | 531 | 8. send 0xe9(status request) PS/2 command to FSP; |
417 | 532 | ||
418 | 9. the response read from FSP should be the requested register value. | 533 | 9. the 4th byte of the response read from FSP should be the |
534 | requested register value(?? indicates don't care byte): | ||
535 | |||
536 | host: 0xe9 | ||
537 | 3888: 0xfa (??) (??) (val) | ||
538 | |||
539 | * Note that since the Cx release, the hardware will return 1's | ||
540 | complement of the register value at the 3rd byte of status request | ||
541 | result: | ||
542 | |||
543 | host: 0xe9 | ||
544 | 3888: 0xfa (??) (~val) (val) | ||
419 | 545 | ||
420 | Register writing sequence: | 546 | Register writing sequence: |
421 | 547 | ||
@@ -465,71 +591,194 @@ Register writing sequence: | |||
465 | 591 | ||
466 | 9. the register writing sequence is completed. | 592 | 9. the register writing sequence is completed. |
467 | 593 | ||
594 | * Note that since the Cx release, the hardware will return 1's | ||
595 | complement of the register value at the 3rd byte of status request | ||
596 | result. Host can optionally send another 0xe9 (status request) PS/2 | ||
597 | command to FSP at the end of register writing to verify that the | ||
598 | register writing operation is successful (?? indicates don't care | ||
599 | byte): | ||
600 | |||
601 | host: 0xe9 | ||
602 | 3888: 0xfa (??) (~val) (val) | ||
603 | |||
604 | ============================================================================== | ||
605 | * Programming Sequence for Page Register Reading/Writing | ||
606 | ============================================================================== | ||
607 | |||
608 | In order to overcome the limitation of maximum number of registers | ||
609 | supported, the hardware separates register into different groups called | ||
610 | 'pages.' Each page is able to include up to 255 registers. | ||
611 | |||
612 | The default page after power up is 0x82; therefore, if one has to get | ||
613 | access to register 0x8301, one has to use following sequence to switch | ||
614 | to page 0x83, then start reading/writing from/to offset 0x01 by using | ||
615 | the register read/write sequence described in previous section. | ||
616 | |||
617 | Page register reading sequence: | ||
618 | |||
619 | 1. send 0xf3 PS/2 command to FSP; | ||
620 | |||
621 | 2. send 0x66 PS/2 command to FSP; | ||
622 | |||
623 | 3. send 0x88 PS/2 command to FSP; | ||
624 | |||
625 | 4. send 0xf3 PS/2 command to FSP; | ||
626 | |||
627 | 5. send 0x83 PS/2 command to FSP; | ||
628 | |||
629 | 6. send 0x88 PS/2 command to FSP; | ||
630 | |||
631 | 7. send 0xe9(status request) PS/2 command to FSP; | ||
632 | |||
633 | 8. the response read from FSP should be the requested page value. | ||
634 | |||
635 | Page register writing sequence: | ||
636 | |||
637 | 1. send 0xf3 PS/2 command to FSP; | ||
638 | |||
639 | 2. send 0x38 PS/2 command to FSP; | ||
640 | |||
641 | 3. send 0x88 PS/2 command to FSP; | ||
642 | |||
643 | 4. send 0xf3 PS/2 command to FSP; | ||
644 | |||
645 | 5. if the page address being written is not required to be | ||
646 | inverted(refer to the 'Register inversion requirement' section), | ||
647 | goto step 6 | ||
648 | |||
649 | 5a. send 0x47 PS/2 command to FSP; | ||
650 | |||
651 | 5b. send the inverted page address to FSP and goto step 9; | ||
652 | |||
653 | 6. if the page address being written is not required to be | ||
654 | swapped(refer to the 'Register swapping requirement' section), | ||
655 | goto step 7 | ||
656 | |||
657 | 6a. send 0x44 PS/2 command to FSP; | ||
658 | |||
659 | 6b. send the swapped page address to FSP and goto step 9; | ||
660 | |||
661 | 7. send 0x33 PS/2 command to FSP; | ||
662 | |||
663 | 8. send the page address to FSP; | ||
664 | |||
665 | 9. the page register writing sequence is completed. | ||
666 | |||
667 | ============================================================================== | ||
668 | * Gesture ID | ||
669 | ============================================================================== | ||
670 | |||
671 | Unlike other devices which sends multiple fingers' coordinates to host, | ||
672 | FSP processes multiple fingers' coordinates internally and convert them | ||
673 | into a 8 bits integer, namely 'Gesture ID.' Following is a list of | ||
674 | supported gesture IDs: | ||
675 | |||
676 | ID Description | ||
677 | 0x86 2 finger straight up | ||
678 | 0x82 2 finger straight down | ||
679 | 0x80 2 finger straight right | ||
680 | 0x84 2 finger straight left | ||
681 | 0x8f 2 finger zoom in | ||
682 | 0x8b 2 finger zoom out | ||
683 | 0xc0 2 finger curve, counter clockwise | ||
684 | 0xc4 2 finger curve, clockwise | ||
685 | 0x2e 3 finger straight up | ||
686 | 0x2a 3 finger straight down | ||
687 | 0x28 3 finger straight right | ||
688 | 0x2c 3 finger straight left | ||
689 | 0x38 palm | ||
690 | |||
468 | ============================================================================== | 691 | ============================================================================== |
469 | * Register Listing | 692 | * Register Listing |
470 | ============================================================================== | 693 | ============================================================================== |
471 | 694 | ||
695 | Registers are represented in 16 bits values. The higher 8 bits represent | ||
696 | the page address and the lower 8 bits represent the relative offset within | ||
697 | that particular page. Refer to the 'Programming Sequence for Page Register | ||
698 | Reading/Writing' section for instructions on how to change current page | ||
699 | address. | ||
700 | |||
472 | offset width default r/w name | 701 | offset width default r/w name |
473 | 0x00 bit7~bit0 0x01 RO device ID | 702 | 0x8200 bit7~bit0 0x01 RO device ID |
474 | 703 | ||
475 | 0x01 bit7~bit0 0xc0 RW version ID | 704 | 0x8201 bit7~bit0 RW version ID |
705 | 0xc1: STL3888 Ax | ||
706 | 0xd0 ~ 0xd2: STL3888 Bx | ||
707 | 0xe0 ~ 0xe1: STL3888 Cx | ||
708 | 0xe2 ~ 0xe3: STL3888 Dx | ||
476 | 709 | ||
477 | 0x02 bit7~bit0 0x01 RO vendor ID | 710 | 0x8202 bit7~bit0 0x01 RO vendor ID |
478 | 711 | ||
479 | 0x03 bit7~bit0 0x01 RO product ID | 712 | 0x8203 bit7~bit0 0x01 RO product ID |
480 | 713 | ||
481 | 0x04 bit3~bit0 0x01 RW revision ID | 714 | 0x8204 bit3~bit0 0x01 RW revision ID |
482 | 715 | ||
483 | 0x0b RO test mode status 1 | 716 | 0x820b test mode status 1 |
484 | bit3 1 RO 0: rotate 180 degree, 1: no rotation | 717 | bit3 1 RO 0: rotate 180 degree |
718 | 1: no rotation | ||
719 | *only supported by H/W prior to Cx | ||
485 | 720 | ||
486 | bit5~bit4 RO number of buttons | 721 | 0x820f register file page control |
487 | 11 => 2, lbtn/rbtn | 722 | bit2 0 RW 1: rotate 180 degree |
488 | 10 => 4, lbtn/rbtn/scru/scrd | 723 | 0: no rotation |
489 | 01 => 6, lbtn/rbtn/scru/scrd/scrl/scrr | 724 | *supported since Cx |
490 | 00 => 6, lbtn/rbtn/scru/scrd/fbtn/bbtn | ||
491 | 725 | ||
492 | 0x0f RW register file page control | ||
493 | bit0 0 RW 1 to enable page 1 register files | 726 | bit0 0 RW 1 to enable page 1 register files |
727 | *only supported by H/W prior to Cx | ||
494 | 728 | ||
495 | 0x10 RW system control 1 | 729 | 0x8210 RW system control 1 |
496 | bit0 1 RW Reserved, must be 1 | 730 | bit0 1 RW Reserved, must be 1 |
497 | bit1 0 RW Reserved, must be 0 | 731 | bit1 0 RW Reserved, must be 0 |
498 | bit4 1 RW Reserved, must be 0 | 732 | bit4 0 RW Reserved, must be 0 |
499 | bit5 0 RW register clock gating enable | 733 | bit5 1 RW register clock gating enable |
500 | 0: read only, 1: read/write enable | 734 | 0: read only, 1: read/write enable |
501 | (Note that following registers does not require clock gating being | 735 | (Note that following registers does not require clock gating being |
502 | enabled prior to write: 05 06 07 08 09 0c 0f 10 11 12 16 17 18 23 2e | 736 | enabled prior to write: 05 06 07 08 09 0c 0f 10 11 12 16 17 18 23 2e |
503 | 40 41 42 43. In addition to that, this bit must be 1 when gesture | 737 | 40 41 42 43. In addition to that, this bit must be 1 when gesture |
504 | mode is enabled) | 738 | mode is enabled) |
505 | 739 | ||
506 | 0x31 RW on-pad command detection | 740 | 0x8220 test mode status |
741 | bit5~bit4 RO number of buttons | ||
742 | 11 => 2, lbtn/rbtn | ||
743 | 10 => 4, lbtn/rbtn/scru/scrd | ||
744 | 01 => 6, lbtn/rbtn/scru/scrd/scrl/scrr | ||
745 | 00 => 6, lbtn/rbtn/scru/scrd/fbtn/bbtn | ||
746 | *only supported by H/W prior to Cx | ||
747 | |||
748 | 0x8231 RW on-pad command detection | ||
507 | bit7 0 RW on-pad command left button down tag | 749 | bit7 0 RW on-pad command left button down tag |
508 | enable | 750 | enable |
509 | 0: disable, 1: enable | 751 | 0: disable, 1: enable |
752 | *only supported by H/W prior to Cx | ||
510 | 753 | ||
511 | 0x34 RW on-pad command control 5 | 754 | 0x8234 RW on-pad command control 5 |
512 | bit4~bit0 0x05 RW XLO in 0s/4/1, so 03h = 0010.1b = 2.5 | 755 | bit4~bit0 0x05 RW XLO in 0s/4/1, so 03h = 0010.1b = 2.5 |
513 | (Note that position unit is in 0.5 scanline) | 756 | (Note that position unit is in 0.5 scanline) |
757 | *only supported by H/W prior to Cx | ||
514 | 758 | ||
515 | bit7 0 RW on-pad tap zone enable | 759 | bit7 0 RW on-pad tap zone enable |
516 | 0: disable, 1: enable | 760 | 0: disable, 1: enable |
761 | *only supported by H/W prior to Cx | ||
517 | 762 | ||
518 | 0x35 RW on-pad command control 6 | 763 | 0x8235 RW on-pad command control 6 |
519 | bit4~bit0 0x1d RW XHI in 0s/4/1, so 19h = 1100.1b = 12.5 | 764 | bit4~bit0 0x1d RW XHI in 0s/4/1, so 19h = 1100.1b = 12.5 |
520 | (Note that position unit is in 0.5 scanline) | 765 | (Note that position unit is in 0.5 scanline) |
766 | *only supported by H/W prior to Cx | ||
521 | 767 | ||
522 | 0x36 RW on-pad command control 7 | 768 | 0x8236 RW on-pad command control 7 |
523 | bit4~bit0 0x04 RW YLO in 0s/4/1, so 03h = 0010.1b = 2.5 | 769 | bit4~bit0 0x04 RW YLO in 0s/4/1, so 03h = 0010.1b = 2.5 |
524 | (Note that position unit is in 0.5 scanline) | 770 | (Note that position unit is in 0.5 scanline) |
771 | *only supported by H/W prior to Cx | ||
525 | 772 | ||
526 | 0x37 RW on-pad command control 8 | 773 | 0x8237 RW on-pad command control 8 |
527 | bit4~bit0 0x13 RW YHI in 0s/4/1, so 11h = 1000.1b = 8.5 | 774 | bit4~bit0 0x13 RW YHI in 0s/4/1, so 11h = 1000.1b = 8.5 |
528 | (Note that position unit is in 0.5 scanline) | 775 | (Note that position unit is in 0.5 scanline) |
776 | *only supported by H/W prior to Cx | ||
529 | 777 | ||
530 | 0x40 RW system control 5 | 778 | 0x8240 RW system control 5 |
531 | bit1 0 RW FSP Intellimouse mode enable | 779 | bit1 0 RW FSP Intellimouse mode enable |
532 | 0: disable, 1: enable | 780 | 0: disable, 1: enable |
781 | *only supported by H/W prior to Cx | ||
533 | 782 | ||
534 | bit2 0 RW movement + abs. coordinate mode enable | 783 | bit2 0 RW movement + abs. coordinate mode enable |
535 | 0: disable, 1: enable | 784 | 0: disable, 1: enable |
@@ -537,6 +786,7 @@ offset width default r/w name | |||
537 | bit 1 is not set. However, the format is different from that of bit 1. | 786 | bit 1 is not set. However, the format is different from that of bit 1. |
538 | In addition, when bit 1 and bit 2 are set at the same time, bit 2 will | 787 | In addition, when bit 1 and bit 2 are set at the same time, bit 2 will |
539 | override bit 1.) | 788 | override bit 1.) |
789 | *only supported by H/W prior to Cx | ||
540 | 790 | ||
541 | bit3 0 RW abs. coordinate only mode enable | 791 | bit3 0 RW abs. coordinate only mode enable |
542 | 0: disable, 1: enable | 792 | 0: disable, 1: enable |
@@ -544,9 +794,11 @@ offset width default r/w name | |||
544 | bit 1 is not set. However, the format is different from that of bit 1. | 794 | bit 1 is not set. However, the format is different from that of bit 1. |
545 | In addition, when bit 1, bit 2 and bit 3 are set at the same time, | 795 | In addition, when bit 1, bit 2 and bit 3 are set at the same time, |
546 | bit 3 will override bit 1 and 2.) | 796 | bit 3 will override bit 1 and 2.) |
797 | *only supported by H/W prior to Cx | ||
547 | 798 | ||
548 | bit5 0 RW auto switch enable | 799 | bit5 0 RW auto switch enable |
549 | 0: disable, 1: enable | 800 | 0: disable, 1: enable |
801 | *only supported by H/W prior to Cx | ||
550 | 802 | ||
551 | bit6 0 RW G0 abs. + notify packet format enable | 803 | bit6 0 RW G0 abs. + notify packet format enable |
552 | 0: disable, 1: enable | 804 | 0: disable, 1: enable |
@@ -554,18 +806,68 @@ offset width default r/w name | |||
554 | bit 2 and 3. That is, if any of those bit is 1, host will receive | 806 | bit 2 and 3. That is, if any of those bit is 1, host will receive |
555 | absolute coordinates; otherwise, host only receives packets with | 807 | absolute coordinates; otherwise, host only receives packets with |
556 | relative coordinate.) | 808 | relative coordinate.) |
809 | *only supported by H/W prior to Cx | ||
557 | 810 | ||
558 | bit7 0 RW EN_PS2_F2: PS/2 gesture mode 2nd | 811 | bit7 0 RW EN_PS2_F2: PS/2 gesture mode 2nd |
559 | finger packet enable | 812 | finger packet enable |
560 | 0: disable, 1: enable | 813 | 0: disable, 1: enable |
814 | *only supported by H/W prior to Cx | ||
561 | 815 | ||
562 | 0x43 RW on-pad control | 816 | 0x8243 RW on-pad control |
563 | bit0 0 RW on-pad control enable | 817 | bit0 0 RW on-pad control enable |
564 | 0: disable, 1: enable | 818 | 0: disable, 1: enable |
565 | (Note that if this bit is cleared, bit 3/5 will be ineffective) | 819 | (Note that if this bit is cleared, bit 3/5 will be ineffective) |
820 | *only supported by H/W prior to Cx | ||
566 | 821 | ||
567 | bit3 0 RW on-pad fix vertical scrolling enable | 822 | bit3 0 RW on-pad fix vertical scrolling enable |
568 | 0: disable, 1: enable | 823 | 0: disable, 1: enable |
824 | *only supported by H/W prior to Cx | ||
569 | 825 | ||
570 | bit5 0 RW on-pad fix horizontal scrolling enable | 826 | bit5 0 RW on-pad fix horizontal scrolling enable |
571 | 0: disable, 1: enable | 827 | 0: disable, 1: enable |
828 | *only supported by H/W prior to Cx | ||
829 | |||
830 | 0x8290 RW software control register 1 | ||
831 | bit0 0 RW absolute coordination mode | ||
832 | 0: disable, 1: enable | ||
833 | *supported since Cx | ||
834 | |||
835 | bit1 0 RW gesture ID output | ||
836 | 0: disable, 1: enable | ||
837 | *supported since Cx | ||
838 | |||
839 | bit2 0 RW two fingers' coordinates output | ||
840 | 0: disable, 1: enable | ||
841 | *supported since Cx | ||
842 | |||
843 | bit3 0 RW finger up one packet output | ||
844 | 0: disable, 1: enable | ||
845 | *supported since Cx | ||
846 | |||
847 | bit4 0 RW absolute coordination continuous mode | ||
848 | 0: disable, 1: enable | ||
849 | *supported since Cx | ||
850 | |||
851 | bit6~bit5 00 RW gesture group selection | ||
852 | 00: basic | ||
853 | 01: suite | ||
854 | 10: suite pro | ||
855 | 11: advanced | ||
856 | *supported since Cx | ||
857 | |||
858 | bit7 0 RW Bx packet output compatible mode | ||
859 | 0: disable, 1: enable *supported since Cx | ||
860 | *supported since Cx | ||
861 | |||
862 | |||
863 | 0x833d RW on-pad command control 1 | ||
864 | bit7 1 RW on-pad command detection enable | ||
865 | 0: disable, 1: enable | ||
866 | *supported since Cx | ||
867 | |||
868 | 0x833e RW on-pad command detection | ||
869 | bit7 0 RW on-pad command left button down tag | ||
870 | enable. Works only in H/W based PS/2 | ||
871 | data packet mode. | ||
872 | 0: disable, 1: enable | ||
873 | *supported since Cx | ||
diff --git a/arch/arm/mach-tegra/include/mach/kbc.h b/arch/arm/mach-tegra/include/mach/kbc.h index 4f3572a1c684..20bb0545f992 100644 --- a/arch/arm/mach-tegra/include/mach/kbc.h +++ b/arch/arm/mach-tegra/include/mach/kbc.h | |||
@@ -53,6 +53,7 @@ struct tegra_kbc_platform_data { | |||
53 | struct tegra_kbc_pin_cfg pin_cfg[KBC_MAX_GPIO]; | 53 | struct tegra_kbc_pin_cfg pin_cfg[KBC_MAX_GPIO]; |
54 | const struct matrix_keymap_data *keymap_data; | 54 | const struct matrix_keymap_data *keymap_data; |
55 | 55 | ||
56 | u32 wakeup_key; | ||
56 | bool wakeup; | 57 | bool wakeup; |
57 | bool use_fn_map; | 58 | bool use_fn_map; |
58 | bool use_ghost_filter; | 59 | bool use_ghost_filter; |
diff --git a/arch/arm/plat-samsung/include/plat/keypad.h b/arch/arm/plat-samsung/include/plat/keypad.h index b59a6483cd8a..c81ace332a1e 100644 --- a/arch/arm/plat-samsung/include/plat/keypad.h +++ b/arch/arm/plat-samsung/include/plat/keypad.h | |||
@@ -13,32 +13,7 @@ | |||
13 | #ifndef __PLAT_SAMSUNG_KEYPAD_H | 13 | #ifndef __PLAT_SAMSUNG_KEYPAD_H |
14 | #define __PLAT_SAMSUNG_KEYPAD_H | 14 | #define __PLAT_SAMSUNG_KEYPAD_H |
15 | 15 | ||
16 | #include <linux/input/matrix_keypad.h> | 16 | #include <linux/input/samsung-keypad.h> |
17 | |||
18 | #define SAMSUNG_MAX_ROWS 8 | ||
19 | #define SAMSUNG_MAX_COLS 8 | ||
20 | |||
21 | /** | ||
22 | * struct samsung_keypad_platdata - Platform device data for Samsung Keypad. | ||
23 | * @keymap_data: pointer to &matrix_keymap_data. | ||
24 | * @rows: number of keypad row supported. | ||
25 | * @cols: number of keypad col supported. | ||
26 | * @no_autorepeat: disable key autorepeat. | ||
27 | * @wakeup: controls whether the device should be set up as wakeup source. | ||
28 | * @cfg_gpio: configure the GPIO. | ||
29 | * | ||
30 | * Initialisation data specific to either the machine or the platform | ||
31 | * for the device driver to use or call-back when configuring gpio. | ||
32 | */ | ||
33 | struct samsung_keypad_platdata { | ||
34 | const struct matrix_keymap_data *keymap_data; | ||
35 | unsigned int rows; | ||
36 | unsigned int cols; | ||
37 | bool no_autorepeat; | ||
38 | bool wakeup; | ||
39 | |||
40 | void (*cfg_gpio)(unsigned int rows, unsigned int cols); | ||
41 | }; | ||
42 | 17 | ||
43 | /** | 18 | /** |
44 | * samsung_keypad_set_platdata - Set platform data for Samsung Keypad device. | 19 | * samsung_keypad_set_platdata - Set platform data for Samsung Keypad device. |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 4cf25347b015..76457d50bc34 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -369,7 +369,7 @@ static int evdev_fetch_next_event(struct evdev_client *client, | |||
369 | 369 | ||
370 | spin_lock_irq(&client->buffer_lock); | 370 | spin_lock_irq(&client->buffer_lock); |
371 | 371 | ||
372 | have_event = client->head != client->tail; | 372 | have_event = client->packet_head != client->tail; |
373 | if (have_event) { | 373 | if (have_event) { |
374 | *event = client->buffer[client->tail++]; | 374 | *event = client->buffer[client->tail++]; |
375 | client->tail &= client->bufsize - 1; | 375 | client->tail &= client->bufsize - 1; |
@@ -391,14 +391,13 @@ static ssize_t evdev_read(struct file *file, char __user *buffer, | |||
391 | if (count < input_event_size()) | 391 | if (count < input_event_size()) |
392 | return -EINVAL; | 392 | return -EINVAL; |
393 | 393 | ||
394 | if (client->packet_head == client->tail && evdev->exist && | 394 | if (!(file->f_flags & O_NONBLOCK)) { |
395 | (file->f_flags & O_NONBLOCK)) | 395 | retval = wait_event_interruptible(evdev->wait, |
396 | return -EAGAIN; | 396 | client->packet_head != client->tail || |
397 | 397 | !evdev->exist); | |
398 | retval = wait_event_interruptible(evdev->wait, | 398 | if (retval) |
399 | client->packet_head != client->tail || !evdev->exist); | 399 | return retval; |
400 | if (retval) | 400 | } |
401 | return retval; | ||
402 | 401 | ||
403 | if (!evdev->exist) | 402 | if (!evdev->exist) |
404 | return -ENODEV; | 403 | return -ENODEV; |
@@ -412,6 +411,9 @@ static ssize_t evdev_read(struct file *file, char __user *buffer, | |||
412 | retval += input_event_size(); | 411 | retval += input_event_size(); |
413 | } | 412 | } |
414 | 413 | ||
414 | if (retval == 0 && (file->f_flags & O_NONBLOCK)) | ||
415 | return -EAGAIN; | ||
416 | |||
415 | return retval; | 417 | return retval; |
416 | } | 418 | } |
417 | 419 | ||
diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c index 7dfe1009fae0..7f161d93203c 100644 --- a/drivers/input/input-polldev.c +++ b/drivers/input/input-polldev.c | |||
@@ -84,10 +84,12 @@ static ssize_t input_polldev_set_poll(struct device *dev, | |||
84 | { | 84 | { |
85 | struct input_polled_dev *polldev = dev_get_drvdata(dev); | 85 | struct input_polled_dev *polldev = dev_get_drvdata(dev); |
86 | struct input_dev *input = polldev->input; | 86 | struct input_dev *input = polldev->input; |
87 | unsigned long interval; | 87 | unsigned int interval; |
88 | int err; | ||
88 | 89 | ||
89 | if (strict_strtoul(buf, 0, &interval)) | 90 | err = kstrtouint(buf, 0, &interval); |
90 | return -EINVAL; | 91 | if (err) |
92 | return err; | ||
91 | 93 | ||
92 | if (interval < polldev->poll_interval_min) | 94 | if (interval < polldev->poll_interval_min) |
93 | return -EINVAL; | 95 | return -EINVAL; |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 615c21f2a553..cdc385b2cf7d 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -221,6 +221,22 @@ config KEYBOARD_TCA6416 | |||
221 | To compile this driver as a module, choose M here: the | 221 | To compile this driver as a module, choose M here: the |
222 | module will be called tca6416_keypad. | 222 | module will be called tca6416_keypad. |
223 | 223 | ||
224 | config KEYBOARD_TCA8418 | ||
225 | tristate "TCA8418 Keypad Support" | ||
226 | depends on I2C | ||
227 | help | ||
228 | This driver implements basic keypad functionality | ||
229 | for keys connected through TCA8418 keypad decoder. | ||
230 | |||
231 | Say Y here if your device has keys connected to | ||
232 | TCA8418 keypad decoder. | ||
233 | |||
234 | If enabled the complete TCA8418 device will be managed through | ||
235 | this driver. | ||
236 | |||
237 | To compile this driver as a module, choose M here: the | ||
238 | module will be called tca8418_keypad. | ||
239 | |||
224 | config KEYBOARD_MATRIX | 240 | config KEYBOARD_MATRIX |
225 | tristate "GPIO driven matrix keypad support" | 241 | tristate "GPIO driven matrix keypad support" |
226 | depends on GENERIC_GPIO | 242 | depends on GENERIC_GPIO |
@@ -425,9 +441,10 @@ config KEYBOARD_PMIC8XXX | |||
425 | 441 | ||
426 | config KEYBOARD_SAMSUNG | 442 | config KEYBOARD_SAMSUNG |
427 | tristate "Samsung keypad support" | 443 | tristate "Samsung keypad support" |
428 | depends on SAMSUNG_DEV_KEYPAD | 444 | depends on HAVE_CLK |
429 | help | 445 | help |
430 | Say Y here if you want to use the Samsung keypad. | 446 | Say Y here if you want to use the keypad on your Samsung mobile |
447 | device. | ||
431 | 448 | ||
432 | To compile this driver as a module, choose M here: the | 449 | To compile this driver as a module, choose M here: the |
433 | module will be called samsung-keypad. | 450 | module will be called samsung-keypad. |
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index ddde0fd476f7..df7061f12918 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile | |||
@@ -16,6 +16,7 @@ obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o | |||
16 | obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o | 16 | obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o |
17 | obj-$(CONFIG_KEYBOARD_GPIO_POLLED) += gpio_keys_polled.o | 17 | obj-$(CONFIG_KEYBOARD_GPIO_POLLED) += gpio_keys_polled.o |
18 | obj-$(CONFIG_KEYBOARD_TCA6416) += tca6416-keypad.o | 18 | obj-$(CONFIG_KEYBOARD_TCA6416) += tca6416-keypad.o |
19 | obj-$(CONFIG_KEYBOARD_TCA8418) += tca8418_keypad.o | ||
19 | obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o | 20 | obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o |
20 | obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o | 21 | obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o |
21 | obj-$(CONFIG_KEYBOARD_IMX) += imx_keypad.o | 22 | obj-$(CONFIG_KEYBOARD_IMX) += imx_keypad.o |
diff --git a/drivers/input/keyboard/adp5520-keys.c b/drivers/input/keyboard/adp5520-keys.c index 3db8006dac3a..e9e8674dfda1 100644 --- a/drivers/input/keyboard/adp5520-keys.c +++ b/drivers/input/keyboard/adp5520-keys.c | |||
@@ -202,18 +202,7 @@ static struct platform_driver adp5520_keys_driver = { | |||
202 | .probe = adp5520_keys_probe, | 202 | .probe = adp5520_keys_probe, |
203 | .remove = __devexit_p(adp5520_keys_remove), | 203 | .remove = __devexit_p(adp5520_keys_remove), |
204 | }; | 204 | }; |
205 | 205 | module_platform_driver(adp5520_keys_driver); | |
206 | static int __init adp5520_keys_init(void) | ||
207 | { | ||
208 | return platform_driver_register(&adp5520_keys_driver); | ||
209 | } | ||
210 | module_init(adp5520_keys_init); | ||
211 | |||
212 | static void __exit adp5520_keys_exit(void) | ||
213 | { | ||
214 | platform_driver_unregister(&adp5520_keys_driver); | ||
215 | } | ||
216 | module_exit(adp5520_keys_exit); | ||
217 | 206 | ||
218 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); | 207 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); |
219 | MODULE_DESCRIPTION("Keys ADP5520 Driver"); | 208 | MODULE_DESCRIPTION("Keys ADP5520 Driver"); |
diff --git a/drivers/input/keyboard/amikbd.c b/drivers/input/keyboard/amikbd.c index 79172af164f2..6df5f6aa7908 100644 --- a/drivers/input/keyboard/amikbd.c +++ b/drivers/input/keyboard/amikbd.c | |||
@@ -259,19 +259,6 @@ static struct platform_driver amikbd_driver = { | |||
259 | .owner = THIS_MODULE, | 259 | .owner = THIS_MODULE, |
260 | }, | 260 | }, |
261 | }; | 261 | }; |
262 | 262 | module_platform_driver(amikbd_driver); | |
263 | static int __init amikbd_init(void) | ||
264 | { | ||
265 | return platform_driver_probe(&amikbd_driver, amikbd_probe); | ||
266 | } | ||
267 | |||
268 | module_init(amikbd_init); | ||
269 | |||
270 | static void __exit amikbd_exit(void) | ||
271 | { | ||
272 | platform_driver_unregister(&amikbd_driver); | ||
273 | } | ||
274 | |||
275 | module_exit(amikbd_exit); | ||
276 | 263 | ||
277 | MODULE_ALIAS("platform:amiga-keyboard"); | 264 | MODULE_ALIAS("platform:amiga-keyboard"); |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 19cfc0cf558c..e05a2e7073c6 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -1305,7 +1305,7 @@ static ssize_t atkbd_show_extra(struct atkbd *atkbd, char *buf) | |||
1305 | static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t count) | 1305 | static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t count) |
1306 | { | 1306 | { |
1307 | struct input_dev *old_dev, *new_dev; | 1307 | struct input_dev *old_dev, *new_dev; |
1308 | unsigned long value; | 1308 | unsigned int value; |
1309 | int err; | 1309 | int err; |
1310 | bool old_extra; | 1310 | bool old_extra; |
1311 | unsigned char old_set; | 1311 | unsigned char old_set; |
@@ -1313,7 +1313,11 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun | |||
1313 | if (!atkbd->write) | 1313 | if (!atkbd->write) |
1314 | return -EIO; | 1314 | return -EIO; |
1315 | 1315 | ||
1316 | if (strict_strtoul(buf, 10, &value) || value > 1) | 1316 | err = kstrtouint(buf, 10, &value); |
1317 | if (err) | ||
1318 | return err; | ||
1319 | |||
1320 | if (value > 1) | ||
1317 | return -EINVAL; | 1321 | return -EINVAL; |
1318 | 1322 | ||
1319 | if (atkbd->extra != value) { | 1323 | if (atkbd->extra != value) { |
@@ -1389,11 +1393,15 @@ static ssize_t atkbd_show_scroll(struct atkbd *atkbd, char *buf) | |||
1389 | static ssize_t atkbd_set_scroll(struct atkbd *atkbd, const char *buf, size_t count) | 1393 | static ssize_t atkbd_set_scroll(struct atkbd *atkbd, const char *buf, size_t count) |
1390 | { | 1394 | { |
1391 | struct input_dev *old_dev, *new_dev; | 1395 | struct input_dev *old_dev, *new_dev; |
1392 | unsigned long value; | 1396 | unsigned int value; |
1393 | int err; | 1397 | int err; |
1394 | bool old_scroll; | 1398 | bool old_scroll; |
1395 | 1399 | ||
1396 | if (strict_strtoul(buf, 10, &value) || value > 1) | 1400 | err = kstrtouint(buf, 10, &value); |
1401 | if (err) | ||
1402 | return err; | ||
1403 | |||
1404 | if (value > 1) | ||
1397 | return -EINVAL; | 1405 | return -EINVAL; |
1398 | 1406 | ||
1399 | if (atkbd->scroll != value) { | 1407 | if (atkbd->scroll != value) { |
@@ -1433,7 +1441,7 @@ static ssize_t atkbd_show_set(struct atkbd *atkbd, char *buf) | |||
1433 | static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count) | 1441 | static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count) |
1434 | { | 1442 | { |
1435 | struct input_dev *old_dev, *new_dev; | 1443 | struct input_dev *old_dev, *new_dev; |
1436 | unsigned long value; | 1444 | unsigned int value; |
1437 | int err; | 1445 | int err; |
1438 | unsigned char old_set; | 1446 | unsigned char old_set; |
1439 | bool old_extra; | 1447 | bool old_extra; |
@@ -1441,7 +1449,11 @@ static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count) | |||
1441 | if (!atkbd->write) | 1449 | if (!atkbd->write) |
1442 | return -EIO; | 1450 | return -EIO; |
1443 | 1451 | ||
1444 | if (strict_strtoul(buf, 10, &value) || (value != 2 && value != 3)) | 1452 | err = kstrtouint(buf, 10, &value); |
1453 | if (err) | ||
1454 | return err; | ||
1455 | |||
1456 | if (value != 2 && value != 3) | ||
1445 | return -EINVAL; | 1457 | return -EINVAL; |
1446 | 1458 | ||
1447 | if (atkbd->set != value) { | 1459 | if (atkbd->set != value) { |
@@ -1484,14 +1496,18 @@ static ssize_t atkbd_show_softrepeat(struct atkbd *atkbd, char *buf) | |||
1484 | static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t count) | 1496 | static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t count) |
1485 | { | 1497 | { |
1486 | struct input_dev *old_dev, *new_dev; | 1498 | struct input_dev *old_dev, *new_dev; |
1487 | unsigned long value; | 1499 | unsigned int value; |
1488 | int err; | 1500 | int err; |
1489 | bool old_softrepeat, old_softraw; | 1501 | bool old_softrepeat, old_softraw; |
1490 | 1502 | ||
1491 | if (!atkbd->write) | 1503 | if (!atkbd->write) |
1492 | return -EIO; | 1504 | return -EIO; |
1493 | 1505 | ||
1494 | if (strict_strtoul(buf, 10, &value) || value > 1) | 1506 | err = kstrtouint(buf, 10, &value); |
1507 | if (err) | ||
1508 | return err; | ||
1509 | |||
1510 | if (value > 1) | ||
1495 | return -EINVAL; | 1511 | return -EINVAL; |
1496 | 1512 | ||
1497 | if (atkbd->softrepeat != value) { | 1513 | if (atkbd->softrepeat != value) { |
@@ -1534,11 +1550,15 @@ static ssize_t atkbd_show_softraw(struct atkbd *atkbd, char *buf) | |||
1534 | static ssize_t atkbd_set_softraw(struct atkbd *atkbd, const char *buf, size_t count) | 1550 | static ssize_t atkbd_set_softraw(struct atkbd *atkbd, const char *buf, size_t count) |
1535 | { | 1551 | { |
1536 | struct input_dev *old_dev, *new_dev; | 1552 | struct input_dev *old_dev, *new_dev; |
1537 | unsigned long value; | 1553 | unsigned int value; |
1538 | int err; | 1554 | int err; |
1539 | bool old_softraw; | 1555 | bool old_softraw; |
1540 | 1556 | ||
1541 | if (strict_strtoul(buf, 10, &value) || value > 1) | 1557 | err = kstrtouint(buf, 10, &value); |
1558 | if (err) | ||
1559 | return err; | ||
1560 | |||
1561 | if (value > 1) | ||
1542 | return -EINVAL; | 1562 | return -EINVAL; |
1543 | 1563 | ||
1544 | if (atkbd->softraw != value) { | 1564 | if (atkbd->softraw != value) { |
diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c index 7d989603f875..8eb9116e0a5f 100644 --- a/drivers/input/keyboard/bf54x-keys.c +++ b/drivers/input/keyboard/bf54x-keys.c | |||
@@ -384,7 +384,7 @@ static int bfin_kpad_resume(struct platform_device *pdev) | |||
384 | # define bfin_kpad_resume NULL | 384 | # define bfin_kpad_resume NULL |
385 | #endif | 385 | #endif |
386 | 386 | ||
387 | struct platform_driver bfin_kpad_device_driver = { | 387 | static struct platform_driver bfin_kpad_device_driver = { |
388 | .driver = { | 388 | .driver = { |
389 | .name = DRV_NAME, | 389 | .name = DRV_NAME, |
390 | .owner = THIS_MODULE, | 390 | .owner = THIS_MODULE, |
@@ -394,19 +394,7 @@ struct platform_driver bfin_kpad_device_driver = { | |||
394 | .suspend = bfin_kpad_suspend, | 394 | .suspend = bfin_kpad_suspend, |
395 | .resume = bfin_kpad_resume, | 395 | .resume = bfin_kpad_resume, |
396 | }; | 396 | }; |
397 | 397 | module_platform_driver(bfin_kpad_device_driver); | |
398 | static int __init bfin_kpad_init(void) | ||
399 | { | ||
400 | return platform_driver_register(&bfin_kpad_device_driver); | ||
401 | } | ||
402 | |||
403 | static void __exit bfin_kpad_exit(void) | ||
404 | { | ||
405 | platform_driver_unregister(&bfin_kpad_device_driver); | ||
406 | } | ||
407 | |||
408 | module_init(bfin_kpad_init); | ||
409 | module_exit(bfin_kpad_exit); | ||
410 | 398 | ||
411 | MODULE_LICENSE("GPL"); | 399 | MODULE_LICENSE("GPL"); |
412 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); | 400 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); |
diff --git a/drivers/input/keyboard/davinci_keyscan.c b/drivers/input/keyboard/davinci_keyscan.c index 9d82b3aeff5e..469825247552 100644 --- a/drivers/input/keyboard/davinci_keyscan.c +++ b/drivers/input/keyboard/davinci_keyscan.c | |||
@@ -328,18 +328,7 @@ static struct platform_driver davinci_ks_driver = { | |||
328 | }, | 328 | }, |
329 | .remove = __devexit_p(davinci_ks_remove), | 329 | .remove = __devexit_p(davinci_ks_remove), |
330 | }; | 330 | }; |
331 | 331 | module_platform_driver(davinci_ks_driver); | |
332 | static int __init davinci_ks_init(void) | ||
333 | { | ||
334 | return platform_driver_probe(&davinci_ks_driver, davinci_ks_probe); | ||
335 | } | ||
336 | module_init(davinci_ks_init); | ||
337 | |||
338 | static void __exit davinci_ks_exit(void) | ||
339 | { | ||
340 | platform_driver_unregister(&davinci_ks_driver); | ||
341 | } | ||
342 | module_exit(davinci_ks_exit); | ||
343 | 332 | ||
344 | MODULE_AUTHOR("Miguel Aguilar"); | 333 | MODULE_AUTHOR("Miguel Aguilar"); |
345 | MODULE_DESCRIPTION("Texas Instruments DaVinci Key Scan Driver"); | 334 | MODULE_DESCRIPTION("Texas Instruments DaVinci Key Scan Driver"); |
diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c index 4662c5da8018..0ba69f3fcb52 100644 --- a/drivers/input/keyboard/ep93xx_keypad.c +++ b/drivers/input/keyboard/ep93xx_keypad.c | |||
@@ -390,19 +390,7 @@ static struct platform_driver ep93xx_keypad_driver = { | |||
390 | .suspend = ep93xx_keypad_suspend, | 390 | .suspend = ep93xx_keypad_suspend, |
391 | .resume = ep93xx_keypad_resume, | 391 | .resume = ep93xx_keypad_resume, |
392 | }; | 392 | }; |
393 | 393 | module_platform_driver(ep93xx_keypad_driver); | |
394 | static int __init ep93xx_keypad_init(void) | ||
395 | { | ||
396 | return platform_driver_register(&ep93xx_keypad_driver); | ||
397 | } | ||
398 | |||
399 | static void __exit ep93xx_keypad_exit(void) | ||
400 | { | ||
401 | platform_driver_unregister(&ep93xx_keypad_driver); | ||
402 | } | ||
403 | |||
404 | module_init(ep93xx_keypad_init); | ||
405 | module_exit(ep93xx_keypad_exit); | ||
406 | 394 | ||
407 | MODULE_LICENSE("GPL"); | 395 | MODULE_LICENSE("GPL"); |
408 | MODULE_AUTHOR("H Hartley Sweeten <hsweeten@visionengravers.com>"); | 396 | MODULE_AUTHOR("H Hartley Sweeten <hsweeten@visionengravers.com>"); |
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c index 4c17aff20657..20c8ab172214 100644 --- a/drivers/input/keyboard/gpio_keys_polled.c +++ b/drivers/input/keyboard/gpio_keys_polled.c | |||
@@ -241,19 +241,7 @@ static struct platform_driver gpio_keys_polled_driver = { | |||
241 | .owner = THIS_MODULE, | 241 | .owner = THIS_MODULE, |
242 | }, | 242 | }, |
243 | }; | 243 | }; |
244 | 244 | module_platform_driver(gpio_keys_polled_driver); | |
245 | static int __init gpio_keys_polled_init(void) | ||
246 | { | ||
247 | return platform_driver_register(&gpio_keys_polled_driver); | ||
248 | } | ||
249 | |||
250 | static void __exit gpio_keys_polled_exit(void) | ||
251 | { | ||
252 | platform_driver_unregister(&gpio_keys_polled_driver); | ||
253 | } | ||
254 | |||
255 | module_init(gpio_keys_polled_init); | ||
256 | module_exit(gpio_keys_polled_exit); | ||
257 | 245 | ||
258 | MODULE_LICENSE("GPL v2"); | 246 | MODULE_LICENSE("GPL v2"); |
259 | MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>"); | 247 | MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>"); |
diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c index ccebd2d09151..fb87b3bcadb9 100644 --- a/drivers/input/keyboard/imx_keypad.c +++ b/drivers/input/keyboard/imx_keypad.c | |||
@@ -619,19 +619,7 @@ static struct platform_driver imx_keypad_driver = { | |||
619 | .probe = imx_keypad_probe, | 619 | .probe = imx_keypad_probe, |
620 | .remove = __devexit_p(imx_keypad_remove), | 620 | .remove = __devexit_p(imx_keypad_remove), |
621 | }; | 621 | }; |
622 | 622 | module_platform_driver(imx_keypad_driver); | |
623 | static int __init imx_keypad_init(void) | ||
624 | { | ||
625 | return platform_driver_register(&imx_keypad_driver); | ||
626 | } | ||
627 | |||
628 | static void __exit imx_keypad_exit(void) | ||
629 | { | ||
630 | platform_driver_unregister(&imx_keypad_driver); | ||
631 | } | ||
632 | |||
633 | module_init(imx_keypad_init); | ||
634 | module_exit(imx_keypad_exit); | ||
635 | 623 | ||
636 | MODULE_AUTHOR("Alberto Panizzo <maramaopercheseimorto@gmail.com>"); | 624 | MODULE_AUTHOR("Alberto Panizzo <maramaopercheseimorto@gmail.com>"); |
637 | MODULE_DESCRIPTION("IMX Keypad Port Driver"); | 625 | MODULE_DESCRIPTION("IMX Keypad Port Driver"); |
diff --git a/drivers/input/keyboard/jornada680_kbd.c b/drivers/input/keyboard/jornada680_kbd.c index 7197c5698747..24f3ea01c4d5 100644 --- a/drivers/input/keyboard/jornada680_kbd.c +++ b/drivers/input/keyboard/jornada680_kbd.c | |||
@@ -260,19 +260,7 @@ static struct platform_driver jornada680kbd_driver = { | |||
260 | .probe = jornada680kbd_probe, | 260 | .probe = jornada680kbd_probe, |
261 | .remove = __devexit_p(jornada680kbd_remove), | 261 | .remove = __devexit_p(jornada680kbd_remove), |
262 | }; | 262 | }; |
263 | 263 | module_platform_driver(jornada680kbd_driver); | |
264 | static int __init jornada680kbd_init(void) | ||
265 | { | ||
266 | return platform_driver_register(&jornada680kbd_driver); | ||
267 | } | ||
268 | |||
269 | static void __exit jornada680kbd_exit(void) | ||
270 | { | ||
271 | platform_driver_unregister(&jornada680kbd_driver); | ||
272 | } | ||
273 | |||
274 | module_init(jornada680kbd_init); | ||
275 | module_exit(jornada680kbd_exit); | ||
276 | 264 | ||
277 | MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); | 265 | MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); |
278 | MODULE_DESCRIPTION("HP Jornada 620/660/680/690 Keyboard Driver"); | 266 | MODULE_DESCRIPTION("HP Jornada 620/660/680/690 Keyboard Driver"); |
diff --git a/drivers/input/keyboard/jornada720_kbd.c b/drivers/input/keyboard/jornada720_kbd.c index 0aa6740e60d0..eeafc30b207b 100644 --- a/drivers/input/keyboard/jornada720_kbd.c +++ b/drivers/input/keyboard/jornada720_kbd.c | |||
@@ -174,16 +174,4 @@ static struct platform_driver jornada720_kbd_driver = { | |||
174 | .probe = jornada720_kbd_probe, | 174 | .probe = jornada720_kbd_probe, |
175 | .remove = __devexit_p(jornada720_kbd_remove), | 175 | .remove = __devexit_p(jornada720_kbd_remove), |
176 | }; | 176 | }; |
177 | 177 | module_platform_driver(jornada720_kbd_driver); | |
178 | static int __init jornada720_kbd_init(void) | ||
179 | { | ||
180 | return platform_driver_register(&jornada720_kbd_driver); | ||
181 | } | ||
182 | |||
183 | static void __exit jornada720_kbd_exit(void) | ||
184 | { | ||
185 | platform_driver_unregister(&jornada720_kbd_driver); | ||
186 | } | ||
187 | |||
188 | module_init(jornada720_kbd_init); | ||
189 | module_exit(jornada720_kbd_exit); | ||
diff --git a/drivers/input/keyboard/lm8323.c b/drivers/input/keyboard/lm8323.c index 82d1dc8badd5..21823bfc7911 100644 --- a/drivers/input/keyboard/lm8323.c +++ b/drivers/input/keyboard/lm8323.c | |||
@@ -545,13 +545,12 @@ static ssize_t lm8323_pwm_store_time(struct device *dev, | |||
545 | { | 545 | { |
546 | struct led_classdev *led_cdev = dev_get_drvdata(dev); | 546 | struct led_classdev *led_cdev = dev_get_drvdata(dev); |
547 | struct lm8323_pwm *pwm = cdev_to_pwm(led_cdev); | 547 | struct lm8323_pwm *pwm = cdev_to_pwm(led_cdev); |
548 | int ret; | 548 | int ret, time; |
549 | unsigned long time; | ||
550 | 549 | ||
551 | ret = strict_strtoul(buf, 10, &time); | 550 | ret = kstrtoint(buf, 10, &time); |
552 | /* Numbers only, please. */ | 551 | /* Numbers only, please. */ |
553 | if (ret) | 552 | if (ret) |
554 | return -EINVAL; | 553 | return ret; |
555 | 554 | ||
556 | pwm->fade_time = time; | 555 | pwm->fade_time = time; |
557 | 556 | ||
@@ -613,9 +612,9 @@ static ssize_t lm8323_set_disable(struct device *dev, | |||
613 | { | 612 | { |
614 | struct lm8323_chip *lm = dev_get_drvdata(dev); | 613 | struct lm8323_chip *lm = dev_get_drvdata(dev); |
615 | int ret; | 614 | int ret; |
616 | unsigned long i; | 615 | unsigned int i; |
617 | 616 | ||
618 | ret = strict_strtoul(buf, 10, &i); | 617 | ret = kstrtouint(buf, 10, &i); |
619 | 618 | ||
620 | mutex_lock(&lm->lock); | 619 | mutex_lock(&lm->lock); |
621 | lm->kp_enabled = !i; | 620 | lm->kp_enabled = !i; |
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index e2ae657717ea..9b223d73de32 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c | |||
@@ -496,19 +496,7 @@ static struct platform_driver matrix_keypad_driver = { | |||
496 | #endif | 496 | #endif |
497 | }, | 497 | }, |
498 | }; | 498 | }; |
499 | 499 | module_platform_driver(matrix_keypad_driver); | |
500 | static int __init matrix_keypad_init(void) | ||
501 | { | ||
502 | return platform_driver_register(&matrix_keypad_driver); | ||
503 | } | ||
504 | |||
505 | static void __exit matrix_keypad_exit(void) | ||
506 | { | ||
507 | platform_driver_unregister(&matrix_keypad_driver); | ||
508 | } | ||
509 | |||
510 | module_init(matrix_keypad_init); | ||
511 | module_exit(matrix_keypad_exit); | ||
512 | 500 | ||
513 | MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>"); | 501 | MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>"); |
514 | MODULE_DESCRIPTION("GPIO Driven Matrix Keypad Driver"); | 502 | MODULE_DESCRIPTION("GPIO Driven Matrix Keypad Driver"); |
diff --git a/drivers/input/keyboard/nomadik-ske-keypad.c b/drivers/input/keyboard/nomadik-ske-keypad.c index fcdec5e2b297..5a71e55c9c54 100644 --- a/drivers/input/keyboard/nomadik-ske-keypad.c +++ b/drivers/input/keyboard/nomadik-ske-keypad.c | |||
@@ -379,7 +379,7 @@ static const struct dev_pm_ops ske_keypad_dev_pm_ops = { | |||
379 | }; | 379 | }; |
380 | #endif | 380 | #endif |
381 | 381 | ||
382 | struct platform_driver ske_keypad_driver = { | 382 | static struct platform_driver ske_keypad_driver = { |
383 | .driver = { | 383 | .driver = { |
384 | .name = "nmk-ske-keypad", | 384 | .name = "nmk-ske-keypad", |
385 | .owner = THIS_MODULE, | 385 | .owner = THIS_MODULE, |
@@ -390,18 +390,7 @@ struct platform_driver ske_keypad_driver = { | |||
390 | .probe = ske_keypad_probe, | 390 | .probe = ske_keypad_probe, |
391 | .remove = __devexit_p(ske_keypad_remove), | 391 | .remove = __devexit_p(ske_keypad_remove), |
392 | }; | 392 | }; |
393 | 393 | module_platform_driver(ske_keypad_driver); | |
394 | static int __init ske_keypad_init(void) | ||
395 | { | ||
396 | return platform_driver_probe(&ske_keypad_driver, ske_keypad_probe); | ||
397 | } | ||
398 | module_init(ske_keypad_init); | ||
399 | |||
400 | static void __exit ske_keypad_exit(void) | ||
401 | { | ||
402 | platform_driver_unregister(&ske_keypad_driver); | ||
403 | } | ||
404 | module_exit(ske_keypad_exit); | ||
405 | 394 | ||
406 | MODULE_LICENSE("GPL v2"); | 395 | MODULE_LICENSE("GPL v2"); |
407 | MODULE_AUTHOR("Naveen Kumar <naveen.gaddipati@stericsson.com> / Sundar Iyer <sundar.iyer@stericsson.com>"); | 396 | MODULE_AUTHOR("Naveen Kumar <naveen.gaddipati@stericsson.com> / Sundar Iyer <sundar.iyer@stericsson.com>"); |
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c index 323bcdfff248..6b630d9d3dff 100644 --- a/drivers/input/keyboard/omap-keypad.c +++ b/drivers/input/keyboard/omap-keypad.c | |||
@@ -473,20 +473,7 @@ static struct platform_driver omap_kp_driver = { | |||
473 | .owner = THIS_MODULE, | 473 | .owner = THIS_MODULE, |
474 | }, | 474 | }, |
475 | }; | 475 | }; |
476 | 476 | module_platform_driver(omap_kp_driver); | |
477 | static int __init omap_kp_init(void) | ||
478 | { | ||
479 | printk(KERN_INFO "OMAP Keypad Driver\n"); | ||
480 | return platform_driver_register(&omap_kp_driver); | ||
481 | } | ||
482 | |||
483 | static void __exit omap_kp_exit(void) | ||
484 | { | ||
485 | platform_driver_unregister(&omap_kp_driver); | ||
486 | } | ||
487 | |||
488 | module_init(omap_kp_init); | ||
489 | module_exit(omap_kp_exit); | ||
490 | 477 | ||
491 | MODULE_AUTHOR("Timo Teräs"); | 478 | MODULE_AUTHOR("Timo Teräs"); |
492 | MODULE_DESCRIPTION("OMAP Keypad Driver"); | 479 | MODULE_DESCRIPTION("OMAP Keypad Driver"); |
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index c51a3c4a7feb..d5c5d77f4b82 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c | |||
@@ -335,18 +335,7 @@ static struct platform_driver omap4_keypad_driver = { | |||
335 | .owner = THIS_MODULE, | 335 | .owner = THIS_MODULE, |
336 | }, | 336 | }, |
337 | }; | 337 | }; |
338 | 338 | module_platform_driver(omap4_keypad_driver); | |
339 | static int __init omap4_keypad_init(void) | ||
340 | { | ||
341 | return platform_driver_register(&omap4_keypad_driver); | ||
342 | } | ||
343 | module_init(omap4_keypad_init); | ||
344 | |||
345 | static void __exit omap4_keypad_exit(void) | ||
346 | { | ||
347 | platform_driver_unregister(&omap4_keypad_driver); | ||
348 | } | ||
349 | module_exit(omap4_keypad_exit); | ||
350 | 339 | ||
351 | MODULE_AUTHOR("Texas Instruments"); | 340 | MODULE_AUTHOR("Texas Instruments"); |
352 | MODULE_DESCRIPTION("OMAP4 Keypad Driver"); | 341 | MODULE_DESCRIPTION("OMAP4 Keypad Driver"); |
diff --git a/drivers/input/keyboard/opencores-kbd.c b/drivers/input/keyboard/opencores-kbd.c index 1f1a5563f60a..abe728c7b88e 100644 --- a/drivers/input/keyboard/opencores-kbd.c +++ b/drivers/input/keyboard/opencores-kbd.c | |||
@@ -163,18 +163,7 @@ static struct platform_driver opencores_kbd_device_driver = { | |||
163 | .name = "opencores-kbd", | 163 | .name = "opencores-kbd", |
164 | }, | 164 | }, |
165 | }; | 165 | }; |
166 | 166 | module_platform_driver(opencores_kbd_device_driver); | |
167 | static int __init opencores_kbd_init(void) | ||
168 | { | ||
169 | return platform_driver_register(&opencores_kbd_device_driver); | ||
170 | } | ||
171 | module_init(opencores_kbd_init); | ||
172 | |||
173 | static void __exit opencores_kbd_exit(void) | ||
174 | { | ||
175 | platform_driver_unregister(&opencores_kbd_device_driver); | ||
176 | } | ||
177 | module_exit(opencores_kbd_exit); | ||
178 | 167 | ||
179 | MODULE_LICENSE("GPL"); | 168 | MODULE_LICENSE("GPL"); |
180 | MODULE_AUTHOR("Javier Herrero <jherrero@hvsistemas.es>"); | 169 | MODULE_AUTHOR("Javier Herrero <jherrero@hvsistemas.es>"); |
diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c index e7cc51d0fb34..01a1c9f8a383 100644 --- a/drivers/input/keyboard/pmic8xxx-keypad.c +++ b/drivers/input/keyboard/pmic8xxx-keypad.c | |||
@@ -780,18 +780,7 @@ static struct platform_driver pmic8xxx_kp_driver = { | |||
780 | .pm = &pm8xxx_kp_pm_ops, | 780 | .pm = &pm8xxx_kp_pm_ops, |
781 | }, | 781 | }, |
782 | }; | 782 | }; |
783 | 783 | module_platform_driver(pmic8xxx_kp_driver); | |
784 | static int __init pmic8xxx_kp_init(void) | ||
785 | { | ||
786 | return platform_driver_register(&pmic8xxx_kp_driver); | ||
787 | } | ||
788 | module_init(pmic8xxx_kp_init); | ||
789 | |||
790 | static void __exit pmic8xxx_kp_exit(void) | ||
791 | { | ||
792 | platform_driver_unregister(&pmic8xxx_kp_driver); | ||
793 | } | ||
794 | module_exit(pmic8xxx_kp_exit); | ||
795 | 784 | ||
796 | MODULE_LICENSE("GPL v2"); | 785 | MODULE_LICENSE("GPL v2"); |
797 | MODULE_DESCRIPTION("PMIC8XXX keypad driver"); | 786 | MODULE_DESCRIPTION("PMIC8XXX keypad driver"); |
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index eca6ae63de14..29fe1b2be1c1 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c | |||
@@ -602,19 +602,7 @@ static struct platform_driver pxa27x_keypad_driver = { | |||
602 | #endif | 602 | #endif |
603 | }, | 603 | }, |
604 | }; | 604 | }; |
605 | 605 | module_platform_driver(pxa27x_keypad_driver); | |
606 | static int __init pxa27x_keypad_init(void) | ||
607 | { | ||
608 | return platform_driver_register(&pxa27x_keypad_driver); | ||
609 | } | ||
610 | |||
611 | static void __exit pxa27x_keypad_exit(void) | ||
612 | { | ||
613 | platform_driver_unregister(&pxa27x_keypad_driver); | ||
614 | } | ||
615 | |||
616 | module_init(pxa27x_keypad_init); | ||
617 | module_exit(pxa27x_keypad_exit); | ||
618 | 606 | ||
619 | MODULE_DESCRIPTION("PXA27x Keypad Controller Driver"); | 607 | MODULE_DESCRIPTION("PXA27x Keypad Controller Driver"); |
620 | MODULE_LICENSE("GPL"); | 608 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/input/keyboard/pxa930_rotary.c b/drivers/input/keyboard/pxa930_rotary.c index 35451bf780c7..d7f1134b789e 100644 --- a/drivers/input/keyboard/pxa930_rotary.c +++ b/drivers/input/keyboard/pxa930_rotary.c | |||
@@ -195,18 +195,7 @@ static struct platform_driver pxa930_rotary_driver = { | |||
195 | .probe = pxa930_rotary_probe, | 195 | .probe = pxa930_rotary_probe, |
196 | .remove = __devexit_p(pxa930_rotary_remove), | 196 | .remove = __devexit_p(pxa930_rotary_remove), |
197 | }; | 197 | }; |
198 | 198 | module_platform_driver(pxa930_rotary_driver); | |
199 | static int __init pxa930_rotary_init(void) | ||
200 | { | ||
201 | return platform_driver_register(&pxa930_rotary_driver); | ||
202 | } | ||
203 | module_init(pxa930_rotary_init); | ||
204 | |||
205 | static void __exit pxa930_rotary_exit(void) | ||
206 | { | ||
207 | platform_driver_unregister(&pxa930_rotary_driver); | ||
208 | } | ||
209 | module_exit(pxa930_rotary_exit); | ||
210 | 199 | ||
211 | MODULE_LICENSE("GPL"); | 200 | MODULE_LICENSE("GPL"); |
212 | MODULE_DESCRIPTION("Driver for PXA93x Enhanced Rotary Controller"); | 201 | MODULE_DESCRIPTION("Driver for PXA93x Enhanced Rotary Controller"); |
diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index 8a0060cd3982..17ba7f9f80f3 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c | |||
@@ -20,11 +20,13 @@ | |||
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <linux/pm.h> | ||
24 | #include <linux/pm_runtime.h> | ||
23 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
24 | #include <linux/of.h> | 26 | #include <linux/of.h> |
25 | #include <linux/of_gpio.h> | 27 | #include <linux/of_gpio.h> |
26 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
27 | #include <plat/keypad.h> | 29 | #include <linux/input/samsung-keypad.h> |
28 | 30 | ||
29 | #define SAMSUNG_KEYIFCON 0x00 | 31 | #define SAMSUNG_KEYIFCON 0x00 |
30 | #define SAMSUNG_KEYIFSTSCLR 0x04 | 32 | #define SAMSUNG_KEYIFSTSCLR 0x04 |
@@ -65,10 +67,12 @@ enum samsung_keypad_type { | |||
65 | 67 | ||
66 | struct samsung_keypad { | 68 | struct samsung_keypad { |
67 | struct input_dev *input_dev; | 69 | struct input_dev *input_dev; |
70 | struct platform_device *pdev; | ||
68 | struct clk *clk; | 71 | struct clk *clk; |
69 | void __iomem *base; | 72 | void __iomem *base; |
70 | wait_queue_head_t wait; | 73 | wait_queue_head_t wait; |
71 | bool stopped; | 74 | bool stopped; |
75 | bool wake_enabled; | ||
72 | int irq; | 76 | int irq; |
73 | enum samsung_keypad_type type; | 77 | enum samsung_keypad_type type; |
74 | unsigned int row_shift; | 78 | unsigned int row_shift; |
@@ -155,6 +159,8 @@ static irqreturn_t samsung_keypad_irq(int irq, void *dev_id) | |||
155 | unsigned int val; | 159 | unsigned int val; |
156 | bool key_down; | 160 | bool key_down; |
157 | 161 | ||
162 | pm_runtime_get_sync(&keypad->pdev->dev); | ||
163 | |||
158 | do { | 164 | do { |
159 | val = readl(keypad->base + SAMSUNG_KEYIFSTSCLR); | 165 | val = readl(keypad->base + SAMSUNG_KEYIFSTSCLR); |
160 | /* Clear interrupt. */ | 166 | /* Clear interrupt. */ |
@@ -169,6 +175,8 @@ static irqreturn_t samsung_keypad_irq(int irq, void *dev_id) | |||
169 | 175 | ||
170 | } while (key_down && !keypad->stopped); | 176 | } while (key_down && !keypad->stopped); |
171 | 177 | ||
178 | pm_runtime_put_sync(&keypad->pdev->dev); | ||
179 | |||
172 | return IRQ_HANDLED; | 180 | return IRQ_HANDLED; |
173 | } | 181 | } |
174 | 182 | ||
@@ -176,6 +184,8 @@ static void samsung_keypad_start(struct samsung_keypad *keypad) | |||
176 | { | 184 | { |
177 | unsigned int val; | 185 | unsigned int val; |
178 | 186 | ||
187 | pm_runtime_get_sync(&keypad->pdev->dev); | ||
188 | |||
179 | /* Tell IRQ thread that it may poll the device. */ | 189 | /* Tell IRQ thread that it may poll the device. */ |
180 | keypad->stopped = false; | 190 | keypad->stopped = false; |
181 | 191 | ||
@@ -188,12 +198,16 @@ static void samsung_keypad_start(struct samsung_keypad *keypad) | |||
188 | 198 | ||
189 | /* KEYIFCOL reg clear. */ | 199 | /* KEYIFCOL reg clear. */ |
190 | writel(0, keypad->base + SAMSUNG_KEYIFCOL); | 200 | writel(0, keypad->base + SAMSUNG_KEYIFCOL); |
201 | |||
202 | pm_runtime_put_sync(&keypad->pdev->dev); | ||
191 | } | 203 | } |
192 | 204 | ||
193 | static void samsung_keypad_stop(struct samsung_keypad *keypad) | 205 | static void samsung_keypad_stop(struct samsung_keypad *keypad) |
194 | { | 206 | { |
195 | unsigned int val; | 207 | unsigned int val; |
196 | 208 | ||
209 | pm_runtime_get_sync(&keypad->pdev->dev); | ||
210 | |||
197 | /* Signal IRQ thread to stop polling and disable the handler. */ | 211 | /* Signal IRQ thread to stop polling and disable the handler. */ |
198 | keypad->stopped = true; | 212 | keypad->stopped = true; |
199 | wake_up(&keypad->wait); | 213 | wake_up(&keypad->wait); |
@@ -214,6 +228,8 @@ static void samsung_keypad_stop(struct samsung_keypad *keypad) | |||
214 | * re-enable the handler. | 228 | * re-enable the handler. |
215 | */ | 229 | */ |
216 | enable_irq(keypad->irq); | 230 | enable_irq(keypad->irq); |
231 | |||
232 | pm_runtime_put_sync(&keypad->pdev->dev); | ||
217 | } | 233 | } |
218 | 234 | ||
219 | static int samsung_keypad_open(struct input_dev *input_dev) | 235 | static int samsung_keypad_open(struct input_dev *input_dev) |
@@ -418,9 +434,11 @@ static int __devinit samsung_keypad_probe(struct platform_device *pdev) | |||
418 | } | 434 | } |
419 | 435 | ||
420 | keypad->input_dev = input_dev; | 436 | keypad->input_dev = input_dev; |
437 | keypad->pdev = pdev; | ||
421 | keypad->row_shift = row_shift; | 438 | keypad->row_shift = row_shift; |
422 | keypad->rows = pdata->rows; | 439 | keypad->rows = pdata->rows; |
423 | keypad->cols = pdata->cols; | 440 | keypad->cols = pdata->cols; |
441 | keypad->stopped = true; | ||
424 | init_waitqueue_head(&keypad->wait); | 442 | init_waitqueue_head(&keypad->wait); |
425 | 443 | ||
426 | if (pdev->dev.of_node) { | 444 | if (pdev->dev.of_node) { |
@@ -467,13 +485,14 @@ static int __devinit samsung_keypad_probe(struct platform_device *pdev) | |||
467 | goto err_put_clk; | 485 | goto err_put_clk; |
468 | } | 486 | } |
469 | 487 | ||
488 | device_init_wakeup(&pdev->dev, pdata->wakeup); | ||
489 | platform_set_drvdata(pdev, keypad); | ||
490 | pm_runtime_enable(&pdev->dev); | ||
491 | |||
470 | error = input_register_device(keypad->input_dev); | 492 | error = input_register_device(keypad->input_dev); |
471 | if (error) | 493 | if (error) |
472 | goto err_free_irq; | 494 | goto err_free_irq; |
473 | 495 | ||
474 | device_init_wakeup(&pdev->dev, pdata->wakeup); | ||
475 | platform_set_drvdata(pdev, keypad); | ||
476 | |||
477 | if (pdev->dev.of_node) { | 496 | if (pdev->dev.of_node) { |
478 | devm_kfree(&pdev->dev, (void *)pdata->keymap_data->keymap); | 497 | devm_kfree(&pdev->dev, (void *)pdata->keymap_data->keymap); |
479 | devm_kfree(&pdev->dev, (void *)pdata->keymap_data); | 498 | devm_kfree(&pdev->dev, (void *)pdata->keymap_data); |
@@ -483,6 +502,9 @@ static int __devinit samsung_keypad_probe(struct platform_device *pdev) | |||
483 | 502 | ||
484 | err_free_irq: | 503 | err_free_irq: |
485 | free_irq(keypad->irq, keypad); | 504 | free_irq(keypad->irq, keypad); |
505 | pm_runtime_disable(&pdev->dev); | ||
506 | device_init_wakeup(&pdev->dev, 0); | ||
507 | platform_set_drvdata(pdev, NULL); | ||
486 | err_put_clk: | 508 | err_put_clk: |
487 | clk_put(keypad->clk); | 509 | clk_put(keypad->clk); |
488 | samsung_keypad_dt_gpio_free(keypad); | 510 | samsung_keypad_dt_gpio_free(keypad); |
@@ -499,6 +521,7 @@ static int __devexit samsung_keypad_remove(struct platform_device *pdev) | |||
499 | { | 521 | { |
500 | struct samsung_keypad *keypad = platform_get_drvdata(pdev); | 522 | struct samsung_keypad *keypad = platform_get_drvdata(pdev); |
501 | 523 | ||
524 | pm_runtime_disable(&pdev->dev); | ||
502 | device_init_wakeup(&pdev->dev, 0); | 525 | device_init_wakeup(&pdev->dev, 0); |
503 | platform_set_drvdata(pdev, NULL); | 526 | platform_set_drvdata(pdev, NULL); |
504 | 527 | ||
@@ -519,11 +542,57 @@ static int __devexit samsung_keypad_remove(struct platform_device *pdev) | |||
519 | return 0; | 542 | return 0; |
520 | } | 543 | } |
521 | 544 | ||
522 | #ifdef CONFIG_PM | 545 | #ifdef CONFIG_PM_RUNTIME |
546 | static int samsung_keypad_runtime_suspend(struct device *dev) | ||
547 | { | ||
548 | struct platform_device *pdev = to_platform_device(dev); | ||
549 | struct samsung_keypad *keypad = platform_get_drvdata(pdev); | ||
550 | unsigned int val; | ||
551 | int error; | ||
552 | |||
553 | if (keypad->stopped) | ||
554 | return 0; | ||
555 | |||
556 | /* This may fail on some SoCs due to lack of controller support */ | ||
557 | error = enable_irq_wake(keypad->irq); | ||
558 | if (!error) | ||
559 | keypad->wake_enabled = true; | ||
560 | |||
561 | val = readl(keypad->base + SAMSUNG_KEYIFCON); | ||
562 | val |= SAMSUNG_KEYIFCON_WAKEUPEN; | ||
563 | writel(val, keypad->base + SAMSUNG_KEYIFCON); | ||
564 | |||
565 | clk_disable(keypad->clk); | ||
566 | |||
567 | return 0; | ||
568 | } | ||
569 | |||
570 | static int samsung_keypad_runtime_resume(struct device *dev) | ||
571 | { | ||
572 | struct platform_device *pdev = to_platform_device(dev); | ||
573 | struct samsung_keypad *keypad = platform_get_drvdata(pdev); | ||
574 | unsigned int val; | ||
575 | |||
576 | if (keypad->stopped) | ||
577 | return 0; | ||
578 | |||
579 | clk_enable(keypad->clk); | ||
580 | |||
581 | val = readl(keypad->base + SAMSUNG_KEYIFCON); | ||
582 | val &= ~SAMSUNG_KEYIFCON_WAKEUPEN; | ||
583 | writel(val, keypad->base + SAMSUNG_KEYIFCON); | ||
584 | |||
585 | if (keypad->wake_enabled) | ||
586 | disable_irq_wake(keypad->irq); | ||
587 | |||
588 | return 0; | ||
589 | } | ||
590 | #endif | ||
591 | |||
592 | #ifdef CONFIG_PM_SLEEP | ||
523 | static void samsung_keypad_toggle_wakeup(struct samsung_keypad *keypad, | 593 | static void samsung_keypad_toggle_wakeup(struct samsung_keypad *keypad, |
524 | bool enable) | 594 | bool enable) |
525 | { | 595 | { |
526 | struct device *dev = keypad->input_dev->dev.parent; | ||
527 | unsigned int val; | 596 | unsigned int val; |
528 | 597 | ||
529 | clk_enable(keypad->clk); | 598 | clk_enable(keypad->clk); |
@@ -531,11 +600,11 @@ static void samsung_keypad_toggle_wakeup(struct samsung_keypad *keypad, | |||
531 | val = readl(keypad->base + SAMSUNG_KEYIFCON); | 600 | val = readl(keypad->base + SAMSUNG_KEYIFCON); |
532 | if (enable) { | 601 | if (enable) { |
533 | val |= SAMSUNG_KEYIFCON_WAKEUPEN; | 602 | val |= SAMSUNG_KEYIFCON_WAKEUPEN; |
534 | if (device_may_wakeup(dev)) | 603 | if (device_may_wakeup(&keypad->pdev->dev)) |
535 | enable_irq_wake(keypad->irq); | 604 | enable_irq_wake(keypad->irq); |
536 | } else { | 605 | } else { |
537 | val &= ~SAMSUNG_KEYIFCON_WAKEUPEN; | 606 | val &= ~SAMSUNG_KEYIFCON_WAKEUPEN; |
538 | if (device_may_wakeup(dev)) | 607 | if (device_may_wakeup(&keypad->pdev->dev)) |
539 | disable_irq_wake(keypad->irq); | 608 | disable_irq_wake(keypad->irq); |
540 | } | 609 | } |
541 | writel(val, keypad->base + SAMSUNG_KEYIFCON); | 610 | writel(val, keypad->base + SAMSUNG_KEYIFCON); |
@@ -578,12 +647,13 @@ static int samsung_keypad_resume(struct device *dev) | |||
578 | 647 | ||
579 | return 0; | 648 | return 0; |
580 | } | 649 | } |
650 | #endif | ||
581 | 651 | ||
582 | static const struct dev_pm_ops samsung_keypad_pm_ops = { | 652 | static const struct dev_pm_ops samsung_keypad_pm_ops = { |
583 | .suspend = samsung_keypad_suspend, | 653 | SET_SYSTEM_SLEEP_PM_OPS(samsung_keypad_suspend, samsung_keypad_resume) |
584 | .resume = samsung_keypad_resume, | 654 | SET_RUNTIME_PM_OPS(samsung_keypad_runtime_suspend, |
655 | samsung_keypad_runtime_resume, NULL) | ||
585 | }; | 656 | }; |
586 | #endif | ||
587 | 657 | ||
588 | #ifdef CONFIG_OF | 658 | #ifdef CONFIG_OF |
589 | static const struct of_device_id samsung_keypad_dt_match[] = { | 659 | static const struct of_device_id samsung_keypad_dt_match[] = { |
@@ -615,27 +685,13 @@ static struct platform_driver samsung_keypad_driver = { | |||
615 | .name = "samsung-keypad", | 685 | .name = "samsung-keypad", |
616 | .owner = THIS_MODULE, | 686 | .owner = THIS_MODULE, |
617 | .of_match_table = samsung_keypad_dt_match, | 687 | .of_match_table = samsung_keypad_dt_match, |
618 | #ifdef CONFIG_PM | ||
619 | .pm = &samsung_keypad_pm_ops, | 688 | .pm = &samsung_keypad_pm_ops, |
620 | #endif | ||
621 | }, | 689 | }, |
622 | .id_table = samsung_keypad_driver_ids, | 690 | .id_table = samsung_keypad_driver_ids, |
623 | }; | 691 | }; |
624 | 692 | module_platform_driver(samsung_keypad_driver); | |
625 | static int __init samsung_keypad_init(void) | ||
626 | { | ||
627 | return platform_driver_register(&samsung_keypad_driver); | ||
628 | } | ||
629 | module_init(samsung_keypad_init); | ||
630 | |||
631 | static void __exit samsung_keypad_exit(void) | ||
632 | { | ||
633 | platform_driver_unregister(&samsung_keypad_driver); | ||
634 | } | ||
635 | module_exit(samsung_keypad_exit); | ||
636 | 693 | ||
637 | MODULE_DESCRIPTION("Samsung keypad driver"); | 694 | MODULE_DESCRIPTION("Samsung keypad driver"); |
638 | MODULE_AUTHOR("Joonyoung Shim <jy0922.shim@samsung.com>"); | 695 | MODULE_AUTHOR("Joonyoung Shim <jy0922.shim@samsung.com>"); |
639 | MODULE_AUTHOR("Donghwa Lee <dh09.lee@samsung.com>"); | 696 | MODULE_AUTHOR("Donghwa Lee <dh09.lee@samsung.com>"); |
640 | MODULE_LICENSE("GPL"); | 697 | MODULE_LICENSE("GPL"); |
641 | MODULE_ALIAS("platform:samsung-keypad"); | ||
diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c index 934aeb583b30..da54ad5db154 100644 --- a/drivers/input/keyboard/sh_keysc.c +++ b/drivers/input/keyboard/sh_keysc.c | |||
@@ -337,19 +337,7 @@ static struct platform_driver sh_keysc_device_driver = { | |||
337 | .pm = &sh_keysc_dev_pm_ops, | 337 | .pm = &sh_keysc_dev_pm_ops, |
338 | } | 338 | } |
339 | }; | 339 | }; |
340 | 340 | module_platform_driver(sh_keysc_device_driver); | |
341 | static int __init sh_keysc_init(void) | ||
342 | { | ||
343 | return platform_driver_register(&sh_keysc_device_driver); | ||
344 | } | ||
345 | |||
346 | static void __exit sh_keysc_exit(void) | ||
347 | { | ||
348 | platform_driver_unregister(&sh_keysc_device_driver); | ||
349 | } | ||
350 | |||
351 | module_init(sh_keysc_init); | ||
352 | module_exit(sh_keysc_exit); | ||
353 | 341 | ||
354 | MODULE_AUTHOR("Magnus Damm"); | 342 | MODULE_AUTHOR("Magnus Damm"); |
355 | MODULE_DESCRIPTION("SuperH KEYSC Keypad Driver"); | 343 | MODULE_DESCRIPTION("SuperH KEYSC Keypad Driver"); |
diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index d712dffd2157..c88bd63dc9cc 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c | |||
@@ -326,18 +326,7 @@ static struct platform_driver spear_kbd_driver = { | |||
326 | #endif | 326 | #endif |
327 | }, | 327 | }, |
328 | }; | 328 | }; |
329 | 329 | module_platform_driver(spear_kbd_driver); | |
330 | static int __init spear_kbd_init(void) | ||
331 | { | ||
332 | return platform_driver_register(&spear_kbd_driver); | ||
333 | } | ||
334 | module_init(spear_kbd_init); | ||
335 | |||
336 | static void __exit spear_kbd_exit(void) | ||
337 | { | ||
338 | platform_driver_unregister(&spear_kbd_driver); | ||
339 | } | ||
340 | module_exit(spear_kbd_exit); | ||
341 | 330 | ||
342 | MODULE_AUTHOR("Rajeev Kumar"); | 331 | MODULE_AUTHOR("Rajeev Kumar"); |
343 | MODULE_DESCRIPTION("SPEAr Keyboard Driver"); | 332 | MODULE_DESCRIPTION("SPEAr Keyboard Driver"); |
diff --git a/drivers/input/keyboard/stmpe-keypad.c b/drivers/input/keyboard/stmpe-keypad.c index ab7610ca10eb..9397cf9c625c 100644 --- a/drivers/input/keyboard/stmpe-keypad.c +++ b/drivers/input/keyboard/stmpe-keypad.c | |||
@@ -368,18 +368,7 @@ static struct platform_driver stmpe_keypad_driver = { | |||
368 | .probe = stmpe_keypad_probe, | 368 | .probe = stmpe_keypad_probe, |
369 | .remove = __devexit_p(stmpe_keypad_remove), | 369 | .remove = __devexit_p(stmpe_keypad_remove), |
370 | }; | 370 | }; |
371 | 371 | module_platform_driver(stmpe_keypad_driver); | |
372 | static int __init stmpe_keypad_init(void) | ||
373 | { | ||
374 | return platform_driver_register(&stmpe_keypad_driver); | ||
375 | } | ||
376 | module_init(stmpe_keypad_init); | ||
377 | |||
378 | static void __exit stmpe_keypad_exit(void) | ||
379 | { | ||
380 | platform_driver_unregister(&stmpe_keypad_driver); | ||
381 | } | ||
382 | module_exit(stmpe_keypad_exit); | ||
383 | 372 | ||
384 | MODULE_LICENSE("GPL v2"); | 373 | MODULE_LICENSE("GPL v2"); |
385 | MODULE_DESCRIPTION("STMPExxxx keypad driver"); | 374 | MODULE_DESCRIPTION("STMPExxxx keypad driver"); |
diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c index f60c9e82f204..2dee3e4e7c6f 100644 --- a/drivers/input/keyboard/tc3589x-keypad.c +++ b/drivers/input/keyboard/tc3589x-keypad.c | |||
@@ -74,11 +74,13 @@ | |||
74 | 74 | ||
75 | /** | 75 | /** |
76 | * struct tc_keypad - data structure used by keypad driver | 76 | * struct tc_keypad - data structure used by keypad driver |
77 | * @tc3589x: pointer to tc35893 | ||
77 | * @input: pointer to input device object | 78 | * @input: pointer to input device object |
78 | * @board: keypad platform device | 79 | * @board: keypad platform device |
79 | * @krow: number of rows | 80 | * @krow: number of rows |
80 | * @kcol: number of coloumns | 81 | * @kcol: number of coloumns |
81 | * @keymap: matrix scan code table for keycodes | 82 | * @keymap: matrix scan code table for keycodes |
83 | * @keypad_stopped: holds keypad status | ||
82 | */ | 84 | */ |
83 | struct tc_keypad { | 85 | struct tc_keypad { |
84 | struct tc3589x *tc3589x; | 86 | struct tc3589x *tc3589x; |
@@ -453,18 +455,7 @@ static struct platform_driver tc3589x_keypad_driver = { | |||
453 | .probe = tc3589x_keypad_probe, | 455 | .probe = tc3589x_keypad_probe, |
454 | .remove = __devexit_p(tc3589x_keypad_remove), | 456 | .remove = __devexit_p(tc3589x_keypad_remove), |
455 | }; | 457 | }; |
456 | 458 | module_platform_driver(tc3589x_keypad_driver); | |
457 | static int __init tc3589x_keypad_init(void) | ||
458 | { | ||
459 | return platform_driver_register(&tc3589x_keypad_driver); | ||
460 | } | ||
461 | module_init(tc3589x_keypad_init); | ||
462 | |||
463 | static void __exit tc3589x_keypad_exit(void) | ||
464 | { | ||
465 | return platform_driver_unregister(&tc3589x_keypad_driver); | ||
466 | } | ||
467 | module_exit(tc3589x_keypad_exit); | ||
468 | 459 | ||
469 | MODULE_LICENSE("GPL v2"); | 460 | MODULE_LICENSE("GPL v2"); |
470 | MODULE_AUTHOR("Jayeeta Banerjee/Sundar Iyer"); | 461 | MODULE_AUTHOR("Jayeeta Banerjee/Sundar Iyer"); |
diff --git a/drivers/input/keyboard/tca8418_keypad.c b/drivers/input/keyboard/tca8418_keypad.c new file mode 100644 index 000000000000..958ec107bfbc --- /dev/null +++ b/drivers/input/keyboard/tca8418_keypad.c | |||
@@ -0,0 +1,430 @@ | |||
1 | /* | ||
2 | * Driver for TCA8418 I2C keyboard | ||
3 | * | ||
4 | * Copyright (C) 2011 Fuel7, Inc. All rights reserved. | ||
5 | * | ||
6 | * Author: Kyle Manna <kyle.manna@fuel7.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public | ||
10 | * License v2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public | ||
18 | * License along with this program; if not, write to the | ||
19 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
20 | * Boston, MA 021110-1307, USA. | ||
21 | * | ||
22 | * If you can't comply with GPLv2, alternative licensing terms may be | ||
23 | * arranged. Please contact Fuel7, Inc. (http://fuel7.com/) for proprietary | ||
24 | * alternative licensing inquiries. | ||
25 | */ | ||
26 | |||
27 | #include <linux/types.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/init.h> | ||
30 | #include <linux/delay.h> | ||
31 | #include <linux/slab.h> | ||
32 | #include <linux/interrupt.h> | ||
33 | #include <linux/workqueue.h> | ||
34 | #include <linux/gpio.h> | ||
35 | #include <linux/i2c.h> | ||
36 | #include <linux/input.h> | ||
37 | #include <linux/input/tca8418_keypad.h> | ||
38 | |||
39 | /* TCA8418 hardware limits */ | ||
40 | #define TCA8418_MAX_ROWS 8 | ||
41 | #define TCA8418_MAX_COLS 10 | ||
42 | |||
43 | /* TCA8418 register offsets */ | ||
44 | #define REG_CFG 0x01 | ||
45 | #define REG_INT_STAT 0x02 | ||
46 | #define REG_KEY_LCK_EC 0x03 | ||
47 | #define REG_KEY_EVENT_A 0x04 | ||
48 | #define REG_KEY_EVENT_B 0x05 | ||
49 | #define REG_KEY_EVENT_C 0x06 | ||
50 | #define REG_KEY_EVENT_D 0x07 | ||
51 | #define REG_KEY_EVENT_E 0x08 | ||
52 | #define REG_KEY_EVENT_F 0x09 | ||
53 | #define REG_KEY_EVENT_G 0x0A | ||
54 | #define REG_KEY_EVENT_H 0x0B | ||
55 | #define REG_KEY_EVENT_I 0x0C | ||
56 | #define REG_KEY_EVENT_J 0x0D | ||
57 | #define REG_KP_LCK_TIMER 0x0E | ||
58 | #define REG_UNLOCK1 0x0F | ||
59 | #define REG_UNLOCK2 0x10 | ||
60 | #define REG_GPIO_INT_STAT1 0x11 | ||
61 | #define REG_GPIO_INT_STAT2 0x12 | ||
62 | #define REG_GPIO_INT_STAT3 0x13 | ||
63 | #define REG_GPIO_DAT_STAT1 0x14 | ||
64 | #define REG_GPIO_DAT_STAT2 0x15 | ||
65 | #define REG_GPIO_DAT_STAT3 0x16 | ||
66 | #define REG_GPIO_DAT_OUT1 0x17 | ||
67 | #define REG_GPIO_DAT_OUT2 0x18 | ||
68 | #define REG_GPIO_DAT_OUT3 0x19 | ||
69 | #define REG_GPIO_INT_EN1 0x1A | ||
70 | #define REG_GPIO_INT_EN2 0x1B | ||
71 | #define REG_GPIO_INT_EN3 0x1C | ||
72 | #define REG_KP_GPIO1 0x1D | ||
73 | #define REG_KP_GPIO2 0x1E | ||
74 | #define REG_KP_GPIO3 0x1F | ||
75 | #define REG_GPI_EM1 0x20 | ||
76 | #define REG_GPI_EM2 0x21 | ||
77 | #define REG_GPI_EM3 0x22 | ||
78 | #define REG_GPIO_DIR1 0x23 | ||
79 | #define REG_GPIO_DIR2 0x24 | ||
80 | #define REG_GPIO_DIR3 0x25 | ||
81 | #define REG_GPIO_INT_LVL1 0x26 | ||
82 | #define REG_GPIO_INT_LVL2 0x27 | ||
83 | #define REG_GPIO_INT_LVL3 0x28 | ||
84 | #define REG_DEBOUNCE_DIS1 0x29 | ||
85 | #define REG_DEBOUNCE_DIS2 0x2A | ||
86 | #define REG_DEBOUNCE_DIS3 0x2B | ||
87 | #define REG_GPIO_PULL1 0x2C | ||
88 | #define REG_GPIO_PULL2 0x2D | ||
89 | #define REG_GPIO_PULL3 0x2E | ||
90 | |||
91 | /* TCA8418 bit definitions */ | ||
92 | #define CFG_AI BIT(7) | ||
93 | #define CFG_GPI_E_CFG BIT(6) | ||
94 | #define CFG_OVR_FLOW_M BIT(5) | ||
95 | #define CFG_INT_CFG BIT(4) | ||
96 | #define CFG_OVR_FLOW_IEN BIT(3) | ||
97 | #define CFG_K_LCK_IEN BIT(2) | ||
98 | #define CFG_GPI_IEN BIT(1) | ||
99 | #define CFG_KE_IEN BIT(0) | ||
100 | |||
101 | #define INT_STAT_CAD_INT BIT(4) | ||
102 | #define INT_STAT_OVR_FLOW_INT BIT(3) | ||
103 | #define INT_STAT_K_LCK_INT BIT(2) | ||
104 | #define INT_STAT_GPI_INT BIT(1) | ||
105 | #define INT_STAT_K_INT BIT(0) | ||
106 | |||
107 | /* TCA8418 register masks */ | ||
108 | #define KEY_LCK_EC_KEC 0x7 | ||
109 | #define KEY_EVENT_CODE 0x7f | ||
110 | #define KEY_EVENT_VALUE 0x80 | ||
111 | |||
112 | |||
113 | static const struct i2c_device_id tca8418_id[] = { | ||
114 | { TCA8418_NAME, 8418, }, | ||
115 | { } | ||
116 | }; | ||
117 | MODULE_DEVICE_TABLE(i2c, tca8418_id); | ||
118 | |||
119 | struct tca8418_keypad { | ||
120 | unsigned int rows; | ||
121 | unsigned int cols; | ||
122 | unsigned int keypad_mask; /* Mask for keypad col/rol regs */ | ||
123 | unsigned int irq; | ||
124 | unsigned int row_shift; | ||
125 | |||
126 | struct i2c_client *client; | ||
127 | struct input_dev *input; | ||
128 | |||
129 | /* Flexible array member, must be at end of struct */ | ||
130 | unsigned short keymap[]; | ||
131 | }; | ||
132 | |||
133 | /* | ||
134 | * Write a byte to the TCA8418 | ||
135 | */ | ||
136 | static int tca8418_write_byte(struct tca8418_keypad *keypad_data, | ||
137 | int reg, u8 val) | ||
138 | { | ||
139 | int error; | ||
140 | |||
141 | error = i2c_smbus_write_byte_data(keypad_data->client, reg, val); | ||
142 | if (error < 0) { | ||
143 | dev_err(&keypad_data->client->dev, | ||
144 | "%s failed, reg: %d, val: %d, error: %d\n", | ||
145 | __func__, reg, val, error); | ||
146 | return error; | ||
147 | } | ||
148 | |||
149 | return 0; | ||
150 | } | ||
151 | |||
152 | /* | ||
153 | * Read a byte from the TCA8418 | ||
154 | */ | ||
155 | static int tca8418_read_byte(struct tca8418_keypad *keypad_data, | ||
156 | int reg, u8 *val) | ||
157 | { | ||
158 | int error; | ||
159 | |||
160 | error = i2c_smbus_read_byte_data(keypad_data->client, reg); | ||
161 | if (error < 0) { | ||
162 | dev_err(&keypad_data->client->dev, | ||
163 | "%s failed, reg: %d, error: %d\n", | ||
164 | __func__, reg, error); | ||
165 | return error; | ||
166 | } | ||
167 | |||
168 | *val = (u8)error; | ||
169 | |||
170 | return 0; | ||
171 | } | ||
172 | |||
173 | static void tca8418_read_keypad(struct tca8418_keypad *keypad_data) | ||
174 | { | ||
175 | int error, col, row; | ||
176 | u8 reg, state, code; | ||
177 | |||
178 | /* Initial read of the key event FIFO */ | ||
179 | error = tca8418_read_byte(keypad_data, REG_KEY_EVENT_A, ®); | ||
180 | |||
181 | /* Assume that key code 0 signifies empty FIFO */ | ||
182 | while (error >= 0 && reg > 0) { | ||
183 | state = reg & KEY_EVENT_VALUE; | ||
184 | code = reg & KEY_EVENT_CODE; | ||
185 | |||
186 | row = code / TCA8418_MAX_COLS; | ||
187 | col = code % TCA8418_MAX_COLS; | ||
188 | |||
189 | row = (col) ? row : row - 1; | ||
190 | col = (col) ? col - 1 : TCA8418_MAX_COLS - 1; | ||
191 | |||
192 | code = MATRIX_SCAN_CODE(row, col, keypad_data->row_shift); | ||
193 | input_event(keypad_data->input, EV_MSC, MSC_SCAN, code); | ||
194 | input_report_key(keypad_data->input, | ||
195 | keypad_data->keymap[code], state); | ||
196 | |||
197 | /* Read for next loop */ | ||
198 | error = tca8418_read_byte(keypad_data, REG_KEY_EVENT_A, ®); | ||
199 | } | ||
200 | |||
201 | if (error < 0) | ||
202 | dev_err(&keypad_data->client->dev, | ||
203 | "unable to read REG_KEY_EVENT_A\n"); | ||
204 | |||
205 | input_sync(keypad_data->input); | ||
206 | } | ||
207 | |||
208 | /* | ||
209 | * Threaded IRQ handler and this can (and will) sleep. | ||
210 | */ | ||
211 | static irqreturn_t tca8418_irq_handler(int irq, void *dev_id) | ||
212 | { | ||
213 | struct tca8418_keypad *keypad_data = dev_id; | ||
214 | u8 reg; | ||
215 | int error; | ||
216 | |||
217 | error = tca8418_read_byte(keypad_data, REG_INT_STAT, ®); | ||
218 | if (error) { | ||
219 | dev_err(&keypad_data->client->dev, | ||
220 | "unable to read REG_INT_STAT\n"); | ||
221 | goto exit; | ||
222 | } | ||
223 | |||
224 | if (reg & INT_STAT_OVR_FLOW_INT) | ||
225 | dev_warn(&keypad_data->client->dev, "overflow occurred\n"); | ||
226 | |||
227 | if (reg & INT_STAT_K_INT) | ||
228 | tca8418_read_keypad(keypad_data); | ||
229 | |||
230 | exit: | ||
231 | /* Clear all interrupts, even IRQs we didn't check (GPI, CAD, LCK) */ | ||
232 | reg = 0xff; | ||
233 | error = tca8418_write_byte(keypad_data, REG_INT_STAT, reg); | ||
234 | if (error) | ||
235 | dev_err(&keypad_data->client->dev, | ||
236 | "unable to clear REG_INT_STAT\n"); | ||
237 | |||
238 | return IRQ_HANDLED; | ||
239 | } | ||
240 | |||
241 | /* | ||
242 | * Configure the TCA8418 for keypad operation | ||
243 | */ | ||
244 | static int __devinit tca8418_configure(struct tca8418_keypad *keypad_data) | ||
245 | { | ||
246 | int reg, error; | ||
247 | |||
248 | /* Write config register, if this fails assume device not present */ | ||
249 | error = tca8418_write_byte(keypad_data, REG_CFG, | ||
250 | CFG_INT_CFG | CFG_OVR_FLOW_IEN | CFG_KE_IEN); | ||
251 | if (error < 0) | ||
252 | return -ENODEV; | ||
253 | |||
254 | |||
255 | /* Assemble a mask for row and column registers */ | ||
256 | reg = ~(~0 << keypad_data->rows); | ||
257 | reg += (~(~0 << keypad_data->cols)) << 8; | ||
258 | keypad_data->keypad_mask = reg; | ||
259 | |||
260 | /* Set registers to keypad mode */ | ||
261 | error |= tca8418_write_byte(keypad_data, REG_KP_GPIO1, reg); | ||
262 | error |= tca8418_write_byte(keypad_data, REG_KP_GPIO2, reg >> 8); | ||
263 | error |= tca8418_write_byte(keypad_data, REG_KP_GPIO3, reg >> 16); | ||
264 | |||
265 | /* Enable column debouncing */ | ||
266 | error |= tca8418_write_byte(keypad_data, REG_DEBOUNCE_DIS1, reg); | ||
267 | error |= tca8418_write_byte(keypad_data, REG_DEBOUNCE_DIS2, reg >> 8); | ||
268 | error |= tca8418_write_byte(keypad_data, REG_DEBOUNCE_DIS3, reg >> 16); | ||
269 | |||
270 | return error; | ||
271 | } | ||
272 | |||
273 | static int __devinit tca8418_keypad_probe(struct i2c_client *client, | ||
274 | const struct i2c_device_id *id) | ||
275 | { | ||
276 | const struct tca8418_keypad_platform_data *pdata = | ||
277 | client->dev.platform_data; | ||
278 | struct tca8418_keypad *keypad_data; | ||
279 | struct input_dev *input; | ||
280 | int error, row_shift, max_keys; | ||
281 | |||
282 | /* Copy the platform data */ | ||
283 | if (!pdata) { | ||
284 | dev_dbg(&client->dev, "no platform data\n"); | ||
285 | return -EINVAL; | ||
286 | } | ||
287 | |||
288 | if (!pdata->keymap_data) { | ||
289 | dev_err(&client->dev, "no keymap data defined\n"); | ||
290 | return -EINVAL; | ||
291 | } | ||
292 | |||
293 | if (!pdata->rows || pdata->rows > TCA8418_MAX_ROWS) { | ||
294 | dev_err(&client->dev, "invalid rows\n"); | ||
295 | return -EINVAL; | ||
296 | } | ||
297 | |||
298 | if (!pdata->cols || pdata->cols > TCA8418_MAX_COLS) { | ||
299 | dev_err(&client->dev, "invalid columns\n"); | ||
300 | return -EINVAL; | ||
301 | } | ||
302 | |||
303 | /* Check i2c driver capabilities */ | ||
304 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE)) { | ||
305 | dev_err(&client->dev, "%s adapter not supported\n", | ||
306 | dev_driver_string(&client->adapter->dev)); | ||
307 | return -ENODEV; | ||
308 | } | ||
309 | |||
310 | row_shift = get_count_order(pdata->cols); | ||
311 | max_keys = pdata->rows << row_shift; | ||
312 | |||
313 | /* Allocate memory for keypad_data, keymap and input device */ | ||
314 | keypad_data = kzalloc(sizeof(*keypad_data) + | ||
315 | max_keys * sizeof(keypad_data->keymap[0]), GFP_KERNEL); | ||
316 | if (!keypad_data) | ||
317 | return -ENOMEM; | ||
318 | |||
319 | keypad_data->rows = pdata->rows; | ||
320 | keypad_data->cols = pdata->cols; | ||
321 | keypad_data->client = client; | ||
322 | keypad_data->row_shift = row_shift; | ||
323 | |||
324 | /* Initialize the chip or fail if chip isn't present */ | ||
325 | error = tca8418_configure(keypad_data); | ||
326 | if (error < 0) | ||
327 | goto fail1; | ||
328 | |||
329 | /* Configure input device */ | ||
330 | input = input_allocate_device(); | ||
331 | if (!input) { | ||
332 | error = -ENOMEM; | ||
333 | goto fail1; | ||
334 | } | ||
335 | keypad_data->input = input; | ||
336 | |||
337 | input->name = client->name; | ||
338 | input->dev.parent = &client->dev; | ||
339 | |||
340 | input->id.bustype = BUS_I2C; | ||
341 | input->id.vendor = 0x0001; | ||
342 | input->id.product = 0x001; | ||
343 | input->id.version = 0x0001; | ||
344 | |||
345 | input->keycode = keypad_data->keymap; | ||
346 | input->keycodesize = sizeof(keypad_data->keymap[0]); | ||
347 | input->keycodemax = max_keys; | ||
348 | |||
349 | __set_bit(EV_KEY, input->evbit); | ||
350 | if (pdata->rep) | ||
351 | __set_bit(EV_REP, input->evbit); | ||
352 | |||
353 | input_set_capability(input, EV_MSC, MSC_SCAN); | ||
354 | |||
355 | input_set_drvdata(input, keypad_data); | ||
356 | |||
357 | matrix_keypad_build_keymap(pdata->keymap_data, row_shift, | ||
358 | input->keycode, input->keybit); | ||
359 | |||
360 | if (pdata->irq_is_gpio) | ||
361 | client->irq = gpio_to_irq(client->irq); | ||
362 | |||
363 | error = request_threaded_irq(client->irq, NULL, tca8418_irq_handler, | ||
364 | IRQF_TRIGGER_FALLING, | ||
365 | client->name, keypad_data); | ||
366 | if (error) { | ||
367 | dev_dbg(&client->dev, | ||
368 | "Unable to claim irq %d; error %d\n", | ||
369 | client->irq, error); | ||
370 | goto fail2; | ||
371 | } | ||
372 | |||
373 | error = input_register_device(input); | ||
374 | if (error) { | ||
375 | dev_dbg(&client->dev, | ||
376 | "Unable to register input device, error: %d\n", error); | ||
377 | goto fail3; | ||
378 | } | ||
379 | |||
380 | i2c_set_clientdata(client, keypad_data); | ||
381 | return 0; | ||
382 | |||
383 | fail3: | ||
384 | free_irq(client->irq, keypad_data); | ||
385 | fail2: | ||
386 | input_free_device(input); | ||
387 | fail1: | ||
388 | kfree(keypad_data); | ||
389 | return error; | ||
390 | } | ||
391 | |||
392 | static int __devexit tca8418_keypad_remove(struct i2c_client *client) | ||
393 | { | ||
394 | struct tca8418_keypad *keypad_data = i2c_get_clientdata(client); | ||
395 | |||
396 | free_irq(keypad_data->client->irq, keypad_data); | ||
397 | |||
398 | input_unregister_device(keypad_data->input); | ||
399 | |||
400 | kfree(keypad_data); | ||
401 | |||
402 | return 0; | ||
403 | } | ||
404 | |||
405 | |||
406 | static struct i2c_driver tca8418_keypad_driver = { | ||
407 | .driver = { | ||
408 | .name = TCA8418_NAME, | ||
409 | .owner = THIS_MODULE, | ||
410 | }, | ||
411 | .probe = tca8418_keypad_probe, | ||
412 | .remove = __devexit_p(tca8418_keypad_remove), | ||
413 | .id_table = tca8418_id, | ||
414 | }; | ||
415 | |||
416 | static int __init tca8418_keypad_init(void) | ||
417 | { | ||
418 | return i2c_add_driver(&tca8418_keypad_driver); | ||
419 | } | ||
420 | subsys_initcall(tca8418_keypad_init); | ||
421 | |||
422 | static void __exit tca8418_keypad_exit(void) | ||
423 | { | ||
424 | i2c_del_driver(&tca8418_keypad_driver); | ||
425 | } | ||
426 | module_exit(tca8418_keypad_exit); | ||
427 | |||
428 | MODULE_AUTHOR("Kyle Manna <kyle.manna@fuel7.com>"); | ||
429 | MODULE_DESCRIPTION("Keypad driver for TCA8418"); | ||
430 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index cf3228b0ab90..a136e2e832be 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
29 | #include <linux/of.h> | ||
29 | #include <linux/clk.h> | 30 | #include <linux/clk.h> |
30 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
31 | #include <mach/clk.h> | 32 | #include <mach/clk.h> |
@@ -52,6 +53,7 @@ | |||
52 | /* KBC Interrupt Register */ | 53 | /* KBC Interrupt Register */ |
53 | #define KBC_INT_0 0x4 | 54 | #define KBC_INT_0 0x4 |
54 | #define KBC_INT_FIFO_CNT_INT_STATUS (1 << 2) | 55 | #define KBC_INT_FIFO_CNT_INT_STATUS (1 << 2) |
56 | #define KBC_INT_KEYPRESS_INT_STATUS (1 << 0) | ||
55 | 57 | ||
56 | #define KBC_ROW_CFG0_0 0x8 | 58 | #define KBC_ROW_CFG0_0 0x8 |
57 | #define KBC_COL_CFG0_0 0x18 | 59 | #define KBC_COL_CFG0_0 0x18 |
@@ -74,15 +76,17 @@ struct tegra_kbc { | |||
74 | unsigned int cp_to_wkup_dly; | 76 | unsigned int cp_to_wkup_dly; |
75 | bool use_fn_map; | 77 | bool use_fn_map; |
76 | bool use_ghost_filter; | 78 | bool use_ghost_filter; |
79 | bool keypress_caused_wake; | ||
77 | const struct tegra_kbc_platform_data *pdata; | 80 | const struct tegra_kbc_platform_data *pdata; |
78 | unsigned short keycode[KBC_MAX_KEY * 2]; | 81 | unsigned short keycode[KBC_MAX_KEY * 2]; |
79 | unsigned short current_keys[KBC_MAX_KPENT]; | 82 | unsigned short current_keys[KBC_MAX_KPENT]; |
80 | unsigned int num_pressed_keys; | 83 | unsigned int num_pressed_keys; |
84 | u32 wakeup_key; | ||
81 | struct timer_list timer; | 85 | struct timer_list timer; |
82 | struct clk *clk; | 86 | struct clk *clk; |
83 | }; | 87 | }; |
84 | 88 | ||
85 | static const u32 tegra_kbc_default_keymap[] = { | 89 | static const u32 tegra_kbc_default_keymap[] __devinitdata = { |
86 | KEY(0, 2, KEY_W), | 90 | KEY(0, 2, KEY_W), |
87 | KEY(0, 3, KEY_S), | 91 | KEY(0, 3, KEY_S), |
88 | KEY(0, 4, KEY_A), | 92 | KEY(0, 4, KEY_A), |
@@ -217,7 +221,8 @@ static const u32 tegra_kbc_default_keymap[] = { | |||
217 | KEY(31, 4, KEY_HELP), | 221 | KEY(31, 4, KEY_HELP), |
218 | }; | 222 | }; |
219 | 223 | ||
220 | static const struct matrix_keymap_data tegra_kbc_default_keymap_data = { | 224 | static const |
225 | struct matrix_keymap_data tegra_kbc_default_keymap_data __devinitdata = { | ||
221 | .keymap = tegra_kbc_default_keymap, | 226 | .keymap = tegra_kbc_default_keymap, |
222 | .keymap_size = ARRAY_SIZE(tegra_kbc_default_keymap), | 227 | .keymap_size = ARRAY_SIZE(tegra_kbc_default_keymap), |
223 | }; | 228 | }; |
@@ -409,6 +414,9 @@ static irqreturn_t tegra_kbc_isr(int irq, void *args) | |||
409 | */ | 414 | */ |
410 | tegra_kbc_set_fifo_interrupt(kbc, false); | 415 | tegra_kbc_set_fifo_interrupt(kbc, false); |
411 | mod_timer(&kbc->timer, jiffies + kbc->cp_dly_jiffies); | 416 | mod_timer(&kbc->timer, jiffies + kbc->cp_dly_jiffies); |
417 | } else if (val & KBC_INT_KEYPRESS_INT_STATUS) { | ||
418 | /* We can be here only through system resume path */ | ||
419 | kbc->keypress_caused_wake = true; | ||
412 | } | 420 | } |
413 | 421 | ||
414 | spin_unlock_irqrestore(&kbc->lock, flags); | 422 | spin_unlock_irqrestore(&kbc->lock, flags); |
@@ -576,6 +584,56 @@ tegra_kbc_check_pin_cfg(const struct tegra_kbc_platform_data *pdata, | |||
576 | return true; | 584 | return true; |
577 | } | 585 | } |
578 | 586 | ||
587 | #ifdef CONFIG_OF | ||
588 | static struct tegra_kbc_platform_data * __devinit | ||
589 | tegra_kbc_dt_parse_pdata(struct platform_device *pdev) | ||
590 | { | ||
591 | struct tegra_kbc_platform_data *pdata; | ||
592 | struct device_node *np = pdev->dev.of_node; | ||
593 | |||
594 | if (!np) | ||
595 | return NULL; | ||
596 | |||
597 | pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); | ||
598 | if (!pdata) | ||
599 | return NULL; | ||
600 | |||
601 | if (!of_property_read_u32(np, "debounce-delay", &prop)) | ||
602 | pdata->debounce_cnt = prop; | ||
603 | |||
604 | if (!of_property_read_u32(np, "repeat-delay", &prop)) | ||
605 | pdata->repeat_cnt = prop; | ||
606 | |||
607 | if (of_find_property(np, "needs-ghost-filter", NULL)) | ||
608 | pdata->use_ghost_filter = true; | ||
609 | |||
610 | if (of_find_property(np, "wakeup-source", NULL)) | ||
611 | pdata->wakeup = true; | ||
612 | |||
613 | /* | ||
614 | * All currently known keymaps with device tree support use the same | ||
615 | * pin_cfg, so set it up here. | ||
616 | */ | ||
617 | for (i = 0; i < KBC_MAX_ROW; i++) { | ||
618 | pdata->pin_cfg[i].num = i; | ||
619 | pdata->pin_cfg[i].is_row = true; | ||
620 | } | ||
621 | |||
622 | for (i = 0; i < KBC_MAX_COL; i++) { | ||
623 | pdata->pin_cfg[KBC_MAX_ROW + i].num = i; | ||
624 | pdata->pin_cfg[KBC_MAX_ROW + i].is_row = false; | ||
625 | } | ||
626 | |||
627 | return pdata; | ||
628 | } | ||
629 | #else | ||
630 | static inline struct tegra_kbc_platform_data *tegra_kbc_dt_parse_pdata( | ||
631 | struct platform_device *pdev) | ||
632 | { | ||
633 | return NULL; | ||
634 | } | ||
635 | #endif | ||
636 | |||
579 | static int __devinit tegra_kbc_probe(struct platform_device *pdev) | 637 | static int __devinit tegra_kbc_probe(struct platform_device *pdev) |
580 | { | 638 | { |
581 | const struct tegra_kbc_platform_data *pdata = pdev->dev.platform_data; | 639 | const struct tegra_kbc_platform_data *pdata = pdev->dev.platform_data; |
@@ -590,21 +648,28 @@ static int __devinit tegra_kbc_probe(struct platform_device *pdev) | |||
590 | unsigned int scan_time_rows; | 648 | unsigned int scan_time_rows; |
591 | 649 | ||
592 | if (!pdata) | 650 | if (!pdata) |
593 | return -EINVAL; | 651 | pdata = tegra_kbc_dt_parse_pdata(pdev); |
594 | 652 | ||
595 | if (!tegra_kbc_check_pin_cfg(pdata, &pdev->dev, &num_rows)) | 653 | if (!pdata) |
596 | return -EINVAL; | 654 | return -EINVAL; |
597 | 655 | ||
656 | if (!tegra_kbc_check_pin_cfg(pdata, &pdev->dev, &num_rows)) { | ||
657 | err = -EINVAL; | ||
658 | goto err_free_pdata; | ||
659 | } | ||
660 | |||
598 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 661 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
599 | if (!res) { | 662 | if (!res) { |
600 | dev_err(&pdev->dev, "failed to get I/O memory\n"); | 663 | dev_err(&pdev->dev, "failed to get I/O memory\n"); |
601 | return -ENXIO; | 664 | err = -ENXIO; |
665 | goto err_free_pdata; | ||
602 | } | 666 | } |
603 | 667 | ||
604 | irq = platform_get_irq(pdev, 0); | 668 | irq = platform_get_irq(pdev, 0); |
605 | if (irq < 0) { | 669 | if (irq < 0) { |
606 | dev_err(&pdev->dev, "failed to get keyboard IRQ\n"); | 670 | dev_err(&pdev->dev, "failed to get keyboard IRQ\n"); |
607 | return -ENXIO; | 671 | err = -ENXIO; |
672 | goto err_free_pdata; | ||
608 | } | 673 | } |
609 | 674 | ||
610 | kbc = kzalloc(sizeof(*kbc), GFP_KERNEL); | 675 | kbc = kzalloc(sizeof(*kbc), GFP_KERNEL); |
@@ -674,9 +739,10 @@ static int __devinit tegra_kbc_probe(struct platform_device *pdev) | |||
674 | keymap_data = pdata->keymap_data ?: &tegra_kbc_default_keymap_data; | 739 | keymap_data = pdata->keymap_data ?: &tegra_kbc_default_keymap_data; |
675 | matrix_keypad_build_keymap(keymap_data, KBC_ROW_SHIFT, | 740 | matrix_keypad_build_keymap(keymap_data, KBC_ROW_SHIFT, |
676 | input_dev->keycode, input_dev->keybit); | 741 | input_dev->keycode, input_dev->keybit); |
742 | kbc->wakeup_key = pdata->wakeup_key; | ||
677 | 743 | ||
678 | err = request_irq(kbc->irq, tegra_kbc_isr, IRQF_TRIGGER_HIGH, | 744 | err = request_irq(kbc->irq, tegra_kbc_isr, |
679 | pdev->name, kbc); | 745 | IRQF_NO_SUSPEND | IRQF_TRIGGER_HIGH, pdev->name, kbc); |
680 | if (err) { | 746 | if (err) { |
681 | dev_err(&pdev->dev, "failed to request keyboard IRQ\n"); | 747 | dev_err(&pdev->dev, "failed to request keyboard IRQ\n"); |
682 | goto err_put_clk; | 748 | goto err_put_clk; |
@@ -706,6 +772,9 @@ err_free_mem_region: | |||
706 | err_free_mem: | 772 | err_free_mem: |
707 | input_free_device(input_dev); | 773 | input_free_device(input_dev); |
708 | kfree(kbc); | 774 | kfree(kbc); |
775 | err_free_pdata: | ||
776 | if (!pdev->dev.platform_data) | ||
777 | kfree(pdata); | ||
709 | 778 | ||
710 | return err; | 779 | return err; |
711 | } | 780 | } |
@@ -715,6 +784,8 @@ static int __devexit tegra_kbc_remove(struct platform_device *pdev) | |||
715 | struct tegra_kbc *kbc = platform_get_drvdata(pdev); | 784 | struct tegra_kbc *kbc = platform_get_drvdata(pdev); |
716 | struct resource *res; | 785 | struct resource *res; |
717 | 786 | ||
787 | platform_set_drvdata(pdev, NULL); | ||
788 | |||
718 | free_irq(kbc->irq, pdev); | 789 | free_irq(kbc->irq, pdev); |
719 | clk_put(kbc->clk); | 790 | clk_put(kbc->clk); |
720 | 791 | ||
@@ -723,9 +794,14 @@ static int __devexit tegra_kbc_remove(struct platform_device *pdev) | |||
723 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 794 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
724 | release_mem_region(res->start, resource_size(res)); | 795 | release_mem_region(res->start, resource_size(res)); |
725 | 796 | ||
726 | kfree(kbc); | 797 | /* |
798 | * If we do not have platform data attached to the device we | ||
799 | * allocated it ourselves and thus need to free it. | ||
800 | */ | ||
801 | if (!pdev->dev.platform_data) | ||
802 | kfree(kbc->pdata); | ||
727 | 803 | ||
728 | platform_set_drvdata(pdev, NULL); | 804 | kfree(kbc); |
729 | 805 | ||
730 | return 0; | 806 | return 0; |
731 | } | 807 | } |
@@ -754,6 +830,8 @@ static int tegra_kbc_suspend(struct device *dev) | |||
754 | tegra_kbc_setup_wakekeys(kbc, true); | 830 | tegra_kbc_setup_wakekeys(kbc, true); |
755 | msleep(30); | 831 | msleep(30); |
756 | 832 | ||
833 | kbc->keypress_caused_wake = false; | ||
834 | enable_irq(kbc->irq); | ||
757 | enable_irq_wake(kbc->irq); | 835 | enable_irq_wake(kbc->irq); |
758 | } else { | 836 | } else { |
759 | if (kbc->idev->users) | 837 | if (kbc->idev->users) |
@@ -780,7 +858,19 @@ static int tegra_kbc_resume(struct device *dev) | |||
780 | 858 | ||
781 | tegra_kbc_set_fifo_interrupt(kbc, true); | 859 | tegra_kbc_set_fifo_interrupt(kbc, true); |
782 | 860 | ||
783 | enable_irq(kbc->irq); | 861 | if (kbc->keypress_caused_wake && kbc->wakeup_key) { |
862 | /* | ||
863 | * We can't report events directly from the ISR | ||
864 | * because timekeeping is stopped when processing | ||
865 | * wakeup request and we get a nasty warning when | ||
866 | * we try to call do_gettimeofday() in evdev | ||
867 | * handler. | ||
868 | */ | ||
869 | input_report_key(kbc->idev, kbc->wakeup_key, 1); | ||
870 | input_sync(kbc->idev); | ||
871 | input_report_key(kbc->idev, kbc->wakeup_key, 0); | ||
872 | input_sync(kbc->idev); | ||
873 | } | ||
784 | } else { | 874 | } else { |
785 | if (kbc->idev->users) | 875 | if (kbc->idev->users) |
786 | err = tegra_kbc_start(kbc); | 876 | err = tegra_kbc_start(kbc); |
@@ -793,6 +883,12 @@ static int tegra_kbc_resume(struct device *dev) | |||
793 | 883 | ||
794 | static SIMPLE_DEV_PM_OPS(tegra_kbc_pm_ops, tegra_kbc_suspend, tegra_kbc_resume); | 884 | static SIMPLE_DEV_PM_OPS(tegra_kbc_pm_ops, tegra_kbc_suspend, tegra_kbc_resume); |
795 | 885 | ||
886 | static const struct of_device_id tegra_kbc_of_match[] = { | ||
887 | { .compatible = "nvidia,tegra20-kbc", }, | ||
888 | { }, | ||
889 | }; | ||
890 | MODULE_DEVICE_TABLE(of, tegra_kbc_of_match); | ||
891 | |||
796 | static struct platform_driver tegra_kbc_driver = { | 892 | static struct platform_driver tegra_kbc_driver = { |
797 | .probe = tegra_kbc_probe, | 893 | .probe = tegra_kbc_probe, |
798 | .remove = __devexit_p(tegra_kbc_remove), | 894 | .remove = __devexit_p(tegra_kbc_remove), |
@@ -800,20 +896,10 @@ static struct platform_driver tegra_kbc_driver = { | |||
800 | .name = "tegra-kbc", | 896 | .name = "tegra-kbc", |
801 | .owner = THIS_MODULE, | 897 | .owner = THIS_MODULE, |
802 | .pm = &tegra_kbc_pm_ops, | 898 | .pm = &tegra_kbc_pm_ops, |
899 | .of_match_table = tegra_kbc_of_match, | ||
803 | }, | 900 | }, |
804 | }; | 901 | }; |
805 | 902 | module_platform_driver(tegra_kbc_driver); | |
806 | static void __exit tegra_kbc_exit(void) | ||
807 | { | ||
808 | platform_driver_unregister(&tegra_kbc_driver); | ||
809 | } | ||
810 | module_exit(tegra_kbc_exit); | ||
811 | |||
812 | static int __init tegra_kbc_init(void) | ||
813 | { | ||
814 | return platform_driver_register(&tegra_kbc_driver); | ||
815 | } | ||
816 | module_init(tegra_kbc_init); | ||
817 | 903 | ||
818 | MODULE_LICENSE("GPL"); | 904 | MODULE_LICENSE("GPL"); |
819 | MODULE_AUTHOR("Rakesh Iyer <riyer@nvidia.com>"); | 905 | MODULE_AUTHOR("Rakesh Iyer <riyer@nvidia.com>"); |
diff --git a/drivers/input/keyboard/tnetv107x-keypad.c b/drivers/input/keyboard/tnetv107x-keypad.c index 66e55e5cfdd6..fb39c94b6fdd 100644 --- a/drivers/input/keyboard/tnetv107x-keypad.c +++ b/drivers/input/keyboard/tnetv107x-keypad.c | |||
@@ -322,19 +322,7 @@ static struct platform_driver keypad_driver = { | |||
322 | .driver.name = "tnetv107x-keypad", | 322 | .driver.name = "tnetv107x-keypad", |
323 | .driver.owner = THIS_MODULE, | 323 | .driver.owner = THIS_MODULE, |
324 | }; | 324 | }; |
325 | 325 | module_platform_driver(keypad_driver); | |
326 | static int __init keypad_init(void) | ||
327 | { | ||
328 | return platform_driver_register(&keypad_driver); | ||
329 | } | ||
330 | |||
331 | static void __exit keypad_exit(void) | ||
332 | { | ||
333 | platform_driver_unregister(&keypad_driver); | ||
334 | } | ||
335 | |||
336 | module_init(keypad_init); | ||
337 | module_exit(keypad_exit); | ||
338 | 326 | ||
339 | MODULE_AUTHOR("Cyril Chemparathy"); | 327 | MODULE_AUTHOR("Cyril Chemparathy"); |
340 | MODULE_DESCRIPTION("TNETV107X Keypad Driver"); | 328 | MODULE_DESCRIPTION("TNETV107X Keypad Driver"); |
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c index a26922cf0e84..a588578037eb 100644 --- a/drivers/input/keyboard/twl4030_keypad.c +++ b/drivers/input/keyboard/twl4030_keypad.c | |||
@@ -460,18 +460,7 @@ static struct platform_driver twl4030_kp_driver = { | |||
460 | .owner = THIS_MODULE, | 460 | .owner = THIS_MODULE, |
461 | }, | 461 | }, |
462 | }; | 462 | }; |
463 | 463 | module_platform_driver(twl4030_kp_driver); | |
464 | static int __init twl4030_kp_init(void) | ||
465 | { | ||
466 | return platform_driver_register(&twl4030_kp_driver); | ||
467 | } | ||
468 | module_init(twl4030_kp_init); | ||
469 | |||
470 | static void __exit twl4030_kp_exit(void) | ||
471 | { | ||
472 | platform_driver_unregister(&twl4030_kp_driver); | ||
473 | } | ||
474 | module_exit(twl4030_kp_exit); | ||
475 | 464 | ||
476 | MODULE_AUTHOR("Texas Instruments"); | 465 | MODULE_AUTHOR("Texas Instruments"); |
477 | MODULE_DESCRIPTION("TWL4030 Keypad Driver"); | 466 | MODULE_DESCRIPTION("TWL4030 Keypad Driver"); |
diff --git a/drivers/input/keyboard/w90p910_keypad.c b/drivers/input/keyboard/w90p910_keypad.c index 318586dadacf..99bbb7e775ae 100644 --- a/drivers/input/keyboard/w90p910_keypad.c +++ b/drivers/input/keyboard/w90p910_keypad.c | |||
@@ -262,19 +262,7 @@ static struct platform_driver w90p910_keypad_driver = { | |||
262 | .owner = THIS_MODULE, | 262 | .owner = THIS_MODULE, |
263 | }, | 263 | }, |
264 | }; | 264 | }; |
265 | 265 | module_platform_driver(w90p910_keypad_driver); | |
266 | static int __init w90p910_keypad_init(void) | ||
267 | { | ||
268 | return platform_driver_register(&w90p910_keypad_driver); | ||
269 | } | ||
270 | |||
271 | static void __exit w90p910_keypad_exit(void) | ||
272 | { | ||
273 | platform_driver_unregister(&w90p910_keypad_driver); | ||
274 | } | ||
275 | |||
276 | module_init(w90p910_keypad_init); | ||
277 | module_exit(w90p910_keypad_exit); | ||
278 | 266 | ||
279 | MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); | 267 | MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); |
280 | MODULE_DESCRIPTION("w90p910 keypad driver"); | 268 | MODULE_DESCRIPTION("w90p910 keypad driver"); |
diff --git a/drivers/input/misc/88pm860x_onkey.c b/drivers/input/misc/88pm860x_onkey.c index 3dca3c14510e..f2e0cbc5ab64 100644 --- a/drivers/input/misc/88pm860x_onkey.c +++ b/drivers/input/misc/88pm860x_onkey.c | |||
@@ -137,18 +137,7 @@ static struct platform_driver pm860x_onkey_driver = { | |||
137 | .probe = pm860x_onkey_probe, | 137 | .probe = pm860x_onkey_probe, |
138 | .remove = __devexit_p(pm860x_onkey_remove), | 138 | .remove = __devexit_p(pm860x_onkey_remove), |
139 | }; | 139 | }; |
140 | 140 | module_platform_driver(pm860x_onkey_driver); | |
141 | static int __init pm860x_onkey_init(void) | ||
142 | { | ||
143 | return platform_driver_register(&pm860x_onkey_driver); | ||
144 | } | ||
145 | module_init(pm860x_onkey_init); | ||
146 | |||
147 | static void __exit pm860x_onkey_exit(void) | ||
148 | { | ||
149 | platform_driver_unregister(&pm860x_onkey_driver); | ||
150 | } | ||
151 | module_exit(pm860x_onkey_exit); | ||
152 | 141 | ||
153 | MODULE_DESCRIPTION("Marvell 88PM860x ONKEY driver"); | 142 | MODULE_DESCRIPTION("Marvell 88PM860x ONKEY driver"); |
154 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); | 143 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); |
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 22d875fde53a..7b46781c30c9 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig | |||
@@ -179,6 +179,31 @@ config INPUT_APANEL | |||
179 | To compile this driver as a module, choose M here: the module will | 179 | To compile this driver as a module, choose M here: the module will |
180 | be called apanel. | 180 | be called apanel. |
181 | 181 | ||
182 | config INPUT_GP2A | ||
183 | tristate "Sharp GP2AP002A00F I2C Proximity/Opto sensor driver" | ||
184 | depends on I2C | ||
185 | depends on GENERIC_GPIO | ||
186 | help | ||
187 | Say Y here if you have a Sharp GP2AP002A00F proximity/als combo-chip | ||
188 | hooked to an I2C bus. | ||
189 | |||
190 | To compile this driver as a module, choose M here: the | ||
191 | module will be called gp2ap002a00f. | ||
192 | |||
193 | config INPUT_GPIO_TILT_POLLED | ||
194 | tristate "Polled GPIO tilt switch" | ||
195 | depends on GENERIC_GPIO | ||
196 | select INPUT_POLLDEV | ||
197 | help | ||
198 | This driver implements support for tilt switches connected | ||
199 | to GPIO pins that are not capable of generating interrupts. | ||
200 | |||
201 | The list of gpios to use and the mapping of their states | ||
202 | to specific angles is done via platform data. | ||
203 | |||
204 | To compile this driver as a module, choose M here: the | ||
205 | module will be called gpio_tilt_polled. | ||
206 | |||
182 | config INPUT_IXP4XX_BEEPER | 207 | config INPUT_IXP4XX_BEEPER |
183 | tristate "IXP4XX Beeper support" | 208 | tristate "IXP4XX Beeper support" |
184 | depends on ARCH_IXP4XX | 209 | depends on ARCH_IXP4XX |
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index a244fc6a781c..46671a875b91 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile | |||
@@ -22,6 +22,8 @@ obj-$(CONFIG_INPUT_CMA3000) += cma3000_d0x.o | |||
22 | obj-$(CONFIG_INPUT_CMA3000_I2C) += cma3000_d0x_i2c.o | 22 | obj-$(CONFIG_INPUT_CMA3000_I2C) += cma3000_d0x_i2c.o |
23 | obj-$(CONFIG_INPUT_COBALT_BTNS) += cobalt_btns.o | 23 | obj-$(CONFIG_INPUT_COBALT_BTNS) += cobalt_btns.o |
24 | obj-$(CONFIG_INPUT_DM355EVM) += dm355evm_keys.o | 24 | obj-$(CONFIG_INPUT_DM355EVM) += dm355evm_keys.o |
25 | obj-$(CONFIG_INPUT_GP2A) += gp2ap002a00f.o | ||
26 | obj-$(CONFIG_INPUT_GPIO_TILT_POLLED) += gpio_tilt_polled.o | ||
25 | obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o | 27 | obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o |
26 | obj-$(CONFIG_INPUT_IXP4XX_BEEPER) += ixp4xx-beeper.o | 28 | obj-$(CONFIG_INPUT_IXP4XX_BEEPER) += ixp4xx-beeper.o |
27 | obj-$(CONFIG_INPUT_KEYSPAN_REMOTE) += keyspan_remote.o | 29 | obj-$(CONFIG_INPUT_KEYSPAN_REMOTE) += keyspan_remote.o |
diff --git a/drivers/input/misc/ab8500-ponkey.c b/drivers/input/misc/ab8500-ponkey.c index 3d3288a78fdc..79d901633635 100644 --- a/drivers/input/misc/ab8500-ponkey.c +++ b/drivers/input/misc/ab8500-ponkey.c | |||
@@ -139,18 +139,7 @@ static struct platform_driver ab8500_ponkey_driver = { | |||
139 | .probe = ab8500_ponkey_probe, | 139 | .probe = ab8500_ponkey_probe, |
140 | .remove = __devexit_p(ab8500_ponkey_remove), | 140 | .remove = __devexit_p(ab8500_ponkey_remove), |
141 | }; | 141 | }; |
142 | 142 | module_platform_driver(ab8500_ponkey_driver); | |
143 | static int __init ab8500_ponkey_init(void) | ||
144 | { | ||
145 | return platform_driver_register(&ab8500_ponkey_driver); | ||
146 | } | ||
147 | module_init(ab8500_ponkey_init); | ||
148 | |||
149 | static void __exit ab8500_ponkey_exit(void) | ||
150 | { | ||
151 | platform_driver_unregister(&ab8500_ponkey_driver); | ||
152 | } | ||
153 | module_exit(ab8500_ponkey_exit); | ||
154 | 143 | ||
155 | MODULE_LICENSE("GPL v2"); | 144 | MODULE_LICENSE("GPL v2"); |
156 | MODULE_AUTHOR("Sundar Iyer <sundar.iyer@stericsson.com>"); | 145 | MODULE_AUTHOR("Sundar Iyer <sundar.iyer@stericsson.com>"); |
diff --git a/drivers/input/misc/adxl34x-spi.c b/drivers/input/misc/adxl34x-spi.c index f29de22fdda0..34d401efd4a1 100644 --- a/drivers/input/misc/adxl34x-spi.c +++ b/drivers/input/misc/adxl34x-spi.c | |||
@@ -122,7 +122,6 @@ static SIMPLE_DEV_PM_OPS(adxl34x_spi_pm, adxl34x_spi_suspend, | |||
122 | static struct spi_driver adxl34x_driver = { | 122 | static struct spi_driver adxl34x_driver = { |
123 | .driver = { | 123 | .driver = { |
124 | .name = "adxl34x", | 124 | .name = "adxl34x", |
125 | .bus = &spi_bus_type, | ||
126 | .owner = THIS_MODULE, | 125 | .owner = THIS_MODULE, |
127 | .pm = &adxl34x_spi_pm, | 126 | .pm = &adxl34x_spi_pm, |
128 | }, | 127 | }, |
diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c index 09244804fb97..1cf72fe513e6 100644 --- a/drivers/input/misc/adxl34x.c +++ b/drivers/input/misc/adxl34x.c | |||
@@ -452,10 +452,10 @@ static ssize_t adxl34x_disable_store(struct device *dev, | |||
452 | const char *buf, size_t count) | 452 | const char *buf, size_t count) |
453 | { | 453 | { |
454 | struct adxl34x *ac = dev_get_drvdata(dev); | 454 | struct adxl34x *ac = dev_get_drvdata(dev); |
455 | unsigned long val; | 455 | unsigned int val; |
456 | int error; | 456 | int error; |
457 | 457 | ||
458 | error = strict_strtoul(buf, 10, &val); | 458 | error = kstrtouint(buf, 10, &val); |
459 | if (error) | 459 | if (error) |
460 | return error; | 460 | return error; |
461 | 461 | ||
@@ -541,10 +541,10 @@ static ssize_t adxl34x_rate_store(struct device *dev, | |||
541 | const char *buf, size_t count) | 541 | const char *buf, size_t count) |
542 | { | 542 | { |
543 | struct adxl34x *ac = dev_get_drvdata(dev); | 543 | struct adxl34x *ac = dev_get_drvdata(dev); |
544 | unsigned long val; | 544 | unsigned char val; |
545 | int error; | 545 | int error; |
546 | 546 | ||
547 | error = strict_strtoul(buf, 10, &val); | 547 | error = kstrtou8(buf, 10, &val); |
548 | if (error) | 548 | if (error) |
549 | return error; | 549 | return error; |
550 | 550 | ||
@@ -576,10 +576,10 @@ static ssize_t adxl34x_autosleep_store(struct device *dev, | |||
576 | const char *buf, size_t count) | 576 | const char *buf, size_t count) |
577 | { | 577 | { |
578 | struct adxl34x *ac = dev_get_drvdata(dev); | 578 | struct adxl34x *ac = dev_get_drvdata(dev); |
579 | unsigned long val; | 579 | unsigned int val; |
580 | int error; | 580 | int error; |
581 | 581 | ||
582 | error = strict_strtoul(buf, 10, &val); | 582 | error = kstrtouint(buf, 10, &val); |
583 | if (error) | 583 | if (error) |
584 | return error; | 584 | return error; |
585 | 585 | ||
@@ -623,13 +623,13 @@ static ssize_t adxl34x_write_store(struct device *dev, | |||
623 | const char *buf, size_t count) | 623 | const char *buf, size_t count) |
624 | { | 624 | { |
625 | struct adxl34x *ac = dev_get_drvdata(dev); | 625 | struct adxl34x *ac = dev_get_drvdata(dev); |
626 | unsigned long val; | 626 | unsigned int val; |
627 | int error; | 627 | int error; |
628 | 628 | ||
629 | /* | 629 | /* |
630 | * This allows basic ADXL register write access for debug purposes. | 630 | * This allows basic ADXL register write access for debug purposes. |
631 | */ | 631 | */ |
632 | error = strict_strtoul(buf, 16, &val); | 632 | error = kstrtouint(buf, 16, &val); |
633 | if (error) | 633 | if (error) |
634 | return error; | 634 | return error; |
635 | 635 | ||
diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c index 874a51c2fbb2..f63341f20b91 100644 --- a/drivers/input/misc/ati_remote2.c +++ b/drivers/input/misc/ati_remote2.c | |||
@@ -42,13 +42,13 @@ static int ati_remote2_set_mask(const char *val, | |||
42 | const struct kernel_param *kp, | 42 | const struct kernel_param *kp, |
43 | unsigned int max) | 43 | unsigned int max) |
44 | { | 44 | { |
45 | unsigned long mask; | 45 | unsigned int mask; |
46 | int ret; | 46 | int ret; |
47 | 47 | ||
48 | if (!val) | 48 | if (!val) |
49 | return -EINVAL; | 49 | return -EINVAL; |
50 | 50 | ||
51 | ret = strict_strtoul(val, 0, &mask); | 51 | ret = kstrtouint(val, 0, &mask); |
52 | if (ret) | 52 | if (ret) |
53 | return ret; | 53 | return ret; |
54 | 54 | ||
@@ -720,11 +720,12 @@ static ssize_t ati_remote2_store_channel_mask(struct device *dev, | |||
720 | struct usb_device *udev = to_usb_device(dev); | 720 | struct usb_device *udev = to_usb_device(dev); |
721 | struct usb_interface *intf = usb_ifnum_to_if(udev, 0); | 721 | struct usb_interface *intf = usb_ifnum_to_if(udev, 0); |
722 | struct ati_remote2 *ar2 = usb_get_intfdata(intf); | 722 | struct ati_remote2 *ar2 = usb_get_intfdata(intf); |
723 | unsigned long mask; | 723 | unsigned int mask; |
724 | int r; | 724 | int r; |
725 | 725 | ||
726 | if (strict_strtoul(buf, 0, &mask)) | 726 | r = kstrtouint(buf, 0, &mask); |
727 | return -EINVAL; | 727 | if (r) |
728 | return r; | ||
728 | 729 | ||
729 | if (mask & ~ATI_REMOTE2_MAX_CHANNEL_MASK) | 730 | if (mask & ~ATI_REMOTE2_MAX_CHANNEL_MASK) |
730 | return -EINVAL; | 731 | return -EINVAL; |
@@ -769,10 +770,12 @@ static ssize_t ati_remote2_store_mode_mask(struct device *dev, | |||
769 | struct usb_device *udev = to_usb_device(dev); | 770 | struct usb_device *udev = to_usb_device(dev); |
770 | struct usb_interface *intf = usb_ifnum_to_if(udev, 0); | 771 | struct usb_interface *intf = usb_ifnum_to_if(udev, 0); |
771 | struct ati_remote2 *ar2 = usb_get_intfdata(intf); | 772 | struct ati_remote2 *ar2 = usb_get_intfdata(intf); |
772 | unsigned long mask; | 773 | unsigned int mask; |
774 | int err; | ||
773 | 775 | ||
774 | if (strict_strtoul(buf, 0, &mask)) | 776 | err = kstrtouint(buf, 0, &mask); |
775 | return -EINVAL; | 777 | if (err) |
778 | return err; | ||
776 | 779 | ||
777 | if (mask & ~ATI_REMOTE2_MAX_MODE_MASK) | 780 | if (mask & ~ATI_REMOTE2_MAX_MODE_MASK) |
778 | return -EINVAL; | 781 | return -EINVAL; |
diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c index d00edc9f39d1..1c4146fccfdf 100644 --- a/drivers/input/misc/bfin_rotary.c +++ b/drivers/input/misc/bfin_rotary.c | |||
@@ -264,18 +264,7 @@ static struct platform_driver bfin_rotary_device_driver = { | |||
264 | #endif | 264 | #endif |
265 | }, | 265 | }, |
266 | }; | 266 | }; |
267 | 267 | module_platform_driver(bfin_rotary_device_driver); | |
268 | static int __init bfin_rotary_init(void) | ||
269 | { | ||
270 | return platform_driver_register(&bfin_rotary_device_driver); | ||
271 | } | ||
272 | module_init(bfin_rotary_init); | ||
273 | |||
274 | static void __exit bfin_rotary_exit(void) | ||
275 | { | ||
276 | platform_driver_unregister(&bfin_rotary_device_driver); | ||
277 | } | ||
278 | module_exit(bfin_rotary_exit); | ||
279 | 268 | ||
280 | MODULE_LICENSE("GPL"); | 269 | MODULE_LICENSE("GPL"); |
281 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); | 270 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); |
diff --git a/drivers/input/misc/cobalt_btns.c b/drivers/input/misc/cobalt_btns.c index fd8407a29631..53e43d295148 100644 --- a/drivers/input/misc/cobalt_btns.c +++ b/drivers/input/misc/cobalt_btns.c | |||
@@ -163,16 +163,4 @@ static struct platform_driver cobalt_buttons_driver = { | |||
163 | .owner = THIS_MODULE, | 163 | .owner = THIS_MODULE, |
164 | }, | 164 | }, |
165 | }; | 165 | }; |
166 | 166 | module_platform_driver(cobalt_buttons_driver); | |
167 | static int __init cobalt_buttons_init(void) | ||
168 | { | ||
169 | return platform_driver_register(&cobalt_buttons_driver); | ||
170 | } | ||
171 | |||
172 | static void __exit cobalt_buttons_exit(void) | ||
173 | { | ||
174 | platform_driver_unregister(&cobalt_buttons_driver); | ||
175 | } | ||
176 | |||
177 | module_init(cobalt_buttons_init); | ||
178 | module_exit(cobalt_buttons_exit); | ||
diff --git a/drivers/input/misc/dm355evm_keys.c b/drivers/input/misc/dm355evm_keys.c index 7283dd2a1ad3..35083c6836c3 100644 --- a/drivers/input/misc/dm355evm_keys.c +++ b/drivers/input/misc/dm355evm_keys.c | |||
@@ -267,17 +267,6 @@ static struct platform_driver dm355evm_keys_driver = { | |||
267 | .name = "dm355evm_keys", | 267 | .name = "dm355evm_keys", |
268 | }, | 268 | }, |
269 | }; | 269 | }; |
270 | 270 | module_platform_driver(dm355evm_keys_driver); | |
271 | static int __init dm355evm_keys_init(void) | ||
272 | { | ||
273 | return platform_driver_register(&dm355evm_keys_driver); | ||
274 | } | ||
275 | module_init(dm355evm_keys_init); | ||
276 | |||
277 | static void __exit dm355evm_keys_exit(void) | ||
278 | { | ||
279 | platform_driver_unregister(&dm355evm_keys_driver); | ||
280 | } | ||
281 | module_exit(dm355evm_keys_exit); | ||
282 | 271 | ||
283 | MODULE_LICENSE("GPL"); | 272 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/input/misc/gp2ap002a00f.c b/drivers/input/misc/gp2ap002a00f.c new file mode 100644 index 000000000000..71fba8c2fc66 --- /dev/null +++ b/drivers/input/misc/gp2ap002a00f.c | |||
@@ -0,0 +1,299 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Sony Ericsson Mobile Communications Inc. | ||
3 | * | ||
4 | * Author: Courtney Cavin <courtney.cavin@sonyericsson.com> | ||
5 | * Prepared for up-stream by: Oskar Andero <oskar.andero@sonyericsson.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2, as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/i2c.h> | ||
13 | #include <linux/irq.h> | ||
14 | #include <linux/slab.h> | ||
15 | #include <linux/input.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/gpio.h> | ||
19 | #include <linux/delay.h> | ||
20 | #include <linux/input/gp2ap002a00f.h> | ||
21 | |||
22 | struct gp2a_data { | ||
23 | struct input_dev *input; | ||
24 | const struct gp2a_platform_data *pdata; | ||
25 | struct i2c_client *i2c_client; | ||
26 | }; | ||
27 | |||
28 | enum gp2a_addr { | ||
29 | GP2A_ADDR_PROX = 0x0, | ||
30 | GP2A_ADDR_GAIN = 0x1, | ||
31 | GP2A_ADDR_HYS = 0x2, | ||
32 | GP2A_ADDR_CYCLE = 0x3, | ||
33 | GP2A_ADDR_OPMOD = 0x4, | ||
34 | GP2A_ADDR_CON = 0x6 | ||
35 | }; | ||
36 | |||
37 | enum gp2a_controls { | ||
38 | /* Software Shutdown control: 0 = shutdown, 1 = normal operation */ | ||
39 | GP2A_CTRL_SSD = 0x01 | ||
40 | }; | ||
41 | |||
42 | static int gp2a_report(struct gp2a_data *dt) | ||
43 | { | ||
44 | int vo = gpio_get_value(dt->pdata->vout_gpio); | ||
45 | |||
46 | input_report_switch(dt->input, SW_FRONT_PROXIMITY, !vo); | ||
47 | input_sync(dt->input); | ||
48 | |||
49 | return 0; | ||
50 | } | ||
51 | |||
52 | static irqreturn_t gp2a_irq(int irq, void *handle) | ||
53 | { | ||
54 | struct gp2a_data *dt = handle; | ||
55 | |||
56 | gp2a_report(dt); | ||
57 | |||
58 | return IRQ_HANDLED; | ||
59 | } | ||
60 | |||
61 | static int gp2a_enable(struct gp2a_data *dt) | ||
62 | { | ||
63 | return i2c_smbus_write_byte_data(dt->i2c_client, GP2A_ADDR_OPMOD, | ||
64 | GP2A_CTRL_SSD); | ||
65 | } | ||
66 | |||
67 | static int gp2a_disable(struct gp2a_data *dt) | ||
68 | { | ||
69 | return i2c_smbus_write_byte_data(dt->i2c_client, GP2A_ADDR_OPMOD, | ||
70 | 0x00); | ||
71 | } | ||
72 | |||
73 | static int gp2a_device_open(struct input_dev *dev) | ||
74 | { | ||
75 | struct gp2a_data *dt = input_get_drvdata(dev); | ||
76 | int error; | ||
77 | |||
78 | error = gp2a_enable(dt); | ||
79 | if (error < 0) { | ||
80 | dev_err(&dt->i2c_client->dev, | ||
81 | "unable to activate, err %d\n", error); | ||
82 | return error; | ||
83 | } | ||
84 | |||
85 | gp2a_report(dt); | ||
86 | |||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | static void gp2a_device_close(struct input_dev *dev) | ||
91 | { | ||
92 | struct gp2a_data *dt = input_get_drvdata(dev); | ||
93 | int error; | ||
94 | |||
95 | error = gp2a_disable(dt); | ||
96 | if (error < 0) | ||
97 | dev_err(&dt->i2c_client->dev, | ||
98 | "unable to deactivate, err %d\n", error); | ||
99 | } | ||
100 | |||
101 | static int __devinit gp2a_initialize(struct gp2a_data *dt) | ||
102 | { | ||
103 | int error; | ||
104 | |||
105 | error = i2c_smbus_write_byte_data(dt->i2c_client, GP2A_ADDR_GAIN, | ||
106 | 0x08); | ||
107 | if (error < 0) | ||
108 | return error; | ||
109 | |||
110 | error = i2c_smbus_write_byte_data(dt->i2c_client, GP2A_ADDR_HYS, | ||
111 | 0xc2); | ||
112 | if (error < 0) | ||
113 | return error; | ||
114 | |||
115 | error = i2c_smbus_write_byte_data(dt->i2c_client, GP2A_ADDR_CYCLE, | ||
116 | 0x04); | ||
117 | if (error < 0) | ||
118 | return error; | ||
119 | |||
120 | error = gp2a_disable(dt); | ||
121 | |||
122 | return error; | ||
123 | } | ||
124 | |||
125 | static int __devinit gp2a_probe(struct i2c_client *client, | ||
126 | const struct i2c_device_id *id) | ||
127 | { | ||
128 | const struct gp2a_platform_data *pdata = client->dev.platform_data; | ||
129 | struct gp2a_data *dt; | ||
130 | int error; | ||
131 | |||
132 | if (!pdata) | ||
133 | return -EINVAL; | ||
134 | |||
135 | if (pdata->hw_setup) { | ||
136 | error = pdata->hw_setup(client); | ||
137 | if (error < 0) | ||
138 | return error; | ||
139 | } | ||
140 | |||
141 | error = gpio_request_one(pdata->vout_gpio, GPIOF_IN, GP2A_I2C_NAME); | ||
142 | if (error) | ||
143 | goto err_hw_shutdown; | ||
144 | |||
145 | dt = kzalloc(sizeof(struct gp2a_data), GFP_KERNEL); | ||
146 | if (!dt) { | ||
147 | error = -ENOMEM; | ||
148 | goto err_free_gpio; | ||
149 | } | ||
150 | |||
151 | dt->pdata = pdata; | ||
152 | dt->i2c_client = client; | ||
153 | |||
154 | error = gp2a_initialize(dt); | ||
155 | if (error < 0) | ||
156 | goto err_free_mem; | ||
157 | |||
158 | dt->input = input_allocate_device(); | ||
159 | if (!dt->input) { | ||
160 | error = -ENOMEM; | ||
161 | goto err_free_mem; | ||
162 | } | ||
163 | |||
164 | input_set_drvdata(dt->input, dt); | ||
165 | |||
166 | dt->input->open = gp2a_device_open; | ||
167 | dt->input->close = gp2a_device_close; | ||
168 | dt->input->name = GP2A_I2C_NAME; | ||
169 | dt->input->id.bustype = BUS_I2C; | ||
170 | dt->input->dev.parent = &client->dev; | ||
171 | |||
172 | input_set_capability(dt->input, EV_SW, SW_FRONT_PROXIMITY); | ||
173 | |||
174 | error = request_threaded_irq(client->irq, NULL, gp2a_irq, | ||
175 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | | ||
176 | IRQF_ONESHOT, | ||
177 | GP2A_I2C_NAME, dt); | ||
178 | if (error) { | ||
179 | dev_err(&client->dev, "irq request failed\n"); | ||
180 | goto err_free_input_dev; | ||
181 | } | ||
182 | |||
183 | error = input_register_device(dt->input); | ||
184 | if (error) { | ||
185 | dev_err(&client->dev, "device registration failed\n"); | ||
186 | goto err_free_irq; | ||
187 | } | ||
188 | |||
189 | device_init_wakeup(&client->dev, pdata->wakeup); | ||
190 | i2c_set_clientdata(client, dt); | ||
191 | |||
192 | return 0; | ||
193 | |||
194 | err_free_irq: | ||
195 | free_irq(client->irq, dt); | ||
196 | err_free_input_dev: | ||
197 | input_free_device(dt->input); | ||
198 | err_free_mem: | ||
199 | kfree(dt); | ||
200 | err_free_gpio: | ||
201 | gpio_free(pdata->vout_gpio); | ||
202 | err_hw_shutdown: | ||
203 | if (pdata->hw_shutdown) | ||
204 | pdata->hw_shutdown(client); | ||
205 | return error; | ||
206 | } | ||
207 | |||
208 | static int __devexit gp2a_remove(struct i2c_client *client) | ||
209 | { | ||
210 | struct gp2a_data *dt = i2c_get_clientdata(client); | ||
211 | const struct gp2a_platform_data *pdata = dt->pdata; | ||
212 | |||
213 | device_init_wakeup(&client->dev, false); | ||
214 | |||
215 | free_irq(client->irq, dt); | ||
216 | |||
217 | input_unregister_device(dt->input); | ||
218 | kfree(dt); | ||
219 | |||
220 | gpio_free(pdata->vout_gpio); | ||
221 | |||
222 | if (pdata->hw_shutdown) | ||
223 | pdata->hw_shutdown(client); | ||
224 | |||
225 | return 0; | ||
226 | } | ||
227 | |||
228 | #ifdef CONFIG_PM_SLEEP | ||
229 | static int gp2a_suspend(struct device *dev) | ||
230 | { | ||
231 | struct i2c_client *client = to_i2c_client(dev); | ||
232 | struct gp2a_data *dt = i2c_get_clientdata(client); | ||
233 | int retval = 0; | ||
234 | |||
235 | if (device_may_wakeup(&client->dev)) { | ||
236 | enable_irq_wake(client->irq); | ||
237 | } else { | ||
238 | mutex_lock(&dt->input->mutex); | ||
239 | if (dt->input->users) | ||
240 | retval = gp2a_disable(dt); | ||
241 | mutex_unlock(&dt->input->mutex); | ||
242 | } | ||
243 | |||
244 | return retval; | ||
245 | } | ||
246 | |||
247 | static int gp2a_resume(struct device *dev) | ||
248 | { | ||
249 | struct i2c_client *client = to_i2c_client(dev); | ||
250 | struct gp2a_data *dt = i2c_get_clientdata(client); | ||
251 | int retval = 0; | ||
252 | |||
253 | if (device_may_wakeup(&client->dev)) { | ||
254 | disable_irq_wake(client->irq); | ||
255 | } else { | ||
256 | mutex_lock(&dt->input->mutex); | ||
257 | if (dt->input->users) | ||
258 | retval = gp2a_enable(dt); | ||
259 | mutex_unlock(&dt->input->mutex); | ||
260 | } | ||
261 | |||
262 | return retval; | ||
263 | } | ||
264 | #endif | ||
265 | |||
266 | static SIMPLE_DEV_PM_OPS(gp2a_pm, gp2a_suspend, gp2a_resume); | ||
267 | |||
268 | static const struct i2c_device_id gp2a_i2c_id[] = { | ||
269 | { GP2A_I2C_NAME, 0 }, | ||
270 | { } | ||
271 | }; | ||
272 | |||
273 | static struct i2c_driver gp2a_i2c_driver = { | ||
274 | .driver = { | ||
275 | .name = GP2A_I2C_NAME, | ||
276 | .owner = THIS_MODULE, | ||
277 | .pm = &gp2a_pm, | ||
278 | }, | ||
279 | .probe = gp2a_probe, | ||
280 | .remove = __devexit_p(gp2a_remove), | ||
281 | .id_table = gp2a_i2c_id, | ||
282 | }; | ||
283 | |||
284 | static int __init gp2a_init(void) | ||
285 | { | ||
286 | return i2c_add_driver(&gp2a_i2c_driver); | ||
287 | } | ||
288 | |||
289 | static void __exit gp2a_exit(void) | ||
290 | { | ||
291 | i2c_del_driver(&gp2a_i2c_driver); | ||
292 | } | ||
293 | |||
294 | module_init(gp2a_init); | ||
295 | module_exit(gp2a_exit); | ||
296 | |||
297 | MODULE_AUTHOR("Courtney Cavin <courtney.cavin@sonyericsson.com>"); | ||
298 | MODULE_DESCRIPTION("Sharp GP2AP002A00F I2C Proximity/Opto sensor driver"); | ||
299 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/input/misc/gpio_tilt_polled.c b/drivers/input/misc/gpio_tilt_polled.c new file mode 100644 index 000000000000..277a0574c199 --- /dev/null +++ b/drivers/input/misc/gpio_tilt_polled.c | |||
@@ -0,0 +1,213 @@ | |||
1 | /* | ||
2 | * Driver for tilt switches connected via GPIO lines | ||
3 | * not capable of generating interrupts | ||
4 | * | ||
5 | * Copyright (C) 2011 Heiko Stuebner <heiko@sntech.de> | ||
6 | * | ||
7 | * based on: drivers/input/keyboard/gpio_keys_polled.c | ||
8 | * | ||
9 | * Copyright (C) 2007-2010 Gabor Juhos <juhosg@openwrt.org> | ||
10 | * Copyright (C) 2010 Nuno Goncalves <nunojpg@gmail.com> | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/slab.h> | ||
21 | #include <linux/input.h> | ||
22 | #include <linux/input-polldev.h> | ||
23 | #include <linux/ioport.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <linux/gpio.h> | ||
26 | #include <linux/input/gpio_tilt.h> | ||
27 | |||
28 | #define DRV_NAME "gpio-tilt-polled" | ||
29 | |||
30 | struct gpio_tilt_polled_dev { | ||
31 | struct input_polled_dev *poll_dev; | ||
32 | struct device *dev; | ||
33 | const struct gpio_tilt_platform_data *pdata; | ||
34 | |||
35 | int last_state; | ||
36 | |||
37 | int threshold; | ||
38 | int count; | ||
39 | }; | ||
40 | |||
41 | static void gpio_tilt_polled_poll(struct input_polled_dev *dev) | ||
42 | { | ||
43 | struct gpio_tilt_polled_dev *tdev = dev->private; | ||
44 | const struct gpio_tilt_platform_data *pdata = tdev->pdata; | ||
45 | struct input_dev *input = dev->input; | ||
46 | struct gpio_tilt_state *tilt_state = NULL; | ||
47 | int state, i; | ||
48 | |||
49 | if (tdev->count < tdev->threshold) { | ||
50 | tdev->count++; | ||
51 | } else { | ||
52 | state = 0; | ||
53 | for (i = 0; i < pdata->nr_gpios; i++) | ||
54 | state |= (!!gpio_get_value(pdata->gpios[i].gpio) << i); | ||
55 | |||
56 | if (state != tdev->last_state) { | ||
57 | for (i = 0; i < pdata->nr_states; i++) | ||
58 | if (pdata->states[i].gpios == state) | ||
59 | tilt_state = &pdata->states[i]; | ||
60 | |||
61 | if (tilt_state) { | ||
62 | for (i = 0; i < pdata->nr_axes; i++) | ||
63 | input_report_abs(input, | ||
64 | pdata->axes[i].axis, | ||
65 | tilt_state->axes[i]); | ||
66 | |||
67 | input_sync(input); | ||
68 | } | ||
69 | |||
70 | tdev->count = 0; | ||
71 | tdev->last_state = state; | ||
72 | } | ||
73 | } | ||
74 | } | ||
75 | |||
76 | static void gpio_tilt_polled_open(struct input_polled_dev *dev) | ||
77 | { | ||
78 | struct gpio_tilt_polled_dev *tdev = dev->private; | ||
79 | const struct gpio_tilt_platform_data *pdata = tdev->pdata; | ||
80 | |||
81 | if (pdata->enable) | ||
82 | pdata->enable(tdev->dev); | ||
83 | |||
84 | /* report initial state of the axes */ | ||
85 | tdev->last_state = -1; | ||
86 | tdev->count = tdev->threshold; | ||
87 | gpio_tilt_polled_poll(tdev->poll_dev); | ||
88 | } | ||
89 | |||
90 | static void gpio_tilt_polled_close(struct input_polled_dev *dev) | ||
91 | { | ||
92 | struct gpio_tilt_polled_dev *tdev = dev->private; | ||
93 | const struct gpio_tilt_platform_data *pdata = tdev->pdata; | ||
94 | |||
95 | if (pdata->disable) | ||
96 | pdata->disable(tdev->dev); | ||
97 | } | ||
98 | |||
99 | static int __devinit gpio_tilt_polled_probe(struct platform_device *pdev) | ||
100 | { | ||
101 | const struct gpio_tilt_platform_data *pdata = pdev->dev.platform_data; | ||
102 | struct device *dev = &pdev->dev; | ||
103 | struct gpio_tilt_polled_dev *tdev; | ||
104 | struct input_polled_dev *poll_dev; | ||
105 | struct input_dev *input; | ||
106 | int error, i; | ||
107 | |||
108 | if (!pdata || !pdata->poll_interval) | ||
109 | return -EINVAL; | ||
110 | |||
111 | tdev = kzalloc(sizeof(struct gpio_tilt_polled_dev), GFP_KERNEL); | ||
112 | if (!tdev) { | ||
113 | dev_err(dev, "no memory for private data\n"); | ||
114 | return -ENOMEM; | ||
115 | } | ||
116 | |||
117 | error = gpio_request_array(pdata->gpios, pdata->nr_gpios); | ||
118 | if (error) { | ||
119 | dev_err(dev, | ||
120 | "Could not request tilt GPIOs: %d\n", error); | ||
121 | goto err_free_tdev; | ||
122 | } | ||
123 | |||
124 | poll_dev = input_allocate_polled_device(); | ||
125 | if (!poll_dev) { | ||
126 | dev_err(dev, "no memory for polled device\n"); | ||
127 | error = -ENOMEM; | ||
128 | goto err_free_gpios; | ||
129 | } | ||
130 | |||
131 | poll_dev->private = tdev; | ||
132 | poll_dev->poll = gpio_tilt_polled_poll; | ||
133 | poll_dev->poll_interval = pdata->poll_interval; | ||
134 | poll_dev->open = gpio_tilt_polled_open; | ||
135 | poll_dev->close = gpio_tilt_polled_close; | ||
136 | |||
137 | input = poll_dev->input; | ||
138 | |||
139 | input->name = pdev->name; | ||
140 | input->phys = DRV_NAME"/input0"; | ||
141 | input->dev.parent = &pdev->dev; | ||
142 | |||
143 | input->id.bustype = BUS_HOST; | ||
144 | input->id.vendor = 0x0001; | ||
145 | input->id.product = 0x0001; | ||
146 | input->id.version = 0x0100; | ||
147 | |||
148 | __set_bit(EV_ABS, input->evbit); | ||
149 | for (i = 0; i < pdata->nr_axes; i++) | ||
150 | input_set_abs_params(input, pdata->axes[i].axis, | ||
151 | pdata->axes[i].min, pdata->axes[i].max, | ||
152 | pdata->axes[i].fuzz, pdata->axes[i].flat); | ||
153 | |||
154 | tdev->threshold = DIV_ROUND_UP(pdata->debounce_interval, | ||
155 | pdata->poll_interval); | ||
156 | |||
157 | tdev->poll_dev = poll_dev; | ||
158 | tdev->dev = dev; | ||
159 | tdev->pdata = pdata; | ||
160 | |||
161 | error = input_register_polled_device(poll_dev); | ||
162 | if (error) { | ||
163 | dev_err(dev, "unable to register polled device, err=%d\n", | ||
164 | error); | ||
165 | goto err_free_polldev; | ||
166 | } | ||
167 | |||
168 | platform_set_drvdata(pdev, tdev); | ||
169 | |||
170 | return 0; | ||
171 | |||
172 | err_free_polldev: | ||
173 | input_free_polled_device(poll_dev); | ||
174 | err_free_gpios: | ||
175 | gpio_free_array(pdata->gpios, pdata->nr_gpios); | ||
176 | err_free_tdev: | ||
177 | kfree(tdev); | ||
178 | |||
179 | return error; | ||
180 | } | ||
181 | |||
182 | static int __devexit gpio_tilt_polled_remove(struct platform_device *pdev) | ||
183 | { | ||
184 | struct gpio_tilt_polled_dev *tdev = platform_get_drvdata(pdev); | ||
185 | const struct gpio_tilt_platform_data *pdata = tdev->pdata; | ||
186 | |||
187 | platform_set_drvdata(pdev, NULL); | ||
188 | |||
189 | input_unregister_polled_device(tdev->poll_dev); | ||
190 | input_free_polled_device(tdev->poll_dev); | ||
191 | |||
192 | gpio_free_array(pdata->gpios, pdata->nr_gpios); | ||
193 | |||
194 | kfree(tdev); | ||
195 | |||
196 | return 0; | ||
197 | } | ||
198 | |||
199 | static struct platform_driver gpio_tilt_polled_driver = { | ||
200 | .probe = gpio_tilt_polled_probe, | ||
201 | .remove = __devexit_p(gpio_tilt_polled_remove), | ||
202 | .driver = { | ||
203 | .name = DRV_NAME, | ||
204 | .owner = THIS_MODULE, | ||
205 | }, | ||
206 | }; | ||
207 | |||
208 | module_platform_driver(gpio_tilt_polled_driver); | ||
209 | |||
210 | MODULE_LICENSE("GPL v2"); | ||
211 | MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>"); | ||
212 | MODULE_DESCRIPTION("Polled GPIO tilt driver"); | ||
213 | MODULE_ALIAS("platform:" DRV_NAME); | ||
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c index 302ab46ce752..50e283068301 100644 --- a/drivers/input/misc/ixp4xx-beeper.c +++ b/drivers/input/misc/ixp4xx-beeper.c | |||
@@ -168,16 +168,5 @@ static struct platform_driver ixp4xx_spkr_platform_driver = { | |||
168 | .remove = __devexit_p(ixp4xx_spkr_remove), | 168 | .remove = __devexit_p(ixp4xx_spkr_remove), |
169 | .shutdown = ixp4xx_spkr_shutdown, | 169 | .shutdown = ixp4xx_spkr_shutdown, |
170 | }; | 170 | }; |
171 | module_platform_driver(ixp4xx_spkr_platform_driver); | ||
171 | 172 | ||
172 | static int __init ixp4xx_spkr_init(void) | ||
173 | { | ||
174 | return platform_driver_register(&ixp4xx_spkr_platform_driver); | ||
175 | } | ||
176 | |||
177 | static void __exit ixp4xx_spkr_exit(void) | ||
178 | { | ||
179 | platform_driver_unregister(&ixp4xx_spkr_platform_driver); | ||
180 | } | ||
181 | |||
182 | module_init(ixp4xx_spkr_init); | ||
183 | module_exit(ixp4xx_spkr_exit); | ||
diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c index 7de0ded4ccc3..23cf08271049 100644 --- a/drivers/input/misc/max8925_onkey.c +++ b/drivers/input/misc/max8925_onkey.c | |||
@@ -166,18 +166,7 @@ static struct platform_driver max8925_onkey_driver = { | |||
166 | .probe = max8925_onkey_probe, | 166 | .probe = max8925_onkey_probe, |
167 | .remove = __devexit_p(max8925_onkey_remove), | 167 | .remove = __devexit_p(max8925_onkey_remove), |
168 | }; | 168 | }; |
169 | 169 | module_platform_driver(max8925_onkey_driver); | |
170 | static int __init max8925_onkey_init(void) | ||
171 | { | ||
172 | return platform_driver_register(&max8925_onkey_driver); | ||
173 | } | ||
174 | module_init(max8925_onkey_init); | ||
175 | |||
176 | static void __exit max8925_onkey_exit(void) | ||
177 | { | ||
178 | platform_driver_unregister(&max8925_onkey_driver); | ||
179 | } | ||
180 | module_exit(max8925_onkey_exit); | ||
181 | 170 | ||
182 | MODULE_DESCRIPTION("Maxim MAX8925 ONKEY driver"); | 171 | MODULE_DESCRIPTION("Maxim MAX8925 ONKEY driver"); |
183 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); | 172 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); |
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c index 09b052288657..8428f1e8e83e 100644 --- a/drivers/input/misc/mc13783-pwrbutton.c +++ b/drivers/input/misc/mc13783-pwrbutton.c | |||
@@ -255,7 +255,7 @@ static int __devexit mc13783_pwrbutton_remove(struct platform_device *pdev) | |||
255 | return 0; | 255 | return 0; |
256 | } | 256 | } |
257 | 257 | ||
258 | struct platform_driver mc13783_pwrbutton_driver = { | 258 | static struct platform_driver mc13783_pwrbutton_driver = { |
259 | .probe = mc13783_pwrbutton_probe, | 259 | .probe = mc13783_pwrbutton_probe, |
260 | .remove = __devexit_p(mc13783_pwrbutton_remove), | 260 | .remove = __devexit_p(mc13783_pwrbutton_remove), |
261 | .driver = { | 261 | .driver = { |
@@ -264,17 +264,7 @@ struct platform_driver mc13783_pwrbutton_driver = { | |||
264 | }, | 264 | }, |
265 | }; | 265 | }; |
266 | 266 | ||
267 | static int __init mc13783_pwrbutton_init(void) | 267 | module_platform_driver(mc13783_pwrbutton_driver); |
268 | { | ||
269 | return platform_driver_register(&mc13783_pwrbutton_driver); | ||
270 | } | ||
271 | module_init(mc13783_pwrbutton_init); | ||
272 | |||
273 | static void __exit mc13783_pwrbutton_exit(void) | ||
274 | { | ||
275 | platform_driver_unregister(&mc13783_pwrbutton_driver); | ||
276 | } | ||
277 | module_exit(mc13783_pwrbutton_exit); | ||
278 | 268 | ||
279 | MODULE_ALIAS("platform:mc13783-pwrbutton"); | 269 | MODULE_ALIAS("platform:mc13783-pwrbutton"); |
280 | MODULE_DESCRIPTION("MC13783 Power Button"); | 270 | MODULE_DESCRIPTION("MC13783 Power Button"); |
diff --git a/drivers/input/misc/mpu3050.c b/drivers/input/misc/mpu3050.c index f71dc728da58..208d1a1cc7f3 100644 --- a/drivers/input/misc/mpu3050.c +++ b/drivers/input/misc/mpu3050.c | |||
@@ -41,18 +41,67 @@ | |||
41 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
42 | #include <linux/pm_runtime.h> | 42 | #include <linux/pm_runtime.h> |
43 | 43 | ||
44 | #define MPU3050_CHIP_ID_REG 0x00 | ||
45 | #define MPU3050_CHIP_ID 0x69 | 44 | #define MPU3050_CHIP_ID 0x69 |
46 | #define MPU3050_XOUT_H 0x1D | ||
47 | #define MPU3050_PWR_MGM 0x3E | ||
48 | #define MPU3050_PWR_MGM_POS 6 | ||
49 | #define MPU3050_PWR_MGM_MASK 0x40 | ||
50 | 45 | ||
51 | #define MPU3050_AUTO_DELAY 1000 | 46 | #define MPU3050_AUTO_DELAY 1000 |
52 | 47 | ||
53 | #define MPU3050_MIN_VALUE -32768 | 48 | #define MPU3050_MIN_VALUE -32768 |
54 | #define MPU3050_MAX_VALUE 32767 | 49 | #define MPU3050_MAX_VALUE 32767 |
55 | 50 | ||
51 | #define MPU3050_DEFAULT_POLL_INTERVAL 200 | ||
52 | #define MPU3050_DEFAULT_FS_RANGE 3 | ||
53 | |||
54 | /* Register map */ | ||
55 | #define MPU3050_CHIP_ID_REG 0x00 | ||
56 | #define MPU3050_SMPLRT_DIV 0x15 | ||
57 | #define MPU3050_DLPF_FS_SYNC 0x16 | ||
58 | #define MPU3050_INT_CFG 0x17 | ||
59 | #define MPU3050_XOUT_H 0x1D | ||
60 | #define MPU3050_PWR_MGM 0x3E | ||
61 | #define MPU3050_PWR_MGM_POS 6 | ||
62 | |||
63 | /* Register bits */ | ||
64 | |||
65 | /* DLPF_FS_SYNC */ | ||
66 | #define MPU3050_EXT_SYNC_NONE 0x00 | ||
67 | #define MPU3050_EXT_SYNC_TEMP 0x20 | ||
68 | #define MPU3050_EXT_SYNC_GYROX 0x40 | ||
69 | #define MPU3050_EXT_SYNC_GYROY 0x60 | ||
70 | #define MPU3050_EXT_SYNC_GYROZ 0x80 | ||
71 | #define MPU3050_EXT_SYNC_ACCELX 0xA0 | ||
72 | #define MPU3050_EXT_SYNC_ACCELY 0xC0 | ||
73 | #define MPU3050_EXT_SYNC_ACCELZ 0xE0 | ||
74 | #define MPU3050_EXT_SYNC_MASK 0xE0 | ||
75 | #define MPU3050_FS_250DPS 0x00 | ||
76 | #define MPU3050_FS_500DPS 0x08 | ||
77 | #define MPU3050_FS_1000DPS 0x10 | ||
78 | #define MPU3050_FS_2000DPS 0x18 | ||
79 | #define MPU3050_FS_MASK 0x18 | ||
80 | #define MPU3050_DLPF_CFG_256HZ_NOLPF2 0x00 | ||
81 | #define MPU3050_DLPF_CFG_188HZ 0x01 | ||
82 | #define MPU3050_DLPF_CFG_98HZ 0x02 | ||
83 | #define MPU3050_DLPF_CFG_42HZ 0x03 | ||
84 | #define MPU3050_DLPF_CFG_20HZ 0x04 | ||
85 | #define MPU3050_DLPF_CFG_10HZ 0x05 | ||
86 | #define MPU3050_DLPF_CFG_5HZ 0x06 | ||
87 | #define MPU3050_DLPF_CFG_2100HZ_NOLPF 0x07 | ||
88 | #define MPU3050_DLPF_CFG_MASK 0x07 | ||
89 | /* INT_CFG */ | ||
90 | #define MPU3050_RAW_RDY_EN 0x01 | ||
91 | #define MPU3050_MPU_RDY_EN 0x02 | ||
92 | #define MPU3050_LATCH_INT_EN 0x04 | ||
93 | /* PWR_MGM */ | ||
94 | #define MPU3050_PWR_MGM_PLL_X 0x01 | ||
95 | #define MPU3050_PWR_MGM_PLL_Y 0x02 | ||
96 | #define MPU3050_PWR_MGM_PLL_Z 0x03 | ||
97 | #define MPU3050_PWR_MGM_CLKSEL 0x07 | ||
98 | #define MPU3050_PWR_MGM_STBY_ZG 0x08 | ||
99 | #define MPU3050_PWR_MGM_STBY_YG 0x10 | ||
100 | #define MPU3050_PWR_MGM_STBY_XG 0x20 | ||
101 | #define MPU3050_PWR_MGM_SLEEP 0x40 | ||
102 | #define MPU3050_PWR_MGM_RESET 0x80 | ||
103 | #define MPU3050_PWR_MGM_MASK 0x40 | ||
104 | |||
56 | struct axis_data { | 105 | struct axis_data { |
57 | s16 x; | 106 | s16 x; |
58 | s16 y; | 107 | s16 y; |
@@ -148,9 +197,20 @@ static void mpu3050_set_power_mode(struct i2c_client *client, u8 val) | |||
148 | static int mpu3050_input_open(struct input_dev *input) | 197 | static int mpu3050_input_open(struct input_dev *input) |
149 | { | 198 | { |
150 | struct mpu3050_sensor *sensor = input_get_drvdata(input); | 199 | struct mpu3050_sensor *sensor = input_get_drvdata(input); |
200 | int error; | ||
151 | 201 | ||
152 | pm_runtime_get(sensor->dev); | 202 | pm_runtime_get(sensor->dev); |
153 | 203 | ||
204 | /* Enable interrupts */ | ||
205 | error = i2c_smbus_write_byte_data(sensor->client, MPU3050_INT_CFG, | ||
206 | MPU3050_LATCH_INT_EN | | ||
207 | MPU3050_RAW_RDY_EN | | ||
208 | MPU3050_MPU_RDY_EN); | ||
209 | if (error < 0) { | ||
210 | pm_runtime_put(sensor->dev); | ||
211 | return error; | ||
212 | } | ||
213 | |||
154 | return 0; | 214 | return 0; |
155 | } | 215 | } |
156 | 216 | ||
@@ -192,6 +252,51 @@ static irqreturn_t mpu3050_interrupt_thread(int irq, void *data) | |||
192 | } | 252 | } |
193 | 253 | ||
194 | /** | 254 | /** |
255 | * mpu3050_hw_init - initialize hardware | ||
256 | * @sensor: the sensor | ||
257 | * | ||
258 | * Called during device probe; configures the sampling method. | ||
259 | */ | ||
260 | static int __devinit mpu3050_hw_init(struct mpu3050_sensor *sensor) | ||
261 | { | ||
262 | struct i2c_client *client = sensor->client; | ||
263 | int ret; | ||
264 | u8 reg; | ||
265 | |||
266 | /* Reset */ | ||
267 | ret = i2c_smbus_write_byte_data(client, MPU3050_PWR_MGM, | ||
268 | MPU3050_PWR_MGM_RESET); | ||
269 | if (ret < 0) | ||
270 | return ret; | ||
271 | |||
272 | ret = i2c_smbus_read_byte_data(client, MPU3050_PWR_MGM); | ||
273 | if (ret < 0) | ||
274 | return ret; | ||
275 | |||
276 | ret &= ~MPU3050_PWR_MGM_CLKSEL; | ||
277 | ret |= MPU3050_PWR_MGM_PLL_Z; | ||
278 | ret = i2c_smbus_write_byte_data(client, MPU3050_PWR_MGM, ret); | ||
279 | if (ret < 0) | ||
280 | return ret; | ||
281 | |||
282 | /* Output frequency divider. The poll interval */ | ||
283 | ret = i2c_smbus_write_byte_data(client, MPU3050_SMPLRT_DIV, | ||
284 | MPU3050_DEFAULT_POLL_INTERVAL - 1); | ||
285 | if (ret < 0) | ||
286 | return ret; | ||
287 | |||
288 | /* Set low pass filter and full scale */ | ||
289 | reg = MPU3050_DEFAULT_FS_RANGE; | ||
290 | reg |= MPU3050_DLPF_CFG_42HZ << 3; | ||
291 | reg |= MPU3050_EXT_SYNC_NONE << 5; | ||
292 | ret = i2c_smbus_write_byte_data(client, MPU3050_DLPF_FS_SYNC, reg); | ||
293 | if (ret < 0) | ||
294 | return ret; | ||
295 | |||
296 | return 0; | ||
297 | } | ||
298 | |||
299 | /** | ||
195 | * mpu3050_probe - device detection callback | 300 | * mpu3050_probe - device detection callback |
196 | * @client: i2c client of found device | 301 | * @client: i2c client of found device |
197 | * @id: id match information | 302 | * @id: id match information |
@@ -256,10 +361,14 @@ static int __devinit mpu3050_probe(struct i2c_client *client, | |||
256 | 361 | ||
257 | pm_runtime_set_active(&client->dev); | 362 | pm_runtime_set_active(&client->dev); |
258 | 363 | ||
364 | error = mpu3050_hw_init(sensor); | ||
365 | if (error) | ||
366 | goto err_pm_set_suspended; | ||
367 | |||
259 | error = request_threaded_irq(client->irq, | 368 | error = request_threaded_irq(client->irq, |
260 | NULL, mpu3050_interrupt_thread, | 369 | NULL, mpu3050_interrupt_thread, |
261 | IRQF_TRIGGER_RISING, | 370 | IRQF_TRIGGER_RISING, |
262 | "mpu_int", sensor); | 371 | "mpu3050", sensor); |
263 | if (error) { | 372 | if (error) { |
264 | dev_err(&client->dev, | 373 | dev_err(&client->dev, |
265 | "can't get IRQ %d, error %d\n", client->irq, error); | 374 | "can't get IRQ %d, error %d\n", client->irq, error); |
@@ -348,11 +457,18 @@ static const struct i2c_device_id mpu3050_ids[] = { | |||
348 | }; | 457 | }; |
349 | MODULE_DEVICE_TABLE(i2c, mpu3050_ids); | 458 | MODULE_DEVICE_TABLE(i2c, mpu3050_ids); |
350 | 459 | ||
460 | static const struct of_device_id mpu3050_of_match[] = { | ||
461 | { .compatible = "invn,mpu3050", }, | ||
462 | { }, | ||
463 | }; | ||
464 | MODULE_DEVICE_TABLE(of, mpu3050_of_match); | ||
465 | |||
351 | static struct i2c_driver mpu3050_i2c_driver = { | 466 | static struct i2c_driver mpu3050_i2c_driver = { |
352 | .driver = { | 467 | .driver = { |
353 | .name = "mpu3050", | 468 | .name = "mpu3050", |
354 | .owner = THIS_MODULE, | 469 | .owner = THIS_MODULE, |
355 | .pm = &mpu3050_pm, | 470 | .pm = &mpu3050_pm, |
471 | .of_match_table = mpu3050_of_match, | ||
356 | }, | 472 | }, |
357 | .probe = mpu3050_probe, | 473 | .probe = mpu3050_probe, |
358 | .remove = __devexit_p(mpu3050_remove), | 474 | .remove = __devexit_p(mpu3050_remove), |
diff --git a/drivers/input/misc/pcap_keys.c b/drivers/input/misc/pcap_keys.c index 99335c286250..e09b4fe81913 100644 --- a/drivers/input/misc/pcap_keys.c +++ b/drivers/input/misc/pcap_keys.c | |||
@@ -125,19 +125,7 @@ static struct platform_driver pcap_keys_device_driver = { | |||
125 | .owner = THIS_MODULE, | 125 | .owner = THIS_MODULE, |
126 | } | 126 | } |
127 | }; | 127 | }; |
128 | 128 | module_platform_driver(pcap_keys_device_driver); | |
129 | static int __init pcap_keys_init(void) | ||
130 | { | ||
131 | return platform_driver_register(&pcap_keys_device_driver); | ||
132 | }; | ||
133 | |||
134 | static void __exit pcap_keys_exit(void) | ||
135 | { | ||
136 | platform_driver_unregister(&pcap_keys_device_driver); | ||
137 | }; | ||
138 | |||
139 | module_init(pcap_keys_init); | ||
140 | module_exit(pcap_keys_exit); | ||
141 | 129 | ||
142 | MODULE_DESCRIPTION("Motorola PCAP2 input events driver"); | 130 | MODULE_DESCRIPTION("Motorola PCAP2 input events driver"); |
143 | MODULE_AUTHOR("Ilya Petrov <ilya.muromec@gmail.com>"); | 131 | MODULE_AUTHOR("Ilya Petrov <ilya.muromec@gmail.com>"); |
diff --git a/drivers/input/misc/pcf50633-input.c b/drivers/input/misc/pcf50633-input.c index 95562735728d..53891de80b0e 100644 --- a/drivers/input/misc/pcf50633-input.c +++ b/drivers/input/misc/pcf50633-input.c | |||
@@ -113,18 +113,7 @@ static struct platform_driver pcf50633_input_driver = { | |||
113 | .probe = pcf50633_input_probe, | 113 | .probe = pcf50633_input_probe, |
114 | .remove = __devexit_p(pcf50633_input_remove), | 114 | .remove = __devexit_p(pcf50633_input_remove), |
115 | }; | 115 | }; |
116 | 116 | module_platform_driver(pcf50633_input_driver); | |
117 | static int __init pcf50633_input_init(void) | ||
118 | { | ||
119 | return platform_driver_register(&pcf50633_input_driver); | ||
120 | } | ||
121 | module_init(pcf50633_input_init); | ||
122 | |||
123 | static void __exit pcf50633_input_exit(void) | ||
124 | { | ||
125 | platform_driver_unregister(&pcf50633_input_driver); | ||
126 | } | ||
127 | module_exit(pcf50633_input_exit); | ||
128 | 117 | ||
129 | MODULE_AUTHOR("Balaji Rao <balajirrao@openmoko.org>"); | 118 | MODULE_AUTHOR("Balaji Rao <balajirrao@openmoko.org>"); |
130 | MODULE_DESCRIPTION("PCF50633 input driver"); | 119 | MODULE_DESCRIPTION("PCF50633 input driver"); |
diff --git a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c index 34f4d2e0f50f..b2484aa07f32 100644 --- a/drivers/input/misc/pcspkr.c +++ b/drivers/input/misc/pcspkr.c | |||
@@ -134,17 +134,5 @@ static struct platform_driver pcspkr_platform_driver = { | |||
134 | .remove = __devexit_p(pcspkr_remove), | 134 | .remove = __devexit_p(pcspkr_remove), |
135 | .shutdown = pcspkr_shutdown, | 135 | .shutdown = pcspkr_shutdown, |
136 | }; | 136 | }; |
137 | module_platform_driver(pcspkr_platform_driver); | ||
137 | 138 | ||
138 | |||
139 | static int __init pcspkr_init(void) | ||
140 | { | ||
141 | return platform_driver_register(&pcspkr_platform_driver); | ||
142 | } | ||
143 | |||
144 | static void __exit pcspkr_exit(void) | ||
145 | { | ||
146 | platform_driver_unregister(&pcspkr_platform_driver); | ||
147 | } | ||
148 | |||
149 | module_init(pcspkr_init); | ||
150 | module_exit(pcspkr_exit); | ||
diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c index 43192930824b..dfbfb463ea5d 100644 --- a/drivers/input/misc/pm8xxx-vibrator.c +++ b/drivers/input/misc/pm8xxx-vibrator.c | |||
@@ -277,18 +277,7 @@ static struct platform_driver pm8xxx_vib_driver = { | |||
277 | .pm = &pm8xxx_vib_pm_ops, | 277 | .pm = &pm8xxx_vib_pm_ops, |
278 | }, | 278 | }, |
279 | }; | 279 | }; |
280 | 280 | module_platform_driver(pm8xxx_vib_driver); | |
281 | static int __init pm8xxx_vib_init(void) | ||
282 | { | ||
283 | return platform_driver_register(&pm8xxx_vib_driver); | ||
284 | } | ||
285 | module_init(pm8xxx_vib_init); | ||
286 | |||
287 | static void __exit pm8xxx_vib_exit(void) | ||
288 | { | ||
289 | platform_driver_unregister(&pm8xxx_vib_driver); | ||
290 | } | ||
291 | module_exit(pm8xxx_vib_exit); | ||
292 | 281 | ||
293 | MODULE_ALIAS("platform:pm8xxx_vib"); | 282 | MODULE_ALIAS("platform:pm8xxx_vib"); |
294 | MODULE_DESCRIPTION("PMIC8xxx vibrator driver based on ff-memless framework"); | 283 | MODULE_DESCRIPTION("PMIC8xxx vibrator driver based on ff-memless framework"); |
diff --git a/drivers/input/misc/pmic8xxx-pwrkey.c b/drivers/input/misc/pmic8xxx-pwrkey.c index b3cfb9c71e66..0f83d0f1d015 100644 --- a/drivers/input/misc/pmic8xxx-pwrkey.c +++ b/drivers/input/misc/pmic8xxx-pwrkey.c | |||
@@ -213,18 +213,7 @@ static struct platform_driver pmic8xxx_pwrkey_driver = { | |||
213 | .pm = &pm8xxx_pwr_key_pm_ops, | 213 | .pm = &pm8xxx_pwr_key_pm_ops, |
214 | }, | 214 | }, |
215 | }; | 215 | }; |
216 | 216 | module_platform_driver(pmic8xxx_pwrkey_driver); | |
217 | static int __init pmic8xxx_pwrkey_init(void) | ||
218 | { | ||
219 | return platform_driver_register(&pmic8xxx_pwrkey_driver); | ||
220 | } | ||
221 | module_init(pmic8xxx_pwrkey_init); | ||
222 | |||
223 | static void __exit pmic8xxx_pwrkey_exit(void) | ||
224 | { | ||
225 | platform_driver_unregister(&pmic8xxx_pwrkey_driver); | ||
226 | } | ||
227 | module_exit(pmic8xxx_pwrkey_exit); | ||
228 | 217 | ||
229 | MODULE_ALIAS("platform:pmic8xxx_pwrkey"); | 218 | MODULE_ALIAS("platform:pmic8xxx_pwrkey"); |
230 | MODULE_DESCRIPTION("PMIC8XXX Power Key driver"); | 219 | MODULE_DESCRIPTION("PMIC8XXX Power Key driver"); |
diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c index 57c294f07198..fc84c8a51147 100644 --- a/drivers/input/misc/pwm-beeper.c +++ b/drivers/input/misc/pwm-beeper.c | |||
@@ -180,18 +180,7 @@ static struct platform_driver pwm_beeper_driver = { | |||
180 | .pm = PWM_BEEPER_PM_OPS, | 180 | .pm = PWM_BEEPER_PM_OPS, |
181 | }, | 181 | }, |
182 | }; | 182 | }; |
183 | 183 | module_platform_driver(pwm_beeper_driver); | |
184 | static int __init pwm_beeper_init(void) | ||
185 | { | ||
186 | return platform_driver_register(&pwm_beeper_driver); | ||
187 | } | ||
188 | module_init(pwm_beeper_init); | ||
189 | |||
190 | static void __exit pwm_beeper_exit(void) | ||
191 | { | ||
192 | platform_driver_unregister(&pwm_beeper_driver); | ||
193 | } | ||
194 | module_exit(pwm_beeper_exit); | ||
195 | 184 | ||
196 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); | 185 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); |
197 | MODULE_DESCRIPTION("PWM beeper driver"); | 186 | MODULE_DESCRIPTION("PWM beeper driver"); |
diff --git a/drivers/input/misc/rb532_button.c b/drivers/input/misc/rb532_button.c index e2c7f622a0b5..aeb02bcf7233 100644 --- a/drivers/input/misc/rb532_button.c +++ b/drivers/input/misc/rb532_button.c | |||
@@ -100,19 +100,7 @@ static struct platform_driver rb532_button_driver = { | |||
100 | .owner = THIS_MODULE, | 100 | .owner = THIS_MODULE, |
101 | }, | 101 | }, |
102 | }; | 102 | }; |
103 | 103 | module_platform_driver(rb532_button_driver); | |
104 | static int __init rb532_button_init(void) | ||
105 | { | ||
106 | return platform_driver_register(&rb532_button_driver); | ||
107 | } | ||
108 | |||
109 | static void __exit rb532_button_exit(void) | ||
110 | { | ||
111 | platform_driver_unregister(&rb532_button_driver); | ||
112 | } | ||
113 | |||
114 | module_init(rb532_button_init); | ||
115 | module_exit(rb532_button_exit); | ||
116 | 104 | ||
117 | MODULE_AUTHOR("Phil Sutter <n0-1@freewrt.org>"); | 105 | MODULE_AUTHOR("Phil Sutter <n0-1@freewrt.org>"); |
118 | MODULE_LICENSE("GPL"); | 106 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c index 2be21694fac1..f07f784198b9 100644 --- a/drivers/input/misc/rotary_encoder.c +++ b/drivers/input/misc/rotary_encoder.c | |||
@@ -284,19 +284,7 @@ static struct platform_driver rotary_encoder_driver = { | |||
284 | .owner = THIS_MODULE, | 284 | .owner = THIS_MODULE, |
285 | } | 285 | } |
286 | }; | 286 | }; |
287 | 287 | module_platform_driver(rotary_encoder_driver); | |
288 | static int __init rotary_encoder_init(void) | ||
289 | { | ||
290 | return platform_driver_register(&rotary_encoder_driver); | ||
291 | } | ||
292 | |||
293 | static void __exit rotary_encoder_exit(void) | ||
294 | { | ||
295 | platform_driver_unregister(&rotary_encoder_driver); | ||
296 | } | ||
297 | |||
298 | module_init(rotary_encoder_init); | ||
299 | module_exit(rotary_encoder_exit); | ||
300 | 288 | ||
301 | MODULE_ALIAS("platform:" DRV_NAME); | 289 | MODULE_ALIAS("platform:" DRV_NAME); |
302 | MODULE_DESCRIPTION("GPIO rotary encoder driver"); | 290 | MODULE_DESCRIPTION("GPIO rotary encoder driver"); |
diff --git a/drivers/input/misc/sgi_btns.c b/drivers/input/misc/sgi_btns.c index 1a80c0dab83b..5d9fd5571199 100644 --- a/drivers/input/misc/sgi_btns.c +++ b/drivers/input/misc/sgi_btns.c | |||
@@ -164,17 +164,6 @@ static struct platform_driver sgi_buttons_driver = { | |||
164 | .owner = THIS_MODULE, | 164 | .owner = THIS_MODULE, |
165 | }, | 165 | }, |
166 | }; | 166 | }; |
167 | 167 | module_platform_driver(sgi_buttons_driver); | |
168 | static int __init sgi_buttons_init(void) | ||
169 | { | ||
170 | return platform_driver_register(&sgi_buttons_driver); | ||
171 | } | ||
172 | |||
173 | static void __exit sgi_buttons_exit(void) | ||
174 | { | ||
175 | platform_driver_unregister(&sgi_buttons_driver); | ||
176 | } | ||
177 | 168 | ||
178 | MODULE_LICENSE("GPL"); | 169 | MODULE_LICENSE("GPL"); |
179 | module_init(sgi_buttons_init); | ||
180 | module_exit(sgi_buttons_exit); | ||
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c index 38e4b507b94c..19a68828cd86 100644 --- a/drivers/input/misc/twl4030-pwrbutton.c +++ b/drivers/input/misc/twl4030-pwrbutton.c | |||
@@ -107,25 +107,14 @@ static int __exit twl4030_pwrbutton_remove(struct platform_device *pdev) | |||
107 | } | 107 | } |
108 | 108 | ||
109 | static struct platform_driver twl4030_pwrbutton_driver = { | 109 | static struct platform_driver twl4030_pwrbutton_driver = { |
110 | .probe = twl4030_pwrbutton_probe, | ||
110 | .remove = __exit_p(twl4030_pwrbutton_remove), | 111 | .remove = __exit_p(twl4030_pwrbutton_remove), |
111 | .driver = { | 112 | .driver = { |
112 | .name = "twl4030_pwrbutton", | 113 | .name = "twl4030_pwrbutton", |
113 | .owner = THIS_MODULE, | 114 | .owner = THIS_MODULE, |
114 | }, | 115 | }, |
115 | }; | 116 | }; |
116 | 117 | module_platform_driver(twl4030_pwrbutton_driver); | |
117 | static int __init twl4030_pwrbutton_init(void) | ||
118 | { | ||
119 | return platform_driver_probe(&twl4030_pwrbutton_driver, | ||
120 | twl4030_pwrbutton_probe); | ||
121 | } | ||
122 | module_init(twl4030_pwrbutton_init); | ||
123 | |||
124 | static void __exit twl4030_pwrbutton_exit(void) | ||
125 | { | ||
126 | platform_driver_unregister(&twl4030_pwrbutton_driver); | ||
127 | } | ||
128 | module_exit(twl4030_pwrbutton_exit); | ||
129 | 118 | ||
130 | MODULE_ALIAS("platform:twl4030_pwrbutton"); | 119 | MODULE_ALIAS("platform:twl4030_pwrbutton"); |
131 | MODULE_DESCRIPTION("Triton2 Power Button"); | 120 | MODULE_DESCRIPTION("Triton2 Power Button"); |
diff --git a/drivers/input/misc/twl4030-vibra.c b/drivers/input/misc/twl4030-vibra.c index 3c1a432c14dc..37651373a95b 100644 --- a/drivers/input/misc/twl4030-vibra.c +++ b/drivers/input/misc/twl4030-vibra.c | |||
@@ -278,21 +278,9 @@ static struct platform_driver twl4030_vibra_driver = { | |||
278 | #endif | 278 | #endif |
279 | }, | 279 | }, |
280 | }; | 280 | }; |
281 | 281 | module_platform_driver(twl4030_vibra_driver); | |
282 | static int __init twl4030_vibra_init(void) | ||
283 | { | ||
284 | return platform_driver_register(&twl4030_vibra_driver); | ||
285 | } | ||
286 | module_init(twl4030_vibra_init); | ||
287 | |||
288 | static void __exit twl4030_vibra_exit(void) | ||
289 | { | ||
290 | platform_driver_unregister(&twl4030_vibra_driver); | ||
291 | } | ||
292 | module_exit(twl4030_vibra_exit); | ||
293 | 282 | ||
294 | MODULE_ALIAS("platform:twl4030-vibra"); | 283 | MODULE_ALIAS("platform:twl4030-vibra"); |
295 | |||
296 | MODULE_DESCRIPTION("TWL4030 Vibra driver"); | 284 | MODULE_DESCRIPTION("TWL4030 Vibra driver"); |
297 | MODULE_LICENSE("GPL"); | 285 | MODULE_LICENSE("GPL"); |
298 | MODULE_AUTHOR("Nokia Corporation"); | 286 | MODULE_AUTHOR("Nokia Corporation"); |
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c index ad153a417eed..45874fed523a 100644 --- a/drivers/input/misc/twl6040-vibra.c +++ b/drivers/input/misc/twl6040-vibra.c | |||
@@ -410,18 +410,7 @@ static struct platform_driver twl6040_vibra_driver = { | |||
410 | .pm = &twl6040_vibra_pm_ops, | 410 | .pm = &twl6040_vibra_pm_ops, |
411 | }, | 411 | }, |
412 | }; | 412 | }; |
413 | 413 | module_platform_driver(twl6040_vibra_driver); | |
414 | static int __init twl6040_vibra_init(void) | ||
415 | { | ||
416 | return platform_driver_register(&twl6040_vibra_driver); | ||
417 | } | ||
418 | module_init(twl6040_vibra_init); | ||
419 | |||
420 | static void __exit twl6040_vibra_exit(void) | ||
421 | { | ||
422 | platform_driver_unregister(&twl6040_vibra_driver); | ||
423 | } | ||
424 | module_exit(twl6040_vibra_exit); | ||
425 | 414 | ||
426 | MODULE_ALIAS("platform:twl6040-vibra"); | 415 | MODULE_ALIAS("platform:twl6040-vibra"); |
427 | MODULE_DESCRIPTION("TWL6040 Vibra driver"); | 416 | MODULE_DESCRIPTION("TWL6040 Vibra driver"); |
diff --git a/drivers/input/misc/wm831x-on.c b/drivers/input/misc/wm831x-on.c index c3d7ba5f5b47..47f18d6bce46 100644 --- a/drivers/input/misc/wm831x-on.c +++ b/drivers/input/misc/wm831x-on.c | |||
@@ -145,18 +145,7 @@ static struct platform_driver wm831x_on_driver = { | |||
145 | .owner = THIS_MODULE, | 145 | .owner = THIS_MODULE, |
146 | }, | 146 | }, |
147 | }; | 147 | }; |
148 | 148 | module_platform_driver(wm831x_on_driver); | |
149 | static int __init wm831x_on_init(void) | ||
150 | { | ||
151 | return platform_driver_register(&wm831x_on_driver); | ||
152 | } | ||
153 | module_init(wm831x_on_init); | ||
154 | |||
155 | static void __exit wm831x_on_exit(void) | ||
156 | { | ||
157 | platform_driver_unregister(&wm831x_on_driver); | ||
158 | } | ||
159 | module_exit(wm831x_on_exit); | ||
160 | 149 | ||
161 | MODULE_ALIAS("platform:wm831x-on"); | 150 | MODULE_ALIAS("platform:wm831x-on"); |
162 | MODULE_DESCRIPTION("WM831x ON pin"); | 151 | MODULE_DESCRIPTION("WM831x ON pin"); |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 003587c71f43..bd87380bd879 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -17,13 +17,63 @@ | |||
17 | 17 | ||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/input.h> | 19 | #include <linux/input.h> |
20 | #include <linux/input/mt.h> | ||
20 | #include <linux/serio.h> | 21 | #include <linux/serio.h> |
21 | #include <linux/libps2.h> | 22 | #include <linux/libps2.h> |
22 | 23 | ||
23 | #include "psmouse.h" | 24 | #include "psmouse.h" |
24 | #include "alps.h" | 25 | #include "alps.h" |
25 | 26 | ||
26 | #define ALPS_OLDPROTO 0x01 /* old style input */ | 27 | /* |
28 | * Definitions for ALPS version 3 and 4 command mode protocol | ||
29 | */ | ||
30 | #define ALPS_V3_X_MAX 2000 | ||
31 | #define ALPS_V3_Y_MAX 1400 | ||
32 | |||
33 | #define ALPS_BITMAP_X_BITS 15 | ||
34 | #define ALPS_BITMAP_Y_BITS 11 | ||
35 | |||
36 | #define ALPS_CMD_NIBBLE_10 0x01f2 | ||
37 | |||
38 | static const struct alps_nibble_commands alps_v3_nibble_commands[] = { | ||
39 | { PSMOUSE_CMD_SETPOLL, 0x00 }, /* 0 */ | ||
40 | { PSMOUSE_CMD_RESET_DIS, 0x00 }, /* 1 */ | ||
41 | { PSMOUSE_CMD_SETSCALE21, 0x00 }, /* 2 */ | ||
42 | { PSMOUSE_CMD_SETRATE, 0x0a }, /* 3 */ | ||
43 | { PSMOUSE_CMD_SETRATE, 0x14 }, /* 4 */ | ||
44 | { PSMOUSE_CMD_SETRATE, 0x28 }, /* 5 */ | ||
45 | { PSMOUSE_CMD_SETRATE, 0x3c }, /* 6 */ | ||
46 | { PSMOUSE_CMD_SETRATE, 0x50 }, /* 7 */ | ||
47 | { PSMOUSE_CMD_SETRATE, 0x64 }, /* 8 */ | ||
48 | { PSMOUSE_CMD_SETRATE, 0xc8 }, /* 9 */ | ||
49 | { ALPS_CMD_NIBBLE_10, 0x00 }, /* a */ | ||
50 | { PSMOUSE_CMD_SETRES, 0x00 }, /* b */ | ||
51 | { PSMOUSE_CMD_SETRES, 0x01 }, /* c */ | ||
52 | { PSMOUSE_CMD_SETRES, 0x02 }, /* d */ | ||
53 | { PSMOUSE_CMD_SETRES, 0x03 }, /* e */ | ||
54 | { PSMOUSE_CMD_SETSCALE11, 0x00 }, /* f */ | ||
55 | }; | ||
56 | |||
57 | static const struct alps_nibble_commands alps_v4_nibble_commands[] = { | ||
58 | { PSMOUSE_CMD_ENABLE, 0x00 }, /* 0 */ | ||
59 | { PSMOUSE_CMD_RESET_DIS, 0x00 }, /* 1 */ | ||
60 | { PSMOUSE_CMD_SETSCALE21, 0x00 }, /* 2 */ | ||
61 | { PSMOUSE_CMD_SETRATE, 0x0a }, /* 3 */ | ||
62 | { PSMOUSE_CMD_SETRATE, 0x14 }, /* 4 */ | ||
63 | { PSMOUSE_CMD_SETRATE, 0x28 }, /* 5 */ | ||
64 | { PSMOUSE_CMD_SETRATE, 0x3c }, /* 6 */ | ||
65 | { PSMOUSE_CMD_SETRATE, 0x50 }, /* 7 */ | ||
66 | { PSMOUSE_CMD_SETRATE, 0x64 }, /* 8 */ | ||
67 | { PSMOUSE_CMD_SETRATE, 0xc8 }, /* 9 */ | ||
68 | { ALPS_CMD_NIBBLE_10, 0x00 }, /* a */ | ||
69 | { PSMOUSE_CMD_SETRES, 0x00 }, /* b */ | ||
70 | { PSMOUSE_CMD_SETRES, 0x01 }, /* c */ | ||
71 | { PSMOUSE_CMD_SETRES, 0x02 }, /* d */ | ||
72 | { PSMOUSE_CMD_SETRES, 0x03 }, /* e */ | ||
73 | { PSMOUSE_CMD_SETSCALE11, 0x00 }, /* f */ | ||
74 | }; | ||
75 | |||
76 | |||
27 | #define ALPS_DUALPOINT 0x02 /* touchpad has trackstick */ | 77 | #define ALPS_DUALPOINT 0x02 /* touchpad has trackstick */ |
28 | #define ALPS_PASS 0x04 /* device has a pass-through port */ | 78 | #define ALPS_PASS 0x04 /* device has a pass-through port */ |
29 | 79 | ||
@@ -35,30 +85,33 @@ | |||
35 | 6-byte ALPS packet */ | 85 | 6-byte ALPS packet */ |
36 | 86 | ||
37 | static const struct alps_model_info alps_model_data[] = { | 87 | static const struct alps_model_info alps_model_data[] = { |
38 | { { 0x32, 0x02, 0x14 }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Toshiba Salellite Pro M10 */ | 88 | { { 0x32, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Toshiba Salellite Pro M10 */ |
39 | { { 0x33, 0x02, 0x0a }, 0x88, 0xf8, ALPS_OLDPROTO }, /* UMAX-530T */ | 89 | { { 0x33, 0x02, 0x0a }, 0x00, ALPS_PROTO_V1, 0x88, 0xf8, 0 }, /* UMAX-530T */ |
40 | { { 0x53, 0x02, 0x0a }, 0xf8, 0xf8, 0 }, | 90 | { { 0x53, 0x02, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, |
41 | { { 0x53, 0x02, 0x14 }, 0xf8, 0xf8, 0 }, | 91 | { { 0x53, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, |
42 | { { 0x60, 0x03, 0xc8 }, 0xf8, 0xf8, 0 }, /* HP ze1115 */ | 92 | { { 0x60, 0x03, 0xc8 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, /* HP ze1115 */ |
43 | { { 0x63, 0x02, 0x0a }, 0xf8, 0xf8, 0 }, | 93 | { { 0x63, 0x02, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, |
44 | { { 0x63, 0x02, 0x14 }, 0xf8, 0xf8, 0 }, | 94 | { { 0x63, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, |
45 | { { 0x63, 0x02, 0x28 }, 0xf8, 0xf8, ALPS_FW_BK_2 }, /* Fujitsu Siemens S6010 */ | 95 | { { 0x63, 0x02, 0x28 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 }, /* Fujitsu Siemens S6010 */ |
46 | { { 0x63, 0x02, 0x3c }, 0x8f, 0x8f, ALPS_WHEEL }, /* Toshiba Satellite S2400-103 */ | 96 | { { 0x63, 0x02, 0x3c }, 0x00, ALPS_PROTO_V2, 0x8f, 0x8f, ALPS_WHEEL }, /* Toshiba Satellite S2400-103 */ |
47 | { { 0x63, 0x02, 0x50 }, 0xef, 0xef, ALPS_FW_BK_1 }, /* NEC Versa L320 */ | 97 | { { 0x63, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xef, 0xef, ALPS_FW_BK_1 }, /* NEC Versa L320 */ |
48 | { { 0x63, 0x02, 0x64 }, 0xf8, 0xf8, 0 }, | 98 | { { 0x63, 0x02, 0x64 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, |
49 | { { 0x63, 0x03, 0xc8 }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D800 */ | 99 | { { 0x63, 0x03, 0xc8 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D800 */ |
50 | { { 0x73, 0x00, 0x0a }, 0xf8, 0xf8, ALPS_DUALPOINT }, /* ThinkPad R61 8918-5QG */ | 100 | { { 0x73, 0x00, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_DUALPOINT }, /* ThinkPad R61 8918-5QG */ |
51 | { { 0x73, 0x02, 0x0a }, 0xf8, 0xf8, 0 }, | 101 | { { 0x73, 0x02, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, |
52 | { { 0x73, 0x02, 0x14 }, 0xf8, 0xf8, ALPS_FW_BK_2 }, /* Ahtec Laptop */ | 102 | { { 0x73, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 }, /* Ahtec Laptop */ |
53 | { { 0x20, 0x02, 0x0e }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */ | 103 | { { 0x20, 0x02, 0x0e }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */ |
54 | { { 0x22, 0x02, 0x0a }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, | 104 | { { 0x22, 0x02, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, |
55 | { { 0x22, 0x02, 0x14 }, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */ | 105 | { { 0x22, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */ |
56 | /* Dell Latitude E5500, E6400, E6500, Precision M4400 */ | 106 | /* Dell Latitude E5500, E6400, E6500, Precision M4400 */ |
57 | { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf, | 107 | { { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, |
58 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, | 108 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, |
59 | { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ | 109 | { { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ |
60 | { { 0x52, 0x01, 0x14 }, 0xff, 0xff, | 110 | { { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff, |
61 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */ | 111 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */ |
112 | { { 0x73, 0x02, 0x64 }, 0x9b, ALPS_PROTO_V3, 0x8f, 0x8f, ALPS_DUALPOINT }, | ||
113 | { { 0x73, 0x02, 0x64 }, 0x9d, ALPS_PROTO_V3, 0x8f, 0x8f, ALPS_DUALPOINT }, | ||
114 | { { 0x73, 0x02, 0x64 }, 0x8a, ALPS_PROTO_V4, 0x8f, 0x8f, 0 }, | ||
62 | }; | 115 | }; |
63 | 116 | ||
64 | /* | 117 | /* |
@@ -67,42 +120,7 @@ static const struct alps_model_info alps_model_data[] = { | |||
67 | * isn't valid per PS/2 spec. | 120 | * isn't valid per PS/2 spec. |
68 | */ | 121 | */ |
69 | 122 | ||
70 | /* | 123 | /* Packet formats are described in Documentation/input/alps.txt */ |
71 | * PS/2 packet format | ||
72 | * | ||
73 | * byte 0: 0 0 YSGN XSGN 1 M R L | ||
74 | * byte 1: X7 X6 X5 X4 X3 X2 X1 X0 | ||
75 | * byte 2: Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 | ||
76 | * | ||
77 | * Note that the device never signals overflow condition. | ||
78 | * | ||
79 | * ALPS absolute Mode - new format | ||
80 | * | ||
81 | * byte 0: 1 ? ? ? 1 ? ? ? | ||
82 | * byte 1: 0 x6 x5 x4 x3 x2 x1 x0 | ||
83 | * byte 2: 0 x10 x9 x8 x7 ? fin ges | ||
84 | * byte 3: 0 y9 y8 y7 1 M R L | ||
85 | * byte 4: 0 y6 y5 y4 y3 y2 y1 y0 | ||
86 | * byte 5: 0 z6 z5 z4 z3 z2 z1 z0 | ||
87 | * | ||
88 | * Dualpoint device -- interleaved packet format | ||
89 | * | ||
90 | * byte 0: 1 1 0 0 1 1 1 1 | ||
91 | * byte 1: 0 x6 x5 x4 x3 x2 x1 x0 | ||
92 | * byte 2: 0 x10 x9 x8 x7 0 fin ges | ||
93 | * byte 3: 0 0 YSGN XSGN 1 1 1 1 | ||
94 | * byte 4: X7 X6 X5 X4 X3 X2 X1 X0 | ||
95 | * byte 5: Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 | ||
96 | * byte 6: 0 y9 y8 y7 1 m r l | ||
97 | * byte 7: 0 y6 y5 y4 y3 y2 y1 y0 | ||
98 | * byte 8: 0 z6 z5 z4 z3 z2 z1 z0 | ||
99 | * | ||
100 | * CAPITALS = stick, miniscules = touchpad | ||
101 | * | ||
102 | * ?'s can have different meanings on different models, | ||
103 | * such as wheel rotation, extra buttons, stick buttons | ||
104 | * on a dualpoint, etc. | ||
105 | */ | ||
106 | 124 | ||
107 | static bool alps_is_valid_first_byte(const struct alps_model_info *model, | 125 | static bool alps_is_valid_first_byte(const struct alps_model_info *model, |
108 | unsigned char data) | 126 | unsigned char data) |
@@ -137,7 +155,7 @@ static void alps_report_buttons(struct psmouse *psmouse, | |||
137 | input_sync(dev2); | 155 | input_sync(dev2); |
138 | } | 156 | } |
139 | 157 | ||
140 | static void alps_process_packet(struct psmouse *psmouse) | 158 | static void alps_process_packet_v1_v2(struct psmouse *psmouse) |
141 | { | 159 | { |
142 | struct alps_data *priv = psmouse->private; | 160 | struct alps_data *priv = psmouse->private; |
143 | const struct alps_model_info *model = priv->i; | 161 | const struct alps_model_info *model = priv->i; |
@@ -147,7 +165,7 @@ static void alps_process_packet(struct psmouse *psmouse) | |||
147 | int x, y, z, ges, fin, left, right, middle; | 165 | int x, y, z, ges, fin, left, right, middle; |
148 | int back = 0, forward = 0; | 166 | int back = 0, forward = 0; |
149 | 167 | ||
150 | if (model->flags & ALPS_OLDPROTO) { | 168 | if (model->proto_version == ALPS_PROTO_V1) { |
151 | left = packet[2] & 0x10; | 169 | left = packet[2] & 0x10; |
152 | right = packet[2] & 0x08; | 170 | right = packet[2] & 0x08; |
153 | middle = 0; | 171 | middle = 0; |
@@ -239,6 +257,403 @@ static void alps_process_packet(struct psmouse *psmouse) | |||
239 | input_sync(dev); | 257 | input_sync(dev); |
240 | } | 258 | } |
241 | 259 | ||
260 | /* | ||
261 | * Process bitmap data from v3 and v4 protocols. Returns the number of | ||
262 | * fingers detected. A return value of 0 means at least one of the | ||
263 | * bitmaps was empty. | ||
264 | * | ||
265 | * The bitmaps don't have enough data to track fingers, so this function | ||
266 | * only generates points representing a bounding box of all contacts. | ||
267 | * These points are returned in x1, y1, x2, and y2 when the return value | ||
268 | * is greater than 0. | ||
269 | */ | ||
270 | static int alps_process_bitmap(unsigned int x_map, unsigned int y_map, | ||
271 | int *x1, int *y1, int *x2, int *y2) | ||
272 | { | ||
273 | struct alps_bitmap_point { | ||
274 | int start_bit; | ||
275 | int num_bits; | ||
276 | }; | ||
277 | |||
278 | int fingers_x = 0, fingers_y = 0, fingers; | ||
279 | int i, bit, prev_bit; | ||
280 | struct alps_bitmap_point x_low = {0,}, x_high = {0,}; | ||
281 | struct alps_bitmap_point y_low = {0,}, y_high = {0,}; | ||
282 | struct alps_bitmap_point *point; | ||
283 | |||
284 | if (!x_map || !y_map) | ||
285 | return 0; | ||
286 | |||
287 | *x1 = *y1 = *x2 = *y2 = 0; | ||
288 | |||
289 | prev_bit = 0; | ||
290 | point = &x_low; | ||
291 | for (i = 0; x_map != 0; i++, x_map >>= 1) { | ||
292 | bit = x_map & 1; | ||
293 | if (bit) { | ||
294 | if (!prev_bit) { | ||
295 | point->start_bit = i; | ||
296 | fingers_x++; | ||
297 | } | ||
298 | point->num_bits++; | ||
299 | } else { | ||
300 | if (prev_bit) | ||
301 | point = &x_high; | ||
302 | else | ||
303 | point->num_bits = 0; | ||
304 | } | ||
305 | prev_bit = bit; | ||
306 | } | ||
307 | |||
308 | /* | ||
309 | * y bitmap is reversed for what we need (lower positions are in | ||
310 | * higher bits), so we process from the top end. | ||
311 | */ | ||
312 | y_map = y_map << (sizeof(y_map) * BITS_PER_BYTE - ALPS_BITMAP_Y_BITS); | ||
313 | prev_bit = 0; | ||
314 | point = &y_low; | ||
315 | for (i = 0; y_map != 0; i++, y_map <<= 1) { | ||
316 | bit = y_map & (1 << (sizeof(y_map) * BITS_PER_BYTE - 1)); | ||
317 | if (bit) { | ||
318 | if (!prev_bit) { | ||
319 | point->start_bit = i; | ||
320 | fingers_y++; | ||
321 | } | ||
322 | point->num_bits++; | ||
323 | } else { | ||
324 | if (prev_bit) | ||
325 | point = &y_high; | ||
326 | else | ||
327 | point->num_bits = 0; | ||
328 | } | ||
329 | prev_bit = bit; | ||
330 | } | ||
331 | |||
332 | /* | ||
333 | * Fingers can overlap, so we use the maximum count of fingers | ||
334 | * on either axis as the finger count. | ||
335 | */ | ||
336 | fingers = max(fingers_x, fingers_y); | ||
337 | |||
338 | /* | ||
339 | * If total fingers is > 1 but either axis reports only a single | ||
340 | * contact, we have overlapping or adjacent fingers. For the | ||
341 | * purposes of creating a bounding box, divide the single contact | ||
342 | * (roughly) equally between the two points. | ||
343 | */ | ||
344 | if (fingers > 1) { | ||
345 | if (fingers_x == 1) { | ||
346 | i = x_low.num_bits / 2; | ||
347 | x_low.num_bits = x_low.num_bits - i; | ||
348 | x_high.start_bit = x_low.start_bit + i; | ||
349 | x_high.num_bits = max(i, 1); | ||
350 | } else if (fingers_y == 1) { | ||
351 | i = y_low.num_bits / 2; | ||
352 | y_low.num_bits = y_low.num_bits - i; | ||
353 | y_high.start_bit = y_low.start_bit + i; | ||
354 | y_high.num_bits = max(i, 1); | ||
355 | } | ||
356 | } | ||
357 | |||
358 | *x1 = (ALPS_V3_X_MAX * (2 * x_low.start_bit + x_low.num_bits - 1)) / | ||
359 | (2 * (ALPS_BITMAP_X_BITS - 1)); | ||
360 | *y1 = (ALPS_V3_Y_MAX * (2 * y_low.start_bit + y_low.num_bits - 1)) / | ||
361 | (2 * (ALPS_BITMAP_Y_BITS - 1)); | ||
362 | |||
363 | if (fingers > 1) { | ||
364 | *x2 = (ALPS_V3_X_MAX * (2 * x_high.start_bit + x_high.num_bits - 1)) / | ||
365 | (2 * (ALPS_BITMAP_X_BITS - 1)); | ||
366 | *y2 = (ALPS_V3_Y_MAX * (2 * y_high.start_bit + y_high.num_bits - 1)) / | ||
367 | (2 * (ALPS_BITMAP_Y_BITS - 1)); | ||
368 | } | ||
369 | |||
370 | return fingers; | ||
371 | } | ||
372 | |||
373 | static void alps_set_slot(struct input_dev *dev, int slot, bool active, | ||
374 | int x, int y) | ||
375 | { | ||
376 | input_mt_slot(dev, slot); | ||
377 | input_mt_report_slot_state(dev, MT_TOOL_FINGER, active); | ||
378 | if (active) { | ||
379 | input_report_abs(dev, ABS_MT_POSITION_X, x); | ||
380 | input_report_abs(dev, ABS_MT_POSITION_Y, y); | ||
381 | } | ||
382 | } | ||
383 | |||
384 | static void alps_report_semi_mt_data(struct input_dev *dev, int num_fingers, | ||
385 | int x1, int y1, int x2, int y2) | ||
386 | { | ||
387 | alps_set_slot(dev, 0, num_fingers != 0, x1, y1); | ||
388 | alps_set_slot(dev, 1, num_fingers == 2, x2, y2); | ||
389 | } | ||
390 | |||
391 | static void alps_process_trackstick_packet_v3(struct psmouse *psmouse) | ||
392 | { | ||
393 | struct alps_data *priv = psmouse->private; | ||
394 | unsigned char *packet = psmouse->packet; | ||
395 | struct input_dev *dev = priv->dev2; | ||
396 | int x, y, z, left, right, middle; | ||
397 | |||
398 | /* Sanity check packet */ | ||
399 | if (!(packet[0] & 0x40)) { | ||
400 | psmouse_dbg(psmouse, "Bad trackstick packet, discarding\n"); | ||
401 | return; | ||
402 | } | ||
403 | |||
404 | /* | ||
405 | * There's a special packet that seems to indicate the end | ||
406 | * of a stream of trackstick data. Filter these out. | ||
407 | */ | ||
408 | if (packet[1] == 0x7f && packet[2] == 0x7f && packet[4] == 0x7f) | ||
409 | return; | ||
410 | |||
411 | x = (s8)(((packet[0] & 0x20) << 2) | (packet[1] & 0x7f)); | ||
412 | y = (s8)(((packet[0] & 0x10) << 3) | (packet[2] & 0x7f)); | ||
413 | z = (packet[4] & 0x7c) >> 2; | ||
414 | |||
415 | /* | ||
416 | * The x and y values tend to be quite large, and when used | ||
417 | * alone the trackstick is difficult to use. Scale them down | ||
418 | * to compensate. | ||
419 | */ | ||
420 | x /= 8; | ||
421 | y /= 8; | ||
422 | |||
423 | input_report_rel(dev, REL_X, x); | ||
424 | input_report_rel(dev, REL_Y, -y); | ||
425 | |||
426 | /* | ||
427 | * Most ALPS models report the trackstick buttons in the touchpad | ||
428 | * packets, but a few report them here. No reliable way has been | ||
429 | * found to differentiate between the models upfront, so we enable | ||
430 | * the quirk in response to seeing a button press in the trackstick | ||
431 | * packet. | ||
432 | */ | ||
433 | left = packet[3] & 0x01; | ||
434 | right = packet[3] & 0x02; | ||
435 | middle = packet[3] & 0x04; | ||
436 | |||
437 | if (!(priv->quirks & ALPS_QUIRK_TRACKSTICK_BUTTONS) && | ||
438 | (left || right || middle)) | ||
439 | priv->quirks |= ALPS_QUIRK_TRACKSTICK_BUTTONS; | ||
440 | |||
441 | if (priv->quirks & ALPS_QUIRK_TRACKSTICK_BUTTONS) { | ||
442 | input_report_key(dev, BTN_LEFT, left); | ||
443 | input_report_key(dev, BTN_RIGHT, right); | ||
444 | input_report_key(dev, BTN_MIDDLE, middle); | ||
445 | } | ||
446 | |||
447 | input_sync(dev); | ||
448 | return; | ||
449 | } | ||
450 | |||
451 | static void alps_process_touchpad_packet_v3(struct psmouse *psmouse) | ||
452 | { | ||
453 | struct alps_data *priv = psmouse->private; | ||
454 | unsigned char *packet = psmouse->packet; | ||
455 | struct input_dev *dev = psmouse->dev; | ||
456 | struct input_dev *dev2 = priv->dev2; | ||
457 | int x, y, z; | ||
458 | int left, right, middle; | ||
459 | int x1 = 0, y1 = 0, x2 = 0, y2 = 0; | ||
460 | int fingers = 0, bmap_fingers; | ||
461 | unsigned int x_bitmap, y_bitmap; | ||
462 | |||
463 | /* | ||
464 | * There's no single feature of touchpad position and bitmap packets | ||
465 | * that can be used to distinguish between them. We rely on the fact | ||
466 | * that a bitmap packet should always follow a position packet with | ||
467 | * bit 6 of packet[4] set. | ||
468 | */ | ||
469 | if (priv->multi_packet) { | ||
470 | /* | ||
471 | * Sometimes a position packet will indicate a multi-packet | ||
472 | * sequence, but then what follows is another position | ||
473 | * packet. Check for this, and when it happens process the | ||
474 | * position packet as usual. | ||
475 | */ | ||
476 | if (packet[0] & 0x40) { | ||
477 | fingers = (packet[5] & 0x3) + 1; | ||
478 | x_bitmap = ((packet[4] & 0x7e) << 8) | | ||
479 | ((packet[1] & 0x7f) << 2) | | ||
480 | ((packet[0] & 0x30) >> 4); | ||
481 | y_bitmap = ((packet[3] & 0x70) << 4) | | ||
482 | ((packet[2] & 0x7f) << 1) | | ||
483 | (packet[4] & 0x01); | ||
484 | |||
485 | bmap_fingers = alps_process_bitmap(x_bitmap, y_bitmap, | ||
486 | &x1, &y1, &x2, &y2); | ||
487 | |||
488 | /* | ||
489 | * We shouldn't report more than one finger if | ||
490 | * we don't have two coordinates. | ||
491 | */ | ||
492 | if (fingers > 1 && bmap_fingers < 2) | ||
493 | fingers = bmap_fingers; | ||
494 | |||
495 | /* Now process position packet */ | ||
496 | packet = priv->multi_data; | ||
497 | } else { | ||
498 | priv->multi_packet = 0; | ||
499 | } | ||
500 | } | ||
501 | |||
502 | /* | ||
503 | * Bit 6 of byte 0 is not usually set in position packets. The only | ||
504 | * times it seems to be set is in situations where the data is | ||
505 | * suspect anyway, e.g. a palm resting flat on the touchpad. Given | ||
506 | * this combined with the fact that this bit is useful for filtering | ||
507 | * out misidentified bitmap packets, we reject anything with this | ||
508 | * bit set. | ||
509 | */ | ||
510 | if (packet[0] & 0x40) | ||
511 | return; | ||
512 | |||
513 | if (!priv->multi_packet && (packet[4] & 0x40)) { | ||
514 | priv->multi_packet = 1; | ||
515 | memcpy(priv->multi_data, packet, sizeof(priv->multi_data)); | ||
516 | return; | ||
517 | } | ||
518 | |||
519 | priv->multi_packet = 0; | ||
520 | |||
521 | left = packet[3] & 0x01; | ||
522 | right = packet[3] & 0x02; | ||
523 | middle = packet[3] & 0x04; | ||
524 | |||
525 | x = ((packet[1] & 0x7f) << 4) | ((packet[4] & 0x30) >> 2) | | ||
526 | ((packet[0] & 0x30) >> 4); | ||
527 | y = ((packet[2] & 0x7f) << 4) | (packet[4] & 0x0f); | ||
528 | z = packet[5] & 0x7f; | ||
529 | |||
530 | /* | ||
531 | * Sometimes the hardware sends a single packet with z = 0 | ||
532 | * in the middle of a stream. Real releases generate packets | ||
533 | * with x, y, and z all zero, so these seem to be flukes. | ||
534 | * Ignore them. | ||
535 | */ | ||
536 | if (x && y && !z) | ||
537 | return; | ||
538 | |||
539 | /* | ||
540 | * If we don't have MT data or the bitmaps were empty, we have | ||
541 | * to rely on ST data. | ||
542 | */ | ||
543 | if (!fingers) { | ||
544 | x1 = x; | ||
545 | y1 = y; | ||
546 | fingers = z > 0 ? 1 : 0; | ||
547 | } | ||
548 | |||
549 | if (z >= 64) | ||
550 | input_report_key(dev, BTN_TOUCH, 1); | ||
551 | else | ||
552 | input_report_key(dev, BTN_TOUCH, 0); | ||
553 | |||
554 | alps_report_semi_mt_data(dev, fingers, x1, y1, x2, y2); | ||
555 | |||
556 | input_report_key(dev, BTN_TOOL_FINGER, fingers == 1); | ||
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 | |||
561 | input_report_key(dev, BTN_LEFT, left); | ||
562 | input_report_key(dev, BTN_RIGHT, right); | ||
563 | input_report_key(dev, BTN_MIDDLE, middle); | ||
564 | |||
565 | if (z > 0) { | ||
566 | input_report_abs(dev, ABS_X, x); | ||
567 | input_report_abs(dev, ABS_Y, y); | ||
568 | } | ||
569 | input_report_abs(dev, ABS_PRESSURE, z); | ||
570 | |||
571 | input_sync(dev); | ||
572 | |||
573 | if (!(priv->quirks & ALPS_QUIRK_TRACKSTICK_BUTTONS)) { | ||
574 | left = packet[3] & 0x10; | ||
575 | right = packet[3] & 0x20; | ||
576 | middle = packet[3] & 0x40; | ||
577 | |||
578 | input_report_key(dev2, BTN_LEFT, left); | ||
579 | input_report_key(dev2, BTN_RIGHT, right); | ||
580 | input_report_key(dev2, BTN_MIDDLE, middle); | ||
581 | input_sync(dev2); | ||
582 | } | ||
583 | } | ||
584 | |||
585 | static void alps_process_packet_v3(struct psmouse *psmouse) | ||
586 | { | ||
587 | unsigned char *packet = psmouse->packet; | ||
588 | |||
589 | /* | ||
590 | * v3 protocol packets come in three types, two representing | ||
591 | * touchpad data and one representing trackstick data. | ||
592 | * Trackstick packets seem to be distinguished by always | ||
593 | * having 0x3f in the last byte. This value has never been | ||
594 | * observed in the last byte of either of the other types | ||
595 | * of packets. | ||
596 | */ | ||
597 | if (packet[5] == 0x3f) { | ||
598 | alps_process_trackstick_packet_v3(psmouse); | ||
599 | return; | ||
600 | } | ||
601 | |||
602 | alps_process_touchpad_packet_v3(psmouse); | ||
603 | } | ||
604 | |||
605 | static void alps_process_packet_v4(struct psmouse *psmouse) | ||
606 | { | ||
607 | unsigned char *packet = psmouse->packet; | ||
608 | struct input_dev *dev = psmouse->dev; | ||
609 | int x, y, z; | ||
610 | int left, right; | ||
611 | |||
612 | left = packet[4] & 0x01; | ||
613 | right = packet[4] & 0x02; | ||
614 | |||
615 | x = ((packet[1] & 0x7f) << 4) | ((packet[3] & 0x30) >> 2) | | ||
616 | ((packet[0] & 0x30) >> 4); | ||
617 | y = ((packet[2] & 0x7f) << 4) | (packet[3] & 0x0f); | ||
618 | z = packet[5] & 0x7f; | ||
619 | |||
620 | if (z >= 64) | ||
621 | input_report_key(dev, BTN_TOUCH, 1); | ||
622 | else | ||
623 | input_report_key(dev, BTN_TOUCH, 0); | ||
624 | |||
625 | if (z > 0) { | ||
626 | input_report_abs(dev, ABS_X, x); | ||
627 | input_report_abs(dev, ABS_Y, y); | ||
628 | } | ||
629 | input_report_abs(dev, ABS_PRESSURE, z); | ||
630 | |||
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); | ||
636 | } | ||
637 | |||
638 | static void alps_process_packet(struct psmouse *psmouse) | ||
639 | { | ||
640 | struct alps_data *priv = psmouse->private; | ||
641 | const struct alps_model_info *model = priv->i; | ||
642 | |||
643 | switch (model->proto_version) { | ||
644 | case ALPS_PROTO_V1: | ||
645 | case ALPS_PROTO_V2: | ||
646 | alps_process_packet_v1_v2(psmouse); | ||
647 | break; | ||
648 | case ALPS_PROTO_V3: | ||
649 | alps_process_packet_v3(psmouse); | ||
650 | break; | ||
651 | case ALPS_PROTO_V4: | ||
652 | alps_process_packet_v4(psmouse); | ||
653 | break; | ||
654 | } | ||
655 | } | ||
656 | |||
242 | static void alps_report_bare_ps2_packet(struct psmouse *psmouse, | 657 | static void alps_report_bare_ps2_packet(struct psmouse *psmouse, |
243 | unsigned char packet[], | 658 | unsigned char packet[], |
244 | bool report_buttons) | 659 | bool report_buttons) |
@@ -344,7 +759,7 @@ static void alps_flush_packet(unsigned long data) | |||
344 | 759 | ||
345 | serio_pause_rx(psmouse->ps2dev.serio); | 760 | serio_pause_rx(psmouse->ps2dev.serio); |
346 | 761 | ||
347 | if (psmouse->pktcnt == 6) { | 762 | if (psmouse->pktcnt == psmouse->pktsize) { |
348 | 763 | ||
349 | /* | 764 | /* |
350 | * We did not any more data in reasonable amount of time. | 765 | * We did not any more data in reasonable amount of time. |
@@ -395,8 +810,8 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) | |||
395 | return PSMOUSE_BAD_DATA; | 810 | return PSMOUSE_BAD_DATA; |
396 | } | 811 | } |
397 | 812 | ||
398 | /* Bytes 2 - 6 should have 0 in the highest bit */ | 813 | /* Bytes 2 - pktsize should have 0 in the highest bit */ |
399 | if (psmouse->pktcnt >= 2 && psmouse->pktcnt <= 6 && | 814 | if (psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && |
400 | (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { | 815 | (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { |
401 | psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", | 816 | psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", |
402 | psmouse->pktcnt - 1, | 817 | psmouse->pktcnt - 1, |
@@ -404,7 +819,7 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) | |||
404 | return PSMOUSE_BAD_DATA; | 819 | return PSMOUSE_BAD_DATA; |
405 | } | 820 | } |
406 | 821 | ||
407 | if (psmouse->pktcnt == 6) { | 822 | if (psmouse->pktcnt == psmouse->pktsize) { |
408 | alps_process_packet(psmouse); | 823 | alps_process_packet(psmouse); |
409 | return PSMOUSE_FULL_PACKET; | 824 | return PSMOUSE_FULL_PACKET; |
410 | } | 825 | } |
@@ -412,11 +827,127 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) | |||
412 | return PSMOUSE_GOOD_DATA; | 827 | return PSMOUSE_GOOD_DATA; |
413 | } | 828 | } |
414 | 829 | ||
830 | static int alps_command_mode_send_nibble(struct psmouse *psmouse, int nibble) | ||
831 | { | ||
832 | struct ps2dev *ps2dev = &psmouse->ps2dev; | ||
833 | struct alps_data *priv = psmouse->private; | ||
834 | int command; | ||
835 | unsigned char *param; | ||
836 | unsigned char dummy[4]; | ||
837 | |||
838 | BUG_ON(nibble > 0xf); | ||
839 | |||
840 | command = priv->nibble_commands[nibble].command; | ||
841 | param = (command & 0x0f00) ? | ||
842 | dummy : (unsigned char *)&priv->nibble_commands[nibble].data; | ||
843 | |||
844 | if (ps2_command(ps2dev, param, command)) | ||
845 | return -1; | ||
846 | |||
847 | return 0; | ||
848 | } | ||
849 | |||
850 | static int alps_command_mode_set_addr(struct psmouse *psmouse, int addr) | ||
851 | { | ||
852 | struct ps2dev *ps2dev = &psmouse->ps2dev; | ||
853 | struct alps_data *priv = psmouse->private; | ||
854 | int i, nibble; | ||
855 | |||
856 | if (ps2_command(ps2dev, NULL, priv->addr_command)) | ||
857 | return -1; | ||
858 | |||
859 | for (i = 12; i >= 0; i -= 4) { | ||
860 | nibble = (addr >> i) & 0xf; | ||
861 | if (alps_command_mode_send_nibble(psmouse, nibble)) | ||
862 | return -1; | ||
863 | } | ||
864 | |||
865 | return 0; | ||
866 | } | ||
867 | |||
868 | static int __alps_command_mode_read_reg(struct psmouse *psmouse, int addr) | ||
869 | { | ||
870 | struct ps2dev *ps2dev = &psmouse->ps2dev; | ||
871 | unsigned char param[4]; | ||
872 | |||
873 | if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) | ||
874 | return -1; | ||
875 | |||
876 | /* | ||
877 | * The address being read is returned in the first two bytes | ||
878 | * of the result. Check that this address matches the expected | ||
879 | * address. | ||
880 | */ | ||
881 | if (addr != ((param[0] << 8) | param[1])) | ||
882 | return -1; | ||
883 | |||
884 | return param[2]; | ||
885 | } | ||
886 | |||
887 | static int alps_command_mode_read_reg(struct psmouse *psmouse, int addr) | ||
888 | { | ||
889 | if (alps_command_mode_set_addr(psmouse, addr)) | ||
890 | return -1; | ||
891 | return __alps_command_mode_read_reg(psmouse, addr); | ||
892 | } | ||
893 | |||
894 | static int __alps_command_mode_write_reg(struct psmouse *psmouse, u8 value) | ||
895 | { | ||
896 | if (alps_command_mode_send_nibble(psmouse, (value >> 4) & 0xf)) | ||
897 | return -1; | ||
898 | if (alps_command_mode_send_nibble(psmouse, value & 0xf)) | ||
899 | return -1; | ||
900 | return 0; | ||
901 | } | ||
902 | |||
903 | static int alps_command_mode_write_reg(struct psmouse *psmouse, int addr, | ||
904 | u8 value) | ||
905 | { | ||
906 | if (alps_command_mode_set_addr(psmouse, addr)) | ||
907 | return -1; | ||
908 | return __alps_command_mode_write_reg(psmouse, value); | ||
909 | } | ||
910 | |||
911 | static int alps_enter_command_mode(struct psmouse *psmouse, | ||
912 | unsigned char *resp) | ||
913 | { | ||
914 | unsigned char param[4]; | ||
915 | struct ps2dev *ps2dev = &psmouse->ps2dev; | ||
916 | |||
917 | if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_WRAP) || | ||
918 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_WRAP) || | ||
919 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_WRAP) || | ||
920 | ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) { | ||
921 | psmouse_err(psmouse, "failed to enter command mode\n"); | ||
922 | return -1; | ||
923 | } | ||
924 | |||
925 | if (param[0] != 0x88 && param[1] != 0x07) { | ||
926 | psmouse_dbg(psmouse, | ||
927 | "unknown response while entering command mode: %2.2x %2.2x %2.2x\n", | ||
928 | param[0], param[1], param[2]); | ||
929 | return -1; | ||
930 | } | ||
931 | |||
932 | if (resp) | ||
933 | *resp = param[2]; | ||
934 | return 0; | ||
935 | } | ||
936 | |||
937 | static inline int alps_exit_command_mode(struct psmouse *psmouse) | ||
938 | { | ||
939 | struct ps2dev *ps2dev = &psmouse->ps2dev; | ||
940 | if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSTREAM)) | ||
941 | return -1; | ||
942 | return 0; | ||
943 | } | ||
944 | |||
415 | static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int *version) | 945 | static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int *version) |
416 | { | 946 | { |
417 | struct ps2dev *ps2dev = &psmouse->ps2dev; | 947 | struct ps2dev *ps2dev = &psmouse->ps2dev; |
418 | static const unsigned char rates[] = { 0, 10, 20, 40, 60, 80, 100, 200 }; | 948 | static const unsigned char rates[] = { 0, 10, 20, 40, 60, 80, 100, 200 }; |
419 | unsigned char param[4]; | 949 | unsigned char param[4]; |
950 | const struct alps_model_info *model = NULL; | ||
420 | int i; | 951 | int i; |
421 | 952 | ||
422 | /* | 953 | /* |
@@ -464,12 +995,41 @@ static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int | |||
464 | *version = (param[0] << 8) | (param[1] << 4) | i; | 995 | *version = (param[0] << 8) | (param[1] << 4) | i; |
465 | } | 996 | } |
466 | 997 | ||
467 | for (i = 0; i < ARRAY_SIZE(alps_model_data); i++) | 998 | for (i = 0; i < ARRAY_SIZE(alps_model_data); i++) { |
468 | if (!memcmp(param, alps_model_data[i].signature, | 999 | if (!memcmp(param, alps_model_data[i].signature, |
469 | sizeof(alps_model_data[i].signature))) | 1000 | sizeof(alps_model_data[i].signature))) { |
470 | return alps_model_data + i; | 1001 | model = alps_model_data + i; |
1002 | break; | ||
1003 | } | ||
1004 | } | ||
471 | 1005 | ||
472 | return NULL; | 1006 | if (model && model->proto_version > ALPS_PROTO_V2) { |
1007 | /* | ||
1008 | * Need to check command mode response to identify | ||
1009 | * model | ||
1010 | */ | ||
1011 | model = NULL; | ||
1012 | if (alps_enter_command_mode(psmouse, param)) { | ||
1013 | psmouse_warn(psmouse, | ||
1014 | "touchpad failed to enter command mode\n"); | ||
1015 | } else { | ||
1016 | for (i = 0; i < ARRAY_SIZE(alps_model_data); i++) { | ||
1017 | if (alps_model_data[i].proto_version > ALPS_PROTO_V2 && | ||
1018 | alps_model_data[i].command_mode_resp == param[0]) { | ||
1019 | model = alps_model_data + i; | ||
1020 | break; | ||
1021 | } | ||
1022 | } | ||
1023 | alps_exit_command_mode(psmouse); | ||
1024 | |||
1025 | if (!model) | ||
1026 | psmouse_dbg(psmouse, | ||
1027 | "Unknown command mode response %2.2x\n", | ||
1028 | param[0]); | ||
1029 | } | ||
1030 | } | ||
1031 | |||
1032 | return model; | ||
473 | } | 1033 | } |
474 | 1034 | ||
475 | /* | 1035 | /* |
@@ -477,7 +1037,7 @@ static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int | |||
477 | * subsequent commands. It looks like glidepad is behind stickpointer, | 1037 | * subsequent commands. It looks like glidepad is behind stickpointer, |
478 | * I'd thought it would be other way around... | 1038 | * I'd thought it would be other way around... |
479 | */ | 1039 | */ |
480 | static int alps_passthrough_mode(struct psmouse *psmouse, bool enable) | 1040 | static int alps_passthrough_mode_v2(struct psmouse *psmouse, bool enable) |
481 | { | 1041 | { |
482 | struct ps2dev *ps2dev = &psmouse->ps2dev; | 1042 | struct ps2dev *ps2dev = &psmouse->ps2dev; |
483 | int cmd = enable ? PSMOUSE_CMD_SETSCALE21 : PSMOUSE_CMD_SETSCALE11; | 1043 | int cmd = enable ? PSMOUSE_CMD_SETSCALE21 : PSMOUSE_CMD_SETSCALE11; |
@@ -494,7 +1054,7 @@ static int alps_passthrough_mode(struct psmouse *psmouse, bool enable) | |||
494 | return 0; | 1054 | return 0; |
495 | } | 1055 | } |
496 | 1056 | ||
497 | static int alps_absolute_mode(struct psmouse *psmouse) | 1057 | static int alps_absolute_mode_v1_v2(struct psmouse *psmouse) |
498 | { | 1058 | { |
499 | struct ps2dev *ps2dev = &psmouse->ps2dev; | 1059 | struct ps2dev *ps2dev = &psmouse->ps2dev; |
500 | 1060 | ||
@@ -565,17 +1125,17 @@ static int alps_tap_mode(struct psmouse *psmouse, int enable) | |||
565 | static int alps_poll(struct psmouse *psmouse) | 1125 | static int alps_poll(struct psmouse *psmouse) |
566 | { | 1126 | { |
567 | struct alps_data *priv = psmouse->private; | 1127 | struct alps_data *priv = psmouse->private; |
568 | unsigned char buf[6]; | 1128 | unsigned char buf[sizeof(psmouse->packet)]; |
569 | bool poll_failed; | 1129 | bool poll_failed; |
570 | 1130 | ||
571 | if (priv->i->flags & ALPS_PASS) | 1131 | if (priv->i->flags & ALPS_PASS) |
572 | alps_passthrough_mode(psmouse, true); | 1132 | alps_passthrough_mode_v2(psmouse, true); |
573 | 1133 | ||
574 | poll_failed = ps2_command(&psmouse->ps2dev, buf, | 1134 | poll_failed = ps2_command(&psmouse->ps2dev, buf, |
575 | PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)) < 0; | 1135 | PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)) < 0; |
576 | 1136 | ||
577 | if (priv->i->flags & ALPS_PASS) | 1137 | if (priv->i->flags & ALPS_PASS) |
578 | alps_passthrough_mode(psmouse, false); | 1138 | alps_passthrough_mode_v2(psmouse, false); |
579 | 1139 | ||
580 | if (poll_failed || (buf[0] & priv->i->mask0) != priv->i->byte0) | 1140 | if (poll_failed || (buf[0] & priv->i->mask0) != priv->i->byte0) |
581 | return -1; | 1141 | return -1; |
@@ -592,13 +1152,13 @@ static int alps_poll(struct psmouse *psmouse) | |||
592 | return 0; | 1152 | return 0; |
593 | } | 1153 | } |
594 | 1154 | ||
595 | static int alps_hw_init(struct psmouse *psmouse) | 1155 | static int alps_hw_init_v1_v2(struct psmouse *psmouse) |
596 | { | 1156 | { |
597 | struct alps_data *priv = psmouse->private; | 1157 | struct alps_data *priv = psmouse->private; |
598 | const struct alps_model_info *model = priv->i; | 1158 | const struct alps_model_info *model = priv->i; |
599 | 1159 | ||
600 | if ((model->flags & ALPS_PASS) && | 1160 | if ((model->flags & ALPS_PASS) && |
601 | alps_passthrough_mode(psmouse, true)) { | 1161 | alps_passthrough_mode_v2(psmouse, true)) { |
602 | return -1; | 1162 | return -1; |
603 | } | 1163 | } |
604 | 1164 | ||
@@ -607,13 +1167,13 @@ static int alps_hw_init(struct psmouse *psmouse) | |||
607 | return -1; | 1167 | return -1; |
608 | } | 1168 | } |
609 | 1169 | ||
610 | if (alps_absolute_mode(psmouse)) { | 1170 | if (alps_absolute_mode_v1_v2(psmouse)) { |
611 | psmouse_err(psmouse, "Failed to enable absolute mode\n"); | 1171 | psmouse_err(psmouse, "Failed to enable absolute mode\n"); |
612 | return -1; | 1172 | return -1; |
613 | } | 1173 | } |
614 | 1174 | ||
615 | if ((model->flags & ALPS_PASS) && | 1175 | if ((model->flags & ALPS_PASS) && |
616 | alps_passthrough_mode(psmouse, false)) { | 1176 | alps_passthrough_mode_v2(psmouse, false)) { |
617 | return -1; | 1177 | return -1; |
618 | } | 1178 | } |
619 | 1179 | ||
@@ -626,6 +1186,297 @@ static int alps_hw_init(struct psmouse *psmouse) | |||
626 | return 0; | 1186 | return 0; |
627 | } | 1187 | } |
628 | 1188 | ||
1189 | /* | ||
1190 | * Enable or disable passthrough mode to the trackstick. Must be in | ||
1191 | * command mode when calling this function. | ||
1192 | */ | ||
1193 | static int alps_passthrough_mode_v3(struct psmouse *psmouse, bool enable) | ||
1194 | { | ||
1195 | int reg_val; | ||
1196 | |||
1197 | reg_val = alps_command_mode_read_reg(psmouse, 0x0008); | ||
1198 | if (reg_val == -1) | ||
1199 | return -1; | ||
1200 | |||
1201 | if (enable) | ||
1202 | reg_val |= 0x01; | ||
1203 | else | ||
1204 | reg_val &= ~0x01; | ||
1205 | |||
1206 | if (__alps_command_mode_write_reg(psmouse, reg_val)) | ||
1207 | return -1; | ||
1208 | |||
1209 | return 0; | ||
1210 | } | ||
1211 | |||
1212 | /* Must be in command mode when calling this function */ | ||
1213 | static int alps_absolute_mode_v3(struct psmouse *psmouse) | ||
1214 | { | ||
1215 | int reg_val; | ||
1216 | |||
1217 | reg_val = alps_command_mode_read_reg(psmouse, 0x0004); | ||
1218 | if (reg_val == -1) | ||
1219 | return -1; | ||
1220 | |||
1221 | reg_val |= 0x06; | ||
1222 | if (__alps_command_mode_write_reg(psmouse, reg_val)) | ||
1223 | return -1; | ||
1224 | |||
1225 | return 0; | ||
1226 | } | ||
1227 | |||
1228 | static int alps_hw_init_v3(struct psmouse *psmouse) | ||
1229 | { | ||
1230 | struct alps_data *priv = psmouse->private; | ||
1231 | struct ps2dev *ps2dev = &psmouse->ps2dev; | ||
1232 | int reg_val; | ||
1233 | unsigned char param[4]; | ||
1234 | |||
1235 | priv->nibble_commands = alps_v3_nibble_commands; | ||
1236 | priv->addr_command = PSMOUSE_CMD_RESET_WRAP; | ||
1237 | |||
1238 | if (alps_enter_command_mode(psmouse, NULL)) | ||
1239 | goto error; | ||
1240 | |||
1241 | /* Check for trackstick */ | ||
1242 | reg_val = alps_command_mode_read_reg(psmouse, 0x0008); | ||
1243 | if (reg_val == -1) | ||
1244 | goto error; | ||
1245 | if (reg_val & 0x80) { | ||
1246 | if (alps_passthrough_mode_v3(psmouse, true)) | ||
1247 | goto error; | ||
1248 | if (alps_exit_command_mode(psmouse)) | ||
1249 | goto error; | ||
1250 | |||
1251 | /* | ||
1252 | * E7 report for the trackstick | ||
1253 | * | ||
1254 | * There have been reports of failures to seem to trace back | ||
1255 | * to the above trackstick check failing. When these occur | ||
1256 | * this E7 report fails, so when that happens we continue | ||
1257 | * with the assumption that there isn't a trackstick after | ||
1258 | * all. | ||
1259 | */ | ||
1260 | param[0] = 0x64; | ||
1261 | if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE21) || | ||
1262 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE21) || | ||
1263 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE21) || | ||
1264 | ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) { | ||
1265 | psmouse_warn(psmouse, "trackstick E7 report failed\n"); | ||
1266 | } else { | ||
1267 | psmouse_dbg(psmouse, | ||
1268 | "trackstick E7 report: %2.2x %2.2x %2.2x\n", | ||
1269 | param[0], param[1], param[2]); | ||
1270 | |||
1271 | /* | ||
1272 | * Not sure what this does, but it is absolutely | ||
1273 | * essential. Without it, the touchpad does not | ||
1274 | * work at all and the trackstick just emits normal | ||
1275 | * PS/2 packets. | ||
1276 | */ | ||
1277 | if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || | ||
1278 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || | ||
1279 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || | ||
1280 | alps_command_mode_send_nibble(psmouse, 0x9) || | ||
1281 | alps_command_mode_send_nibble(psmouse, 0x4)) { | ||
1282 | psmouse_err(psmouse, | ||
1283 | "Error sending magic E6 sequence\n"); | ||
1284 | goto error_passthrough; | ||
1285 | } | ||
1286 | } | ||
1287 | |||
1288 | if (alps_enter_command_mode(psmouse, NULL)) | ||
1289 | goto error_passthrough; | ||
1290 | if (alps_passthrough_mode_v3(psmouse, false)) | ||
1291 | goto error; | ||
1292 | } | ||
1293 | |||
1294 | if (alps_absolute_mode_v3(psmouse)) { | ||
1295 | psmouse_err(psmouse, "Failed to enter absolute mode\n"); | ||
1296 | goto error; | ||
1297 | } | ||
1298 | |||
1299 | reg_val = alps_command_mode_read_reg(psmouse, 0x0006); | ||
1300 | if (reg_val == -1) | ||
1301 | goto error; | ||
1302 | if (__alps_command_mode_write_reg(psmouse, reg_val | 0x01)) | ||
1303 | goto error; | ||
1304 | |||
1305 | reg_val = alps_command_mode_read_reg(psmouse, 0x0007); | ||
1306 | if (reg_val == -1) | ||
1307 | goto error; | ||
1308 | if (__alps_command_mode_write_reg(psmouse, reg_val | 0x01)) | ||
1309 | goto error; | ||
1310 | |||
1311 | if (alps_command_mode_read_reg(psmouse, 0x0144) == -1) | ||
1312 | goto error; | ||
1313 | if (__alps_command_mode_write_reg(psmouse, 0x04)) | ||
1314 | goto error; | ||
1315 | |||
1316 | if (alps_command_mode_read_reg(psmouse, 0x0159) == -1) | ||
1317 | goto error; | ||
1318 | if (__alps_command_mode_write_reg(psmouse, 0x03)) | ||
1319 | goto error; | ||
1320 | |||
1321 | if (alps_command_mode_read_reg(psmouse, 0x0163) == -1) | ||
1322 | goto error; | ||
1323 | if (alps_command_mode_write_reg(psmouse, 0x0163, 0x03)) | ||
1324 | goto error; | ||
1325 | |||
1326 | if (alps_command_mode_read_reg(psmouse, 0x0162) == -1) | ||
1327 | goto error; | ||
1328 | if (alps_command_mode_write_reg(psmouse, 0x0162, 0x04)) | ||
1329 | goto error; | ||
1330 | |||
1331 | /* | ||
1332 | * This ensures the trackstick packets are in the format | ||
1333 | * supported by this driver. If bit 1 isn't set the packet | ||
1334 | * format is different. | ||
1335 | */ | ||
1336 | if (alps_command_mode_write_reg(psmouse, 0x0008, 0x82)) | ||
1337 | goto error; | ||
1338 | |||
1339 | alps_exit_command_mode(psmouse); | ||
1340 | |||
1341 | /* Set rate and enable data reporting */ | ||
1342 | param[0] = 0x64; | ||
1343 | if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE) || | ||
1344 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE)) { | ||
1345 | psmouse_err(psmouse, "Failed to enable data reporting\n"); | ||
1346 | return -1; | ||
1347 | } | ||
1348 | |||
1349 | return 0; | ||
1350 | |||
1351 | error_passthrough: | ||
1352 | /* Something failed while in passthrough mode, so try to get out */ | ||
1353 | if (!alps_enter_command_mode(psmouse, NULL)) | ||
1354 | alps_passthrough_mode_v3(psmouse, false); | ||
1355 | error: | ||
1356 | /* | ||
1357 | * Leaving the touchpad in command mode will essentially render | ||
1358 | * it unusable until the machine reboots, so exit it here just | ||
1359 | * to be safe | ||
1360 | */ | ||
1361 | alps_exit_command_mode(psmouse); | ||
1362 | return -1; | ||
1363 | } | ||
1364 | |||
1365 | /* Must be in command mode when calling this function */ | ||
1366 | static int alps_absolute_mode_v4(struct psmouse *psmouse) | ||
1367 | { | ||
1368 | int reg_val; | ||
1369 | |||
1370 | reg_val = alps_command_mode_read_reg(psmouse, 0x0004); | ||
1371 | if (reg_val == -1) | ||
1372 | return -1; | ||
1373 | |||
1374 | reg_val |= 0x02; | ||
1375 | if (__alps_command_mode_write_reg(psmouse, reg_val)) | ||
1376 | return -1; | ||
1377 | |||
1378 | return 0; | ||
1379 | } | ||
1380 | |||
1381 | static int alps_hw_init_v4(struct psmouse *psmouse) | ||
1382 | { | ||
1383 | struct alps_data *priv = psmouse->private; | ||
1384 | struct ps2dev *ps2dev = &psmouse->ps2dev; | ||
1385 | unsigned char param[4]; | ||
1386 | |||
1387 | priv->nibble_commands = alps_v4_nibble_commands; | ||
1388 | priv->addr_command = PSMOUSE_CMD_DISABLE; | ||
1389 | |||
1390 | if (alps_enter_command_mode(psmouse, NULL)) | ||
1391 | goto error; | ||
1392 | |||
1393 | if (alps_absolute_mode_v4(psmouse)) { | ||
1394 | psmouse_err(psmouse, "Failed to enter absolute mode\n"); | ||
1395 | goto error; | ||
1396 | } | ||
1397 | |||
1398 | if (alps_command_mode_write_reg(psmouse, 0x0007, 0x8c)) | ||
1399 | goto error; | ||
1400 | |||
1401 | if (alps_command_mode_write_reg(psmouse, 0x0149, 0x03)) | ||
1402 | goto error; | ||
1403 | |||
1404 | if (alps_command_mode_write_reg(psmouse, 0x0160, 0x03)) | ||
1405 | goto error; | ||
1406 | |||
1407 | if (alps_command_mode_write_reg(psmouse, 0x017f, 0x15)) | ||
1408 | goto error; | ||
1409 | |||
1410 | if (alps_command_mode_write_reg(psmouse, 0x0151, 0x01)) | ||
1411 | goto error; | ||
1412 | |||
1413 | if (alps_command_mode_write_reg(psmouse, 0x0168, 0x03)) | ||
1414 | goto error; | ||
1415 | |||
1416 | if (alps_command_mode_write_reg(psmouse, 0x014a, 0x03)) | ||
1417 | goto error; | ||
1418 | |||
1419 | if (alps_command_mode_write_reg(psmouse, 0x0161, 0x03)) | ||
1420 | goto error; | ||
1421 | |||
1422 | alps_exit_command_mode(psmouse); | ||
1423 | |||
1424 | /* | ||
1425 | * This sequence changes the output from a 9-byte to an | ||
1426 | * 8-byte format. All the same data seems to be present, | ||
1427 | * just in a more compact format. | ||
1428 | */ | ||
1429 | param[0] = 0xc8; | ||
1430 | param[1] = 0x64; | ||
1431 | param[2] = 0x50; | ||
1432 | if (ps2_command(ps2dev, ¶m[0], PSMOUSE_CMD_SETRATE) || | ||
1433 | ps2_command(ps2dev, ¶m[1], PSMOUSE_CMD_SETRATE) || | ||
1434 | ps2_command(ps2dev, ¶m[2], PSMOUSE_CMD_SETRATE) || | ||
1435 | ps2_command(ps2dev, param, PSMOUSE_CMD_GETID)) | ||
1436 | return -1; | ||
1437 | |||
1438 | /* Set rate and enable data reporting */ | ||
1439 | param[0] = 0x64; | ||
1440 | if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE) || | ||
1441 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE)) { | ||
1442 | psmouse_err(psmouse, "Failed to enable data reporting\n"); | ||
1443 | return -1; | ||
1444 | } | ||
1445 | |||
1446 | return 0; | ||
1447 | |||
1448 | error: | ||
1449 | /* | ||
1450 | * Leaving the touchpad in command mode will essentially render | ||
1451 | * it unusable until the machine reboots, so exit it here just | ||
1452 | * to be safe | ||
1453 | */ | ||
1454 | alps_exit_command_mode(psmouse); | ||
1455 | return -1; | ||
1456 | } | ||
1457 | |||
1458 | static int alps_hw_init(struct psmouse *psmouse) | ||
1459 | { | ||
1460 | struct alps_data *priv = psmouse->private; | ||
1461 | const struct alps_model_info *model = priv->i; | ||
1462 | int ret = -1; | ||
1463 | |||
1464 | switch (model->proto_version) { | ||
1465 | case ALPS_PROTO_V1: | ||
1466 | case ALPS_PROTO_V2: | ||
1467 | ret = alps_hw_init_v1_v2(psmouse); | ||
1468 | break; | ||
1469 | case ALPS_PROTO_V3: | ||
1470 | ret = alps_hw_init_v3(psmouse); | ||
1471 | break; | ||
1472 | case ALPS_PROTO_V4: | ||
1473 | ret = alps_hw_init_v4(psmouse); | ||
1474 | break; | ||
1475 | } | ||
1476 | |||
1477 | return ret; | ||
1478 | } | ||
1479 | |||
629 | static int alps_reconnect(struct psmouse *psmouse) | 1480 | static int alps_reconnect(struct psmouse *psmouse) |
630 | { | 1481 | { |
631 | const struct alps_model_info *model; | 1482 | const struct alps_model_info *model; |
@@ -666,6 +1517,8 @@ int alps_init(struct psmouse *psmouse) | |||
666 | 1517 | ||
667 | psmouse->private = priv; | 1518 | psmouse->private = priv; |
668 | 1519 | ||
1520 | psmouse_reset(psmouse); | ||
1521 | |||
669 | model = alps_get_model(psmouse, &version); | 1522 | model = alps_get_model(psmouse, &version); |
670 | if (!model) | 1523 | if (!model) |
671 | goto init_fail; | 1524 | goto init_fail; |
@@ -693,8 +1546,29 @@ int alps_init(struct psmouse *psmouse) | |||
693 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT); | 1546 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT); |
694 | 1547 | ||
695 | dev1->evbit[BIT_WORD(EV_ABS)] |= BIT_MASK(EV_ABS); | 1548 | dev1->evbit[BIT_WORD(EV_ABS)] |= BIT_MASK(EV_ABS); |
696 | input_set_abs_params(dev1, ABS_X, 0, 1023, 0, 0); | 1549 | |
697 | input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0); | 1550 | switch (model->proto_version) { |
1551 | case ALPS_PROTO_V1: | ||
1552 | case ALPS_PROTO_V2: | ||
1553 | input_set_abs_params(dev1, ABS_X, 0, 1023, 0, 0); | ||
1554 | input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0); | ||
1555 | break; | ||
1556 | case ALPS_PROTO_V3: | ||
1557 | set_bit(INPUT_PROP_SEMI_MT, dev1->propbit); | ||
1558 | input_mt_init_slots(dev1, 2); | ||
1559 | input_set_abs_params(dev1, ABS_MT_POSITION_X, 0, ALPS_V3_X_MAX, 0, 0); | ||
1560 | input_set_abs_params(dev1, ABS_MT_POSITION_Y, 0, ALPS_V3_Y_MAX, 0, 0); | ||
1561 | |||
1562 | set_bit(BTN_TOOL_DOUBLETAP, dev1->keybit); | ||
1563 | set_bit(BTN_TOOL_TRIPLETAP, dev1->keybit); | ||
1564 | set_bit(BTN_TOOL_QUADTAP, dev1->keybit); | ||
1565 | /* fall through */ | ||
1566 | case ALPS_PROTO_V4: | ||
1567 | input_set_abs_params(dev1, ABS_X, 0, ALPS_V3_X_MAX, 0, 0); | ||
1568 | input_set_abs_params(dev1, ABS_Y, 0, ALPS_V3_Y_MAX, 0, 0); | ||
1569 | break; | ||
1570 | } | ||
1571 | |||
698 | input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0); | 1572 | input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0); |
699 | 1573 | ||
700 | if (model->flags & ALPS_WHEEL) { | 1574 | if (model->flags & ALPS_WHEEL) { |
@@ -737,7 +1611,7 @@ int alps_init(struct psmouse *psmouse) | |||
737 | psmouse->poll = alps_poll; | 1611 | psmouse->poll = alps_poll; |
738 | psmouse->disconnect = alps_disconnect; | 1612 | psmouse->disconnect = alps_disconnect; |
739 | psmouse->reconnect = alps_reconnect; | 1613 | psmouse->reconnect = alps_reconnect; |
740 | psmouse->pktsize = 6; | 1614 | psmouse->pktsize = model->proto_version == ALPS_PROTO_V4 ? 8 : 6; |
741 | 1615 | ||
742 | /* We are having trouble resyncing ALPS touchpads so disable it for now */ | 1616 | /* We are having trouble resyncing ALPS touchpads so disable it for now */ |
743 | psmouse->resync_time = 0; | 1617 | psmouse->resync_time = 0; |
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h index 904ed8b3c8be..a00a4ab92a0f 100644 --- a/drivers/input/mouse/alps.h +++ b/drivers/input/mouse/alps.h | |||
@@ -12,20 +12,39 @@ | |||
12 | #ifndef _ALPS_H | 12 | #ifndef _ALPS_H |
13 | #define _ALPS_H | 13 | #define _ALPS_H |
14 | 14 | ||
15 | #define ALPS_PROTO_V1 0 | ||
16 | #define ALPS_PROTO_V2 1 | ||
17 | #define ALPS_PROTO_V3 2 | ||
18 | #define ALPS_PROTO_V4 3 | ||
19 | |||
15 | struct alps_model_info { | 20 | struct alps_model_info { |
16 | unsigned char signature[3]; | 21 | unsigned char signature[3]; |
22 | unsigned char command_mode_resp; /* v3/v4 only */ | ||
23 | unsigned char proto_version; | ||
17 | unsigned char byte0, mask0; | 24 | unsigned char byte0, mask0; |
18 | unsigned char flags; | 25 | unsigned char flags; |
19 | }; | 26 | }; |
20 | 27 | ||
28 | struct alps_nibble_commands { | ||
29 | int command; | ||
30 | unsigned char data; | ||
31 | }; | ||
32 | |||
21 | struct alps_data { | 33 | struct alps_data { |
22 | struct input_dev *dev2; /* Relative device */ | 34 | struct input_dev *dev2; /* Relative device */ |
23 | char phys[32]; /* Phys */ | 35 | char phys[32]; /* Phys */ |
24 | const struct alps_model_info *i;/* Info */ | 36 | const struct alps_model_info *i;/* Info */ |
37 | const struct alps_nibble_commands *nibble_commands; | ||
38 | int addr_command; /* Command to set register address */ | ||
25 | 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 */ | ||
41 | unsigned char multi_data[6]; /* Saved multi-packet data */ | ||
42 | u8 quirks; | ||
26 | struct timer_list timer; | 43 | struct timer_list timer; |
27 | }; | 44 | }; |
28 | 45 | ||
46 | #define ALPS_QUIRK_TRACKSTICK_BUTTONS 1 /* trakcstick buttons in trackstick packet */ | ||
47 | |||
29 | #ifdef CONFIG_MOUSE_PS2_ALPS | 48 | #ifdef CONFIG_MOUSE_PS2_ALPS |
30 | int alps_detect(struct psmouse *psmouse, bool set_properties); | 49 | int alps_detect(struct psmouse *psmouse, bool set_properties); |
31 | int alps_init(struct psmouse *psmouse); | 50 | int alps_init(struct psmouse *psmouse); |
diff --git a/drivers/input/mouse/amimouse.c b/drivers/input/mouse/amimouse.c index ff5f61a0fd3a..39be7b82c046 100644 --- a/drivers/input/mouse/amimouse.c +++ b/drivers/input/mouse/amimouse.c | |||
@@ -140,25 +140,13 @@ static int __exit amimouse_remove(struct platform_device *pdev) | |||
140 | } | 140 | } |
141 | 141 | ||
142 | static struct platform_driver amimouse_driver = { | 142 | static struct platform_driver amimouse_driver = { |
143 | .probe = amimouse_probe, | ||
143 | .remove = __exit_p(amimouse_remove), | 144 | .remove = __exit_p(amimouse_remove), |
144 | .driver = { | 145 | .driver = { |
145 | .name = "amiga-mouse", | 146 | .name = "amiga-mouse", |
146 | .owner = THIS_MODULE, | 147 | .owner = THIS_MODULE, |
147 | }, | 148 | }, |
148 | }; | 149 | }; |
149 | 150 | module_platform_driver(amimouse_driver); | |
150 | static int __init amimouse_init(void) | ||
151 | { | ||
152 | return platform_driver_probe(&amimouse_driver, amimouse_probe); | ||
153 | } | ||
154 | |||
155 | module_init(amimouse_init); | ||
156 | |||
157 | static void __exit amimouse_exit(void) | ||
158 | { | ||
159 | platform_driver_unregister(&amimouse_driver); | ||
160 | } | ||
161 | |||
162 | module_exit(amimouse_exit); | ||
163 | 151 | ||
164 | MODULE_ALIAS("platform:amiga-mouse"); | 152 | MODULE_ALIAS("platform:amiga-mouse"); |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index e2a9867c19d5..d2c0db159b18 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -43,6 +43,24 @@ static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, | |||
43 | } | 43 | } |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * V3 and later support this fast command | ||
47 | */ | ||
48 | static int elantech_send_cmd(struct psmouse *psmouse, unsigned char c, | ||
49 | unsigned char *param) | ||
50 | { | ||
51 | struct ps2dev *ps2dev = &psmouse->ps2dev; | ||
52 | |||
53 | if (ps2_command(ps2dev, NULL, ETP_PS2_CUSTOM_COMMAND) || | ||
54 | ps2_command(ps2dev, NULL, c) || | ||
55 | ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) { | ||
56 | psmouse_err(psmouse, "%s query 0x%02x failed.\n", __func__, c); | ||
57 | return -1; | ||
58 | } | ||
59 | |||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | /* | ||
46 | * A retrying version of ps2_command | 64 | * A retrying version of ps2_command |
47 | */ | 65 | */ |
48 | static int elantech_ps2_command(struct psmouse *psmouse, | 66 | static int elantech_ps2_command(struct psmouse *psmouse, |
@@ -863,13 +881,13 @@ static int elantech_set_range(struct psmouse *psmouse, | |||
863 | i = (etd->fw_version > 0x020800 && | 881 | i = (etd->fw_version > 0x020800 && |
864 | etd->fw_version < 0x020900) ? 1 : 2; | 882 | etd->fw_version < 0x020900) ? 1 : 2; |
865 | 883 | ||
866 | if (synaptics_send_cmd(psmouse, ETP_FW_ID_QUERY, param)) | 884 | if (etd->send_cmd(psmouse, ETP_FW_ID_QUERY, param)) |
867 | return -1; | 885 | return -1; |
868 | 886 | ||
869 | fixed_dpi = param[1] & 0x10; | 887 | fixed_dpi = param[1] & 0x10; |
870 | 888 | ||
871 | if (((etd->fw_version >> 16) == 0x14) && fixed_dpi) { | 889 | if (((etd->fw_version >> 16) == 0x14) && fixed_dpi) { |
872 | if (synaptics_send_cmd(psmouse, ETP_SAMPLE_QUERY, param)) | 890 | if (etd->send_cmd(psmouse, ETP_SAMPLE_QUERY, param)) |
873 | return -1; | 891 | return -1; |
874 | 892 | ||
875 | *x_max = (etd->capabilities[1] - i) * param[1] / 2; | 893 | *x_max = (etd->capabilities[1] - i) * param[1] / 2; |
@@ -888,7 +906,7 @@ static int elantech_set_range(struct psmouse *psmouse, | |||
888 | break; | 906 | break; |
889 | 907 | ||
890 | case 3: | 908 | case 3: |
891 | if (synaptics_send_cmd(psmouse, ETP_FW_ID_QUERY, param)) | 909 | if (etd->send_cmd(psmouse, ETP_FW_ID_QUERY, param)) |
892 | return -1; | 910 | return -1; |
893 | 911 | ||
894 | *x_max = (0x0f & param[0]) << 8 | param[1]; | 912 | *x_max = (0x0f & param[0]) << 8 | param[1]; |
@@ -896,7 +914,7 @@ static int elantech_set_range(struct psmouse *psmouse, | |||
896 | break; | 914 | break; |
897 | 915 | ||
898 | case 4: | 916 | case 4: |
899 | if (synaptics_send_cmd(psmouse, ETP_FW_ID_QUERY, param)) | 917 | if (etd->send_cmd(psmouse, ETP_FW_ID_QUERY, param)) |
900 | return -1; | 918 | return -1; |
901 | 919 | ||
902 | *x_max = (0x0f & param[0]) << 8 | param[1]; | 920 | *x_max = (0x0f & param[0]) << 8 | param[1]; |
@@ -913,6 +931,30 @@ static int elantech_set_range(struct psmouse *psmouse, | |||
913 | } | 931 | } |
914 | 932 | ||
915 | /* | 933 | /* |
934 | * (value from firmware) * 10 + 790 = dpi | ||
935 | * we also have to convert dpi to dots/mm (*10/254 to avoid floating point) | ||
936 | */ | ||
937 | static unsigned int elantech_convert_res(unsigned int val) | ||
938 | { | ||
939 | return (val * 10 + 790) * 10 / 254; | ||
940 | } | ||
941 | |||
942 | static int elantech_get_resolution_v4(struct psmouse *psmouse, | ||
943 | unsigned int *x_res, | ||
944 | unsigned int *y_res) | ||
945 | { | ||
946 | unsigned char param[3]; | ||
947 | |||
948 | if (elantech_send_cmd(psmouse, ETP_RESOLUTION_QUERY, param)) | ||
949 | return -1; | ||
950 | |||
951 | *x_res = elantech_convert_res(param[1] & 0x0f); | ||
952 | *y_res = elantech_convert_res((param[1] & 0xf0) >> 4); | ||
953 | |||
954 | return 0; | ||
955 | } | ||
956 | |||
957 | /* | ||
916 | * Set the appropriate event bits for the input subsystem | 958 | * Set the appropriate event bits for the input subsystem |
917 | */ | 959 | */ |
918 | static int elantech_set_input_params(struct psmouse *psmouse) | 960 | static int elantech_set_input_params(struct psmouse *psmouse) |
@@ -920,6 +962,7 @@ static int elantech_set_input_params(struct psmouse *psmouse) | |||
920 | struct input_dev *dev = psmouse->dev; | 962 | struct input_dev *dev = psmouse->dev; |
921 | struct elantech_data *etd = psmouse->private; | 963 | struct elantech_data *etd = psmouse->private; |
922 | unsigned int x_min = 0, y_min = 0, x_max = 0, y_max = 0, width = 0; | 964 | unsigned int x_min = 0, y_min = 0, x_max = 0, y_max = 0, width = 0; |
965 | unsigned int x_res = 0, y_res = 0; | ||
923 | 966 | ||
924 | if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width)) | 967 | if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width)) |
925 | return -1; | 968 | return -1; |
@@ -967,10 +1010,20 @@ static int elantech_set_input_params(struct psmouse *psmouse) | |||
967 | break; | 1010 | break; |
968 | 1011 | ||
969 | case 4: | 1012 | case 4: |
1013 | if (elantech_get_resolution_v4(psmouse, &x_res, &y_res)) { | ||
1014 | /* | ||
1015 | * if query failed, print a warning and leave the values | ||
1016 | * zero to resemble synaptics.c behavior. | ||
1017 | */ | ||
1018 | psmouse_warn(psmouse, "couldn't query resolution data.\n"); | ||
1019 | } | ||
1020 | |||
970 | __set_bit(BTN_TOOL_QUADTAP, dev->keybit); | 1021 | __set_bit(BTN_TOOL_QUADTAP, dev->keybit); |
971 | /* For X to recognize me as touchpad. */ | 1022 | /* For X to recognize me as touchpad. */ |
972 | input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0); | 1023 | input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0); |
973 | input_set_abs_params(dev, ABS_Y, y_min, y_max, 0, 0); | 1024 | input_set_abs_params(dev, ABS_Y, y_min, y_max, 0, 0); |
1025 | input_abs_set_res(dev, ABS_X, x_res); | ||
1026 | input_abs_set_res(dev, ABS_Y, y_res); | ||
974 | /* | 1027 | /* |
975 | * range of pressure and width is the same as v2, | 1028 | * range of pressure and width is the same as v2, |
976 | * report ABS_PRESSURE, ABS_TOOL_WIDTH for compatibility. | 1029 | * report ABS_PRESSURE, ABS_TOOL_WIDTH for compatibility. |
@@ -983,6 +1036,8 @@ static int elantech_set_input_params(struct psmouse *psmouse) | |||
983 | input_mt_init_slots(dev, ETP_MAX_FINGERS); | 1036 | input_mt_init_slots(dev, ETP_MAX_FINGERS); |
984 | input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0); | 1037 | input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0); |
985 | input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0); | 1038 | input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0); |
1039 | input_abs_set_res(dev, ABS_MT_POSITION_X, x_res); | ||
1040 | input_abs_set_res(dev, ABS_MT_POSITION_Y, y_res); | ||
986 | input_set_abs_params(dev, ABS_MT_PRESSURE, ETP_PMIN_V2, | 1041 | input_set_abs_params(dev, ABS_MT_PRESSURE, ETP_PMIN_V2, |
987 | ETP_PMAX_V2, 0, 0); | 1042 | ETP_PMAX_V2, 0, 0); |
988 | /* | 1043 | /* |
@@ -1031,16 +1086,13 @@ static ssize_t elantech_set_int_attr(struct psmouse *psmouse, | |||
1031 | struct elantech_data *etd = psmouse->private; | 1086 | struct elantech_data *etd = psmouse->private; |
1032 | struct elantech_attr_data *attr = data; | 1087 | struct elantech_attr_data *attr = data; |
1033 | unsigned char *reg = (unsigned char *) etd + attr->field_offset; | 1088 | unsigned char *reg = (unsigned char *) etd + attr->field_offset; |
1034 | unsigned long value; | 1089 | unsigned char value; |
1035 | int err; | 1090 | int err; |
1036 | 1091 | ||
1037 | err = strict_strtoul(buf, 16, &value); | 1092 | err = kstrtou8(buf, 16, &value); |
1038 | if (err) | 1093 | if (err) |
1039 | return err; | 1094 | return err; |
1040 | 1095 | ||
1041 | if (value > 0xff) | ||
1042 | return -EINVAL; | ||
1043 | |||
1044 | /* Do we need to preserve some bits for version 2 hardware too? */ | 1096 | /* Do we need to preserve some bits for version 2 hardware too? */ |
1045 | if (etd->hw_version == 1) { | 1097 | if (etd->hw_version == 1) { |
1046 | if (attr->reg == 0x10) | 1098 | if (attr->reg == 0x10) |
@@ -1233,9 +1285,11 @@ static int elantech_set_properties(struct elantech_data *etd) | |||
1233 | } | 1285 | } |
1234 | } | 1286 | } |
1235 | 1287 | ||
1236 | /* | 1288 | /* decide which send_cmd we're gonna use early */ |
1237 | * Turn on packet checking by default. | 1289 | etd->send_cmd = etd->hw_version >= 3 ? elantech_send_cmd : |
1238 | */ | 1290 | synaptics_send_cmd; |
1291 | |||
1292 | /* Turn on packet checking by default */ | ||
1239 | etd->paritycheck = 1; | 1293 | etd->paritycheck = 1; |
1240 | 1294 | ||
1241 | /* | 1295 | /* |
@@ -1291,7 +1345,7 @@ int elantech_init(struct psmouse *psmouse) | |||
1291 | "assuming hardware version %d (with firmware version 0x%02x%02x%02x)\n", | 1345 | "assuming hardware version %d (with firmware version 0x%02x%02x%02x)\n", |
1292 | etd->hw_version, param[0], param[1], param[2]); | 1346 | etd->hw_version, param[0], param[1], param[2]); |
1293 | 1347 | ||
1294 | if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY, | 1348 | if (etd->send_cmd(psmouse, ETP_CAPABILITIES_QUERY, |
1295 | etd->capabilities)) { | 1349 | etd->capabilities)) { |
1296 | psmouse_err(psmouse, "failed to query capabilities.\n"); | 1350 | psmouse_err(psmouse, "failed to query capabilities.\n"); |
1297 | goto init_fail; | 1351 | goto init_fail; |
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index 9e5f1aabea7e..46db3be45ac9 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #define ETP_FW_VERSION_QUERY 0x01 | 20 | #define ETP_FW_VERSION_QUERY 0x01 |
21 | #define ETP_CAPABILITIES_QUERY 0x02 | 21 | #define ETP_CAPABILITIES_QUERY 0x02 |
22 | #define ETP_SAMPLE_QUERY 0x03 | 22 | #define ETP_SAMPLE_QUERY 0x03 |
23 | #define ETP_RESOLUTION_QUERY 0x04 | ||
23 | 24 | ||
24 | /* | 25 | /* |
25 | * Command values for register reading or writing | 26 | * Command values for register reading or writing |
@@ -135,6 +136,7 @@ struct elantech_data { | |||
135 | unsigned int width; | 136 | unsigned int width; |
136 | struct finger_pos mt[ETP_MAX_FINGERS]; | 137 | struct finger_pos mt[ETP_MAX_FINGERS]; |
137 | unsigned char parity[256]; | 138 | unsigned char parity[256]; |
139 | int (*send_cmd)(struct psmouse *psmouse, unsigned char c, unsigned char *param); | ||
138 | }; | 140 | }; |
139 | 141 | ||
140 | #ifdef CONFIG_MOUSE_PS2_ELANTECH | 142 | #ifdef CONFIG_MOUSE_PS2_ELANTECH |
diff --git a/drivers/input/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c index 58902fbb9896..a9ad8e1402be 100644 --- a/drivers/input/mouse/gpio_mouse.c +++ b/drivers/input/mouse/gpio_mouse.c | |||
@@ -178,18 +178,7 @@ static struct platform_driver gpio_mouse_device_driver = { | |||
178 | .owner = THIS_MODULE, | 178 | .owner = THIS_MODULE, |
179 | } | 179 | } |
180 | }; | 180 | }; |
181 | 181 | module_platform_driver(gpio_mouse_device_driver); | |
182 | static int __init gpio_mouse_init(void) | ||
183 | { | ||
184 | return platform_driver_register(&gpio_mouse_device_driver); | ||
185 | } | ||
186 | module_init(gpio_mouse_init); | ||
187 | |||
188 | static void __exit gpio_mouse_exit(void) | ||
189 | { | ||
190 | platform_driver_unregister(&gpio_mouse_device_driver); | ||
191 | } | ||
192 | module_exit(gpio_mouse_exit); | ||
193 | 182 | ||
194 | MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>"); | 183 | MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>"); |
195 | MODULE_DESCRIPTION("GPIO mouse driver"); | 184 | MODULE_DESCRIPTION("GPIO mouse driver"); |
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c index 0470dd46b566..1c5d521de600 100644 --- a/drivers/input/mouse/hgpk.c +++ b/drivers/input/mouse/hgpk.c | |||
@@ -789,11 +789,14 @@ static ssize_t hgpk_set_powered(struct psmouse *psmouse, void *data, | |||
789 | const char *buf, size_t count) | 789 | const char *buf, size_t count) |
790 | { | 790 | { |
791 | struct hgpk_data *priv = psmouse->private; | 791 | struct hgpk_data *priv = psmouse->private; |
792 | unsigned long value; | 792 | unsigned int value; |
793 | int err; | 793 | int err; |
794 | 794 | ||
795 | err = strict_strtoul(buf, 10, &value); | 795 | err = kstrtouint(buf, 10, &value); |
796 | if (err || value > 1) | 796 | if (err) |
797 | return err; | ||
798 | |||
799 | if (value > 1) | ||
797 | return -EINVAL; | 800 | return -EINVAL; |
798 | 801 | ||
799 | if (value != priv->powered) { | 802 | if (value != priv->powered) { |
@@ -881,11 +884,14 @@ static ssize_t hgpk_trigger_recal(struct psmouse *psmouse, void *data, | |||
881 | const char *buf, size_t count) | 884 | const char *buf, size_t count) |
882 | { | 885 | { |
883 | struct hgpk_data *priv = psmouse->private; | 886 | struct hgpk_data *priv = psmouse->private; |
884 | unsigned long value; | 887 | unsigned int value; |
885 | int err; | 888 | int err; |
886 | 889 | ||
887 | err = strict_strtoul(buf, 10, &value); | 890 | err = kstrtouint(buf, 10, &value); |
888 | if (err || value != 1) | 891 | if (err) |
892 | return err; | ||
893 | |||
894 | if (value != 1) | ||
889 | return -EINVAL; | 895 | return -EINVAL; |
890 | 896 | ||
891 | /* | 897 | /* |
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c index faac2c3bef74..84de2fc6acc1 100644 --- a/drivers/input/mouse/logips2pp.c +++ b/drivers/input/mouse/logips2pp.c | |||
@@ -155,9 +155,14 @@ static ssize_t ps2pp_attr_show_smartscroll(struct psmouse *psmouse, | |||
155 | static ssize_t ps2pp_attr_set_smartscroll(struct psmouse *psmouse, void *data, | 155 | static ssize_t ps2pp_attr_set_smartscroll(struct psmouse *psmouse, void *data, |
156 | const char *buf, size_t count) | 156 | const char *buf, size_t count) |
157 | { | 157 | { |
158 | unsigned long value; | 158 | unsigned int value; |
159 | int err; | ||
159 | 160 | ||
160 | if (strict_strtoul(buf, 10, &value) || value > 1) | 161 | err = kstrtouint(buf, 10, &value); |
162 | if (err) | ||
163 | return err; | ||
164 | |||
165 | if (value > 1) | ||
161 | return -EINVAL; | 166 | return -EINVAL; |
162 | 167 | ||
163 | ps2pp_set_smartscroll(psmouse, value); | 168 | ps2pp_set_smartscroll(psmouse, value); |
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 9f352fbd7b4f..de7e8bc17b1f 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -127,7 +127,7 @@ struct psmouse_protocol { | |||
127 | * relevant events to the input module once full packet has arrived. | 127 | * relevant events to the input module once full packet has arrived. |
128 | */ | 128 | */ |
129 | 129 | ||
130 | static psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse) | 130 | psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse) |
131 | { | 131 | { |
132 | struct input_dev *dev = psmouse->dev; | 132 | struct input_dev *dev = psmouse->dev; |
133 | unsigned char *packet = psmouse->packet; | 133 | unsigned char *packet = psmouse->packet; |
@@ -418,6 +418,49 @@ int psmouse_reset(struct psmouse *psmouse) | |||
418 | return 0; | 418 | return 0; |
419 | } | 419 | } |
420 | 420 | ||
421 | /* | ||
422 | * Here we set the mouse resolution. | ||
423 | */ | ||
424 | |||
425 | void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution) | ||
426 | { | ||
427 | static const unsigned char params[] = { 0, 1, 2, 2, 3 }; | ||
428 | unsigned char p; | ||
429 | |||
430 | if (resolution == 0 || resolution > 200) | ||
431 | resolution = 200; | ||
432 | |||
433 | p = params[resolution / 50]; | ||
434 | ps2_command(&psmouse->ps2dev, &p, PSMOUSE_CMD_SETRES); | ||
435 | psmouse->resolution = 25 << p; | ||
436 | } | ||
437 | |||
438 | /* | ||
439 | * Here we set the mouse report rate. | ||
440 | */ | ||
441 | |||
442 | static void psmouse_set_rate(struct psmouse *psmouse, unsigned int rate) | ||
443 | { | ||
444 | static const unsigned char rates[] = { 200, 100, 80, 60, 40, 20, 10, 0 }; | ||
445 | unsigned char r; | ||
446 | int i = 0; | ||
447 | |||
448 | while (rates[i] > rate) i++; | ||
449 | r = rates[i]; | ||
450 | ps2_command(&psmouse->ps2dev, &r, PSMOUSE_CMD_SETRATE); | ||
451 | psmouse->rate = r; | ||
452 | } | ||
453 | |||
454 | /* | ||
455 | * psmouse_poll() - default poll handler. Everyone except for ALPS uses it. | ||
456 | */ | ||
457 | |||
458 | static int psmouse_poll(struct psmouse *psmouse) | ||
459 | { | ||
460 | return ps2_command(&psmouse->ps2dev, psmouse->packet, | ||
461 | PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)); | ||
462 | } | ||
463 | |||
421 | 464 | ||
422 | /* | 465 | /* |
423 | * Genius NetMouse magic init. | 466 | * Genius NetMouse magic init. |
@@ -603,6 +646,56 @@ static int cortron_detect(struct psmouse *psmouse, bool set_properties) | |||
603 | } | 646 | } |
604 | 647 | ||
605 | /* | 648 | /* |
649 | * Apply default settings to the psmouse structure. Most of them will | ||
650 | * be overridden by individual protocol initialization routines. | ||
651 | */ | ||
652 | |||
653 | static void psmouse_apply_defaults(struct psmouse *psmouse) | ||
654 | { | ||
655 | struct input_dev *input_dev = psmouse->dev; | ||
656 | |||
657 | memset(input_dev->evbit, 0, sizeof(input_dev->evbit)); | ||
658 | memset(input_dev->keybit, 0, sizeof(input_dev->keybit)); | ||
659 | memset(input_dev->relbit, 0, sizeof(input_dev->relbit)); | ||
660 | memset(input_dev->absbit, 0, sizeof(input_dev->absbit)); | ||
661 | memset(input_dev->mscbit, 0, sizeof(input_dev->mscbit)); | ||
662 | |||
663 | __set_bit(EV_KEY, input_dev->evbit); | ||
664 | __set_bit(EV_REL, input_dev->evbit); | ||
665 | |||
666 | __set_bit(BTN_LEFT, input_dev->keybit); | ||
667 | __set_bit(BTN_RIGHT, input_dev->keybit); | ||
668 | |||
669 | __set_bit(REL_X, input_dev->relbit); | ||
670 | __set_bit(REL_Y, input_dev->relbit); | ||
671 | |||
672 | psmouse->set_rate = psmouse_set_rate; | ||
673 | psmouse->set_resolution = psmouse_set_resolution; | ||
674 | psmouse->poll = psmouse_poll; | ||
675 | psmouse->protocol_handler = psmouse_process_byte; | ||
676 | psmouse->pktsize = 3; | ||
677 | psmouse->reconnect = NULL; | ||
678 | psmouse->disconnect = NULL; | ||
679 | psmouse->cleanup = NULL; | ||
680 | psmouse->pt_activate = NULL; | ||
681 | psmouse->pt_deactivate = NULL; | ||
682 | } | ||
683 | |||
684 | /* | ||
685 | * Apply default settings to the psmouse structure and call specified | ||
686 | * protocol detection or initialization routine. | ||
687 | */ | ||
688 | static int psmouse_do_detect(int (*detect)(struct psmouse *psmouse, | ||
689 | bool set_properties), | ||
690 | struct psmouse *psmouse, bool set_properties) | ||
691 | { | ||
692 | if (set_properties) | ||
693 | psmouse_apply_defaults(psmouse); | ||
694 | |||
695 | return detect(psmouse, set_properties); | ||
696 | } | ||
697 | |||
698 | /* | ||
606 | * psmouse_extensions() probes for any extensions to the basic PS/2 protocol | 699 | * psmouse_extensions() probes for any extensions to the basic PS/2 protocol |
607 | * the mouse may have. | 700 | * the mouse may have. |
608 | */ | 701 | */ |
@@ -616,7 +709,7 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
616 | * We always check for lifebook because it does not disturb mouse | 709 | * We always check for lifebook because it does not disturb mouse |
617 | * (it only checks DMI information). | 710 | * (it only checks DMI information). |
618 | */ | 711 | */ |
619 | if (lifebook_detect(psmouse, set_properties) == 0) { | 712 | if (psmouse_do_detect(lifebook_detect, psmouse, set_properties) == 0) { |
620 | if (max_proto > PSMOUSE_IMEX) { | 713 | if (max_proto > PSMOUSE_IMEX) { |
621 | if (!set_properties || lifebook_init(psmouse) == 0) | 714 | if (!set_properties || lifebook_init(psmouse) == 0) |
622 | return PSMOUSE_LIFEBOOK; | 715 | return PSMOUSE_LIFEBOOK; |
@@ -628,15 +721,18 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
628 | * upsets the thinkingmouse). | 721 | * upsets the thinkingmouse). |
629 | */ | 722 | */ |
630 | 723 | ||
631 | if (max_proto > PSMOUSE_IMEX && thinking_detect(psmouse, set_properties) == 0) | 724 | if (max_proto > PSMOUSE_IMEX && |
725 | psmouse_do_detect(thinking_detect, psmouse, set_properties) == 0) { | ||
632 | return PSMOUSE_THINKPS; | 726 | return PSMOUSE_THINKPS; |
727 | } | ||
633 | 728 | ||
634 | /* | 729 | /* |
635 | * Try Synaptics TouchPad. Note that probing is done even if Synaptics protocol | 730 | * Try Synaptics TouchPad. Note that probing is done even if Synaptics protocol |
636 | * support is disabled in config - we need to know if it is synaptics so we | 731 | * support is disabled in config - we need to know if it is synaptics so we |
637 | * can reset it properly after probing for intellimouse. | 732 | * can reset it properly after probing for intellimouse. |
638 | */ | 733 | */ |
639 | if (max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse, set_properties) == 0) { | 734 | if (max_proto > PSMOUSE_PS2 && |
735 | psmouse_do_detect(synaptics_detect, psmouse, set_properties) == 0) { | ||
640 | synaptics_hardware = true; | 736 | synaptics_hardware = true; |
641 | 737 | ||
642 | if (max_proto > PSMOUSE_IMEX) { | 738 | if (max_proto > PSMOUSE_IMEX) { |
@@ -667,7 +763,8 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
667 | */ | 763 | */ |
668 | if (max_proto > PSMOUSE_IMEX) { | 764 | if (max_proto > PSMOUSE_IMEX) { |
669 | ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS); | 765 | ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS); |
670 | if (alps_detect(psmouse, set_properties) == 0) { | 766 | if (psmouse_do_detect(alps_detect, |
767 | psmouse, set_properties) == 0) { | ||
671 | if (!set_properties || alps_init(psmouse) == 0) | 768 | if (!set_properties || alps_init(psmouse) == 0) |
672 | return PSMOUSE_ALPS; | 769 | return PSMOUSE_ALPS; |
673 | /* | 770 | /* |
@@ -681,7 +778,7 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
681 | * Try OLPC HGPK touchpad. | 778 | * Try OLPC HGPK touchpad. |
682 | */ | 779 | */ |
683 | if (max_proto > PSMOUSE_IMEX && | 780 | if (max_proto > PSMOUSE_IMEX && |
684 | hgpk_detect(psmouse, set_properties) == 0) { | 781 | psmouse_do_detect(hgpk_detect, psmouse, set_properties) == 0) { |
685 | if (!set_properties || hgpk_init(psmouse) == 0) | 782 | if (!set_properties || hgpk_init(psmouse) == 0) |
686 | return PSMOUSE_HGPK; | 783 | return PSMOUSE_HGPK; |
687 | /* | 784 | /* |
@@ -694,7 +791,7 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
694 | * Try Elantech touchpad. | 791 | * Try Elantech touchpad. |
695 | */ | 792 | */ |
696 | if (max_proto > PSMOUSE_IMEX && | 793 | if (max_proto > PSMOUSE_IMEX && |
697 | elantech_detect(psmouse, set_properties) == 0) { | 794 | psmouse_do_detect(elantech_detect, psmouse, set_properties) == 0) { |
698 | if (!set_properties || elantech_init(psmouse) == 0) | 795 | if (!set_properties || elantech_init(psmouse) == 0) |
699 | return PSMOUSE_ELANTECH; | 796 | return PSMOUSE_ELANTECH; |
700 | /* | 797 | /* |
@@ -703,18 +800,21 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
703 | max_proto = PSMOUSE_IMEX; | 800 | max_proto = PSMOUSE_IMEX; |
704 | } | 801 | } |
705 | 802 | ||
706 | |||
707 | if (max_proto > PSMOUSE_IMEX) { | 803 | if (max_proto > PSMOUSE_IMEX) { |
708 | if (genius_detect(psmouse, set_properties) == 0) | 804 | if (psmouse_do_detect(genius_detect, |
805 | psmouse, set_properties) == 0) | ||
709 | return PSMOUSE_GENPS; | 806 | return PSMOUSE_GENPS; |
710 | 807 | ||
711 | if (ps2pp_init(psmouse, set_properties) == 0) | 808 | if (psmouse_do_detect(ps2pp_init, |
809 | psmouse, set_properties) == 0) | ||
712 | return PSMOUSE_PS2PP; | 810 | return PSMOUSE_PS2PP; |
713 | 811 | ||
714 | if (trackpoint_detect(psmouse, set_properties) == 0) | 812 | if (psmouse_do_detect(trackpoint_detect, |
813 | psmouse, set_properties) == 0) | ||
715 | return PSMOUSE_TRACKPOINT; | 814 | return PSMOUSE_TRACKPOINT; |
716 | 815 | ||
717 | if (touchkit_ps2_detect(psmouse, set_properties) == 0) | 816 | if (psmouse_do_detect(touchkit_ps2_detect, |
817 | psmouse, set_properties) == 0) | ||
718 | return PSMOUSE_TOUCHKIT_PS2; | 818 | return PSMOUSE_TOUCHKIT_PS2; |
719 | } | 819 | } |
720 | 820 | ||
@@ -723,7 +823,8 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
723 | * Trackpoint devices (causing TP_READ_ID command to time out). | 823 | * Trackpoint devices (causing TP_READ_ID command to time out). |
724 | */ | 824 | */ |
725 | if (max_proto > PSMOUSE_IMEX) { | 825 | if (max_proto > PSMOUSE_IMEX) { |
726 | if (fsp_detect(psmouse, set_properties) == 0) { | 826 | if (psmouse_do_detect(fsp_detect, |
827 | psmouse, set_properties) == 0) { | ||
727 | if (!set_properties || fsp_init(psmouse) == 0) | 828 | if (!set_properties || fsp_init(psmouse) == 0) |
728 | return PSMOUSE_FSP; | 829 | return PSMOUSE_FSP; |
729 | /* | 830 | /* |
@@ -741,17 +842,23 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
741 | ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS); | 842 | ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS); |
742 | psmouse_reset(psmouse); | 843 | psmouse_reset(psmouse); |
743 | 844 | ||
744 | if (max_proto >= PSMOUSE_IMEX && im_explorer_detect(psmouse, set_properties) == 0) | 845 | if (max_proto >= PSMOUSE_IMEX && |
846 | psmouse_do_detect(im_explorer_detect, | ||
847 | psmouse, set_properties) == 0) { | ||
745 | return PSMOUSE_IMEX; | 848 | return PSMOUSE_IMEX; |
849 | } | ||
746 | 850 | ||
747 | if (max_proto >= PSMOUSE_IMPS && intellimouse_detect(psmouse, set_properties) == 0) | 851 | if (max_proto >= PSMOUSE_IMPS && |
852 | psmouse_do_detect(intellimouse_detect, | ||
853 | psmouse, set_properties) == 0) { | ||
748 | return PSMOUSE_IMPS; | 854 | return PSMOUSE_IMPS; |
855 | } | ||
749 | 856 | ||
750 | /* | 857 | /* |
751 | * Okay, all failed, we have a standard mouse here. The number of the buttons | 858 | * Okay, all failed, we have a standard mouse here. The number of the buttons |
752 | * is still a question, though. We assume 3. | 859 | * is still a question, though. We assume 3. |
753 | */ | 860 | */ |
754 | ps2bare_detect(psmouse, set_properties); | 861 | psmouse_do_detect(ps2bare_detect, psmouse, set_properties); |
755 | 862 | ||
756 | if (synaptics_hardware) { | 863 | if (synaptics_hardware) { |
757 | /* | 864 | /* |
@@ -819,6 +926,13 @@ static const struct psmouse_protocol psmouse_protocols[] = { | |||
819 | .detect = synaptics_detect, | 926 | .detect = synaptics_detect, |
820 | .init = synaptics_init, | 927 | .init = synaptics_init, |
821 | }, | 928 | }, |
929 | { | ||
930 | .type = PSMOUSE_SYNAPTICS_RELATIVE, | ||
931 | .name = "SynRelPS/2", | ||
932 | .alias = "synaptics-relative", | ||
933 | .detect = synaptics_detect, | ||
934 | .init = synaptics_init_relative, | ||
935 | }, | ||
822 | #endif | 936 | #endif |
823 | #ifdef CONFIG_MOUSE_PS2_ALPS | 937 | #ifdef CONFIG_MOUSE_PS2_ALPS |
824 | { | 938 | { |
@@ -958,39 +1072,6 @@ static int psmouse_probe(struct psmouse *psmouse) | |||
958 | } | 1072 | } |
959 | 1073 | ||
960 | /* | 1074 | /* |
961 | * Here we set the mouse resolution. | ||
962 | */ | ||
963 | |||
964 | void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution) | ||
965 | { | ||
966 | static const unsigned char params[] = { 0, 1, 2, 2, 3 }; | ||
967 | unsigned char p; | ||
968 | |||
969 | if (resolution == 0 || resolution > 200) | ||
970 | resolution = 200; | ||
971 | |||
972 | p = params[resolution / 50]; | ||
973 | ps2_command(&psmouse->ps2dev, &p, PSMOUSE_CMD_SETRES); | ||
974 | psmouse->resolution = 25 << p; | ||
975 | } | ||
976 | |||
977 | /* | ||
978 | * Here we set the mouse report rate. | ||
979 | */ | ||
980 | |||
981 | static void psmouse_set_rate(struct psmouse *psmouse, unsigned int rate) | ||
982 | { | ||
983 | static const unsigned char rates[] = { 200, 100, 80, 60, 40, 20, 10, 0 }; | ||
984 | unsigned char r; | ||
985 | int i = 0; | ||
986 | |||
987 | while (rates[i] > rate) i++; | ||
988 | r = rates[i]; | ||
989 | ps2_command(&psmouse->ps2dev, &r, PSMOUSE_CMD_SETRATE); | ||
990 | psmouse->rate = r; | ||
991 | } | ||
992 | |||
993 | /* | ||
994 | * psmouse_initialize() initializes the mouse to a sane state. | 1075 | * psmouse_initialize() initializes the mouse to a sane state. |
995 | */ | 1076 | */ |
996 | 1077 | ||
@@ -1035,16 +1116,6 @@ static void psmouse_deactivate(struct psmouse *psmouse) | |||
1035 | psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); | 1116 | psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); |
1036 | } | 1117 | } |
1037 | 1118 | ||
1038 | /* | ||
1039 | * psmouse_poll() - default poll handler. Everyone except for ALPS uses it. | ||
1040 | */ | ||
1041 | |||
1042 | static int psmouse_poll(struct psmouse *psmouse) | ||
1043 | { | ||
1044 | return ps2_command(&psmouse->ps2dev, psmouse->packet, | ||
1045 | PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)); | ||
1046 | } | ||
1047 | |||
1048 | 1119 | ||
1049 | /* | 1120 | /* |
1050 | * psmouse_resync() attempts to re-validate current protocol. | 1121 | * psmouse_resync() attempts to re-validate current protocol. |
@@ -1245,18 +1316,9 @@ static int psmouse_switch_protocol(struct psmouse *psmouse, | |||
1245 | 1316 | ||
1246 | input_dev->dev.parent = &psmouse->ps2dev.serio->dev; | 1317 | input_dev->dev.parent = &psmouse->ps2dev.serio->dev; |
1247 | 1318 | ||
1248 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | ||
1249 | input_dev->keybit[BIT_WORD(BTN_MOUSE)] = | ||
1250 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT); | ||
1251 | input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); | ||
1252 | |||
1253 | psmouse->set_rate = psmouse_set_rate; | ||
1254 | psmouse->set_resolution = psmouse_set_resolution; | ||
1255 | psmouse->poll = psmouse_poll; | ||
1256 | psmouse->protocol_handler = psmouse_process_byte; | ||
1257 | psmouse->pktsize = 3; | ||
1258 | |||
1259 | if (proto && (proto->detect || proto->init)) { | 1319 | if (proto && (proto->detect || proto->init)) { |
1320 | psmouse_apply_defaults(psmouse); | ||
1321 | |||
1260 | if (proto->detect && proto->detect(psmouse, true) < 0) | 1322 | if (proto->detect && proto->detect(psmouse, true) < 0) |
1261 | return -1; | 1323 | return -1; |
1262 | 1324 | ||
@@ -1558,13 +1620,12 @@ static ssize_t psmouse_show_int_attr(struct psmouse *psmouse, void *offset, char | |||
1558 | static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const char *buf, size_t count) | 1620 | static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const char *buf, size_t count) |
1559 | { | 1621 | { |
1560 | unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset); | 1622 | unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset); |
1561 | unsigned long value; | 1623 | unsigned int value; |
1562 | 1624 | int err; | |
1563 | if (strict_strtoul(buf, 10, &value)) | ||
1564 | return -EINVAL; | ||
1565 | 1625 | ||
1566 | if ((unsigned int)value != value) | 1626 | err = kstrtouint(buf, 10, &value); |
1567 | return -EINVAL; | 1627 | if (err) |
1628 | return err; | ||
1568 | 1629 | ||
1569 | *field = value; | 1630 | *field = value; |
1570 | 1631 | ||
@@ -1671,10 +1732,12 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co | |||
1671 | 1732 | ||
1672 | static ssize_t psmouse_attr_set_rate(struct psmouse *psmouse, void *data, const char *buf, size_t count) | 1733 | static ssize_t psmouse_attr_set_rate(struct psmouse *psmouse, void *data, const char *buf, size_t count) |
1673 | { | 1734 | { |
1674 | unsigned long value; | 1735 | unsigned int value; |
1736 | int err; | ||
1675 | 1737 | ||
1676 | if (strict_strtoul(buf, 10, &value)) | 1738 | err = kstrtouint(buf, 10, &value); |
1677 | return -EINVAL; | 1739 | if (err) |
1740 | return err; | ||
1678 | 1741 | ||
1679 | psmouse->set_rate(psmouse, value); | 1742 | psmouse->set_rate(psmouse, value); |
1680 | return count; | 1743 | return count; |
@@ -1682,10 +1745,12 @@ static ssize_t psmouse_attr_set_rate(struct psmouse *psmouse, void *data, const | |||
1682 | 1745 | ||
1683 | static ssize_t psmouse_attr_set_resolution(struct psmouse *psmouse, void *data, const char *buf, size_t count) | 1746 | static ssize_t psmouse_attr_set_resolution(struct psmouse *psmouse, void *data, const char *buf, size_t count) |
1684 | { | 1747 | { |
1685 | unsigned long value; | 1748 | unsigned int value; |
1749 | int err; | ||
1686 | 1750 | ||
1687 | if (strict_strtoul(buf, 10, &value)) | 1751 | err = kstrtouint(buf, 10, &value); |
1688 | return -EINVAL; | 1752 | if (err) |
1753 | return err; | ||
1689 | 1754 | ||
1690 | psmouse->set_resolution(psmouse, value); | 1755 | psmouse->set_resolution(psmouse, value); |
1691 | return count; | 1756 | return count; |
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h index 9b84b0c4e371..6a417092d010 100644 --- a/drivers/input/mouse/psmouse.h +++ b/drivers/input/mouse/psmouse.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #define PSMOUSE_CMD_SETSTREAM 0x00ea | 8 | #define PSMOUSE_CMD_SETSTREAM 0x00ea |
9 | #define PSMOUSE_CMD_SETPOLL 0x00f0 | 9 | #define PSMOUSE_CMD_SETPOLL 0x00f0 |
10 | #define PSMOUSE_CMD_POLL 0x00eb /* caller sets number of bytes to receive */ | 10 | #define PSMOUSE_CMD_POLL 0x00eb /* caller sets number of bytes to receive */ |
11 | #define PSMOUSE_CMD_RESET_WRAP 0x00ec | ||
11 | #define PSMOUSE_CMD_GETID 0x02f2 | 12 | #define PSMOUSE_CMD_GETID 0x02f2 |
12 | #define PSMOUSE_CMD_SETRATE 0x10f3 | 13 | #define PSMOUSE_CMD_SETRATE 0x10f3 |
13 | #define PSMOUSE_CMD_ENABLE 0x00f4 | 14 | #define PSMOUSE_CMD_ENABLE 0x00f4 |
@@ -93,6 +94,7 @@ enum psmouse_type { | |||
93 | PSMOUSE_HGPK, | 94 | PSMOUSE_HGPK, |
94 | PSMOUSE_ELANTECH, | 95 | PSMOUSE_ELANTECH, |
95 | PSMOUSE_FSP, | 96 | PSMOUSE_FSP, |
97 | PSMOUSE_SYNAPTICS_RELATIVE, | ||
96 | PSMOUSE_AUTO /* This one should always be last */ | 98 | PSMOUSE_AUTO /* This one should always be last */ |
97 | }; | 99 | }; |
98 | 100 | ||
@@ -102,6 +104,7 @@ int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command); | |||
102 | int psmouse_reset(struct psmouse *psmouse); | 104 | int psmouse_reset(struct psmouse *psmouse); |
103 | void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state); | 105 | void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state); |
104 | void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution); | 106 | void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution); |
107 | psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse); | ||
105 | 108 | ||
106 | struct psmouse_attribute { | 109 | struct psmouse_attribute { |
107 | struct device_attribute dattr; | 110 | struct device_attribute dattr; |
diff --git a/drivers/input/mouse/pxa930_trkball.c b/drivers/input/mouse/pxa930_trkball.c index ee3b0ca9d592..a9e4bfdf31f4 100644 --- a/drivers/input/mouse/pxa930_trkball.c +++ b/drivers/input/mouse/pxa930_trkball.c | |||
@@ -250,19 +250,7 @@ static struct platform_driver pxa930_trkball_driver = { | |||
250 | .probe = pxa930_trkball_probe, | 250 | .probe = pxa930_trkball_probe, |
251 | .remove = __devexit_p(pxa930_trkball_remove), | 251 | .remove = __devexit_p(pxa930_trkball_remove), |
252 | }; | 252 | }; |
253 | 253 | module_platform_driver(pxa930_trkball_driver); | |
254 | static int __init pxa930_trkball_init(void) | ||
255 | { | ||
256 | return platform_driver_register(&pxa930_trkball_driver); | ||
257 | } | ||
258 | |||
259 | static void __exit pxa930_trkball_exit(void) | ||
260 | { | ||
261 | platform_driver_unregister(&pxa930_trkball_driver); | ||
262 | } | ||
263 | |||
264 | module_init(pxa930_trkball_init); | ||
265 | module_exit(pxa930_trkball_exit); | ||
266 | 254 | ||
267 | MODULE_AUTHOR("Yong Yao <yaoyong@marvell.com>"); | 255 | MODULE_AUTHOR("Yong Yao <yaoyong@marvell.com>"); |
268 | MODULE_DESCRIPTION("PXA930 Trackball Mouse Driver"); | 256 | MODULE_DESCRIPTION("PXA930 Trackball Mouse Driver"); |
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c index 86d6f39178b0..e36847de7617 100644 --- a/drivers/input/mouse/sentelic.c +++ b/drivers/input/mouse/sentelic.c | |||
@@ -408,7 +408,7 @@ static int fsp_onpad_hscr(struct psmouse *psmouse, bool enable) | |||
408 | static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data, | 408 | static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data, |
409 | const char *buf, size_t count) | 409 | const char *buf, size_t count) |
410 | { | 410 | { |
411 | unsigned long reg, val; | 411 | int reg, val; |
412 | char *rest; | 412 | char *rest; |
413 | ssize_t retval; | 413 | ssize_t retval; |
414 | 414 | ||
@@ -416,7 +416,11 @@ static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data, | |||
416 | if (rest == buf || *rest != ' ' || reg > 0xff) | 416 | if (rest == buf || *rest != ' ' || reg > 0xff) |
417 | return -EINVAL; | 417 | return -EINVAL; |
418 | 418 | ||
419 | if (strict_strtoul(rest + 1, 16, &val) || val > 0xff) | 419 | retval = kstrtoint(rest + 1, 16, &val); |
420 | if (retval) | ||
421 | return retval; | ||
422 | |||
423 | if (val > 0xff) | ||
420 | return -EINVAL; | 424 | return -EINVAL; |
421 | 425 | ||
422 | if (fsp_reg_write_enable(psmouse, true)) | 426 | if (fsp_reg_write_enable(psmouse, true)) |
@@ -448,10 +452,13 @@ static ssize_t fsp_attr_set_getreg(struct psmouse *psmouse, void *data, | |||
448 | const char *buf, size_t count) | 452 | const char *buf, size_t count) |
449 | { | 453 | { |
450 | struct fsp_data *pad = psmouse->private; | 454 | struct fsp_data *pad = psmouse->private; |
451 | unsigned long reg; | 455 | int reg, val, err; |
452 | int val; | 456 | |
457 | err = kstrtoint(buf, 16, ®); | ||
458 | if (err) | ||
459 | return err; | ||
453 | 460 | ||
454 | if (strict_strtoul(buf, 16, ®) || reg > 0xff) | 461 | if (reg > 0xff) |
455 | return -EINVAL; | 462 | return -EINVAL; |
456 | 463 | ||
457 | if (fsp_reg_read(psmouse, reg, &val)) | 464 | if (fsp_reg_read(psmouse, reg, &val)) |
@@ -480,9 +487,13 @@ static ssize_t fsp_attr_show_pagereg(struct psmouse *psmouse, | |||
480 | static ssize_t fsp_attr_set_pagereg(struct psmouse *psmouse, void *data, | 487 | static ssize_t fsp_attr_set_pagereg(struct psmouse *psmouse, void *data, |
481 | const char *buf, size_t count) | 488 | const char *buf, size_t count) |
482 | { | 489 | { |
483 | unsigned long val; | 490 | int val, err; |
484 | 491 | ||
485 | if (strict_strtoul(buf, 16, &val) || val > 0xff) | 492 | err = kstrtoint(buf, 16, &val); |
493 | if (err) | ||
494 | return err; | ||
495 | |||
496 | if (val > 0xff) | ||
486 | return -EINVAL; | 497 | return -EINVAL; |
487 | 498 | ||
488 | if (fsp_page_reg_write(psmouse, val)) | 499 | if (fsp_page_reg_write(psmouse, val)) |
@@ -505,9 +516,14 @@ static ssize_t fsp_attr_show_vscroll(struct psmouse *psmouse, | |||
505 | static ssize_t fsp_attr_set_vscroll(struct psmouse *psmouse, void *data, | 516 | static ssize_t fsp_attr_set_vscroll(struct psmouse *psmouse, void *data, |
506 | const char *buf, size_t count) | 517 | const char *buf, size_t count) |
507 | { | 518 | { |
508 | unsigned long val; | 519 | unsigned int val; |
520 | int err; | ||
521 | |||
522 | err = kstrtouint(buf, 10, &val); | ||
523 | if (err) | ||
524 | return err; | ||
509 | 525 | ||
510 | if (strict_strtoul(buf, 10, &val) || val > 1) | 526 | if (val > 1) |
511 | return -EINVAL; | 527 | return -EINVAL; |
512 | 528 | ||
513 | fsp_onpad_vscr(psmouse, val); | 529 | fsp_onpad_vscr(psmouse, val); |
@@ -529,9 +545,14 @@ static ssize_t fsp_attr_show_hscroll(struct psmouse *psmouse, | |||
529 | static ssize_t fsp_attr_set_hscroll(struct psmouse *psmouse, void *data, | 545 | static ssize_t fsp_attr_set_hscroll(struct psmouse *psmouse, void *data, |
530 | const char *buf, size_t count) | 546 | const char *buf, size_t count) |
531 | { | 547 | { |
532 | unsigned long val; | 548 | unsigned int val; |
549 | int err; | ||
550 | |||
551 | err = kstrtouint(buf, 10, &val); | ||
552 | if (err) | ||
553 | return err; | ||
533 | 554 | ||
534 | if (strict_strtoul(buf, 10, &val) || val > 1) | 555 | if (val > 1) |
535 | return -EINVAL; | 556 | return -EINVAL; |
536 | 557 | ||
537 | fsp_onpad_hscr(psmouse, val); | 558 | fsp_onpad_hscr(psmouse, val); |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index a6dcd18e9adf..8081a0a5d602 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -269,19 +269,49 @@ static int synaptics_query_hardware(struct psmouse *psmouse) | |||
269 | return 0; | 269 | return 0; |
270 | } | 270 | } |
271 | 271 | ||
272 | static int synaptics_set_absolute_mode(struct psmouse *psmouse) | 272 | static int synaptics_set_advanced_gesture_mode(struct psmouse *psmouse) |
273 | { | ||
274 | static unsigned char param = 0xc8; | ||
275 | struct synaptics_data *priv = psmouse->private; | ||
276 | |||
277 | if (!SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) | ||
278 | return 0; | ||
279 | |||
280 | if (psmouse_sliced_command(psmouse, SYN_QUE_MODEL)) | ||
281 | return -1; | ||
282 | |||
283 | if (ps2_command(&psmouse->ps2dev, ¶m, PSMOUSE_CMD_SETRATE)) | ||
284 | return -1; | ||
285 | |||
286 | /* Advanced gesture mode also sends multi finger data */ | ||
287 | priv->capabilities |= BIT(1); | ||
288 | |||
289 | return 0; | ||
290 | } | ||
291 | |||
292 | static int synaptics_set_mode(struct psmouse *psmouse) | ||
273 | { | 293 | { |
274 | struct synaptics_data *priv = psmouse->private; | 294 | struct synaptics_data *priv = psmouse->private; |
275 | 295 | ||
276 | priv->mode = SYN_BIT_ABSOLUTE_MODE; | 296 | priv->mode = 0; |
277 | if (SYN_ID_MAJOR(priv->identity) >= 4) | 297 | if (priv->absolute_mode) |
298 | priv->mode |= SYN_BIT_ABSOLUTE_MODE; | ||
299 | if (priv->disable_gesture) | ||
278 | priv->mode |= SYN_BIT_DISABLE_GESTURE; | 300 | priv->mode |= SYN_BIT_DISABLE_GESTURE; |
301 | if (psmouse->rate >= 80) | ||
302 | priv->mode |= SYN_BIT_HIGH_RATE; | ||
279 | if (SYN_CAP_EXTENDED(priv->capabilities)) | 303 | if (SYN_CAP_EXTENDED(priv->capabilities)) |
280 | priv->mode |= SYN_BIT_W_MODE; | 304 | priv->mode |= SYN_BIT_W_MODE; |
281 | 305 | ||
282 | if (synaptics_mode_cmd(psmouse, priv->mode)) | 306 | if (synaptics_mode_cmd(psmouse, priv->mode)) |
283 | return -1; | 307 | return -1; |
284 | 308 | ||
309 | if (priv->absolute_mode && | ||
310 | synaptics_set_advanced_gesture_mode(psmouse)) { | ||
311 | psmouse_err(psmouse, "Advanced gesture mode init failed.\n"); | ||
312 | return -1; | ||
313 | } | ||
314 | |||
285 | return 0; | 315 | return 0; |
286 | } | 316 | } |
287 | 317 | ||
@@ -300,26 +330,6 @@ static void synaptics_set_rate(struct psmouse *psmouse, unsigned int rate) | |||
300 | synaptics_mode_cmd(psmouse, priv->mode); | 330 | synaptics_mode_cmd(psmouse, priv->mode); |
301 | } | 331 | } |
302 | 332 | ||
303 | static int synaptics_set_advanced_gesture_mode(struct psmouse *psmouse) | ||
304 | { | ||
305 | static unsigned char param = 0xc8; | ||
306 | struct synaptics_data *priv = psmouse->private; | ||
307 | |||
308 | if (!(SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) || | ||
309 | SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c))) | ||
310 | return 0; | ||
311 | |||
312 | if (psmouse_sliced_command(psmouse, SYN_QUE_MODEL)) | ||
313 | return -1; | ||
314 | if (ps2_command(&psmouse->ps2dev, ¶m, PSMOUSE_CMD_SETRATE)) | ||
315 | return -1; | ||
316 | |||
317 | /* Advanced gesture mode also sends multi finger data */ | ||
318 | priv->capabilities |= BIT(1); | ||
319 | |||
320 | return 0; | ||
321 | } | ||
322 | |||
323 | /***************************************************************************** | 333 | /***************************************************************************** |
324 | * Synaptics pass-through PS/2 port support | 334 | * Synaptics pass-through PS/2 port support |
325 | ****************************************************************************/ | 335 | ****************************************************************************/ |
@@ -1143,8 +1153,24 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) | |||
1143 | { | 1153 | { |
1144 | int i; | 1154 | int i; |
1145 | 1155 | ||
1156 | /* Things that apply to both modes */ | ||
1146 | __set_bit(INPUT_PROP_POINTER, dev->propbit); | 1157 | __set_bit(INPUT_PROP_POINTER, dev->propbit); |
1158 | __set_bit(EV_KEY, dev->evbit); | ||
1159 | __set_bit(BTN_LEFT, dev->keybit); | ||
1160 | __set_bit(BTN_RIGHT, dev->keybit); | ||
1147 | 1161 | ||
1162 | if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) | ||
1163 | __set_bit(BTN_MIDDLE, dev->keybit); | ||
1164 | |||
1165 | if (!priv->absolute_mode) { | ||
1166 | /* Relative mode */ | ||
1167 | __set_bit(EV_REL, dev->evbit); | ||
1168 | __set_bit(REL_X, dev->relbit); | ||
1169 | __set_bit(REL_Y, dev->relbit); | ||
1170 | return; | ||
1171 | } | ||
1172 | |||
1173 | /* Absolute mode */ | ||
1148 | __set_bit(EV_ABS, dev->evbit); | 1174 | __set_bit(EV_ABS, dev->evbit); |
1149 | set_abs_position_params(dev, priv, ABS_X, ABS_Y); | 1175 | set_abs_position_params(dev, priv, ABS_X, ABS_Y); |
1150 | input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); | 1176 | input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); |
@@ -1170,20 +1196,14 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) | |||
1170 | if (SYN_CAP_PALMDETECT(priv->capabilities)) | 1196 | if (SYN_CAP_PALMDETECT(priv->capabilities)) |
1171 | input_set_abs_params(dev, ABS_TOOL_WIDTH, 0, 15, 0, 0); | 1197 | input_set_abs_params(dev, ABS_TOOL_WIDTH, 0, 15, 0, 0); |
1172 | 1198 | ||
1173 | __set_bit(EV_KEY, dev->evbit); | ||
1174 | __set_bit(BTN_TOUCH, dev->keybit); | 1199 | __set_bit(BTN_TOUCH, dev->keybit); |
1175 | __set_bit(BTN_TOOL_FINGER, dev->keybit); | 1200 | __set_bit(BTN_TOOL_FINGER, dev->keybit); |
1176 | __set_bit(BTN_LEFT, dev->keybit); | ||
1177 | __set_bit(BTN_RIGHT, dev->keybit); | ||
1178 | 1201 | ||
1179 | if (SYN_CAP_MULTIFINGER(priv->capabilities)) { | 1202 | if (SYN_CAP_MULTIFINGER(priv->capabilities)) { |
1180 | __set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); | 1203 | __set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); |
1181 | __set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); | 1204 | __set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); |
1182 | } | 1205 | } |
1183 | 1206 | ||
1184 | if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) | ||
1185 | __set_bit(BTN_MIDDLE, dev->keybit); | ||
1186 | |||
1187 | if (SYN_CAP_FOUR_BUTTON(priv->capabilities) || | 1207 | if (SYN_CAP_FOUR_BUTTON(priv->capabilities) || |
1188 | SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) { | 1208 | SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) { |
1189 | __set_bit(BTN_FORWARD, dev->keybit); | 1209 | __set_bit(BTN_FORWARD, dev->keybit); |
@@ -1205,10 +1225,58 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) | |||
1205 | } | 1225 | } |
1206 | } | 1226 | } |
1207 | 1227 | ||
1228 | static ssize_t synaptics_show_disable_gesture(struct psmouse *psmouse, | ||
1229 | void *data, char *buf) | ||
1230 | { | ||
1231 | struct synaptics_data *priv = psmouse->private; | ||
1232 | |||
1233 | return sprintf(buf, "%c\n", priv->disable_gesture ? '1' : '0'); | ||
1234 | } | ||
1235 | |||
1236 | static ssize_t synaptics_set_disable_gesture(struct psmouse *psmouse, | ||
1237 | void *data, const char *buf, | ||
1238 | size_t len) | ||
1239 | { | ||
1240 | struct synaptics_data *priv = psmouse->private; | ||
1241 | unsigned int value; | ||
1242 | int err; | ||
1243 | |||
1244 | err = kstrtouint(buf, 10, &value); | ||
1245 | if (err) | ||
1246 | return err; | ||
1247 | |||
1248 | if (value > 1) | ||
1249 | return -EINVAL; | ||
1250 | |||
1251 | if (value == priv->disable_gesture) | ||
1252 | return len; | ||
1253 | |||
1254 | priv->disable_gesture = value; | ||
1255 | if (value) | ||
1256 | priv->mode |= SYN_BIT_DISABLE_GESTURE; | ||
1257 | else | ||
1258 | priv->mode &= ~SYN_BIT_DISABLE_GESTURE; | ||
1259 | |||
1260 | if (synaptics_mode_cmd(psmouse, priv->mode)) | ||
1261 | return -EIO; | ||
1262 | |||
1263 | return len; | ||
1264 | } | ||
1265 | |||
1266 | PSMOUSE_DEFINE_ATTR(disable_gesture, S_IWUSR | S_IRUGO, NULL, | ||
1267 | synaptics_show_disable_gesture, | ||
1268 | synaptics_set_disable_gesture); | ||
1269 | |||
1208 | static void synaptics_disconnect(struct psmouse *psmouse) | 1270 | static void synaptics_disconnect(struct psmouse *psmouse) |
1209 | { | 1271 | { |
1272 | struct synaptics_data *priv = psmouse->private; | ||
1273 | |||
1274 | if (!priv->absolute_mode && SYN_ID_DISGEST_SUPPORTED(priv->identity)) | ||
1275 | device_remove_file(&psmouse->ps2dev.serio->dev, | ||
1276 | &psmouse_attr_disable_gesture.dattr); | ||
1277 | |||
1210 | synaptics_reset(psmouse); | 1278 | synaptics_reset(psmouse); |
1211 | kfree(psmouse->private); | 1279 | kfree(priv); |
1212 | psmouse->private = NULL; | 1280 | psmouse->private = NULL; |
1213 | } | 1281 | } |
1214 | 1282 | ||
@@ -1245,17 +1313,11 @@ static int synaptics_reconnect(struct psmouse *psmouse) | |||
1245 | return -1; | 1313 | return -1; |
1246 | } | 1314 | } |
1247 | 1315 | ||
1248 | if (synaptics_set_absolute_mode(psmouse)) { | 1316 | if (synaptics_set_mode(psmouse)) { |
1249 | psmouse_err(psmouse, "Unable to initialize device.\n"); | 1317 | psmouse_err(psmouse, "Unable to initialize device.\n"); |
1250 | return -1; | 1318 | return -1; |
1251 | } | 1319 | } |
1252 | 1320 | ||
1253 | if (synaptics_set_advanced_gesture_mode(psmouse)) { | ||
1254 | psmouse_err(psmouse, | ||
1255 | "Advanced gesture mode reconnect failed.\n"); | ||
1256 | return -1; | ||
1257 | } | ||
1258 | |||
1259 | if (old_priv.identity != priv->identity || | 1321 | if (old_priv.identity != priv->identity || |
1260 | old_priv.model_id != priv->model_id || | 1322 | old_priv.model_id != priv->model_id || |
1261 | old_priv.capabilities != priv->capabilities || | 1323 | old_priv.capabilities != priv->capabilities || |
@@ -1332,20 +1394,18 @@ void __init synaptics_module_init(void) | |||
1332 | broken_olpc_ec = dmi_check_system(olpc_dmi_table); | 1394 | broken_olpc_ec = dmi_check_system(olpc_dmi_table); |
1333 | } | 1395 | } |
1334 | 1396 | ||
1335 | int synaptics_init(struct psmouse *psmouse) | 1397 | static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode) |
1336 | { | 1398 | { |
1337 | struct synaptics_data *priv; | 1399 | struct synaptics_data *priv; |
1400 | int err = -1; | ||
1338 | 1401 | ||
1339 | /* | 1402 | /* |
1340 | * The OLPC XO has issues with Synaptics' absolute mode; similarly to | 1403 | * The OLPC XO has issues with Synaptics' absolute mode; the constant |
1341 | * the HGPK, it quickly degrades and the hardware becomes jumpy and | 1404 | * packet spew overloads the EC such that key presses on the keyboard |
1342 | * overly sensitive. Not only that, but the constant packet spew | 1405 | * are missed. Given that, don't even attempt to use Absolute mode. |
1343 | * (even at a lowered 40pps rate) overloads the EC such that key | 1406 | * Relative mode seems to work just fine. |
1344 | * presses on the keyboard are missed. Given all of that, don't | ||
1345 | * even attempt to use Synaptics mode. Relative mode seems to work | ||
1346 | * just fine. | ||
1347 | */ | 1407 | */ |
1348 | if (broken_olpc_ec) { | 1408 | if (absolute_mode && broken_olpc_ec) { |
1349 | psmouse_info(psmouse, | 1409 | psmouse_info(psmouse, |
1350 | "OLPC XO detected, not enabling Synaptics protocol.\n"); | 1410 | "OLPC XO detected, not enabling Synaptics protocol.\n"); |
1351 | return -ENODEV; | 1411 | return -ENODEV; |
@@ -1362,13 +1422,12 @@ int synaptics_init(struct psmouse *psmouse) | |||
1362 | goto init_fail; | 1422 | goto init_fail; |
1363 | } | 1423 | } |
1364 | 1424 | ||
1365 | if (synaptics_set_absolute_mode(psmouse)) { | 1425 | priv->absolute_mode = absolute_mode; |
1366 | psmouse_err(psmouse, "Unable to initialize device.\n"); | 1426 | if (SYN_ID_DISGEST_SUPPORTED(priv->identity)) |
1367 | goto init_fail; | 1427 | priv->disable_gesture = true; |
1368 | } | ||
1369 | 1428 | ||
1370 | if (synaptics_set_advanced_gesture_mode(psmouse)) { | 1429 | if (synaptics_set_mode(psmouse)) { |
1371 | psmouse_err(psmouse, "Advanced gesture mode init failed.\n"); | 1430 | psmouse_err(psmouse, "Unable to initialize device.\n"); |
1372 | goto init_fail; | 1431 | goto init_fail; |
1373 | } | 1432 | } |
1374 | 1433 | ||
@@ -1393,12 +1452,19 @@ int synaptics_init(struct psmouse *psmouse) | |||
1393 | psmouse->model = ((priv->model_id & 0x00ff0000) >> 8) | | 1452 | psmouse->model = ((priv->model_id & 0x00ff0000) >> 8) | |
1394 | (priv->model_id & 0x000000ff); | 1453 | (priv->model_id & 0x000000ff); |
1395 | 1454 | ||
1396 | psmouse->protocol_handler = synaptics_process_byte; | 1455 | if (absolute_mode) { |
1456 | psmouse->protocol_handler = synaptics_process_byte; | ||
1457 | psmouse->pktsize = 6; | ||
1458 | } else { | ||
1459 | /* Relative mode follows standard PS/2 mouse protocol */ | ||
1460 | psmouse->protocol_handler = psmouse_process_byte; | ||
1461 | psmouse->pktsize = 3; | ||
1462 | } | ||
1463 | |||
1397 | psmouse->set_rate = synaptics_set_rate; | 1464 | psmouse->set_rate = synaptics_set_rate; |
1398 | psmouse->disconnect = synaptics_disconnect; | 1465 | psmouse->disconnect = synaptics_disconnect; |
1399 | psmouse->reconnect = synaptics_reconnect; | 1466 | psmouse->reconnect = synaptics_reconnect; |
1400 | psmouse->cleanup = synaptics_reset; | 1467 | psmouse->cleanup = synaptics_reset; |
1401 | psmouse->pktsize = 6; | ||
1402 | /* Synaptics can usually stay in sync without extra help */ | 1468 | /* Synaptics can usually stay in sync without extra help */ |
1403 | psmouse->resync_time = 0; | 1469 | psmouse->resync_time = 0; |
1404 | 1470 | ||
@@ -1417,11 +1483,32 @@ int synaptics_init(struct psmouse *psmouse) | |||
1417 | psmouse->rate = 40; | 1483 | psmouse->rate = 40; |
1418 | } | 1484 | } |
1419 | 1485 | ||
1486 | if (!priv->absolute_mode && SYN_ID_DISGEST_SUPPORTED(priv->identity)) { | ||
1487 | err = device_create_file(&psmouse->ps2dev.serio->dev, | ||
1488 | &psmouse_attr_disable_gesture.dattr); | ||
1489 | if (err) { | ||
1490 | psmouse_err(psmouse, | ||
1491 | "Failed to create disable_gesture attribute (%d)", | ||
1492 | err); | ||
1493 | goto init_fail; | ||
1494 | } | ||
1495 | } | ||
1496 | |||
1420 | return 0; | 1497 | return 0; |
1421 | 1498 | ||
1422 | init_fail: | 1499 | init_fail: |
1423 | kfree(priv); | 1500 | kfree(priv); |
1424 | return -1; | 1501 | return err; |
1502 | } | ||
1503 | |||
1504 | int synaptics_init(struct psmouse *psmouse) | ||
1505 | { | ||
1506 | return __synaptics_init(psmouse, true); | ||
1507 | } | ||
1508 | |||
1509 | int synaptics_init_relative(struct psmouse *psmouse) | ||
1510 | { | ||
1511 | return __synaptics_init(psmouse, false); | ||
1425 | } | 1512 | } |
1426 | 1513 | ||
1427 | bool synaptics_supported(void) | 1514 | bool synaptics_supported(void) |
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index 622aea8dd7e0..fd26ccca13d7 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h | |||
@@ -100,6 +100,7 @@ | |||
100 | #define SYN_ID_MINOR(i) (((i) >> 16) & 0xff) | 100 | #define SYN_ID_MINOR(i) (((i) >> 16) & 0xff) |
101 | #define SYN_ID_FULL(i) ((SYN_ID_MAJOR(i) << 8) | SYN_ID_MINOR(i)) | 101 | #define SYN_ID_FULL(i) ((SYN_ID_MAJOR(i) << 8) | SYN_ID_MINOR(i)) |
102 | #define SYN_ID_IS_SYNAPTICS(i) ((((i) >> 8) & 0xff) == 0x47) | 102 | #define SYN_ID_IS_SYNAPTICS(i) ((((i) >> 8) & 0xff) == 0x47) |
103 | #define SYN_ID_DISGEST_SUPPORTED(i) (SYN_ID_MAJOR(i) >= 4) | ||
103 | 104 | ||
104 | /* synaptics special commands */ | 105 | /* synaptics special commands */ |
105 | #define SYN_PS_SET_MODE2 0x14 | 106 | #define SYN_PS_SET_MODE2 0x14 |
@@ -159,6 +160,9 @@ struct synaptics_data { | |||
159 | unsigned char mode; /* current mode byte */ | 160 | unsigned char mode; /* current mode byte */ |
160 | int scroll; | 161 | int scroll; |
161 | 162 | ||
163 | bool absolute_mode; /* run in Absolute mode */ | ||
164 | bool disable_gesture; /* disable gestures */ | ||
165 | |||
162 | struct serio *pt_port; /* Pass-through serio port */ | 166 | struct serio *pt_port; /* Pass-through serio port */ |
163 | 167 | ||
164 | struct synaptics_mt_state mt_state; /* Current mt finger state */ | 168 | struct synaptics_mt_state mt_state; /* Current mt finger state */ |
@@ -175,6 +179,7 @@ struct synaptics_data { | |||
175 | void synaptics_module_init(void); | 179 | void synaptics_module_init(void); |
176 | int synaptics_detect(struct psmouse *psmouse, bool set_properties); | 180 | int synaptics_detect(struct psmouse *psmouse, bool set_properties); |
177 | int synaptics_init(struct psmouse *psmouse); | 181 | int synaptics_init(struct psmouse *psmouse); |
182 | int synaptics_init_relative(struct psmouse *psmouse); | ||
178 | void synaptics_reset(struct psmouse *psmouse); | 183 | void synaptics_reset(struct psmouse *psmouse); |
179 | bool synaptics_supported(void); | 184 | bool synaptics_supported(void); |
180 | 185 | ||
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index 54b2fa892e19..22b218018137 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
@@ -89,10 +89,12 @@ static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data, | |||
89 | struct trackpoint_data *tp = psmouse->private; | 89 | struct trackpoint_data *tp = psmouse->private; |
90 | struct trackpoint_attr_data *attr = data; | 90 | struct trackpoint_attr_data *attr = data; |
91 | unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); | 91 | unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); |
92 | unsigned long value; | 92 | unsigned char value; |
93 | int err; | ||
93 | 94 | ||
94 | if (strict_strtoul(buf, 10, &value) || value > 255) | 95 | err = kstrtou8(buf, 10, &value); |
95 | return -EINVAL; | 96 | if (err) |
97 | return err; | ||
96 | 98 | ||
97 | *field = value; | 99 | *field = value; |
98 | trackpoint_write(&psmouse->ps2dev, attr->command, value); | 100 | trackpoint_write(&psmouse->ps2dev, attr->command, value); |
@@ -115,9 +117,14 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data, | |||
115 | struct trackpoint_data *tp = psmouse->private; | 117 | struct trackpoint_data *tp = psmouse->private; |
116 | struct trackpoint_attr_data *attr = data; | 118 | struct trackpoint_attr_data *attr = data; |
117 | unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); | 119 | unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); |
118 | unsigned long value; | 120 | unsigned int value; |
121 | int err; | ||
122 | |||
123 | err = kstrtouint(buf, 10, &value); | ||
124 | if (err) | ||
125 | return err; | ||
119 | 126 | ||
120 | if (strict_strtoul(buf, 10, &value) || value > 1) | 127 | if (value > 1) |
121 | return -EINVAL; | 128 | return -EINVAL; |
122 | 129 | ||
123 | if (attr->inverted) | 130 | if (attr->inverted) |
diff --git a/drivers/input/serio/altera_ps2.c b/drivers/input/serio/altera_ps2.c index d363dc4571a3..35864c6130bb 100644 --- a/drivers/input/serio/altera_ps2.c +++ b/drivers/input/serio/altera_ps2.c | |||
@@ -196,18 +196,7 @@ static struct platform_driver altera_ps2_driver = { | |||
196 | .of_match_table = altera_ps2_match, | 196 | .of_match_table = altera_ps2_match, |
197 | }, | 197 | }, |
198 | }; | 198 | }; |
199 | 199 | module_platform_driver(altera_ps2_driver); | |
200 | static int __init altera_ps2_init(void) | ||
201 | { | ||
202 | return platform_driver_register(&altera_ps2_driver); | ||
203 | } | ||
204 | module_init(altera_ps2_init); | ||
205 | |||
206 | static void __exit altera_ps2_exit(void) | ||
207 | { | ||
208 | platform_driver_unregister(&altera_ps2_driver); | ||
209 | } | ||
210 | module_exit(altera_ps2_exit); | ||
211 | 200 | ||
212 | MODULE_DESCRIPTION("Altera University Program PS2 controller driver"); | 201 | MODULE_DESCRIPTION("Altera University Program PS2 controller driver"); |
213 | MODULE_AUTHOR("Thomas Chou <thomas@wytron.com.tw>"); | 202 | MODULE_AUTHOR("Thomas Chou <thomas@wytron.com.tw>"); |
diff --git a/drivers/input/serio/at32psif.c b/drivers/input/serio/at32psif.c index 95280f9207e1..421a7442e464 100644 --- a/drivers/input/serio/at32psif.c +++ b/drivers/input/serio/at32psif.c | |||
@@ -358,19 +358,7 @@ static struct platform_driver psif_driver = { | |||
358 | .suspend = psif_suspend, | 358 | .suspend = psif_suspend, |
359 | .resume = psif_resume, | 359 | .resume = psif_resume, |
360 | }; | 360 | }; |
361 | 361 | module_platform_driver(psif_driver); | |
362 | static int __init psif_init(void) | ||
363 | { | ||
364 | return platform_driver_probe(&psif_driver, psif_probe); | ||
365 | } | ||
366 | |||
367 | static void __exit psif_exit(void) | ||
368 | { | ||
369 | platform_driver_unregister(&psif_driver); | ||
370 | } | ||
371 | |||
372 | module_init(psif_init); | ||
373 | module_exit(psif_exit); | ||
374 | 362 | ||
375 | MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>"); | 363 | MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>"); |
376 | MODULE_DESCRIPTION("Atmel AVR32 PSIF PS/2 driver"); | 364 | MODULE_DESCRIPTION("Atmel AVR32 PSIF PS/2 driver"); |
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index d37a48e099d0..86564414b75a 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -991,7 +991,7 @@ static int i8042_controller_init(void) | |||
991 | * Reset the controller and reset CRT to the original value set by BIOS. | 991 | * Reset the controller and reset CRT to the original value set by BIOS. |
992 | */ | 992 | */ |
993 | 993 | ||
994 | static void i8042_controller_reset(void) | 994 | static void i8042_controller_reset(bool force_reset) |
995 | { | 995 | { |
996 | i8042_flush(); | 996 | i8042_flush(); |
997 | 997 | ||
@@ -1016,7 +1016,7 @@ static void i8042_controller_reset(void) | |||
1016 | * Reset the controller if requested. | 1016 | * Reset the controller if requested. |
1017 | */ | 1017 | */ |
1018 | 1018 | ||
1019 | if (i8042_reset) | 1019 | if (i8042_reset || force_reset) |
1020 | i8042_controller_selftest(); | 1020 | i8042_controller_selftest(); |
1021 | 1021 | ||
1022 | /* | 1022 | /* |
@@ -1139,9 +1139,9 @@ static int i8042_controller_resume(bool force_reset) | |||
1139 | * upsetting it. | 1139 | * upsetting it. |
1140 | */ | 1140 | */ |
1141 | 1141 | ||
1142 | static int i8042_pm_reset(struct device *dev) | 1142 | static int i8042_pm_suspend(struct device *dev) |
1143 | { | 1143 | { |
1144 | i8042_controller_reset(); | 1144 | i8042_controller_reset(true); |
1145 | 1145 | ||
1146 | return 0; | 1146 | return 0; |
1147 | } | 1147 | } |
@@ -1163,13 +1163,20 @@ static int i8042_pm_thaw(struct device *dev) | |||
1163 | return 0; | 1163 | return 0; |
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | static int i8042_pm_reset(struct device *dev) | ||
1167 | { | ||
1168 | i8042_controller_reset(false); | ||
1169 | |||
1170 | return 0; | ||
1171 | } | ||
1172 | |||
1166 | static int i8042_pm_restore(struct device *dev) | 1173 | static int i8042_pm_restore(struct device *dev) |
1167 | { | 1174 | { |
1168 | return i8042_controller_resume(false); | 1175 | return i8042_controller_resume(false); |
1169 | } | 1176 | } |
1170 | 1177 | ||
1171 | static const struct dev_pm_ops i8042_pm_ops = { | 1178 | static const struct dev_pm_ops i8042_pm_ops = { |
1172 | .suspend = i8042_pm_reset, | 1179 | .suspend = i8042_pm_suspend, |
1173 | .resume = i8042_pm_resume, | 1180 | .resume = i8042_pm_resume, |
1174 | .thaw = i8042_pm_thaw, | 1181 | .thaw = i8042_pm_thaw, |
1175 | .poweroff = i8042_pm_reset, | 1182 | .poweroff = i8042_pm_reset, |
@@ -1185,7 +1192,7 @@ static const struct dev_pm_ops i8042_pm_ops = { | |||
1185 | 1192 | ||
1186 | static void i8042_shutdown(struct platform_device *dev) | 1193 | static void i8042_shutdown(struct platform_device *dev) |
1187 | { | 1194 | { |
1188 | i8042_controller_reset(); | 1195 | i8042_controller_reset(false); |
1189 | } | 1196 | } |
1190 | 1197 | ||
1191 | static int __init i8042_create_kbd_port(void) | 1198 | static int __init i8042_create_kbd_port(void) |
@@ -1424,7 +1431,7 @@ static int __init i8042_probe(struct platform_device *dev) | |||
1424 | out_fail: | 1431 | out_fail: |
1425 | i8042_free_aux_ports(); /* in case KBD failed but AUX not */ | 1432 | i8042_free_aux_ports(); /* in case KBD failed but AUX not */ |
1426 | i8042_free_irqs(); | 1433 | i8042_free_irqs(); |
1427 | i8042_controller_reset(); | 1434 | i8042_controller_reset(false); |
1428 | i8042_platform_device = NULL; | 1435 | i8042_platform_device = NULL; |
1429 | 1436 | ||
1430 | return error; | 1437 | return error; |
@@ -1434,7 +1441,7 @@ static int __devexit i8042_remove(struct platform_device *dev) | |||
1434 | { | 1441 | { |
1435 | i8042_unregister_ports(); | 1442 | i8042_unregister_ports(); |
1436 | i8042_free_irqs(); | 1443 | i8042_free_irqs(); |
1437 | i8042_controller_reset(); | 1444 | i8042_controller_reset(false); |
1438 | i8042_platform_device = NULL; | 1445 | i8042_platform_device = NULL; |
1439 | 1446 | ||
1440 | return 0; | 1447 | return 0; |
diff --git a/drivers/input/serio/rpckbd.c b/drivers/input/serio/rpckbd.c index 7ec3c97dc1b9..8b44ddc8041c 100644 --- a/drivers/input/serio/rpckbd.c +++ b/drivers/input/serio/rpckbd.c | |||
@@ -143,16 +143,4 @@ static struct platform_driver rpckbd_driver = { | |||
143 | .owner = THIS_MODULE, | 143 | .owner = THIS_MODULE, |
144 | }, | 144 | }, |
145 | }; | 145 | }; |
146 | 146 | module_platform_driver(rpckbd_driver); | |
147 | static int __init rpckbd_init(void) | ||
148 | { | ||
149 | return platform_driver_register(&rpckbd_driver); | ||
150 | } | ||
151 | |||
152 | static void __exit rpckbd_exit(void) | ||
153 | { | ||
154 | platform_driver_unregister(&rpckbd_driver); | ||
155 | } | ||
156 | |||
157 | module_init(rpckbd_init); | ||
158 | module_exit(rpckbd_exit); | ||
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c index d64c5a43aaad..127c391deced 100644 --- a/drivers/input/serio/xilinx_ps2.c +++ b/drivers/input/serio/xilinx_ps2.c | |||
@@ -369,19 +369,7 @@ static struct platform_driver xps2_of_driver = { | |||
369 | .probe = xps2_of_probe, | 369 | .probe = xps2_of_probe, |
370 | .remove = __devexit_p(xps2_of_remove), | 370 | .remove = __devexit_p(xps2_of_remove), |
371 | }; | 371 | }; |
372 | 372 | module_platform_driver(xps2_of_driver); | |
373 | static int __init xps2_init(void) | ||
374 | { | ||
375 | return platform_driver_register(&xps2_of_driver); | ||
376 | } | ||
377 | |||
378 | static void __exit xps2_cleanup(void) | ||
379 | { | ||
380 | platform_driver_unregister(&xps2_of_driver); | ||
381 | } | ||
382 | |||
383 | module_init(xps2_init); | ||
384 | module_exit(xps2_cleanup); | ||
385 | 373 | ||
386 | MODULE_AUTHOR("Xilinx, Inc."); | 374 | MODULE_AUTHOR("Xilinx, Inc."); |
387 | MODULE_DESCRIPTION("Xilinx XPS PS/2 driver"); | 375 | MODULE_DESCRIPTION("Xilinx XPS PS/2 driver"); |
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c index d5ef3debd045..205d16aab441 100644 --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c | |||
@@ -1198,9 +1198,9 @@ static ssize_t | |||
1198 | store_tabletXtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1198 | store_tabletXtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1199 | { | 1199 | { |
1200 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1200 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1201 | long x; | 1201 | int x; |
1202 | 1202 | ||
1203 | if (strict_strtol(buf, 10, &x)) { | 1203 | if (kstrtoint(buf, 10, &x)) { |
1204 | size_t len = buf[count - 1] == '\n' ? count - 1 : count; | 1204 | size_t len = buf[count - 1] == '\n' ? count - 1 : count; |
1205 | 1205 | ||
1206 | if (strncmp(buf, "disable", len)) | 1206 | if (strncmp(buf, "disable", len)) |
@@ -1240,9 +1240,9 @@ static ssize_t | |||
1240 | store_tabletYtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1240 | store_tabletYtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1241 | { | 1241 | { |
1242 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1242 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1243 | long y; | 1243 | int y; |
1244 | 1244 | ||
1245 | if (strict_strtol(buf, 10, &y)) { | 1245 | if (kstrtoint(buf, 10, &y)) { |
1246 | size_t len = buf[count - 1] == '\n' ? count - 1 : count; | 1246 | size_t len = buf[count - 1] == '\n' ? count - 1 : count; |
1247 | 1247 | ||
1248 | if (strncmp(buf, "disable", len)) | 1248 | if (strncmp(buf, "disable", len)) |
@@ -1277,12 +1277,13 @@ static ssize_t | |||
1277 | store_tabletJitterDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1277 | store_tabletJitterDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1278 | { | 1278 | { |
1279 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1279 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1280 | long j; | 1280 | int err, j; |
1281 | 1281 | ||
1282 | if (strict_strtol(buf, 10, &j)) | 1282 | err = kstrtoint(buf, 10, &j); |
1283 | return -EINVAL; | 1283 | if (err) |
1284 | return err; | ||
1284 | 1285 | ||
1285 | aiptek->newSetting.jitterDelay = (int)j; | 1286 | aiptek->newSetting.jitterDelay = j; |
1286 | return count; | 1287 | return count; |
1287 | } | 1288 | } |
1288 | 1289 | ||
@@ -1306,12 +1307,13 @@ static ssize_t | |||
1306 | store_tabletProgrammableDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1307 | store_tabletProgrammableDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1307 | { | 1308 | { |
1308 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1309 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1309 | long d; | 1310 | int err, d; |
1310 | 1311 | ||
1311 | if (strict_strtol(buf, 10, &d)) | 1312 | err = kstrtoint(buf, 10, &d); |
1312 | return -EINVAL; | 1313 | if (err) |
1314 | return err; | ||
1313 | 1315 | ||
1314 | aiptek->newSetting.programmableDelay = (int)d; | 1316 | aiptek->newSetting.programmableDelay = d; |
1315 | return count; | 1317 | return count; |
1316 | } | 1318 | } |
1317 | 1319 | ||
@@ -1557,11 +1559,13 @@ static ssize_t | |||
1557 | store_tabletWheel(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1559 | store_tabletWheel(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1558 | { | 1560 | { |
1559 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1561 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1560 | long w; | 1562 | int err, w; |
1561 | 1563 | ||
1562 | if (strict_strtol(buf, 10, &w)) return -EINVAL; | 1564 | err = kstrtoint(buf, 10, &w); |
1565 | if (err) | ||
1566 | return err; | ||
1563 | 1567 | ||
1564 | aiptek->newSetting.wheel = (int)w; | 1568 | aiptek->newSetting.wheel = w; |
1565 | return count; | 1569 | return count; |
1566 | } | 1570 | } |
1567 | 1571 | ||
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 8f9cde3e0ec2..2a97b7e76db1 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -28,7 +28,9 @@ | |||
28 | #define HID_USAGE_Y_TILT 0x3e | 28 | #define HID_USAGE_Y_TILT 0x3e |
29 | #define HID_USAGE_FINGER 0x22 | 29 | #define HID_USAGE_FINGER 0x22 |
30 | #define HID_USAGE_STYLUS 0x20 | 30 | #define HID_USAGE_STYLUS 0x20 |
31 | #define HID_COLLECTION 0xc0 | 31 | #define HID_COLLECTION 0xa1 |
32 | #define HID_COLLECTION_LOGICAL 0x02 | ||
33 | #define HID_COLLECTION_END 0xc0 | ||
32 | 34 | ||
33 | enum { | 35 | enum { |
34 | WCM_UNDEFINED = 0, | 36 | WCM_UNDEFINED = 0, |
@@ -66,7 +68,8 @@ static int wacom_get_report(struct usb_interface *intf, u8 type, u8 id, | |||
66 | do { | 68 | do { |
67 | retval = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), | 69 | retval = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), |
68 | USB_REQ_GET_REPORT, | 70 | USB_REQ_GET_REPORT, |
69 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | 71 | USB_DIR_IN | USB_TYPE_CLASS | |
72 | USB_RECIP_INTERFACE, | ||
70 | (type << 8) + id, | 73 | (type << 8) + id, |
71 | intf->altsetting[0].desc.bInterfaceNumber, | 74 | intf->altsetting[0].desc.bInterfaceNumber, |
72 | buf, size, 100); | 75 | buf, size, 100); |
@@ -164,7 +167,70 @@ static void wacom_close(struct input_dev *dev) | |||
164 | usb_autopm_put_interface(wacom->intf); | 167 | usb_autopm_put_interface(wacom->intf); |
165 | } | 168 | } |
166 | 169 | ||
167 | static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc, | 170 | static int wacom_parse_logical_collection(unsigned char *report, |
171 | struct wacom_features *features) | ||
172 | { | ||
173 | int length = 0; | ||
174 | |||
175 | if (features->type == BAMBOO_PT) { | ||
176 | |||
177 | /* Logical collection is only used by 3rd gen Bamboo Touch */ | ||
178 | features->pktlen = WACOM_PKGLEN_BBTOUCH3; | ||
179 | features->device_type = BTN_TOOL_DOUBLETAP; | ||
180 | |||
181 | /* | ||
182 | * Stylus and Touch have same active area | ||
183 | * so compute physical size based on stylus | ||
184 | * data before its overwritten. | ||
185 | */ | ||
186 | features->x_phy = | ||
187 | (features->x_max * features->x_resolution) / 100; | ||
188 | features->y_phy = | ||
189 | (features->y_max * features->y_resolution) / 100; | ||
190 | |||
191 | features->x_max = features->y_max = | ||
192 | get_unaligned_le16(&report[10]); | ||
193 | |||
194 | length = 11; | ||
195 | } | ||
196 | return length; | ||
197 | } | ||
198 | |||
199 | /* | ||
200 | * Interface Descriptor of wacom devices can be incomplete and | ||
201 | * inconsistent so wacom_features table is used to store stylus | ||
202 | * device's packet lengths, various maximum values, and tablet | ||
203 | * resolution based on product ID's. | ||
204 | * | ||
205 | * For devices that contain 2 interfaces, wacom_features table is | ||
206 | * inaccurate for the touch interface. Since the Interface Descriptor | ||
207 | * for touch interfaces has pretty complete data, this function exists | ||
208 | * to query tablet for this missing information instead of hard coding in | ||
209 | * an additional table. | ||
210 | * | ||
211 | * A typical Interface Descriptor for a stylus will contain a | ||
212 | * boot mouse application collection that is not of interest and this | ||
213 | * function will ignore it. | ||
214 | * | ||
215 | * It also contains a digitizer application collection that also is not | ||
216 | * of interest since any information it contains would be duplicate | ||
217 | * of what is in wacom_features. Usually it defines a report of an array | ||
218 | * of bytes that could be used as max length of the stylus packet returned. | ||
219 | * If it happens to define a Digitizer-Stylus Physical Collection then | ||
220 | * the X and Y logical values contain valid data but it is ignored. | ||
221 | * | ||
222 | * A typical Interface Descriptor for a touch interface will contain a | ||
223 | * Digitizer-Finger Physical Collection which will define both logical | ||
224 | * X/Y maximum as well as the physical size of tablet. Since touch | ||
225 | * interfaces haven't supported pressure or distance, this is enough | ||
226 | * information to override invalid values in the wacom_features table. | ||
227 | * | ||
228 | * 3rd gen Bamboo Touch no longer define a Digitizer-Finger Pysical | ||
229 | * Collection. Instead they define a Logical Collection with a single | ||
230 | * Logical Maximum for both X and Y. | ||
231 | */ | ||
232 | static int wacom_parse_hid(struct usb_interface *intf, | ||
233 | struct hid_descriptor *hid_desc, | ||
168 | struct wacom_features *features) | 234 | struct wacom_features *features) |
169 | { | 235 | { |
170 | struct usb_device *dev = interface_to_usbdev(intf); | 236 | struct usb_device *dev = interface_to_usbdev(intf); |
@@ -244,8 +310,6 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi | |||
244 | /* penabled only accepts exact bytes of data */ | 310 | /* penabled only accepts exact bytes of data */ |
245 | if (features->type == TABLETPC2FG) | 311 | if (features->type == TABLETPC2FG) |
246 | features->pktlen = WACOM_PKGLEN_GRAPHIRE; | 312 | features->pktlen = WACOM_PKGLEN_GRAPHIRE; |
247 | if (features->type == BAMBOO_PT) | ||
248 | features->pktlen = WACOM_PKGLEN_BBFUN; | ||
249 | features->device_type = BTN_TOOL_PEN; | 313 | features->device_type = BTN_TOOL_PEN; |
250 | features->x_max = | 314 | features->x_max = |
251 | get_unaligned_le16(&report[i + 3]); | 315 | get_unaligned_le16(&report[i + 3]); |
@@ -287,8 +351,6 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi | |||
287 | /* penabled only accepts exact bytes of data */ | 351 | /* penabled only accepts exact bytes of data */ |
288 | if (features->type == TABLETPC2FG) | 352 | if (features->type == TABLETPC2FG) |
289 | features->pktlen = WACOM_PKGLEN_GRAPHIRE; | 353 | features->pktlen = WACOM_PKGLEN_GRAPHIRE; |
290 | if (features->type == BAMBOO_PT) | ||
291 | features->pktlen = WACOM_PKGLEN_BBFUN; | ||
292 | features->device_type = BTN_TOOL_PEN; | 354 | features->device_type = BTN_TOOL_PEN; |
293 | features->y_max = | 355 | features->y_max = |
294 | get_unaligned_le16(&report[i + 3]); | 356 | get_unaligned_le16(&report[i + 3]); |
@@ -302,6 +364,11 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi | |||
302 | i++; | 364 | i++; |
303 | break; | 365 | break; |
304 | 366 | ||
367 | /* | ||
368 | * Requiring Stylus Usage will ignore boot mouse | ||
369 | * X/Y values and some cases of invalid Digitizer X/Y | ||
370 | * values commonly reported. | ||
371 | */ | ||
305 | case HID_USAGE_STYLUS: | 372 | case HID_USAGE_STYLUS: |
306 | pen = 1; | 373 | pen = 1; |
307 | i++; | 374 | i++; |
@@ -309,10 +376,20 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi | |||
309 | } | 376 | } |
310 | break; | 377 | break; |
311 | 378 | ||
312 | case HID_COLLECTION: | 379 | case HID_COLLECTION_END: |
313 | /* reset UsagePage and Finger */ | 380 | /* reset UsagePage and Finger */ |
314 | finger = usage = 0; | 381 | finger = usage = 0; |
315 | break; | 382 | break; |
383 | |||
384 | case HID_COLLECTION: | ||
385 | i++; | ||
386 | switch (report[i]) { | ||
387 | case HID_COLLECTION_LOGICAL: | ||
388 | i += wacom_parse_logical_collection(&report[i], | ||
389 | features); | ||
390 | break; | ||
391 | } | ||
392 | break; | ||
316 | } | 393 | } |
317 | } | 394 | } |
318 | 395 | ||
@@ -348,7 +425,8 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat | |||
348 | WAC_HID_FEATURE_REPORT, | 425 | WAC_HID_FEATURE_REPORT, |
349 | report_id, rep_data, 4, 1); | 426 | report_id, rep_data, 4, 1); |
350 | } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES); | 427 | } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES); |
351 | } else if (features->type != TABLETPC) { | 428 | } else if (features->type != TABLETPC && |
429 | features->device_type == BTN_TOOL_PEN) { | ||
352 | do { | 430 | do { |
353 | rep_data[0] = 2; | 431 | rep_data[0] = 2; |
354 | rep_data[1] = 2; | 432 | rep_data[1] = 2; |
@@ -485,7 +563,8 @@ static int wacom_led_control(struct wacom *wacom) | |||
485 | if (!buf) | 563 | if (!buf) |
486 | return -ENOMEM; | 564 | return -ENOMEM; |
487 | 565 | ||
488 | if (wacom->wacom_wac.features.type == WACOM_21UX2) | 566 | if (wacom->wacom_wac.features.type == WACOM_21UX2 || |
567 | wacom->wacom_wac.features.type == WACOM_24HD) | ||
489 | led = (wacom->led.select[1] << 4) | 0x40; | 568 | led = (wacom->led.select[1] << 4) | 0x40; |
490 | 569 | ||
491 | led |= wacom->led.select[0] | 0x4; | 570 | led |= wacom->led.select[0] | 0x4; |
@@ -704,6 +783,7 @@ static int wacom_initialize_leds(struct wacom *wacom) | |||
704 | &intuos4_led_attr_group); | 783 | &intuos4_led_attr_group); |
705 | break; | 784 | break; |
706 | 785 | ||
786 | case WACOM_24HD: | ||
707 | case WACOM_21UX2: | 787 | case WACOM_21UX2: |
708 | wacom->led.select[0] = 0; | 788 | wacom->led.select[0] = 0; |
709 | wacom->led.select[1] = 0; | 789 | wacom->led.select[1] = 0; |
@@ -738,6 +818,7 @@ static void wacom_destroy_leds(struct wacom *wacom) | |||
738 | &intuos4_led_attr_group); | 818 | &intuos4_led_attr_group); |
739 | break; | 819 | break; |
740 | 820 | ||
821 | case WACOM_24HD: | ||
741 | case WACOM_21UX2: | 822 | case WACOM_21UX2: |
742 | sysfs_remove_group(&wacom->intf->dev.kobj, | 823 | sysfs_remove_group(&wacom->intf->dev.kobj, |
743 | &cintiq_led_attr_group); | 824 | &cintiq_led_attr_group); |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 2ee47d01a3b4..88672ec296c1 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -452,7 +452,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom) | |||
452 | if ((data[1] & 0xb8) == 0xa0) { | 452 | if ((data[1] & 0xb8) == 0xa0) { |
453 | t = (data[6] << 2) | ((data[7] >> 6) & 3); | 453 | t = (data[6] << 2) | ((data[7] >> 6) & 3); |
454 | if ((features->type >= INTUOS4S && features->type <= INTUOS4L) || | 454 | if ((features->type >= INTUOS4S && features->type <= INTUOS4L) || |
455 | features->type == WACOM_21UX2) { | 455 | features->type == WACOM_21UX2 || features->type == WACOM_24HD) { |
456 | t = (t << 1) | (data[1] & 1); | 456 | t = (t << 1) | (data[1] & 1); |
457 | } | 457 | } |
458 | input_report_abs(input, ABS_PRESSURE, t); | 458 | input_report_abs(input, ABS_PRESSURE, t); |
@@ -519,6 +519,56 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) | |||
519 | input_report_key(input, wacom->tool[1], 0); | 519 | input_report_key(input, wacom->tool[1], 0); |
520 | input_report_abs(input, ABS_MISC, 0); | 520 | input_report_abs(input, ABS_MISC, 0); |
521 | } | 521 | } |
522 | } else if (features->type == WACOM_24HD) { | ||
523 | input_report_key(input, BTN_0, (data[6] & 0x01)); | ||
524 | input_report_key(input, BTN_1, (data[6] & 0x02)); | ||
525 | input_report_key(input, BTN_2, (data[6] & 0x04)); | ||
526 | input_report_key(input, BTN_3, (data[6] & 0x08)); | ||
527 | input_report_key(input, BTN_4, (data[6] & 0x10)); | ||
528 | input_report_key(input, BTN_5, (data[6] & 0x20)); | ||
529 | input_report_key(input, BTN_6, (data[6] & 0x40)); | ||
530 | input_report_key(input, BTN_7, (data[6] & 0x80)); | ||
531 | input_report_key(input, BTN_8, (data[8] & 0x01)); | ||
532 | input_report_key(input, BTN_9, (data[8] & 0x02)); | ||
533 | input_report_key(input, BTN_A, (data[8] & 0x04)); | ||
534 | input_report_key(input, BTN_B, (data[8] & 0x08)); | ||
535 | input_report_key(input, BTN_C, (data[8] & 0x10)); | ||
536 | input_report_key(input, BTN_X, (data[8] & 0x20)); | ||
537 | input_report_key(input, BTN_Y, (data[8] & 0x40)); | ||
538 | input_report_key(input, BTN_Z, (data[8] & 0x80)); | ||
539 | |||
540 | /* | ||
541 | * Three "buttons" are available on the 24HD which are | ||
542 | * physically implemented as a touchstrip. Each button | ||
543 | * is approximately 3 bits wide with a 2 bit spacing. | ||
544 | * The raw touchstrip bits are stored at: | ||
545 | * ((data[3] & 0x1f) << 8) | data[4]) | ||
546 | */ | ||
547 | input_report_key(input, KEY_PROG1, data[4] & 0x07); | ||
548 | input_report_key(input, KEY_PROG2, data[4] & 0xE0); | ||
549 | input_report_key(input, KEY_PROG3, data[3] & 0x1C); | ||
550 | |||
551 | if (data[1] & 0x80) { | ||
552 | input_report_abs(input, ABS_WHEEL, (data[1] & 0x7f)); | ||
553 | } else { | ||
554 | /* Out of proximity, clear wheel value. */ | ||
555 | input_report_abs(input, ABS_WHEEL, 0); | ||
556 | } | ||
557 | |||
558 | if (data[2] & 0x80) { | ||
559 | input_report_abs(input, ABS_THROTTLE, (data[2] & 0x7f)); | ||
560 | } else { | ||
561 | /* Out of proximity, clear second wheel value. */ | ||
562 | input_report_abs(input, ABS_THROTTLE, 0); | ||
563 | } | ||
564 | |||
565 | if (data[1] | data[2] | (data[3] & 0x1f) | data[4] | data[6] | data[8]) { | ||
566 | input_report_key(input, wacom->tool[1], 1); | ||
567 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); | ||
568 | } else { | ||
569 | input_report_key(input, wacom->tool[1], 0); | ||
570 | input_report_abs(input, ABS_MISC, 0); | ||
571 | } | ||
522 | } else { | 572 | } else { |
523 | if (features->type == WACOM_21UX2) { | 573 | if (features->type == WACOM_21UX2) { |
524 | input_report_key(input, BTN_0, (data[5] & 0x01)); | 574 | input_report_key(input, BTN_0, (data[5] & 0x01)); |
@@ -799,6 +849,9 @@ static int wacom_bpt_touch(struct wacom_wac *wacom) | |||
799 | unsigned char *data = wacom->data; | 849 | unsigned char *data = wacom->data; |
800 | int i; | 850 | int i; |
801 | 851 | ||
852 | if (data[0] != 0x02) | ||
853 | return 0; | ||
854 | |||
802 | for (i = 0; i < 2; i++) { | 855 | for (i = 0; i < 2; i++) { |
803 | int offset = (data[1] & 0x80) ? (8 * i) : (9 * i); | 856 | int offset = (data[1] & 0x80) ? (8 * i) : (9 * i); |
804 | bool touch = data[offset + 3] & 0x80; | 857 | bool touch = data[offset + 3] & 0x80; |
@@ -837,18 +890,77 @@ static int wacom_bpt_touch(struct wacom_wac *wacom) | |||
837 | return 0; | 890 | return 0; |
838 | } | 891 | } |
839 | 892 | ||
893 | static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) | ||
894 | { | ||
895 | struct input_dev *input = wacom->input; | ||
896 | int slot_id = data[0] - 2; /* data[0] is between 2 and 17 */ | ||
897 | bool touch = data[1] & 0x80; | ||
898 | |||
899 | touch = touch && !wacom->shared->stylus_in_proximity; | ||
900 | |||
901 | input_mt_slot(input, slot_id); | ||
902 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); | ||
903 | |||
904 | if (touch) { | ||
905 | int x = (data[2] << 4) | (data[4] >> 4); | ||
906 | int y = (data[3] << 4) | (data[4] & 0x0f); | ||
907 | int w = data[6]; | ||
908 | |||
909 | input_report_abs(input, ABS_MT_POSITION_X, x); | ||
910 | input_report_abs(input, ABS_MT_POSITION_Y, y); | ||
911 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, w); | ||
912 | } | ||
913 | } | ||
914 | |||
915 | static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data) | ||
916 | { | ||
917 | struct input_dev *input = wacom->input; | ||
918 | |||
919 | input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); | ||
920 | input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0); | ||
921 | input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0); | ||
922 | input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0); | ||
923 | } | ||
924 | |||
925 | static int wacom_bpt3_touch(struct wacom_wac *wacom) | ||
926 | { | ||
927 | struct input_dev *input = wacom->input; | ||
928 | unsigned char *data = wacom->data; | ||
929 | int count = data[1] & 0x03; | ||
930 | int i; | ||
931 | |||
932 | if (data[0] != 0x02) | ||
933 | return 0; | ||
934 | |||
935 | /* data has up to 7 fixed sized 8-byte messages starting at data[2] */ | ||
936 | for (i = 0; i < count; i++) { | ||
937 | int offset = (8 * i) + 2; | ||
938 | int msg_id = data[offset]; | ||
939 | |||
940 | if (msg_id >= 2 && msg_id <= 17) | ||
941 | wacom_bpt3_touch_msg(wacom, data + offset); | ||
942 | else if (msg_id == 128) | ||
943 | wacom_bpt3_button_msg(wacom, data + offset); | ||
944 | |||
945 | } | ||
946 | |||
947 | input_mt_report_pointer_emulation(input, true); | ||
948 | |||
949 | input_sync(input); | ||
950 | |||
951 | return 0; | ||
952 | } | ||
953 | |||
840 | static int wacom_bpt_pen(struct wacom_wac *wacom) | 954 | static int wacom_bpt_pen(struct wacom_wac *wacom) |
841 | { | 955 | { |
842 | struct input_dev *input = wacom->input; | 956 | struct input_dev *input = wacom->input; |
843 | unsigned char *data = wacom->data; | 957 | unsigned char *data = wacom->data; |
844 | int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0; | 958 | int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0; |
845 | 959 | ||
846 | /* | 960 | if (data[0] != 0x02) |
847 | * Similar to Graphire protocol, data[1] & 0x20 is proximity and | 961 | return 0; |
848 | * data[1] & 0x18 is tool ID. 0x30 is safety check to ignore | 962 | |
849 | * 2 unused tool ID's. | 963 | prox = (data[1] & 0x20) == 0x20; |
850 | */ | ||
851 | prox = (data[1] & 0x30) == 0x30; | ||
852 | 964 | ||
853 | /* | 965 | /* |
854 | * All reports shared between PEN and RUBBER tool must be | 966 | * All reports shared between PEN and RUBBER tool must be |
@@ -912,7 +1024,9 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len) | |||
912 | { | 1024 | { |
913 | if (len == WACOM_PKGLEN_BBTOUCH) | 1025 | if (len == WACOM_PKGLEN_BBTOUCH) |
914 | return wacom_bpt_touch(wacom); | 1026 | return wacom_bpt_touch(wacom); |
915 | else if (len == WACOM_PKGLEN_BBFUN) | 1027 | else if (len == WACOM_PKGLEN_BBTOUCH3) |
1028 | return wacom_bpt3_touch(wacom); | ||
1029 | else if (len == WACOM_PKGLEN_BBFUN || len == WACOM_PKGLEN_BBPEN) | ||
916 | return wacom_bpt_pen(wacom); | 1030 | return wacom_bpt_pen(wacom); |
917 | 1031 | ||
918 | return 0; | 1032 | return 0; |
@@ -955,6 +1069,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) | |||
955 | case CINTIQ: | 1069 | case CINTIQ: |
956 | case WACOM_BEE: | 1070 | case WACOM_BEE: |
957 | case WACOM_21UX2: | 1071 | case WACOM_21UX2: |
1072 | case WACOM_24HD: | ||
958 | sync = wacom_intuos_irq(wacom_wac); | 1073 | sync = wacom_intuos_irq(wacom_wac); |
959 | break; | 1074 | break; |
960 | 1075 | ||
@@ -1031,9 +1146,9 @@ void wacom_setup_device_quirks(struct wacom_features *features) | |||
1031 | features->type == BAMBOO_PT) | 1146 | features->type == BAMBOO_PT) |
1032 | features->quirks |= WACOM_QUIRK_MULTI_INPUT; | 1147 | features->quirks |= WACOM_QUIRK_MULTI_INPUT; |
1033 | 1148 | ||
1034 | /* quirks for bamboo touch */ | 1149 | /* quirk for bamboo touch with 2 low res touches */ |
1035 | if (features->type == BAMBOO_PT && | 1150 | if (features->type == BAMBOO_PT && |
1036 | features->device_type == BTN_TOOL_DOUBLETAP) { | 1151 | features->pktlen == WACOM_PKGLEN_BBTOUCH) { |
1037 | features->x_max <<= 5; | 1152 | features->x_max <<= 5; |
1038 | features->y_max <<= 5; | 1153 | features->y_max <<= 5; |
1039 | features->x_fuzz <<= 5; | 1154 | features->x_fuzz <<= 5; |
@@ -1110,6 +1225,26 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1110 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | 1225 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); |
1111 | break; | 1226 | break; |
1112 | 1227 | ||
1228 | case WACOM_24HD: | ||
1229 | __set_bit(BTN_A, input_dev->keybit); | ||
1230 | __set_bit(BTN_B, input_dev->keybit); | ||
1231 | __set_bit(BTN_C, input_dev->keybit); | ||
1232 | __set_bit(BTN_X, input_dev->keybit); | ||
1233 | __set_bit(BTN_Y, input_dev->keybit); | ||
1234 | __set_bit(BTN_Z, input_dev->keybit); | ||
1235 | |||
1236 | for (i = 0; i < 10; i++) | ||
1237 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
1238 | |||
1239 | __set_bit(KEY_PROG1, input_dev->keybit); | ||
1240 | __set_bit(KEY_PROG2, input_dev->keybit); | ||
1241 | __set_bit(KEY_PROG3, input_dev->keybit); | ||
1242 | |||
1243 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | ||
1244 | input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); | ||
1245 | wacom_setup_cintiq(wacom_wac); | ||
1246 | break; | ||
1247 | |||
1113 | case WACOM_21UX2: | 1248 | case WACOM_21UX2: |
1114 | __set_bit(BTN_A, input_dev->keybit); | 1249 | __set_bit(BTN_A, input_dev->keybit); |
1115 | __set_bit(BTN_B, input_dev->keybit); | 1250 | __set_bit(BTN_B, input_dev->keybit); |
@@ -1240,7 +1375,21 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1240 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); | 1375 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); |
1241 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); | 1376 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); |
1242 | 1377 | ||
1243 | input_mt_init_slots(input_dev, 2); | 1378 | if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { |
1379 | __set_bit(BTN_TOOL_TRIPLETAP, | ||
1380 | input_dev->keybit); | ||
1381 | __set_bit(BTN_TOOL_QUADTAP, | ||
1382 | input_dev->keybit); | ||
1383 | |||
1384 | input_mt_init_slots(input_dev, 16); | ||
1385 | |||
1386 | input_set_abs_params(input_dev, | ||
1387 | ABS_MT_TOUCH_MAJOR, | ||
1388 | 0, 255, 0, 0); | ||
1389 | } else { | ||
1390 | input_mt_init_slots(input_dev, 2); | ||
1391 | } | ||
1392 | |||
1244 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, | 1393 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, |
1245 | 0, features->x_max, | 1394 | 0, features->x_max, |
1246 | features->x_fuzz, 0); | 1395 | features->x_fuzz, 0); |
@@ -1425,6 +1574,9 @@ static const struct wacom_features wacom_features_0xBB = | |||
1425 | static const struct wacom_features wacom_features_0xBC = | 1574 | static const struct wacom_features wacom_features_0xBC = |
1426 | { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047, | 1575 | { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047, |
1427 | 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 1576 | 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
1577 | static const struct wacom_features wacom_features_0xF4 = | ||
1578 | { "Wacom Cintiq 24HD", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, | ||
1579 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | ||
1428 | static const struct wacom_features wacom_features_0x3F = | 1580 | static const struct wacom_features wacom_features_0x3F = |
1429 | { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, | 1581 | { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, |
1430 | 63, CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 1582 | 63, CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
@@ -1509,6 +1661,15 @@ static const struct wacom_features wacom_features_0xDA = | |||
1509 | static struct wacom_features wacom_features_0xDB = | 1661 | static struct wacom_features wacom_features_0xDB = |
1510 | { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, | 1662 | { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, |
1511 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 1663 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
1664 | static const struct wacom_features wacom_features_0xDD = | ||
1665 | { "Wacom Bamboo Connect", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023, | ||
1666 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
1667 | static const struct wacom_features wacom_features_0xDE = | ||
1668 | { "Wacom Bamboo 16FG 4x5", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023, | ||
1669 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
1670 | static const struct wacom_features wacom_features_0xDF = | ||
1671 | { "Wacom Bamboo 16FG 6x8", WACOM_PKGLEN_BBPEN, 21648, 13700, 1023, | ||
1672 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
1512 | static const struct wacom_features wacom_features_0x6004 = | 1673 | static const struct wacom_features wacom_features_0x6004 = |
1513 | { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, | 1674 | { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, |
1514 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 1675 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
@@ -1604,6 +1765,9 @@ const struct usb_device_id wacom_ids[] = { | |||
1604 | { USB_DEVICE_WACOM(0xD8) }, | 1765 | { USB_DEVICE_WACOM(0xD8) }, |
1605 | { USB_DEVICE_WACOM(0xDA) }, | 1766 | { USB_DEVICE_WACOM(0xDA) }, |
1606 | { USB_DEVICE_WACOM(0xDB) }, | 1767 | { USB_DEVICE_WACOM(0xDB) }, |
1768 | { USB_DEVICE_WACOM(0xDD) }, | ||
1769 | { USB_DEVICE_WACOM(0xDE) }, | ||
1770 | { USB_DEVICE_WACOM(0xDF) }, | ||
1607 | { USB_DEVICE_WACOM(0xF0) }, | 1771 | { USB_DEVICE_WACOM(0xF0) }, |
1608 | { USB_DEVICE_WACOM(0xCC) }, | 1772 | { USB_DEVICE_WACOM(0xCC) }, |
1609 | { USB_DEVICE_WACOM(0x90) }, | 1773 | { USB_DEVICE_WACOM(0x90) }, |
@@ -1616,6 +1780,7 @@ const struct usb_device_id wacom_ids[] = { | |||
1616 | { USB_DEVICE_WACOM(0xE6) }, | 1780 | { USB_DEVICE_WACOM(0xE6) }, |
1617 | { USB_DEVICE_WACOM(0xEC) }, | 1781 | { USB_DEVICE_WACOM(0xEC) }, |
1618 | { USB_DEVICE_WACOM(0x47) }, | 1782 | { USB_DEVICE_WACOM(0x47) }, |
1783 | { USB_DEVICE_WACOM(0xF4) }, | ||
1619 | { USB_DEVICE_LENOVO(0x6004) }, | 1784 | { USB_DEVICE_LENOVO(0x6004) }, |
1620 | { } | 1785 | { } |
1621 | }; | 1786 | }; |
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index 53eb71b68330..050acaefee7d 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | 13 | ||
14 | /* maximum packet length for USB devices */ | 14 | /* maximum packet length for USB devices */ |
15 | #define WACOM_PKGLEN_MAX 32 | 15 | #define WACOM_PKGLEN_MAX 64 |
16 | 16 | ||
17 | /* packet length for individual models */ | 17 | /* packet length for individual models */ |
18 | #define WACOM_PKGLEN_PENPRTN 7 | 18 | #define WACOM_PKGLEN_PENPRTN 7 |
@@ -22,6 +22,8 @@ | |||
22 | #define WACOM_PKGLEN_TPC1FG 5 | 22 | #define WACOM_PKGLEN_TPC1FG 5 |
23 | #define WACOM_PKGLEN_TPC2FG 14 | 23 | #define WACOM_PKGLEN_TPC2FG 14 |
24 | #define WACOM_PKGLEN_BBTOUCH 20 | 24 | #define WACOM_PKGLEN_BBTOUCH 20 |
25 | #define WACOM_PKGLEN_BBTOUCH3 64 | ||
26 | #define WACOM_PKGLEN_BBPEN 10 | ||
25 | 27 | ||
26 | /* device IDs */ | 28 | /* device IDs */ |
27 | #define STYLUS_DEVICE_ID 0x02 | 29 | #define STYLUS_DEVICE_ID 0x02 |
@@ -57,6 +59,7 @@ enum { | |||
57 | INTUOS4S, | 59 | INTUOS4S, |
58 | INTUOS4, | 60 | INTUOS4, |
59 | INTUOS4L, | 61 | INTUOS4L, |
62 | WACOM_24HD, | ||
60 | WACOM_21UX2, | 63 | WACOM_21UX2, |
61 | CINTIQ, | 64 | CINTIQ, |
62 | WACOM_BEE, | 65 | WACOM_BEE, |
diff --git a/drivers/input/touchscreen/88pm860x-ts.c b/drivers/input/touchscreen/88pm860x-ts.c index b3aebc2166ba..05f30b73c3c3 100644 --- a/drivers/input/touchscreen/88pm860x-ts.c +++ b/drivers/input/touchscreen/88pm860x-ts.c | |||
@@ -217,18 +217,7 @@ static struct platform_driver pm860x_touch_driver = { | |||
217 | .probe = pm860x_touch_probe, | 217 | .probe = pm860x_touch_probe, |
218 | .remove = __devexit_p(pm860x_touch_remove), | 218 | .remove = __devexit_p(pm860x_touch_remove), |
219 | }; | 219 | }; |
220 | 220 | module_platform_driver(pm860x_touch_driver); | |
221 | static int __init pm860x_touch_init(void) | ||
222 | { | ||
223 | return platform_driver_register(&pm860x_touch_driver); | ||
224 | } | ||
225 | module_init(pm860x_touch_init); | ||
226 | |||
227 | static void __exit pm860x_touch_exit(void) | ||
228 | { | ||
229 | platform_driver_unregister(&pm860x_touch_driver); | ||
230 | } | ||
231 | module_exit(pm860x_touch_exit); | ||
232 | 221 | ||
233 | MODULE_DESCRIPTION("Touchscreen driver for Marvell Semiconductor 88PM860x"); | 222 | MODULE_DESCRIPTION("Touchscreen driver for Marvell Semiconductor 88PM860x"); |
234 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); | 223 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); |
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 3488ffe1fa0a..4af2a18eb3ba 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
@@ -98,6 +98,19 @@ config TOUCHSCREEN_ATMEL_MXT | |||
98 | To compile this driver as a module, choose M here: the | 98 | To compile this driver as a module, choose M here: the |
99 | module will be called atmel_mxt_ts. | 99 | module will be called atmel_mxt_ts. |
100 | 100 | ||
101 | config TOUCHSCREEN_AUO_PIXCIR | ||
102 | tristate "AUO in-cell touchscreen using Pixcir ICs" | ||
103 | depends on I2C | ||
104 | depends on GPIOLIB | ||
105 | help | ||
106 | Say Y here if you have a AUO display with in-cell touchscreen | ||
107 | using Pixcir ICs. | ||
108 | |||
109 | If unsure, say N. | ||
110 | |||
111 | To compile this driver as a module, choose M here: the | ||
112 | module will be called auo-pixcir-ts. | ||
113 | |||
101 | config TOUCHSCREEN_BITSY | 114 | config TOUCHSCREEN_BITSY |
102 | tristate "Compaq iPAQ H3600 (Bitsy) touchscreen" | 115 | tristate "Compaq iPAQ H3600 (Bitsy) touchscreen" |
103 | depends on SA1100_BITSY | 116 | depends on SA1100_BITSY |
@@ -177,6 +190,16 @@ config TOUCHSCREEN_EETI | |||
177 | To compile this driver as a module, choose M here: the | 190 | To compile this driver as a module, choose M here: the |
178 | module will be called eeti_ts. | 191 | module will be called eeti_ts. |
179 | 192 | ||
193 | config TOUCHSCREEN_EGALAX | ||
194 | tristate "EETI eGalax multi-touch panel support" | ||
195 | depends on I2C | ||
196 | help | ||
197 | Say Y here to enable support for I2C connected EETI | ||
198 | eGalax multi-touch panels. | ||
199 | |||
200 | To compile this driver as a module, choose M here: the | ||
201 | module will be called egalax_ts. | ||
202 | |||
180 | config TOUCHSCREEN_FUJITSU | 203 | config TOUCHSCREEN_FUJITSU |
181 | tristate "Fujitsu serial touchscreen" | 204 | tristate "Fujitsu serial touchscreen" |
182 | select SERIO | 205 | select SERIO |
@@ -435,6 +458,18 @@ config TOUCHSCREEN_UCB1400 | |||
435 | To compile this driver as a module, choose M here: the | 458 | To compile this driver as a module, choose M here: the |
436 | module will be called ucb1400_ts. | 459 | module will be called ucb1400_ts. |
437 | 460 | ||
461 | config TOUCHSCREEN_PIXCIR | ||
462 | tristate "PIXCIR I2C touchscreens" | ||
463 | depends on I2C | ||
464 | help | ||
465 | Say Y here if you have a pixcir i2c touchscreen | ||
466 | controller. | ||
467 | |||
468 | If unsure, say N. | ||
469 | |||
470 | To compile this driver as a module, choose M here: the | ||
471 | module will be called pixcir_i2c_ts. | ||
472 | |||
438 | config TOUCHSCREEN_WM831X | 473 | config TOUCHSCREEN_WM831X |
439 | tristate "Support for WM831x touchscreen controllers" | 474 | tristate "Support for WM831x touchscreen controllers" |
440 | depends on MFD_WM831X | 475 | depends on MFD_WM831X |
@@ -541,6 +576,7 @@ config TOUCHSCREEN_USB_COMPOSITE | |||
541 | - GoTop Super_Q2/GogoPen/PenPower tablets | 576 | - GoTop Super_Q2/GogoPen/PenPower tablets |
542 | - JASTEC USB Touch Controller/DigiTech DTR-02U | 577 | - JASTEC USB Touch Controller/DigiTech DTR-02U |
543 | - Zytronic controllers | 578 | - Zytronic controllers |
579 | - Elo TouchSystems 2700 IntelliTouch | ||
544 | 580 | ||
545 | Have a look at <http://linux.chapter7.ch/touchkit/> for | 581 | Have a look at <http://linux.chapter7.ch/touchkit/> for |
546 | a usage description and the required user-space stuff. | 582 | a usage description and the required user-space stuff. |
@@ -620,6 +656,11 @@ config TOUCHSCREEN_USB_JASTEC | |||
620 | bool "JASTEC/DigiTech DTR-02U USB touch controller device support" if EXPERT | 656 | bool "JASTEC/DigiTech DTR-02U USB touch controller device support" if EXPERT |
621 | depends on TOUCHSCREEN_USB_COMPOSITE | 657 | depends on TOUCHSCREEN_USB_COMPOSITE |
622 | 658 | ||
659 | config TOUCHSCREEN_USB_ELO | ||
660 | default y | ||
661 | bool "Elo TouchSystems 2700 IntelliTouch controller device support" if EXPERT | ||
662 | depends on TOUCHSCREEN_USB_COMPOSITE | ||
663 | |||
623 | config TOUCHSCREEN_USB_E2I | 664 | config TOUCHSCREEN_USB_E2I |
624 | default y | 665 | default y |
625 | bool "e2i Touchscreen controller (e.g. from Mimo 740)" | 666 | bool "e2i Touchscreen controller (e.g. from Mimo 740)" |
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index f957676035a4..496091e88460 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile | |||
@@ -14,6 +14,7 @@ obj-$(CONFIG_TOUCHSCREEN_AD7879_SPI) += ad7879-spi.o | |||
14 | obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o | 14 | obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o |
15 | obj-$(CONFIG_TOUCHSCREEN_ATMEL_MXT) += atmel_mxt_ts.o | 15 | obj-$(CONFIG_TOUCHSCREEN_ATMEL_MXT) += atmel_mxt_ts.o |
16 | obj-$(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) += atmel_tsadcc.o | 16 | obj-$(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) += atmel_tsadcc.o |
17 | obj-$(CONFIG_TOUCHSCREEN_AUO_PIXCIR) += auo-pixcir-ts.o | ||
17 | obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o | 18 | obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o |
18 | obj-$(CONFIG_TOUCHSCREEN_BU21013) += bu21013_ts.o | 19 | obj-$(CONFIG_TOUCHSCREEN_BU21013) += bu21013_ts.o |
19 | obj-$(CONFIG_TOUCHSCREEN_CY8CTMG110) += cy8ctmg110_ts.o | 20 | obj-$(CONFIG_TOUCHSCREEN_CY8CTMG110) += cy8ctmg110_ts.o |
@@ -23,6 +24,7 @@ obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o | |||
23 | obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o | 24 | obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o |
24 | obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o | 25 | obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o |
25 | obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o | 26 | obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o |
27 | obj-$(CONFIG_TOUCHSCREEN_EGALAX) += egalax_ts.o | ||
26 | obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o | 28 | obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o |
27 | obj-$(CONFIG_TOUCHSCREEN_INEXIO) += inexio.o | 29 | obj-$(CONFIG_TOUCHSCREEN_INEXIO) += inexio.o |
28 | obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o | 30 | obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o |
@@ -39,6 +41,7 @@ obj-$(CONFIG_TOUCHSCREEN_HTCPEN) += htcpen.o | |||
39 | obj-$(CONFIG_TOUCHSCREEN_USB_COMPOSITE) += usbtouchscreen.o | 41 | obj-$(CONFIG_TOUCHSCREEN_USB_COMPOSITE) += usbtouchscreen.o |
40 | obj-$(CONFIG_TOUCHSCREEN_PCAP) += pcap_ts.o | 42 | obj-$(CONFIG_TOUCHSCREEN_PCAP) += pcap_ts.o |
41 | obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o | 43 | obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o |
44 | obj-$(CONFIG_TOUCHSCREEN_PIXCIR) += pixcir_i2c_ts.o | ||
42 | obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o | 45 | obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o |
43 | obj-$(CONFIG_TOUCHSCREEN_ST1232) += st1232.o | 46 | obj-$(CONFIG_TOUCHSCREEN_ST1232) += st1232.o |
44 | obj-$(CONFIG_TOUCHSCREEN_STMPE) += stmpe-ts.o | 47 | obj-$(CONFIG_TOUCHSCREEN_STMPE) += stmpe-ts.o |
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c index baa43df6502d..49a36df0b752 100644 --- a/drivers/input/touchscreen/ad7877.c +++ b/drivers/input/touchscreen/ad7877.c | |||
@@ -488,10 +488,10 @@ static ssize_t ad7877_disable_store(struct device *dev, | |||
488 | const char *buf, size_t count) | 488 | const char *buf, size_t count) |
489 | { | 489 | { |
490 | struct ad7877 *ts = dev_get_drvdata(dev); | 490 | struct ad7877 *ts = dev_get_drvdata(dev); |
491 | unsigned long val; | 491 | unsigned int val; |
492 | int error; | 492 | int error; |
493 | 493 | ||
494 | error = strict_strtoul(buf, 10, &val); | 494 | error = kstrtouint(buf, 10, &val); |
495 | if (error) | 495 | if (error) |
496 | return error; | 496 | return error; |
497 | 497 | ||
@@ -518,10 +518,10 @@ static ssize_t ad7877_dac_store(struct device *dev, | |||
518 | const char *buf, size_t count) | 518 | const char *buf, size_t count) |
519 | { | 519 | { |
520 | struct ad7877 *ts = dev_get_drvdata(dev); | 520 | struct ad7877 *ts = dev_get_drvdata(dev); |
521 | unsigned long val; | 521 | unsigned int val; |
522 | int error; | 522 | int error; |
523 | 523 | ||
524 | error = strict_strtoul(buf, 10, &val); | 524 | error = kstrtouint(buf, 10, &val); |
525 | if (error) | 525 | if (error) |
526 | return error; | 526 | return error; |
527 | 527 | ||
@@ -548,10 +548,10 @@ static ssize_t ad7877_gpio3_store(struct device *dev, | |||
548 | const char *buf, size_t count) | 548 | const char *buf, size_t count) |
549 | { | 549 | { |
550 | struct ad7877 *ts = dev_get_drvdata(dev); | 550 | struct ad7877 *ts = dev_get_drvdata(dev); |
551 | unsigned long val; | 551 | unsigned int val; |
552 | int error; | 552 | int error; |
553 | 553 | ||
554 | error = strict_strtoul(buf, 10, &val); | 554 | error = kstrtouint(buf, 10, &val); |
555 | if (error) | 555 | if (error) |
556 | return error; | 556 | return error; |
557 | 557 | ||
@@ -579,10 +579,10 @@ static ssize_t ad7877_gpio4_store(struct device *dev, | |||
579 | const char *buf, size_t count) | 579 | const char *buf, size_t count) |
580 | { | 580 | { |
581 | struct ad7877 *ts = dev_get_drvdata(dev); | 581 | struct ad7877 *ts = dev_get_drvdata(dev); |
582 | unsigned long val; | 582 | unsigned int val; |
583 | int error; | 583 | int error; |
584 | 584 | ||
585 | error = strict_strtoul(buf, 10, &val); | 585 | error = kstrtouint(buf, 10, &val); |
586 | if (error) | 586 | if (error) |
587 | return error; | 587 | return error; |
588 | 588 | ||
@@ -853,7 +853,6 @@ static SIMPLE_DEV_PM_OPS(ad7877_pm, ad7877_suspend, ad7877_resume); | |||
853 | static struct spi_driver ad7877_driver = { | 853 | static struct spi_driver ad7877_driver = { |
854 | .driver = { | 854 | .driver = { |
855 | .name = "ad7877", | 855 | .name = "ad7877", |
856 | .bus = &spi_bus_type, | ||
857 | .owner = THIS_MODULE, | 856 | .owner = THIS_MODULE, |
858 | .pm = &ad7877_pm, | 857 | .pm = &ad7877_pm, |
859 | }, | 858 | }, |
diff --git a/drivers/input/touchscreen/ad7879-i2c.c b/drivers/input/touchscreen/ad7879-i2c.c index c789b974c795..0dac6712f42b 100644 --- a/drivers/input/touchscreen/ad7879-i2c.c +++ b/drivers/input/touchscreen/ad7879-i2c.c | |||
@@ -16,30 +16,6 @@ | |||
16 | 16 | ||
17 | #define AD7879_DEVID 0x79 /* AD7879-1/AD7889-1 */ | 17 | #define AD7879_DEVID 0x79 /* AD7879-1/AD7889-1 */ |
18 | 18 | ||
19 | #ifdef CONFIG_PM_SLEEP | ||
20 | static int ad7879_i2c_suspend(struct device *dev) | ||
21 | { | ||
22 | struct i2c_client *client = to_i2c_client(dev); | ||
23 | struct ad7879 *ts = i2c_get_clientdata(client); | ||
24 | |||
25 | ad7879_suspend(ts); | ||
26 | |||
27 | return 0; | ||
28 | } | ||
29 | |||
30 | static int ad7879_i2c_resume(struct device *dev) | ||
31 | { | ||
32 | struct i2c_client *client = to_i2c_client(dev); | ||
33 | struct ad7879 *ts = i2c_get_clientdata(client); | ||
34 | |||
35 | ad7879_resume(ts); | ||
36 | |||
37 | return 0; | ||
38 | } | ||
39 | #endif | ||
40 | |||
41 | static SIMPLE_DEV_PM_OPS(ad7879_i2c_pm, ad7879_i2c_suspend, ad7879_i2c_resume); | ||
42 | |||
43 | /* All registers are word-sized. | 19 | /* All registers are word-sized. |
44 | * AD7879 uses a high-byte first convention. | 20 | * AD7879 uses a high-byte first convention. |
45 | */ | 21 | */ |
@@ -47,7 +23,7 @@ static int ad7879_i2c_read(struct device *dev, u8 reg) | |||
47 | { | 23 | { |
48 | struct i2c_client *client = to_i2c_client(dev); | 24 | struct i2c_client *client = to_i2c_client(dev); |
49 | 25 | ||
50 | return swab16(i2c_smbus_read_word_data(client, reg)); | 26 | return i2c_smbus_read_word_swapped(client, reg); |
51 | } | 27 | } |
52 | 28 | ||
53 | static int ad7879_i2c_multi_read(struct device *dev, | 29 | static int ad7879_i2c_multi_read(struct device *dev, |
@@ -68,7 +44,7 @@ static int ad7879_i2c_write(struct device *dev, u8 reg, u16 val) | |||
68 | { | 44 | { |
69 | struct i2c_client *client = to_i2c_client(dev); | 45 | struct i2c_client *client = to_i2c_client(dev); |
70 | 46 | ||
71 | return i2c_smbus_write_word_data(client, reg, swab16(val)); | 47 | return i2c_smbus_write_word_swapped(client, reg, val); |
72 | } | 48 | } |
73 | 49 | ||
74 | static const struct ad7879_bus_ops ad7879_i2c_bus_ops = { | 50 | static const struct ad7879_bus_ops ad7879_i2c_bus_ops = { |
@@ -119,7 +95,7 @@ static struct i2c_driver ad7879_i2c_driver = { | |||
119 | .driver = { | 95 | .driver = { |
120 | .name = "ad7879", | 96 | .name = "ad7879", |
121 | .owner = THIS_MODULE, | 97 | .owner = THIS_MODULE, |
122 | .pm = &ad7879_i2c_pm, | 98 | .pm = &ad7879_pm_ops, |
123 | }, | 99 | }, |
124 | .probe = ad7879_i2c_probe, | 100 | .probe = ad7879_i2c_probe, |
125 | .remove = __devexit_p(ad7879_i2c_remove), | 101 | .remove = __devexit_p(ad7879_i2c_remove), |
@@ -141,4 +117,3 @@ module_exit(ad7879_i2c_exit); | |||
141 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); | 117 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); |
142 | MODULE_DESCRIPTION("AD7879(-1) touchscreen I2C bus driver"); | 118 | MODULE_DESCRIPTION("AD7879(-1) touchscreen I2C bus driver"); |
143 | MODULE_LICENSE("GPL"); | 119 | MODULE_LICENSE("GPL"); |
144 | MODULE_ALIAS("i2c:ad7879"); | ||
diff --git a/drivers/input/touchscreen/ad7879-spi.c b/drivers/input/touchscreen/ad7879-spi.c index b1643c8fa7c9..9b2e1c2b1971 100644 --- a/drivers/input/touchscreen/ad7879-spi.c +++ b/drivers/input/touchscreen/ad7879-spi.c | |||
@@ -22,30 +22,6 @@ | |||
22 | #define AD7879_WRITECMD(reg) (AD7879_CMD(reg)) | 22 | #define AD7879_WRITECMD(reg) (AD7879_CMD(reg)) |
23 | #define AD7879_READCMD(reg) (AD7879_CMD(reg) | AD7879_CMD_READ) | 23 | #define AD7879_READCMD(reg) (AD7879_CMD(reg) | AD7879_CMD_READ) |
24 | 24 | ||
25 | #ifdef CONFIG_PM_SLEEP | ||
26 | static int ad7879_spi_suspend(struct device *dev) | ||
27 | { | ||
28 | struct spi_device *spi = to_spi_device(dev); | ||
29 | struct ad7879 *ts = spi_get_drvdata(spi); | ||
30 | |||
31 | ad7879_suspend(ts); | ||
32 | |||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | static int ad7879_spi_resume(struct device *dev) | ||
37 | { | ||
38 | struct spi_device *spi = to_spi_device(dev); | ||
39 | struct ad7879 *ts = spi_get_drvdata(spi); | ||
40 | |||
41 | ad7879_resume(ts); | ||
42 | |||
43 | return 0; | ||
44 | } | ||
45 | #endif | ||
46 | |||
47 | static SIMPLE_DEV_PM_OPS(ad7879_spi_pm, ad7879_spi_suspend, ad7879_spi_resume); | ||
48 | |||
49 | /* | 25 | /* |
50 | * ad7879_read/write are only used for initial setup and for sysfs controls. | 26 | * ad7879_read/write are only used for initial setup and for sysfs controls. |
51 | * The main traffic is done in ad7879_collect(). | 27 | * The main traffic is done in ad7879_collect(). |
@@ -174,9 +150,8 @@ static int __devexit ad7879_spi_remove(struct spi_device *spi) | |||
174 | static struct spi_driver ad7879_spi_driver = { | 150 | static struct spi_driver ad7879_spi_driver = { |
175 | .driver = { | 151 | .driver = { |
176 | .name = "ad7879", | 152 | .name = "ad7879", |
177 | .bus = &spi_bus_type, | ||
178 | .owner = THIS_MODULE, | 153 | .owner = THIS_MODULE, |
179 | .pm = &ad7879_spi_pm, | 154 | .pm = &ad7879_pm_ops, |
180 | }, | 155 | }, |
181 | .probe = ad7879_spi_probe, | 156 | .probe = ad7879_spi_probe, |
182 | .remove = __devexit_p(ad7879_spi_remove), | 157 | .remove = __devexit_p(ad7879_spi_remove), |
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index 3b2e9ed2aeec..e2482b40da51 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c | |||
@@ -281,8 +281,11 @@ static void ad7879_close(struct input_dev* input) | |||
281 | __ad7879_disable(ts); | 281 | __ad7879_disable(ts); |
282 | } | 282 | } |
283 | 283 | ||
284 | void ad7879_suspend(struct ad7879 *ts) | 284 | #ifdef CONFIG_PM_SLEEP |
285 | static int ad7879_suspend(struct device *dev) | ||
285 | { | 286 | { |
287 | struct ad7879 *ts = dev_get_drvdata(dev); | ||
288 | |||
286 | mutex_lock(&ts->input->mutex); | 289 | mutex_lock(&ts->input->mutex); |
287 | 290 | ||
288 | if (!ts->suspended && !ts->disabled && ts->input->users) | 291 | if (!ts->suspended && !ts->disabled && ts->input->users) |
@@ -291,11 +294,14 @@ void ad7879_suspend(struct ad7879 *ts) | |||
291 | ts->suspended = true; | 294 | ts->suspended = true; |
292 | 295 | ||
293 | mutex_unlock(&ts->input->mutex); | 296 | mutex_unlock(&ts->input->mutex); |
297 | |||
298 | return 0; | ||
294 | } | 299 | } |
295 | EXPORT_SYMBOL(ad7879_suspend); | ||
296 | 300 | ||
297 | void ad7879_resume(struct ad7879 *ts) | 301 | static int ad7879_resume(struct device *dev) |
298 | { | 302 | { |
303 | struct ad7879 *ts = dev_get_drvdata(dev); | ||
304 | |||
299 | mutex_lock(&ts->input->mutex); | 305 | mutex_lock(&ts->input->mutex); |
300 | 306 | ||
301 | if (ts->suspended && !ts->disabled && ts->input->users) | 307 | if (ts->suspended && !ts->disabled && ts->input->users) |
@@ -304,8 +310,13 @@ void ad7879_resume(struct ad7879 *ts) | |||
304 | ts->suspended = false; | 310 | ts->suspended = false; |
305 | 311 | ||
306 | mutex_unlock(&ts->input->mutex); | 312 | mutex_unlock(&ts->input->mutex); |
313 | |||
314 | return 0; | ||
307 | } | 315 | } |
308 | EXPORT_SYMBOL(ad7879_resume); | 316 | #endif |
317 | |||
318 | SIMPLE_DEV_PM_OPS(ad7879_pm_ops, ad7879_suspend, ad7879_resume); | ||
319 | EXPORT_SYMBOL(ad7879_pm_ops); | ||
309 | 320 | ||
310 | static void ad7879_toggle(struct ad7879 *ts, bool disable) | 321 | static void ad7879_toggle(struct ad7879 *ts, bool disable) |
311 | { | 322 | { |
@@ -340,10 +351,10 @@ static ssize_t ad7879_disable_store(struct device *dev, | |||
340 | const char *buf, size_t count) | 351 | const char *buf, size_t count) |
341 | { | 352 | { |
342 | struct ad7879 *ts = dev_get_drvdata(dev); | 353 | struct ad7879 *ts = dev_get_drvdata(dev); |
343 | unsigned long val; | 354 | unsigned int val; |
344 | int error; | 355 | int error; |
345 | 356 | ||
346 | error = strict_strtoul(buf, 10, &val); | 357 | error = kstrtouint(buf, 10, &val); |
347 | if (error) | 358 | if (error) |
348 | return error; | 359 | return error; |
349 | 360 | ||
diff --git a/drivers/input/touchscreen/ad7879.h b/drivers/input/touchscreen/ad7879.h index 6b45a27236c7..6fd13c48d373 100644 --- a/drivers/input/touchscreen/ad7879.h +++ b/drivers/input/touchscreen/ad7879.h | |||
@@ -21,8 +21,8 @@ struct ad7879_bus_ops { | |||
21 | int (*write)(struct device *dev, u8 reg, u16 val); | 21 | int (*write)(struct device *dev, u8 reg, u16 val); |
22 | }; | 22 | }; |
23 | 23 | ||
24 | void ad7879_suspend(struct ad7879 *); | 24 | extern const struct dev_pm_ops ad7879_pm_ops; |
25 | void ad7879_resume(struct ad7879 *); | 25 | |
26 | struct ad7879 *ad7879_probe(struct device *dev, u8 devid, unsigned irq, | 26 | struct ad7879 *ad7879_probe(struct device *dev, u8 devid, unsigned irq, |
27 | const struct ad7879_bus_ops *bops); | 27 | const struct ad7879_bus_ops *bops); |
28 | void ad7879_remove(struct ad7879 *); | 28 | void ad7879_remove(struct ad7879 *); |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index de31ec6fe9e4..23fd90185659 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -602,10 +602,12 @@ static ssize_t ads7846_disable_store(struct device *dev, | |||
602 | const char *buf, size_t count) | 602 | const char *buf, size_t count) |
603 | { | 603 | { |
604 | struct ads7846 *ts = dev_get_drvdata(dev); | 604 | struct ads7846 *ts = dev_get_drvdata(dev); |
605 | unsigned long i; | 605 | unsigned int i; |
606 | int err; | ||
606 | 607 | ||
607 | if (strict_strtoul(buf, 10, &i)) | 608 | err = kstrtouint(buf, 10, &i); |
608 | return -EINVAL; | 609 | if (err) |
610 | return err; | ||
609 | 611 | ||
610 | if (i) | 612 | if (i) |
611 | ads7846_disable(ts); | 613 | ads7846_disable(ts); |
@@ -1424,7 +1426,6 @@ static int __devexit ads7846_remove(struct spi_device *spi) | |||
1424 | static struct spi_driver ads7846_driver = { | 1426 | static struct spi_driver ads7846_driver = { |
1425 | .driver = { | 1427 | .driver = { |
1426 | .name = "ads7846", | 1428 | .name = "ads7846", |
1427 | .bus = &spi_bus_type, | ||
1428 | .owner = THIS_MODULE, | 1429 | .owner = THIS_MODULE, |
1429 | .pm = &ads7846_pm, | 1430 | .pm = &ads7846_pm, |
1430 | }, | 1431 | }, |
diff --git a/drivers/input/touchscreen/atmel-wm97xx.c b/drivers/input/touchscreen/atmel-wm97xx.c index 8034cbb20f74..d016cb26d125 100644 --- a/drivers/input/touchscreen/atmel-wm97xx.c +++ b/drivers/input/touchscreen/atmel-wm97xx.c | |||
@@ -429,18 +429,7 @@ static struct platform_driver atmel_wm97xx_driver = { | |||
429 | .suspend = atmel_wm97xx_suspend, | 429 | .suspend = atmel_wm97xx_suspend, |
430 | .resume = atmel_wm97xx_resume, | 430 | .resume = atmel_wm97xx_resume, |
431 | }; | 431 | }; |
432 | 432 | module_platform_driver(atmel_wm97xx_driver); | |
433 | static int __init atmel_wm97xx_init(void) | ||
434 | { | ||
435 | return platform_driver_probe(&atmel_wm97xx_driver, atmel_wm97xx_probe); | ||
436 | } | ||
437 | module_init(atmel_wm97xx_init); | ||
438 | |||
439 | static void __exit atmel_wm97xx_exit(void) | ||
440 | { | ||
441 | platform_driver_unregister(&atmel_wm97xx_driver); | ||
442 | } | ||
443 | module_exit(atmel_wm97xx_exit); | ||
444 | 433 | ||
445 | MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>"); | 434 | MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>"); |
446 | MODULE_DESCRIPTION("wm97xx continuous touch driver for Atmel AT91 and AVR32"); | 435 | MODULE_DESCRIPTION("wm97xx continuous touch driver for Atmel AT91 and AVR32"); |
diff --git a/drivers/input/touchscreen/atmel_tsadcc.c b/drivers/input/touchscreen/atmel_tsadcc.c index 122a87883659..201b2d2ec1b3 100644 --- a/drivers/input/touchscreen/atmel_tsadcc.c +++ b/drivers/input/touchscreen/atmel_tsadcc.c | |||
@@ -351,20 +351,7 @@ static struct platform_driver atmel_tsadcc_driver = { | |||
351 | .name = "atmel_tsadcc", | 351 | .name = "atmel_tsadcc", |
352 | }, | 352 | }, |
353 | }; | 353 | }; |
354 | 354 | module_platform_driver(atmel_tsadcc_driver); | |
355 | static int __init atmel_tsadcc_init(void) | ||
356 | { | ||
357 | return platform_driver_register(&atmel_tsadcc_driver); | ||
358 | } | ||
359 | |||
360 | static void __exit atmel_tsadcc_exit(void) | ||
361 | { | ||
362 | platform_driver_unregister(&atmel_tsadcc_driver); | ||
363 | } | ||
364 | |||
365 | module_init(atmel_tsadcc_init); | ||
366 | module_exit(atmel_tsadcc_exit); | ||
367 | |||
368 | 355 | ||
369 | MODULE_LICENSE("GPL"); | 356 | MODULE_LICENSE("GPL"); |
370 | MODULE_DESCRIPTION("Atmel TouchScreen Driver"); | 357 | MODULE_DESCRIPTION("Atmel TouchScreen Driver"); |
diff --git a/drivers/input/touchscreen/auo-pixcir-ts.c b/drivers/input/touchscreen/auo-pixcir-ts.c new file mode 100644 index 000000000000..94fb9fbb08a9 --- /dev/null +++ b/drivers/input/touchscreen/auo-pixcir-ts.c | |||
@@ -0,0 +1,652 @@ | |||
1 | /* | ||
2 | * Driver for AUO in-cell touchscreens | ||
3 | * | ||
4 | * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de> | ||
5 | * | ||
6 | * loosely based on auo_touch.c from Dell Streak vendor-kernel | ||
7 | * | ||
8 | * Copyright (c) 2008 QUALCOMM Incorporated. | ||
9 | * Copyright (c) 2008 QUALCOMM USA, INC. | ||
10 | * | ||
11 | * | ||
12 | * This software is licensed under the terms of the GNU General Public | ||
13 | * License version 2, as published by the Free Software Foundation, and | ||
14 | * may be copied, distributed, and modified under those terms. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/interrupt.h> | ||
26 | #include <linux/slab.h> | ||
27 | #include <linux/input.h> | ||
28 | #include <linux/jiffies.h> | ||
29 | #include <linux/i2c.h> | ||
30 | #include <linux/mutex.h> | ||
31 | #include <linux/delay.h> | ||
32 | #include <linux/gpio.h> | ||
33 | #include <linux/input/auo-pixcir-ts.h> | ||
34 | |||
35 | /* | ||
36 | * Coordinate calculation: | ||
37 | * X1 = X1_LSB + X1_MSB*256 | ||
38 | * Y1 = Y1_LSB + Y1_MSB*256 | ||
39 | * X2 = X2_LSB + X2_MSB*256 | ||
40 | * Y2 = Y2_LSB + Y2_MSB*256 | ||
41 | */ | ||
42 | #define AUO_PIXCIR_REG_X1_LSB 0x00 | ||
43 | #define AUO_PIXCIR_REG_X1_MSB 0x01 | ||
44 | #define AUO_PIXCIR_REG_Y1_LSB 0x02 | ||
45 | #define AUO_PIXCIR_REG_Y1_MSB 0x03 | ||
46 | #define AUO_PIXCIR_REG_X2_LSB 0x04 | ||
47 | #define AUO_PIXCIR_REG_X2_MSB 0x05 | ||
48 | #define AUO_PIXCIR_REG_Y2_LSB 0x06 | ||
49 | #define AUO_PIXCIR_REG_Y2_MSB 0x07 | ||
50 | |||
51 | #define AUO_PIXCIR_REG_STRENGTH 0x0d | ||
52 | #define AUO_PIXCIR_REG_STRENGTH_X1_LSB 0x0e | ||
53 | #define AUO_PIXCIR_REG_STRENGTH_X1_MSB 0x0f | ||
54 | |||
55 | #define AUO_PIXCIR_REG_RAW_DATA_X 0x2b | ||
56 | #define AUO_PIXCIR_REG_RAW_DATA_Y 0x4f | ||
57 | |||
58 | #define AUO_PIXCIR_REG_X_SENSITIVITY 0x6f | ||
59 | #define AUO_PIXCIR_REG_Y_SENSITIVITY 0x70 | ||
60 | #define AUO_PIXCIR_REG_INT_SETTING 0x71 | ||
61 | #define AUO_PIXCIR_REG_INT_WIDTH 0x72 | ||
62 | #define AUO_PIXCIR_REG_POWER_MODE 0x73 | ||
63 | |||
64 | #define AUO_PIXCIR_REG_VERSION 0x77 | ||
65 | #define AUO_PIXCIR_REG_CALIBRATE 0x78 | ||
66 | |||
67 | #define AUO_PIXCIR_REG_TOUCHAREA_X1 0x1e | ||
68 | #define AUO_PIXCIR_REG_TOUCHAREA_Y1 0x1f | ||
69 | #define AUO_PIXCIR_REG_TOUCHAREA_X2 0x20 | ||
70 | #define AUO_PIXCIR_REG_TOUCHAREA_Y2 0x21 | ||
71 | |||
72 | #define AUO_PIXCIR_REG_EEPROM_CALIB_X 0x42 | ||
73 | #define AUO_PIXCIR_REG_EEPROM_CALIB_Y 0xad | ||
74 | |||
75 | #define AUO_PIXCIR_INT_TPNUM_MASK 0xe0 | ||
76 | #define AUO_PIXCIR_INT_TPNUM_SHIFT 5 | ||
77 | #define AUO_PIXCIR_INT_RELEASE (1 << 4) | ||
78 | #define AUO_PIXCIR_INT_ENABLE (1 << 3) | ||
79 | #define AUO_PIXCIR_INT_POL_HIGH (1 << 2) | ||
80 | #define AUO_PIXCIR_INT_MODE_MASK 0x03 | ||
81 | |||
82 | /* | ||
83 | * Power modes: | ||
84 | * active: scan speed 60Hz | ||
85 | * sleep: scan speed 10Hz can be auto-activated, wakeup on 1st touch | ||
86 | * deep sleep: scan speed 1Hz can only be entered or left manually. | ||
87 | */ | ||
88 | #define AUO_PIXCIR_POWER_ACTIVE 0x00 | ||
89 | #define AUO_PIXCIR_POWER_SLEEP 0x01 | ||
90 | #define AUO_PIXCIR_POWER_DEEP_SLEEP 0x02 | ||
91 | #define AUO_PIXCIR_POWER_MASK 0x03 | ||
92 | |||
93 | #define AUO_PIXCIR_POWER_ALLOW_SLEEP (1 << 2) | ||
94 | #define AUO_PIXCIR_POWER_IDLE_TIME(ms) ((ms & 0xf) << 4) | ||
95 | |||
96 | #define AUO_PIXCIR_CALIBRATE 0x03 | ||
97 | |||
98 | #define AUO_PIXCIR_EEPROM_CALIB_X_LEN 62 | ||
99 | #define AUO_PIXCIR_EEPROM_CALIB_Y_LEN 36 | ||
100 | |||
101 | #define AUO_PIXCIR_RAW_DATA_X_LEN 18 | ||
102 | #define AUO_PIXCIR_RAW_DATA_Y_LEN 11 | ||
103 | |||
104 | #define AUO_PIXCIR_STRENGTH_ENABLE (1 << 0) | ||
105 | |||
106 | /* Touchscreen absolute values */ | ||
107 | #define AUO_PIXCIR_REPORT_POINTS 2 | ||
108 | #define AUO_PIXCIR_MAX_AREA 0xff | ||
109 | #define AUO_PIXCIR_PENUP_TIMEOUT_MS 10 | ||
110 | |||
111 | struct auo_pixcir_ts { | ||
112 | struct i2c_client *client; | ||
113 | struct input_dev *input; | ||
114 | char phys[32]; | ||
115 | |||
116 | /* special handling for touch_indicate interupt mode */ | ||
117 | bool touch_ind_mode; | ||
118 | |||
119 | wait_queue_head_t wait; | ||
120 | bool stopped; | ||
121 | }; | ||
122 | |||
123 | struct auo_point_t { | ||
124 | int coord_x; | ||
125 | int coord_y; | ||
126 | int area_major; | ||
127 | int area_minor; | ||
128 | int orientation; | ||
129 | }; | ||
130 | |||
131 | static int auo_pixcir_collect_data(struct auo_pixcir_ts *ts, | ||
132 | struct auo_point_t *point) | ||
133 | { | ||
134 | struct i2c_client *client = ts->client; | ||
135 | const struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data; | ||
136 | uint8_t raw_coord[8]; | ||
137 | uint8_t raw_area[4]; | ||
138 | int i, ret; | ||
139 | |||
140 | /* touch coordinates */ | ||
141 | ret = i2c_smbus_read_i2c_block_data(client, AUO_PIXCIR_REG_X1_LSB, | ||
142 | 8, raw_coord); | ||
143 | if (ret < 0) { | ||
144 | dev_err(&client->dev, "failed to read coordinate, %d\n", ret); | ||
145 | return ret; | ||
146 | } | ||
147 | |||
148 | /* touch area */ | ||
149 | ret = i2c_smbus_read_i2c_block_data(client, AUO_PIXCIR_REG_TOUCHAREA_X1, | ||
150 | 4, raw_area); | ||
151 | if (ret < 0) { | ||
152 | dev_err(&client->dev, "could not read touch area, %d\n", ret); | ||
153 | return ret; | ||
154 | } | ||
155 | |||
156 | for (i = 0; i < AUO_PIXCIR_REPORT_POINTS; i++) { | ||
157 | point[i].coord_x = | ||
158 | raw_coord[4 * i + 1] << 8 | raw_coord[4 * i]; | ||
159 | point[i].coord_y = | ||
160 | raw_coord[4 * i + 3] << 8 | raw_coord[4 * i + 2]; | ||
161 | |||
162 | if (point[i].coord_x > pdata->x_max || | ||
163 | point[i].coord_y > pdata->y_max) { | ||
164 | dev_warn(&client->dev, "coordinates (%d,%d) invalid\n", | ||
165 | point[i].coord_x, point[i].coord_y); | ||
166 | point[i].coord_x = point[i].coord_y = 0; | ||
167 | } | ||
168 | |||
169 | /* determine touch major, minor and orientation */ | ||
170 | point[i].area_major = max(raw_area[2 * i], raw_area[2 * i + 1]); | ||
171 | point[i].area_minor = min(raw_area[2 * i], raw_area[2 * i + 1]); | ||
172 | point[i].orientation = raw_area[2 * i] > raw_area[2 * i + 1]; | ||
173 | } | ||
174 | |||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | static irqreturn_t auo_pixcir_interrupt(int irq, void *dev_id) | ||
179 | { | ||
180 | struct auo_pixcir_ts *ts = dev_id; | ||
181 | struct i2c_client *client = ts->client; | ||
182 | const struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data; | ||
183 | struct auo_point_t point[AUO_PIXCIR_REPORT_POINTS]; | ||
184 | int i; | ||
185 | int ret; | ||
186 | int fingers = 0; | ||
187 | int abs = -1; | ||
188 | |||
189 | while (!ts->stopped) { | ||
190 | |||
191 | /* check for up event in touch touch_ind_mode */ | ||
192 | if (ts->touch_ind_mode) { | ||
193 | if (gpio_get_value(pdata->gpio_int) == 0) { | ||
194 | input_mt_sync(ts->input); | ||
195 | input_report_key(ts->input, BTN_TOUCH, 0); | ||
196 | input_sync(ts->input); | ||
197 | break; | ||
198 | } | ||
199 | } | ||
200 | |||
201 | ret = auo_pixcir_collect_data(ts, point); | ||
202 | if (ret < 0) { | ||
203 | /* we want to loop only in touch_ind_mode */ | ||
204 | if (!ts->touch_ind_mode) | ||
205 | break; | ||
206 | |||
207 | wait_event_timeout(ts->wait, ts->stopped, | ||
208 | msecs_to_jiffies(AUO_PIXCIR_PENUP_TIMEOUT_MS)); | ||
209 | continue; | ||
210 | } | ||
211 | |||
212 | for (i = 0; i < AUO_PIXCIR_REPORT_POINTS; i++) { | ||
213 | if (point[i].coord_x > 0 || point[i].coord_y > 0) { | ||
214 | input_report_abs(ts->input, ABS_MT_POSITION_X, | ||
215 | point[i].coord_x); | ||
216 | input_report_abs(ts->input, ABS_MT_POSITION_Y, | ||
217 | point[i].coord_y); | ||
218 | input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR, | ||
219 | point[i].area_major); | ||
220 | input_report_abs(ts->input, ABS_MT_TOUCH_MINOR, | ||
221 | point[i].area_minor); | ||
222 | input_report_abs(ts->input, ABS_MT_ORIENTATION, | ||
223 | point[i].orientation); | ||
224 | input_mt_sync(ts->input); | ||
225 | |||
226 | /* use first finger as source for singletouch */ | ||
227 | if (fingers == 0) | ||
228 | abs = i; | ||
229 | |||
230 | /* number of touch points could also be queried | ||
231 | * via i2c but would require an additional call | ||
232 | */ | ||
233 | fingers++; | ||
234 | } | ||
235 | } | ||
236 | |||
237 | input_report_key(ts->input, BTN_TOUCH, fingers > 0); | ||
238 | |||
239 | if (abs > -1) { | ||
240 | input_report_abs(ts->input, ABS_X, point[abs].coord_x); | ||
241 | input_report_abs(ts->input, ABS_Y, point[abs].coord_y); | ||
242 | } | ||
243 | |||
244 | input_sync(ts->input); | ||
245 | |||
246 | /* we want to loop only in touch_ind_mode */ | ||
247 | if (!ts->touch_ind_mode) | ||
248 | break; | ||
249 | |||
250 | wait_event_timeout(ts->wait, ts->stopped, | ||
251 | msecs_to_jiffies(AUO_PIXCIR_PENUP_TIMEOUT_MS)); | ||
252 | } | ||
253 | |||
254 | return IRQ_HANDLED; | ||
255 | } | ||
256 | |||
257 | /* | ||
258 | * Set the power mode of the device. | ||
259 | * Valid modes are | ||
260 | * - AUO_PIXCIR_POWER_ACTIVE | ||
261 | * - AUO_PIXCIR_POWER_SLEEP - automatically left on first touch | ||
262 | * - AUO_PIXCIR_POWER_DEEP_SLEEP | ||
263 | */ | ||
264 | static int auo_pixcir_power_mode(struct auo_pixcir_ts *ts, int mode) | ||
265 | { | ||
266 | struct i2c_client *client = ts->client; | ||
267 | int ret; | ||
268 | |||
269 | ret = i2c_smbus_read_byte_data(client, AUO_PIXCIR_REG_POWER_MODE); | ||
270 | if (ret < 0) { | ||
271 | dev_err(&client->dev, "unable to read reg %Xh, %d\n", | ||
272 | AUO_PIXCIR_REG_POWER_MODE, ret); | ||
273 | return ret; | ||
274 | } | ||
275 | |||
276 | ret &= ~AUO_PIXCIR_POWER_MASK; | ||
277 | ret |= mode; | ||
278 | |||
279 | ret = i2c_smbus_write_byte_data(client, AUO_PIXCIR_REG_POWER_MODE, ret); | ||
280 | if (ret) { | ||
281 | dev_err(&client->dev, "unable to write reg %Xh, %d\n", | ||
282 | AUO_PIXCIR_REG_POWER_MODE, ret); | ||
283 | return ret; | ||
284 | } | ||
285 | |||
286 | return 0; | ||
287 | } | ||
288 | |||
289 | static __devinit int auo_pixcir_int_config(struct auo_pixcir_ts *ts, | ||
290 | int int_setting) | ||
291 | { | ||
292 | struct i2c_client *client = ts->client; | ||
293 | struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data; | ||
294 | int ret; | ||
295 | |||
296 | ret = i2c_smbus_read_byte_data(client, AUO_PIXCIR_REG_INT_SETTING); | ||
297 | if (ret < 0) { | ||
298 | dev_err(&client->dev, "unable to read reg %Xh, %d\n", | ||
299 | AUO_PIXCIR_REG_INT_SETTING, ret); | ||
300 | return ret; | ||
301 | } | ||
302 | |||
303 | ret &= ~AUO_PIXCIR_INT_MODE_MASK; | ||
304 | ret |= int_setting; | ||
305 | ret |= AUO_PIXCIR_INT_POL_HIGH; /* always use high for interrupts */ | ||
306 | |||
307 | ret = i2c_smbus_write_byte_data(client, AUO_PIXCIR_REG_INT_SETTING, | ||
308 | ret); | ||
309 | if (ret < 0) { | ||
310 | dev_err(&client->dev, "unable to write reg %Xh, %d\n", | ||
311 | AUO_PIXCIR_REG_INT_SETTING, ret); | ||
312 | return ret; | ||
313 | } | ||
314 | |||
315 | ts->touch_ind_mode = pdata->int_setting == AUO_PIXCIR_INT_TOUCH_IND; | ||
316 | |||
317 | return 0; | ||
318 | } | ||
319 | |||
320 | /* control the generation of interrupts on the device side */ | ||
321 | static int auo_pixcir_int_toggle(struct auo_pixcir_ts *ts, bool enable) | ||
322 | { | ||
323 | struct i2c_client *client = ts->client; | ||
324 | int ret; | ||
325 | |||
326 | ret = i2c_smbus_read_byte_data(client, AUO_PIXCIR_REG_INT_SETTING); | ||
327 | if (ret < 0) { | ||
328 | dev_err(&client->dev, "unable to read reg %Xh, %d\n", | ||
329 | AUO_PIXCIR_REG_INT_SETTING, ret); | ||
330 | return ret; | ||
331 | } | ||
332 | |||
333 | if (enable) | ||
334 | ret |= AUO_PIXCIR_INT_ENABLE; | ||
335 | else | ||
336 | ret &= ~AUO_PIXCIR_INT_ENABLE; | ||
337 | |||
338 | ret = i2c_smbus_write_byte_data(client, AUO_PIXCIR_REG_INT_SETTING, | ||
339 | ret); | ||
340 | if (ret < 0) { | ||
341 | dev_err(&client->dev, "unable to write reg %Xh, %d\n", | ||
342 | AUO_PIXCIR_REG_INT_SETTING, ret); | ||
343 | return ret; | ||
344 | } | ||
345 | |||
346 | return 0; | ||
347 | } | ||
348 | |||
349 | static int auo_pixcir_start(struct auo_pixcir_ts *ts) | ||
350 | { | ||
351 | struct i2c_client *client = ts->client; | ||
352 | int ret; | ||
353 | |||
354 | ret = auo_pixcir_power_mode(ts, AUO_PIXCIR_POWER_ACTIVE); | ||
355 | if (ret < 0) { | ||
356 | dev_err(&client->dev, "could not set power mode, %d\n", | ||
357 | ret); | ||
358 | return ret; | ||
359 | } | ||
360 | |||
361 | ts->stopped = false; | ||
362 | mb(); | ||
363 | enable_irq(client->irq); | ||
364 | |||
365 | ret = auo_pixcir_int_toggle(ts, 1); | ||
366 | if (ret < 0) { | ||
367 | dev_err(&client->dev, "could not enable interrupt, %d\n", | ||
368 | ret); | ||
369 | disable_irq(client->irq); | ||
370 | return ret; | ||
371 | } | ||
372 | |||
373 | return 0; | ||
374 | } | ||
375 | |||
376 | static int auo_pixcir_stop(struct auo_pixcir_ts *ts) | ||
377 | { | ||
378 | struct i2c_client *client = ts->client; | ||
379 | int ret; | ||
380 | |||
381 | ret = auo_pixcir_int_toggle(ts, 0); | ||
382 | if (ret < 0) { | ||
383 | dev_err(&client->dev, "could not disable interrupt, %d\n", | ||
384 | ret); | ||
385 | return ret; | ||
386 | } | ||
387 | |||
388 | /* disable receiving of interrupts */ | ||
389 | disable_irq(client->irq); | ||
390 | ts->stopped = true; | ||
391 | mb(); | ||
392 | wake_up(&ts->wait); | ||
393 | |||
394 | return auo_pixcir_power_mode(ts, AUO_PIXCIR_POWER_DEEP_SLEEP); | ||
395 | } | ||
396 | |||
397 | static int auo_pixcir_input_open(struct input_dev *dev) | ||
398 | { | ||
399 | struct auo_pixcir_ts *ts = input_get_drvdata(dev); | ||
400 | int ret; | ||
401 | |||
402 | ret = auo_pixcir_start(ts); | ||
403 | if (ret) | ||
404 | return ret; | ||
405 | |||
406 | return 0; | ||
407 | } | ||
408 | |||
409 | static void auo_pixcir_input_close(struct input_dev *dev) | ||
410 | { | ||
411 | struct auo_pixcir_ts *ts = input_get_drvdata(dev); | ||
412 | |||
413 | auo_pixcir_stop(ts); | ||
414 | |||
415 | return; | ||
416 | } | ||
417 | |||
418 | #ifdef CONFIG_PM_SLEEP | ||
419 | static int auo_pixcir_suspend(struct device *dev) | ||
420 | { | ||
421 | struct i2c_client *client = to_i2c_client(dev); | ||
422 | struct auo_pixcir_ts *ts = i2c_get_clientdata(client); | ||
423 | struct input_dev *input = ts->input; | ||
424 | int ret = 0; | ||
425 | |||
426 | mutex_lock(&input->mutex); | ||
427 | |||
428 | /* when configured as wakeup source, device should always wake system | ||
429 | * therefore start device if necessary | ||
430 | */ | ||
431 | if (device_may_wakeup(&client->dev)) { | ||
432 | /* need to start device if not open, to be wakeup source */ | ||
433 | if (!input->users) { | ||
434 | ret = auo_pixcir_start(ts); | ||
435 | if (ret) | ||
436 | goto unlock; | ||
437 | } | ||
438 | |||
439 | enable_irq_wake(client->irq); | ||
440 | ret = auo_pixcir_power_mode(ts, AUO_PIXCIR_POWER_SLEEP); | ||
441 | } else if (input->users) { | ||
442 | ret = auo_pixcir_stop(ts); | ||
443 | } | ||
444 | |||
445 | unlock: | ||
446 | mutex_unlock(&input->mutex); | ||
447 | |||
448 | return ret; | ||
449 | } | ||
450 | |||
451 | static int auo_pixcir_resume(struct device *dev) | ||
452 | { | ||
453 | struct i2c_client *client = to_i2c_client(dev); | ||
454 | struct auo_pixcir_ts *ts = i2c_get_clientdata(client); | ||
455 | struct input_dev *input = ts->input; | ||
456 | int ret = 0; | ||
457 | |||
458 | mutex_lock(&input->mutex); | ||
459 | |||
460 | if (device_may_wakeup(&client->dev)) { | ||
461 | disable_irq_wake(client->irq); | ||
462 | |||
463 | /* need to stop device if it was not open on suspend */ | ||
464 | if (!input->users) { | ||
465 | ret = auo_pixcir_stop(ts); | ||
466 | if (ret) | ||
467 | goto unlock; | ||
468 | } | ||
469 | |||
470 | /* device wakes automatically from SLEEP */ | ||
471 | } else if (input->users) { | ||
472 | ret = auo_pixcir_start(ts); | ||
473 | } | ||
474 | |||
475 | unlock: | ||
476 | mutex_unlock(&input->mutex); | ||
477 | |||
478 | return ret; | ||
479 | } | ||
480 | #endif | ||
481 | |||
482 | static SIMPLE_DEV_PM_OPS(auo_pixcir_pm_ops, auo_pixcir_suspend, | ||
483 | auo_pixcir_resume); | ||
484 | |||
485 | static int __devinit auo_pixcir_probe(struct i2c_client *client, | ||
486 | const struct i2c_device_id *id) | ||
487 | { | ||
488 | const struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data; | ||
489 | struct auo_pixcir_ts *ts; | ||
490 | struct input_dev *input_dev; | ||
491 | int ret; | ||
492 | |||
493 | if (!pdata) | ||
494 | return -EINVAL; | ||
495 | |||
496 | ts = kzalloc(sizeof(struct auo_pixcir_ts), GFP_KERNEL); | ||
497 | if (!ts) | ||
498 | return -ENOMEM; | ||
499 | |||
500 | ret = gpio_request(pdata->gpio_int, "auo_pixcir_ts_int"); | ||
501 | if (ret) { | ||
502 | dev_err(&client->dev, "request of gpio %d failed, %d\n", | ||
503 | pdata->gpio_int, ret); | ||
504 | goto err_gpio_int; | ||
505 | } | ||
506 | |||
507 | if (pdata->init_hw) | ||
508 | pdata->init_hw(client); | ||
509 | |||
510 | ts->client = client; | ||
511 | ts->touch_ind_mode = 0; | ||
512 | init_waitqueue_head(&ts->wait); | ||
513 | |||
514 | snprintf(ts->phys, sizeof(ts->phys), | ||
515 | "%s/input0", dev_name(&client->dev)); | ||
516 | |||
517 | input_dev = input_allocate_device(); | ||
518 | if (!input_dev) { | ||
519 | dev_err(&client->dev, "could not allocate input device\n"); | ||
520 | goto err_input_alloc; | ||
521 | } | ||
522 | |||
523 | ts->input = input_dev; | ||
524 | |||
525 | input_dev->name = "AUO-Pixcir touchscreen"; | ||
526 | input_dev->phys = ts->phys; | ||
527 | input_dev->id.bustype = BUS_I2C; | ||
528 | input_dev->dev.parent = &client->dev; | ||
529 | |||
530 | input_dev->open = auo_pixcir_input_open; | ||
531 | input_dev->close = auo_pixcir_input_close; | ||
532 | |||
533 | __set_bit(EV_ABS, input_dev->evbit); | ||
534 | __set_bit(EV_KEY, input_dev->evbit); | ||
535 | |||
536 | __set_bit(BTN_TOUCH, input_dev->keybit); | ||
537 | |||
538 | /* For single touch */ | ||
539 | input_set_abs_params(input_dev, ABS_X, 0, pdata->x_max, 0, 0); | ||
540 | input_set_abs_params(input_dev, ABS_Y, 0, pdata->y_max, 0, 0); | ||
541 | |||
542 | /* For multi touch */ | ||
543 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, | ||
544 | pdata->x_max, 0, 0); | ||
545 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, | ||
546 | pdata->y_max, 0, 0); | ||
547 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, | ||
548 | AUO_PIXCIR_MAX_AREA, 0, 0); | ||
549 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, | ||
550 | AUO_PIXCIR_MAX_AREA, 0, 0); | ||
551 | input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0); | ||
552 | |||
553 | ret = i2c_smbus_read_byte_data(client, AUO_PIXCIR_REG_VERSION); | ||
554 | if (ret < 0) | ||
555 | goto err_fw_vers; | ||
556 | dev_info(&client->dev, "firmware version 0x%X\n", ret); | ||
557 | |||
558 | ret = auo_pixcir_int_config(ts, pdata->int_setting); | ||
559 | if (ret) | ||
560 | goto err_fw_vers; | ||
561 | |||
562 | input_set_drvdata(ts->input, ts); | ||
563 | ts->stopped = true; | ||
564 | |||
565 | ret = request_threaded_irq(client->irq, NULL, auo_pixcir_interrupt, | ||
566 | IRQF_TRIGGER_RISING | IRQF_ONESHOT, | ||
567 | input_dev->name, ts); | ||
568 | if (ret) { | ||
569 | dev_err(&client->dev, "irq %d requested failed\n", client->irq); | ||
570 | goto err_fw_vers; | ||
571 | } | ||
572 | |||
573 | /* stop device and put it into deep sleep until it is opened */ | ||
574 | ret = auo_pixcir_stop(ts); | ||
575 | if (ret < 0) | ||
576 | goto err_input_register; | ||
577 | |||
578 | ret = input_register_device(input_dev); | ||
579 | if (ret) { | ||
580 | dev_err(&client->dev, "could not register input device\n"); | ||
581 | goto err_input_register; | ||
582 | } | ||
583 | |||
584 | i2c_set_clientdata(client, ts); | ||
585 | |||
586 | return 0; | ||
587 | |||
588 | err_input_register: | ||
589 | free_irq(client->irq, ts); | ||
590 | err_fw_vers: | ||
591 | input_free_device(input_dev); | ||
592 | err_input_alloc: | ||
593 | if (pdata->exit_hw) | ||
594 | pdata->exit_hw(client); | ||
595 | gpio_free(pdata->gpio_int); | ||
596 | err_gpio_int: | ||
597 | kfree(ts); | ||
598 | |||
599 | return ret; | ||
600 | } | ||
601 | |||
602 | static int __devexit auo_pixcir_remove(struct i2c_client *client) | ||
603 | { | ||
604 | struct auo_pixcir_ts *ts = i2c_get_clientdata(client); | ||
605 | const struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data; | ||
606 | |||
607 | free_irq(client->irq, ts); | ||
608 | |||
609 | input_unregister_device(ts->input); | ||
610 | |||
611 | if (pdata->exit_hw) | ||
612 | pdata->exit_hw(client); | ||
613 | |||
614 | gpio_free(pdata->gpio_int); | ||
615 | |||
616 | kfree(ts); | ||
617 | |||
618 | return 0; | ||
619 | } | ||
620 | |||
621 | static const struct i2c_device_id auo_pixcir_idtable[] = { | ||
622 | { "auo_pixcir_ts", 0 }, | ||
623 | { } | ||
624 | }; | ||
625 | MODULE_DEVICE_TABLE(i2c, auo_pixcir_idtable); | ||
626 | |||
627 | static struct i2c_driver auo_pixcir_driver = { | ||
628 | .driver = { | ||
629 | .owner = THIS_MODULE, | ||
630 | .name = "auo_pixcir_ts", | ||
631 | .pm = &auo_pixcir_pm_ops, | ||
632 | }, | ||
633 | .probe = auo_pixcir_probe, | ||
634 | .remove = __devexit_p(auo_pixcir_remove), | ||
635 | .id_table = auo_pixcir_idtable, | ||
636 | }; | ||
637 | |||
638 | static int __init auo_pixcir_init(void) | ||
639 | { | ||
640 | return i2c_add_driver(&auo_pixcir_driver); | ||
641 | } | ||
642 | module_init(auo_pixcir_init); | ||
643 | |||
644 | static void __exit auo_pixcir_exit(void) | ||
645 | { | ||
646 | i2c_del_driver(&auo_pixcir_driver); | ||
647 | } | ||
648 | module_exit(auo_pixcir_exit); | ||
649 | |||
650 | MODULE_DESCRIPTION("AUO-PIXCIR touchscreen driver"); | ||
651 | MODULE_LICENSE("GPL v2"); | ||
652 | MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>"); | ||
diff --git a/drivers/input/touchscreen/da9034-ts.c b/drivers/input/touchscreen/da9034-ts.c index 2b72a5923c16..36b65cf10d7f 100644 --- a/drivers/input/touchscreen/da9034-ts.c +++ b/drivers/input/touchscreen/da9034-ts.c | |||
@@ -379,18 +379,7 @@ static struct platform_driver da9034_touch_driver = { | |||
379 | .probe = da9034_touch_probe, | 379 | .probe = da9034_touch_probe, |
380 | .remove = __devexit_p(da9034_touch_remove), | 380 | .remove = __devexit_p(da9034_touch_remove), |
381 | }; | 381 | }; |
382 | 382 | module_platform_driver(da9034_touch_driver); | |
383 | static int __init da9034_touch_init(void) | ||
384 | { | ||
385 | return platform_driver_register(&da9034_touch_driver); | ||
386 | } | ||
387 | module_init(da9034_touch_init); | ||
388 | |||
389 | static void __exit da9034_touch_exit(void) | ||
390 | { | ||
391 | platform_driver_unregister(&da9034_touch_driver); | ||
392 | } | ||
393 | module_exit(da9034_touch_exit); | ||
394 | 383 | ||
395 | MODULE_DESCRIPTION("Touchscreen driver for Dialog Semiconductor DA9034"); | 384 | MODULE_DESCRIPTION("Touchscreen driver for Dialog Semiconductor DA9034"); |
396 | MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>, Bin Yang <bin.yang@marvell.com>"); | 385 | MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>, Bin Yang <bin.yang@marvell.com>"); |
diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c new file mode 100644 index 000000000000..eadcc2e83c77 --- /dev/null +++ b/drivers/input/touchscreen/egalax_ts.c | |||
@@ -0,0 +1,303 @@ | |||
1 | /* | ||
2 | * Driver for EETI eGalax Multiple Touch Controller | ||
3 | * | ||
4 | * Copyright (C) 2011 Freescale Semiconductor, Inc. | ||
5 | * | ||
6 | * based on max11801_ts.c | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | /* EETI eGalax serial touch screen controller is a I2C based multiple | ||
14 | * touch screen controller, it supports 5 point multiple touch. */ | ||
15 | |||
16 | /* TODO: | ||
17 | - auto idle mode support | ||
18 | */ | ||
19 | |||
20 | #include <linux/module.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/i2c.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/input.h> | ||
25 | #include <linux/irq.h> | ||
26 | #include <linux/gpio.h> | ||
27 | #include <linux/delay.h> | ||
28 | #include <linux/slab.h> | ||
29 | #include <linux/bitops.h> | ||
30 | #include <linux/input/mt.h> | ||
31 | |||
32 | /* | ||
33 | * Mouse Mode: some panel may configure the controller to mouse mode, | ||
34 | * which can only report one point at a given time. | ||
35 | * This driver will ignore events in this mode. | ||
36 | */ | ||
37 | #define REPORT_MODE_MOUSE 0x1 | ||
38 | /* | ||
39 | * Vendor Mode: this mode is used to transfer some vendor specific | ||
40 | * messages. | ||
41 | * This driver will ignore events in this mode. | ||
42 | */ | ||
43 | #define REPORT_MODE_VENDOR 0x3 | ||
44 | /* Multiple Touch Mode */ | ||
45 | #define REPORT_MODE_MTTOUCH 0x4 | ||
46 | |||
47 | #define MAX_SUPPORT_POINTS 5 | ||
48 | |||
49 | #define EVENT_VALID_OFFSET 7 | ||
50 | #define EVENT_VALID_MASK (0x1 << EVENT_VALID_OFFSET) | ||
51 | #define EVENT_ID_OFFSET 2 | ||
52 | #define EVENT_ID_MASK (0xf << EVENT_ID_OFFSET) | ||
53 | #define EVENT_IN_RANGE (0x1 << 1) | ||
54 | #define EVENT_DOWN_UP (0X1 << 0) | ||
55 | |||
56 | #define MAX_I2C_DATA_LEN 10 | ||
57 | |||
58 | #define EGALAX_MAX_X 32760 | ||
59 | #define EGALAX_MAX_Y 32760 | ||
60 | #define EGALAX_MAX_TRIES 100 | ||
61 | |||
62 | struct egalax_ts { | ||
63 | struct i2c_client *client; | ||
64 | struct input_dev *input_dev; | ||
65 | }; | ||
66 | |||
67 | static irqreturn_t egalax_ts_interrupt(int irq, void *dev_id) | ||
68 | { | ||
69 | struct egalax_ts *ts = dev_id; | ||
70 | struct input_dev *input_dev = ts->input_dev; | ||
71 | struct i2c_client *client = ts->client; | ||
72 | u8 buf[MAX_I2C_DATA_LEN]; | ||
73 | int id, ret, x, y, z; | ||
74 | int tries = 0; | ||
75 | bool down, valid; | ||
76 | u8 state; | ||
77 | |||
78 | do { | ||
79 | ret = i2c_master_recv(client, buf, MAX_I2C_DATA_LEN); | ||
80 | } while (ret == -EAGAIN && tries++ < EGALAX_MAX_TRIES); | ||
81 | |||
82 | if (ret < 0) | ||
83 | return IRQ_HANDLED; | ||
84 | |||
85 | if (buf[0] != REPORT_MODE_MTTOUCH) { | ||
86 | /* ignore mouse events and vendor events */ | ||
87 | return IRQ_HANDLED; | ||
88 | } | ||
89 | |||
90 | state = buf[1]; | ||
91 | x = (buf[3] << 8) | buf[2]; | ||
92 | y = (buf[5] << 8) | buf[4]; | ||
93 | z = (buf[7] << 8) | buf[6]; | ||
94 | |||
95 | valid = state & EVENT_VALID_MASK; | ||
96 | id = (state & EVENT_ID_MASK) >> EVENT_ID_OFFSET; | ||
97 | down = state & EVENT_DOWN_UP; | ||
98 | |||
99 | if (!valid || id > MAX_SUPPORT_POINTS) { | ||
100 | dev_dbg(&client->dev, "point invalid\n"); | ||
101 | return IRQ_HANDLED; | ||
102 | } | ||
103 | |||
104 | input_mt_slot(input_dev, id); | ||
105 | input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, down); | ||
106 | |||
107 | dev_dbg(&client->dev, "%s id:%d x:%d y:%d z:%d", | ||
108 | down ? "down" : "up", id, x, y, z); | ||
109 | |||
110 | if (down) { | ||
111 | input_report_abs(input_dev, ABS_MT_POSITION_X, x); | ||
112 | input_report_abs(input_dev, ABS_MT_POSITION_Y, y); | ||
113 | input_report_abs(input_dev, ABS_MT_PRESSURE, z); | ||
114 | } | ||
115 | |||
116 | input_mt_report_pointer_emulation(input_dev, true); | ||
117 | input_sync(input_dev); | ||
118 | |||
119 | return IRQ_HANDLED; | ||
120 | } | ||
121 | |||
122 | /* wake up controller by an falling edge of interrupt gpio. */ | ||
123 | static int egalax_wake_up_device(struct i2c_client *client) | ||
124 | { | ||
125 | int gpio = irq_to_gpio(client->irq); | ||
126 | int ret; | ||
127 | |||
128 | ret = gpio_request(gpio, "egalax_irq"); | ||
129 | if (ret < 0) { | ||
130 | dev_err(&client->dev, | ||
131 | "request gpio failed, cannot wake up controller: %d\n", | ||
132 | ret); | ||
133 | return ret; | ||
134 | } | ||
135 | |||
136 | /* wake up controller via an falling edge on IRQ gpio. */ | ||
137 | gpio_direction_output(gpio, 0); | ||
138 | gpio_set_value(gpio, 1); | ||
139 | |||
140 | /* controller should be waken up, return irq. */ | ||
141 | gpio_direction_input(gpio); | ||
142 | gpio_free(gpio); | ||
143 | |||
144 | return 0; | ||
145 | } | ||
146 | |||
147 | static int __devinit egalax_firmware_version(struct i2c_client *client) | ||
148 | { | ||
149 | static const u8 cmd[MAX_I2C_DATA_LEN] = { 0x03, 0x03, 0xa, 0x01, 0x41 }; | ||
150 | int ret; | ||
151 | |||
152 | ret = i2c_master_send(client, cmd, MAX_I2C_DATA_LEN); | ||
153 | if (ret < 0) | ||
154 | return ret; | ||
155 | |||
156 | return 0; | ||
157 | } | ||
158 | |||
159 | static int __devinit egalax_ts_probe(struct i2c_client *client, | ||
160 | const struct i2c_device_id *id) | ||
161 | { | ||
162 | struct egalax_ts *ts; | ||
163 | struct input_dev *input_dev; | ||
164 | int ret; | ||
165 | int error; | ||
166 | |||
167 | ts = kzalloc(sizeof(struct egalax_ts), GFP_KERNEL); | ||
168 | if (!ts) { | ||
169 | dev_err(&client->dev, "Failed to allocate memory\n"); | ||
170 | return -ENOMEM; | ||
171 | } | ||
172 | |||
173 | input_dev = input_allocate_device(); | ||
174 | if (!input_dev) { | ||
175 | dev_err(&client->dev, "Failed to allocate memory\n"); | ||
176 | error = -ENOMEM; | ||
177 | goto err_free_ts; | ||
178 | } | ||
179 | |||
180 | ts->client = client; | ||
181 | ts->input_dev = input_dev; | ||
182 | |||
183 | /* controller may be in sleep, wake it up. */ | ||
184 | egalax_wake_up_device(client); | ||
185 | |||
186 | ret = egalax_firmware_version(client); | ||
187 | if (ret < 0) { | ||
188 | dev_err(&client->dev, "Failed to read firmware version\n"); | ||
189 | error = -EIO; | ||
190 | goto err_free_dev; | ||
191 | } | ||
192 | |||
193 | input_dev->name = "EETI eGalax Touch Screen"; | ||
194 | input_dev->id.bustype = BUS_I2C; | ||
195 | input_dev->dev.parent = &client->dev; | ||
196 | |||
197 | __set_bit(EV_ABS, input_dev->evbit); | ||
198 | __set_bit(EV_KEY, input_dev->evbit); | ||
199 | __set_bit(BTN_TOUCH, input_dev->keybit); | ||
200 | |||
201 | input_set_abs_params(input_dev, ABS_X, 0, EGALAX_MAX_X, 0, 0); | ||
202 | input_set_abs_params(input_dev, ABS_Y, 0, EGALAX_MAX_Y, 0, 0); | ||
203 | input_set_abs_params(input_dev, | ||
204 | ABS_MT_POSITION_X, 0, EGALAX_MAX_X, 0, 0); | ||
205 | input_set_abs_params(input_dev, | ||
206 | ABS_MT_POSITION_X, 0, EGALAX_MAX_Y, 0, 0); | ||
207 | input_mt_init_slots(input_dev, MAX_SUPPORT_POINTS); | ||
208 | |||
209 | input_set_drvdata(input_dev, ts); | ||
210 | |||
211 | error = request_threaded_irq(client->irq, NULL, egalax_ts_interrupt, | ||
212 | IRQF_TRIGGER_LOW | IRQF_ONESHOT, | ||
213 | "egalax_ts", ts); | ||
214 | if (error < 0) { | ||
215 | dev_err(&client->dev, "Failed to register interrupt\n"); | ||
216 | goto err_free_dev; | ||
217 | } | ||
218 | |||
219 | error = input_register_device(ts->input_dev); | ||
220 | if (error) | ||
221 | goto err_free_irq; | ||
222 | |||
223 | i2c_set_clientdata(client, ts); | ||
224 | return 0; | ||
225 | |||
226 | err_free_irq: | ||
227 | free_irq(client->irq, ts); | ||
228 | err_free_dev: | ||
229 | input_free_device(input_dev); | ||
230 | err_free_ts: | ||
231 | kfree(ts); | ||
232 | |||
233 | return error; | ||
234 | } | ||
235 | |||
236 | static __devexit int egalax_ts_remove(struct i2c_client *client) | ||
237 | { | ||
238 | struct egalax_ts *ts = i2c_get_clientdata(client); | ||
239 | |||
240 | free_irq(client->irq, ts); | ||
241 | |||
242 | input_unregister_device(ts->input_dev); | ||
243 | kfree(ts); | ||
244 | |||
245 | return 0; | ||
246 | } | ||
247 | |||
248 | static const struct i2c_device_id egalax_ts_id[] = { | ||
249 | { "egalax_ts", 0 }, | ||
250 | { } | ||
251 | }; | ||
252 | MODULE_DEVICE_TABLE(i2c, egalax_ts_id); | ||
253 | |||
254 | #ifdef CONFIG_PM_SLEEP | ||
255 | static int egalax_ts_suspend(struct device *dev) | ||
256 | { | ||
257 | static const u8 suspend_cmd[MAX_I2C_DATA_LEN] = { | ||
258 | 0x3, 0x6, 0xa, 0x3, 0x36, 0x3f, 0x2, 0, 0, 0 | ||
259 | }; | ||
260 | struct i2c_client *client = to_i2c_client(dev); | ||
261 | int ret; | ||
262 | |||
263 | ret = i2c_master_send(client, suspend_cmd, MAX_I2C_DATA_LEN); | ||
264 | return ret > 0 ? 0 : ret; | ||
265 | } | ||
266 | |||
267 | static int egalax_ts_resume(struct device *dev) | ||
268 | { | ||
269 | struct i2c_client *client = to_i2c_client(dev); | ||
270 | |||
271 | return egalax_wake_up_device(client); | ||
272 | } | ||
273 | #endif | ||
274 | |||
275 | static SIMPLE_DEV_PM_OPS(egalax_ts_pm_ops, egalax_ts_suspend, egalax_ts_resume); | ||
276 | |||
277 | static struct i2c_driver egalax_ts_driver = { | ||
278 | .driver = { | ||
279 | .name = "egalax_ts", | ||
280 | .owner = THIS_MODULE, | ||
281 | .pm = &egalax_ts_pm_ops, | ||
282 | }, | ||
283 | .id_table = egalax_ts_id, | ||
284 | .probe = egalax_ts_probe, | ||
285 | .remove = __devexit_p(egalax_ts_remove), | ||
286 | }; | ||
287 | |||
288 | static int __init egalax_ts_init(void) | ||
289 | { | ||
290 | return i2c_add_driver(&egalax_ts_driver); | ||
291 | } | ||
292 | |||
293 | static void __exit egalax_ts_exit(void) | ||
294 | { | ||
295 | i2c_del_driver(&egalax_ts_driver); | ||
296 | } | ||
297 | |||
298 | module_init(egalax_ts_init); | ||
299 | module_exit(egalax_ts_exit); | ||
300 | |||
301 | MODULE_AUTHOR("Freescale Semiconductor, Inc."); | ||
302 | MODULE_DESCRIPTION("Touchscreen driver for EETI eGalax touch controller"); | ||
303 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/input/touchscreen/htcpen.c b/drivers/input/touchscreen/htcpen.c index 62811de6f18f..81e338623944 100644 --- a/drivers/input/touchscreen/htcpen.c +++ b/drivers/input/touchscreen/htcpen.c | |||
@@ -47,12 +47,6 @@ static int invert_y; | |||
47 | module_param(invert_y, bool, 0644); | 47 | module_param(invert_y, bool, 0644); |
48 | MODULE_PARM_DESC(invert_y, "If set, Y axis is inverted"); | 48 | MODULE_PARM_DESC(invert_y, "If set, Y axis is inverted"); |
49 | 49 | ||
50 | static struct pnp_device_id pnp_ids[] = { | ||
51 | { .id = "PNP0cc0" }, | ||
52 | { .id = "" } | ||
53 | }; | ||
54 | MODULE_DEVICE_TABLE(pnp, pnp_ids); | ||
55 | |||
56 | static irqreturn_t htcpen_interrupt(int irq, void *handle) | 50 | static irqreturn_t htcpen_interrupt(int irq, void *handle) |
57 | { | 51 | { |
58 | struct input_dev *htcpen_dev = handle; | 52 | struct input_dev *htcpen_dev = handle; |
@@ -237,6 +231,7 @@ static struct dmi_system_id __initdata htcshift_dmi_table[] = { | |||
237 | }, | 231 | }, |
238 | { } | 232 | { } |
239 | }; | 233 | }; |
234 | MODULE_DEVICE_TABLE(dmi, htcshift_dmi_table); | ||
240 | 235 | ||
241 | static int __init htcpen_isa_init(void) | 236 | static int __init htcpen_isa_init(void) |
242 | { | 237 | { |
diff --git a/drivers/input/touchscreen/intel-mid-touch.c b/drivers/input/touchscreen/intel-mid-touch.c index 327695268e06..3cd7a837f82b 100644 --- a/drivers/input/touchscreen/intel-mid-touch.c +++ b/drivers/input/touchscreen/intel-mid-touch.c | |||
@@ -664,18 +664,7 @@ static struct platform_driver mrstouch_driver = { | |||
664 | .probe = mrstouch_probe, | 664 | .probe = mrstouch_probe, |
665 | .remove = __devexit_p(mrstouch_remove), | 665 | .remove = __devexit_p(mrstouch_remove), |
666 | }; | 666 | }; |
667 | 667 | module_platform_driver(mrstouch_driver); | |
668 | static int __init mrstouch_init(void) | ||
669 | { | ||
670 | return platform_driver_register(&mrstouch_driver); | ||
671 | } | ||
672 | module_init(mrstouch_init); | ||
673 | |||
674 | static void __exit mrstouch_exit(void) | ||
675 | { | ||
676 | platform_driver_unregister(&mrstouch_driver); | ||
677 | } | ||
678 | module_exit(mrstouch_exit); | ||
679 | 668 | ||
680 | MODULE_AUTHOR("Sreedhara Murthy. D.S, sreedhara.ds@intel.com"); | 669 | MODULE_AUTHOR("Sreedhara Murthy. D.S, sreedhara.ds@intel.com"); |
681 | MODULE_DESCRIPTION("Intel Moorestown Resistive Touch Screen Driver"); | 670 | MODULE_DESCRIPTION("Intel Moorestown Resistive Touch Screen Driver"); |
diff --git a/drivers/input/touchscreen/jornada720_ts.c b/drivers/input/touchscreen/jornada720_ts.c index 50076c2d59e2..c3848ad2325b 100644 --- a/drivers/input/touchscreen/jornada720_ts.c +++ b/drivers/input/touchscreen/jornada720_ts.c | |||
@@ -172,16 +172,4 @@ static struct platform_driver jornada720_ts_driver = { | |||
172 | .owner = THIS_MODULE, | 172 | .owner = THIS_MODULE, |
173 | }, | 173 | }, |
174 | }; | 174 | }; |
175 | 175 | module_platform_driver(jornada720_ts_driver); | |
176 | static int __init jornada720_ts_init(void) | ||
177 | { | ||
178 | return platform_driver_register(&jornada720_ts_driver); | ||
179 | } | ||
180 | |||
181 | static void __exit jornada720_ts_exit(void) | ||
182 | { | ||
183 | platform_driver_unregister(&jornada720_ts_driver); | ||
184 | } | ||
185 | |||
186 | module_init(jornada720_ts_init); | ||
187 | module_exit(jornada720_ts_exit); | ||
diff --git a/drivers/input/touchscreen/lpc32xx_ts.c b/drivers/input/touchscreen/lpc32xx_ts.c index 0a484ed5295c..afcd0691ec67 100644 --- a/drivers/input/touchscreen/lpc32xx_ts.c +++ b/drivers/input/touchscreen/lpc32xx_ts.c | |||
@@ -392,18 +392,7 @@ static struct platform_driver lpc32xx_ts_driver = { | |||
392 | .pm = LPC32XX_TS_PM_OPS, | 392 | .pm = LPC32XX_TS_PM_OPS, |
393 | }, | 393 | }, |
394 | }; | 394 | }; |
395 | 395 | module_platform_driver(lpc32xx_ts_driver); | |
396 | static int __init lpc32xx_ts_init(void) | ||
397 | { | ||
398 | return platform_driver_register(&lpc32xx_ts_driver); | ||
399 | } | ||
400 | module_init(lpc32xx_ts_init); | ||
401 | |||
402 | static void __exit lpc32xx_ts_exit(void) | ||
403 | { | ||
404 | platform_driver_unregister(&lpc32xx_ts_driver); | ||
405 | } | ||
406 | module_exit(lpc32xx_ts_exit); | ||
407 | 396 | ||
408 | MODULE_AUTHOR("Kevin Wells <kevin.wells@nxp.com"); | 397 | MODULE_AUTHOR("Kevin Wells <kevin.wells@nxp.com"); |
409 | MODULE_DESCRIPTION("LPC32XX TSC Driver"); | 398 | MODULE_DESCRIPTION("LPC32XX TSC Driver"); |
diff --git a/drivers/input/touchscreen/mainstone-wm97xx.c b/drivers/input/touchscreen/mainstone-wm97xx.c index e966c29ff1bb..7d2b2136e5ad 100644 --- a/drivers/input/touchscreen/mainstone-wm97xx.c +++ b/drivers/input/touchscreen/mainstone-wm97xx.c | |||
@@ -302,19 +302,7 @@ static struct platform_driver mainstone_wm97xx_driver = { | |||
302 | .name = "wm97xx-touch", | 302 | .name = "wm97xx-touch", |
303 | }, | 303 | }, |
304 | }; | 304 | }; |
305 | 305 | module_platform_driver(mainstone_wm97xx_driver); | |
306 | static int __init mainstone_wm97xx_init(void) | ||
307 | { | ||
308 | return platform_driver_register(&mainstone_wm97xx_driver); | ||
309 | } | ||
310 | |||
311 | static void __exit mainstone_wm97xx_exit(void) | ||
312 | { | ||
313 | platform_driver_unregister(&mainstone_wm97xx_driver); | ||
314 | } | ||
315 | |||
316 | module_init(mainstone_wm97xx_init); | ||
317 | module_exit(mainstone_wm97xx_exit); | ||
318 | 306 | ||
319 | /* Module information */ | 307 | /* Module information */ |
320 | MODULE_AUTHOR("Liam Girdwood <lrg@slimlogic.co.uk>"); | 308 | MODULE_AUTHOR("Liam Girdwood <lrg@slimlogic.co.uk>"); |
diff --git a/drivers/input/touchscreen/mc13783_ts.c b/drivers/input/touchscreen/mc13783_ts.c index ede02743eac1..68f86f7dabbc 100644 --- a/drivers/input/touchscreen/mc13783_ts.c +++ b/drivers/input/touchscreen/mc13783_ts.c | |||
@@ -240,18 +240,7 @@ static struct platform_driver mc13783_ts_driver = { | |||
240 | .name = MC13783_TS_NAME, | 240 | .name = MC13783_TS_NAME, |
241 | }, | 241 | }, |
242 | }; | 242 | }; |
243 | 243 | module_platform_driver(mc13783_ts_driver); | |
244 | static int __init mc13783_ts_init(void) | ||
245 | { | ||
246 | return platform_driver_probe(&mc13783_ts_driver, &mc13783_ts_probe); | ||
247 | } | ||
248 | module_init(mc13783_ts_init); | ||
249 | |||
250 | static void __exit mc13783_ts_exit(void) | ||
251 | { | ||
252 | platform_driver_unregister(&mc13783_ts_driver); | ||
253 | } | ||
254 | module_exit(mc13783_ts_exit); | ||
255 | 244 | ||
256 | MODULE_DESCRIPTION("MC13783 input touchscreen driver"); | 245 | MODULE_DESCRIPTION("MC13783 input touchscreen driver"); |
257 | MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>"); | 246 | MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>"); |
diff --git a/drivers/input/touchscreen/migor_ts.c b/drivers/input/touchscreen/migor_ts.c index 5803bd0c1cca..5226194aa78e 100644 --- a/drivers/input/touchscreen/migor_ts.c +++ b/drivers/input/touchscreen/migor_ts.c | |||
@@ -36,7 +36,6 @@ | |||
36 | struct migor_ts_priv { | 36 | struct migor_ts_priv { |
37 | struct i2c_client *client; | 37 | struct i2c_client *client; |
38 | struct input_dev *input; | 38 | struct input_dev *input; |
39 | struct delayed_work work; | ||
40 | int irq; | 39 | int irq; |
41 | }; | 40 | }; |
42 | 41 | ||
@@ -44,15 +43,24 @@ static const u_int8_t migor_ts_ena_seq[17] = { 0x33, 0x22, 0x11, | |||
44 | 0x01, 0x06, 0x07, }; | 43 | 0x01, 0x06, 0x07, }; |
45 | static const u_int8_t migor_ts_dis_seq[17] = { }; | 44 | static const u_int8_t migor_ts_dis_seq[17] = { }; |
46 | 45 | ||
47 | static void migor_ts_poscheck(struct work_struct *work) | 46 | static irqreturn_t migor_ts_isr(int irq, void *dev_id) |
48 | { | 47 | { |
49 | struct migor_ts_priv *priv = container_of(work, | 48 | struct migor_ts_priv *priv = dev_id; |
50 | struct migor_ts_priv, | ||
51 | work.work); | ||
52 | unsigned short xpos, ypos; | 49 | unsigned short xpos, ypos; |
53 | unsigned char event; | 50 | unsigned char event; |
54 | u_int8_t buf[16]; | 51 | u_int8_t buf[16]; |
55 | 52 | ||
53 | /* | ||
54 | * The touch screen controller chip is hooked up to the CPU | ||
55 | * using I2C and a single interrupt line. The interrupt line | ||
56 | * is pulled low whenever someone taps the screen. To deassert | ||
57 | * the interrupt line we need to acknowledge the interrupt by | ||
58 | * communicating with the controller over the slow i2c bus. | ||
59 | * | ||
60 | * Since I2C bus controller may sleep we are using threaded | ||
61 | * IRQ here. | ||
62 | */ | ||
63 | |||
56 | memset(buf, 0, sizeof(buf)); | 64 | memset(buf, 0, sizeof(buf)); |
57 | 65 | ||
58 | /* Set Index 0 */ | 66 | /* Set Index 0 */ |
@@ -72,41 +80,25 @@ static void migor_ts_poscheck(struct work_struct *work) | |||
72 | xpos = ((buf[11] & 0x03) << 8 | buf[10]); | 80 | xpos = ((buf[11] & 0x03) << 8 | buf[10]); |
73 | event = buf[12]; | 81 | event = buf[12]; |
74 | 82 | ||
75 | if (event == EVENT_PENDOWN || event == EVENT_REPEAT) { | 83 | switch (event) { |
84 | case EVENT_PENDOWN: | ||
85 | case EVENT_REPEAT: | ||
76 | input_report_key(priv->input, BTN_TOUCH, 1); | 86 | input_report_key(priv->input, BTN_TOUCH, 1); |
77 | input_report_abs(priv->input, ABS_X, ypos); /*X-Y swap*/ | 87 | input_report_abs(priv->input, ABS_X, ypos); /*X-Y swap*/ |
78 | input_report_abs(priv->input, ABS_Y, xpos); | 88 | input_report_abs(priv->input, ABS_Y, xpos); |
79 | input_sync(priv->input); | 89 | input_sync(priv->input); |
80 | } else if (event == EVENT_PENUP) { | 90 | break; |
91 | |||
92 | case EVENT_PENUP: | ||
81 | input_report_key(priv->input, BTN_TOUCH, 0); | 93 | input_report_key(priv->input, BTN_TOUCH, 0); |
82 | input_sync(priv->input); | 94 | input_sync(priv->input); |
95 | break; | ||
83 | } | 96 | } |
84 | out: | ||
85 | enable_irq(priv->irq); | ||
86 | } | ||
87 | |||
88 | static irqreturn_t migor_ts_isr(int irq, void *dev_id) | ||
89 | { | ||
90 | struct migor_ts_priv *priv = dev_id; | ||
91 | |||
92 | /* the touch screen controller chip is hooked up to the cpu | ||
93 | * using i2c and a single interrupt line. the interrupt line | ||
94 | * is pulled low whenever someone taps the screen. to deassert | ||
95 | * the interrupt line we need to acknowledge the interrupt by | ||
96 | * communicating with the controller over the slow i2c bus. | ||
97 | * | ||
98 | * we can't acknowledge from interrupt context since the i2c | ||
99 | * bus controller may sleep, so we just disable the interrupt | ||
100 | * here and handle the acknowledge using delayed work. | ||
101 | */ | ||
102 | |||
103 | disable_irq_nosync(irq); | ||
104 | schedule_delayed_work(&priv->work, HZ / 20); | ||
105 | 97 | ||
98 | out: | ||
106 | return IRQ_HANDLED; | 99 | return IRQ_HANDLED; |
107 | } | 100 | } |
108 | 101 | ||
109 | |||
110 | static int migor_ts_open(struct input_dev *dev) | 102 | static int migor_ts_open(struct input_dev *dev) |
111 | { | 103 | { |
112 | struct migor_ts_priv *priv = input_get_drvdata(dev); | 104 | struct migor_ts_priv *priv = input_get_drvdata(dev); |
@@ -131,15 +123,6 @@ static void migor_ts_close(struct input_dev *dev) | |||
131 | 123 | ||
132 | disable_irq(priv->irq); | 124 | disable_irq(priv->irq); |
133 | 125 | ||
134 | /* cancel pending work and wait for migor_ts_poscheck() to finish */ | ||
135 | if (cancel_delayed_work_sync(&priv->work)) { | ||
136 | /* | ||
137 | * if migor_ts_poscheck was canceled we need to enable IRQ | ||
138 | * here to balance disable done in migor_ts_isr. | ||
139 | */ | ||
140 | enable_irq(priv->irq); | ||
141 | } | ||
142 | |||
143 | /* disable controller */ | 126 | /* disable controller */ |
144 | i2c_master_send(client, migor_ts_dis_seq, sizeof(migor_ts_dis_seq)); | 127 | i2c_master_send(client, migor_ts_dis_seq, sizeof(migor_ts_dis_seq)); |
145 | 128 | ||
@@ -154,23 +137,20 @@ static int migor_ts_probe(struct i2c_client *client, | |||
154 | int error; | 137 | int error; |
155 | 138 | ||
156 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 139 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
157 | if (!priv) { | ||
158 | dev_err(&client->dev, "failed to allocate driver data\n"); | ||
159 | error = -ENOMEM; | ||
160 | goto err0; | ||
161 | } | ||
162 | |||
163 | dev_set_drvdata(&client->dev, priv); | ||
164 | |||
165 | input = input_allocate_device(); | 140 | input = input_allocate_device(); |
166 | if (!input) { | 141 | if (!priv || !input) { |
167 | dev_err(&client->dev, "Failed to allocate input device.\n"); | 142 | dev_err(&client->dev, "failed to allocate memory\n"); |
168 | error = -ENOMEM; | 143 | error = -ENOMEM; |
169 | goto err1; | 144 | goto err_free_mem; |
170 | } | 145 | } |
171 | 146 | ||
147 | priv->client = client; | ||
148 | priv->input = input; | ||
149 | priv->irq = client->irq; | ||
150 | |||
172 | input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 151 | input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
173 | input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | 152 | |
153 | __set_bit(BTN_TOUCH, input->keybit); | ||
174 | 154 | ||
175 | input_set_abs_params(input, ABS_X, 95, 955, 0, 0); | 155 | input_set_abs_params(input, ABS_X, 95, 955, 0, 0); |
176 | input_set_abs_params(input, ABS_Y, 85, 935, 0, 0); | 156 | input_set_abs_params(input, ABS_Y, 85, 935, 0, 0); |
@@ -184,39 +164,34 @@ static int migor_ts_probe(struct i2c_client *client, | |||
184 | 164 | ||
185 | input_set_drvdata(input, priv); | 165 | input_set_drvdata(input, priv); |
186 | 166 | ||
187 | priv->client = client; | 167 | error = request_threaded_irq(priv->irq, NULL, migor_ts_isr, |
188 | priv->input = input; | 168 | IRQF_TRIGGER_LOW | IRQF_ONESHOT, |
189 | INIT_DELAYED_WORK(&priv->work, migor_ts_poscheck); | 169 | client->name, priv); |
190 | priv->irq = client->irq; | ||
191 | |||
192 | error = input_register_device(input); | ||
193 | if (error) | ||
194 | goto err1; | ||
195 | |||
196 | error = request_irq(priv->irq, migor_ts_isr, IRQF_TRIGGER_LOW, | ||
197 | client->name, priv); | ||
198 | if (error) { | 170 | if (error) { |
199 | dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); | 171 | dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); |
200 | goto err2; | 172 | goto err_free_mem; |
201 | } | 173 | } |
202 | 174 | ||
175 | error = input_register_device(input); | ||
176 | if (error) | ||
177 | goto err_free_irq; | ||
178 | |||
179 | i2c_set_clientdata(client, priv); | ||
203 | device_init_wakeup(&client->dev, 1); | 180 | device_init_wakeup(&client->dev, 1); |
181 | |||
204 | return 0; | 182 | return 0; |
205 | 183 | ||
206 | err2: | 184 | err_free_irq: |
207 | input_unregister_device(input); | 185 | free_irq(priv->irq, priv); |
208 | input = NULL; /* so we dont try to free it below */ | 186 | err_free_mem: |
209 | err1: | ||
210 | input_free_device(input); | 187 | input_free_device(input); |
211 | kfree(priv); | 188 | kfree(priv); |
212 | err0: | ||
213 | dev_set_drvdata(&client->dev, NULL); | ||
214 | return error; | 189 | return error; |
215 | } | 190 | } |
216 | 191 | ||
217 | static int migor_ts_remove(struct i2c_client *client) | 192 | static int migor_ts_remove(struct i2c_client *client) |
218 | { | 193 | { |
219 | struct migor_ts_priv *priv = dev_get_drvdata(&client->dev); | 194 | struct migor_ts_priv *priv = i2c_get_clientdata(client); |
220 | 195 | ||
221 | free_irq(priv->irq, priv); | 196 | free_irq(priv->irq, priv); |
222 | input_unregister_device(priv->input); | 197 | input_unregister_device(priv->input); |
@@ -230,7 +205,7 @@ static int migor_ts_remove(struct i2c_client *client) | |||
230 | static int migor_ts_suspend(struct device *dev) | 205 | static int migor_ts_suspend(struct device *dev) |
231 | { | 206 | { |
232 | struct i2c_client *client = to_i2c_client(dev); | 207 | struct i2c_client *client = to_i2c_client(dev); |
233 | struct migor_ts_priv *priv = dev_get_drvdata(&client->dev); | 208 | struct migor_ts_priv *priv = i2c_get_clientdata(client); |
234 | 209 | ||
235 | if (device_may_wakeup(&client->dev)) | 210 | if (device_may_wakeup(&client->dev)) |
236 | enable_irq_wake(priv->irq); | 211 | enable_irq_wake(priv->irq); |
@@ -241,7 +216,7 @@ static int migor_ts_suspend(struct device *dev) | |||
241 | static int migor_ts_resume(struct device *dev) | 216 | static int migor_ts_resume(struct device *dev) |
242 | { | 217 | { |
243 | struct i2c_client *client = to_i2c_client(dev); | 218 | struct i2c_client *client = to_i2c_client(dev); |
244 | struct migor_ts_priv *priv = dev_get_drvdata(&client->dev); | 219 | struct migor_ts_priv *priv = i2c_get_clientdata(client); |
245 | 220 | ||
246 | if (device_may_wakeup(&client->dev)) | 221 | if (device_may_wakeup(&client->dev)) |
247 | disable_irq_wake(priv->irq); | 222 | disable_irq_wake(priv->irq); |
diff --git a/drivers/input/touchscreen/pcap_ts.c b/drivers/input/touchscreen/pcap_ts.c index ea6ef16e59b4..f57aeb80f7e3 100644 --- a/drivers/input/touchscreen/pcap_ts.c +++ b/drivers/input/touchscreen/pcap_ts.c | |||
@@ -252,19 +252,7 @@ static struct platform_driver pcap_ts_driver = { | |||
252 | .pm = PCAP_TS_PM_OPS, | 252 | .pm = PCAP_TS_PM_OPS, |
253 | }, | 253 | }, |
254 | }; | 254 | }; |
255 | 255 | module_platform_driver(pcap_ts_driver); | |
256 | static int __init pcap_ts_init(void) | ||
257 | { | ||
258 | return platform_driver_register(&pcap_ts_driver); | ||
259 | } | ||
260 | |||
261 | static void __exit pcap_ts_exit(void) | ||
262 | { | ||
263 | platform_driver_unregister(&pcap_ts_driver); | ||
264 | } | ||
265 | |||
266 | module_init(pcap_ts_init); | ||
267 | module_exit(pcap_ts_exit); | ||
268 | 256 | ||
269 | MODULE_DESCRIPTION("Motorola PCAP2 touchscreen driver"); | 257 | MODULE_DESCRIPTION("Motorola PCAP2 touchscreen driver"); |
270 | MODULE_AUTHOR("Daniel Ribeiro / Harald Welte"); | 258 | MODULE_AUTHOR("Daniel Ribeiro / Harald Welte"); |
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c new file mode 100644 index 000000000000..d5ac09a1ee56 --- /dev/null +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c | |||
@@ -0,0 +1,239 @@ | |||
1 | /* | ||
2 | * Driver for Pixcir I2C touchscreen controllers. | ||
3 | * | ||
4 | * Copyright (C) 2010-2011 Pixcir, Inc. | ||
5 | * | ||
6 | * This software is licensed under the terms of the GNU General Public | ||
7 | * License version 2, as published by the Free Software Foundation, and | ||
8 | * may be copied, distributed, and modified under those terms. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public | ||
16 | * License along with this library; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #include <linux/delay.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/interrupt.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/i2c.h> | ||
25 | #include <linux/input.h> | ||
26 | #include <linux/input/pixcir_ts.h> | ||
27 | |||
28 | struct pixcir_i2c_ts_data { | ||
29 | struct i2c_client *client; | ||
30 | struct input_dev *input; | ||
31 | const struct pixcir_ts_platform_data *chip; | ||
32 | bool exiting; | ||
33 | }; | ||
34 | |||
35 | static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data *data) | ||
36 | { | ||
37 | struct pixcir_i2c_ts_data *tsdata = data; | ||
38 | u8 rdbuf[10], wrbuf[1] = { 0 }; | ||
39 | u8 touch; | ||
40 | int ret; | ||
41 | |||
42 | ret = i2c_master_send(tsdata->client, wrbuf, sizeof(wrbuf)); | ||
43 | if (ret != sizeof(wrbuf)) { | ||
44 | dev_err(&tsdata->client->dev, | ||
45 | "%s: i2c_master_send failed(), ret=%d\n", | ||
46 | __func__, ret); | ||
47 | return; | ||
48 | } | ||
49 | |||
50 | ret = i2c_master_recv(tsdata->client, rdbuf, sizeof(rdbuf)); | ||
51 | if (ret != sizeof(rdbuf)) { | ||
52 | dev_err(&tsdata->client->dev, | ||
53 | "%s: i2c_master_recv failed(), ret=%d\n", | ||
54 | __func__, ret); | ||
55 | return; | ||
56 | } | ||
57 | |||
58 | touch = rdbuf[0]; | ||
59 | if (touch) { | ||
60 | u16 posx1 = (rdbuf[3] << 8) | rdbuf[2]; | ||
61 | u16 posy1 = (rdbuf[5] << 8) | rdbuf[4]; | ||
62 | u16 posx2 = (rdbuf[7] << 8) | rdbuf[6]; | ||
63 | u16 posy2 = (rdbuf[9] << 8) | rdbuf[8]; | ||
64 | |||
65 | input_report_key(tsdata->input, BTN_TOUCH, 1); | ||
66 | input_report_abs(tsdata->input, ABS_X, posx1); | ||
67 | input_report_abs(tsdata->input, ABS_Y, posy1); | ||
68 | |||
69 | input_report_abs(tsdata->input, ABS_MT_POSITION_X, posx1); | ||
70 | input_report_abs(tsdata->input, ABS_MT_POSITION_Y, posy1); | ||
71 | input_mt_sync(tsdata->input); | ||
72 | |||
73 | if (touch == 2) { | ||
74 | input_report_abs(tsdata->input, | ||
75 | ABS_MT_POSITION_X, posx2); | ||
76 | input_report_abs(tsdata->input, | ||
77 | ABS_MT_POSITION_Y, posy2); | ||
78 | input_mt_sync(tsdata->input); | ||
79 | } | ||
80 | } else { | ||
81 | input_report_key(tsdata->input, BTN_TOUCH, 0); | ||
82 | } | ||
83 | |||
84 | input_sync(tsdata->input); | ||
85 | } | ||
86 | |||
87 | static irqreturn_t pixcir_ts_isr(int irq, void *dev_id) | ||
88 | { | ||
89 | struct pixcir_i2c_ts_data *tsdata = dev_id; | ||
90 | |||
91 | while (!tsdata->exiting) { | ||
92 | pixcir_ts_poscheck(tsdata); | ||
93 | |||
94 | if (tsdata->chip->attb_read_val()) | ||
95 | break; | ||
96 | |||
97 | msleep(20); | ||
98 | } | ||
99 | |||
100 | return IRQ_HANDLED; | ||
101 | } | ||
102 | |||
103 | #ifdef CONFIG_PM_SLEEP | ||
104 | static int pixcir_i2c_ts_suspend(struct device *dev) | ||
105 | { | ||
106 | struct i2c_client *client = to_i2c_client(dev); | ||
107 | |||
108 | if (device_may_wakeup(&client->dev)) | ||
109 | enable_irq_wake(client->irq); | ||
110 | |||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static int pixcir_i2c_ts_resume(struct device *dev) | ||
115 | { | ||
116 | struct i2c_client *client = to_i2c_client(dev); | ||
117 | |||
118 | if (device_may_wakeup(&client->dev)) | ||
119 | disable_irq_wake(client->irq); | ||
120 | |||
121 | return 0; | ||
122 | } | ||
123 | #endif | ||
124 | |||
125 | static SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops, | ||
126 | pixcir_i2c_ts_suspend, pixcir_i2c_ts_resume); | ||
127 | |||
128 | static int __devinit pixcir_i2c_ts_probe(struct i2c_client *client, | ||
129 | const struct i2c_device_id *id) | ||
130 | { | ||
131 | const struct pixcir_ts_platform_data *pdata = client->dev.platform_data; | ||
132 | struct pixcir_i2c_ts_data *tsdata; | ||
133 | struct input_dev *input; | ||
134 | int error; | ||
135 | |||
136 | if (!pdata) { | ||
137 | dev_err(&client->dev, "platform data not defined\n"); | ||
138 | return -EINVAL; | ||
139 | } | ||
140 | |||
141 | tsdata = kzalloc(sizeof(*tsdata), GFP_KERNEL); | ||
142 | input = input_allocate_device(); | ||
143 | if (!tsdata || !input) { | ||
144 | dev_err(&client->dev, "Failed to allocate driver data!\n"); | ||
145 | error = -ENOMEM; | ||
146 | goto err_free_mem; | ||
147 | } | ||
148 | |||
149 | tsdata->client = client; | ||
150 | tsdata->input = input; | ||
151 | tsdata->chip = pdata; | ||
152 | |||
153 | input->name = client->name; | ||
154 | input->id.bustype = BUS_I2C; | ||
155 | input->dev.parent = &client->dev; | ||
156 | |||
157 | __set_bit(EV_KEY, input->evbit); | ||
158 | __set_bit(EV_ABS, input->evbit); | ||
159 | __set_bit(BTN_TOUCH, input->keybit); | ||
160 | input_set_abs_params(input, ABS_X, 0, pdata->x_max, 0, 0); | ||
161 | input_set_abs_params(input, ABS_Y, 0, pdata->y_max, 0, 0); | ||
162 | input_set_abs_params(input, ABS_MT_POSITION_X, 0, pdata->x_max, 0, 0); | ||
163 | input_set_abs_params(input, ABS_MT_POSITION_Y, 0, pdata->y_max, 0, 0); | ||
164 | |||
165 | input_set_drvdata(input, tsdata); | ||
166 | |||
167 | error = request_threaded_irq(client->irq, NULL, pixcir_ts_isr, | ||
168 | IRQF_TRIGGER_FALLING, | ||
169 | client->name, tsdata); | ||
170 | if (error) { | ||
171 | dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); | ||
172 | goto err_free_mem; | ||
173 | } | ||
174 | |||
175 | error = input_register_device(input); | ||
176 | if (error) | ||
177 | goto err_free_irq; | ||
178 | |||
179 | i2c_set_clientdata(client, tsdata); | ||
180 | device_init_wakeup(&client->dev, 1); | ||
181 | |||
182 | return 0; | ||
183 | |||
184 | err_free_irq: | ||
185 | free_irq(client->irq, tsdata); | ||
186 | err_free_mem: | ||
187 | input_free_device(input); | ||
188 | kfree(tsdata); | ||
189 | return error; | ||
190 | } | ||
191 | |||
192 | static int __devexit pixcir_i2c_ts_remove(struct i2c_client *client) | ||
193 | { | ||
194 | struct pixcir_i2c_ts_data *tsdata = i2c_get_clientdata(client); | ||
195 | |||
196 | device_init_wakeup(&client->dev, 0); | ||
197 | |||
198 | tsdata->exiting = true; | ||
199 | mb(); | ||
200 | free_irq(client->irq, tsdata); | ||
201 | |||
202 | input_unregister_device(tsdata->input); | ||
203 | kfree(tsdata); | ||
204 | |||
205 | return 0; | ||
206 | } | ||
207 | |||
208 | static const struct i2c_device_id pixcir_i2c_ts_id[] = { | ||
209 | { "pixcir_ts", 0 }, | ||
210 | { } | ||
211 | }; | ||
212 | MODULE_DEVICE_TABLE(i2c, pixcir_i2c_ts_id); | ||
213 | |||
214 | static struct i2c_driver pixcir_i2c_ts_driver = { | ||
215 | .driver = { | ||
216 | .owner = THIS_MODULE, | ||
217 | .name = "pixcir_ts", | ||
218 | .pm = &pixcir_dev_pm_ops, | ||
219 | }, | ||
220 | .probe = pixcir_i2c_ts_probe, | ||
221 | .remove = __devexit_p(pixcir_i2c_ts_remove), | ||
222 | .id_table = pixcir_i2c_ts_id, | ||
223 | }; | ||
224 | |||
225 | static int __init pixcir_i2c_ts_init(void) | ||
226 | { | ||
227 | return i2c_add_driver(&pixcir_i2c_ts_driver); | ||
228 | } | ||
229 | module_init(pixcir_i2c_ts_init); | ||
230 | |||
231 | static void __exit pixcir_i2c_ts_exit(void) | ||
232 | { | ||
233 | i2c_del_driver(&pixcir_i2c_ts_driver); | ||
234 | } | ||
235 | module_exit(pixcir_i2c_ts_exit); | ||
236 | |||
237 | MODULE_AUTHOR("Jianchun Bian <jcbian@pixcir.com.cn>, Dequan Meng <dqmeng@pixcir.com.cn>"); | ||
238 | MODULE_DESCRIPTION("Pixcir I2C Touchscreen Driver"); | ||
239 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c index 64ce697a3456..bf1a06400067 100644 --- a/drivers/input/touchscreen/s3c2410_ts.c +++ b/drivers/input/touchscreen/s3c2410_ts.c | |||
@@ -432,19 +432,7 @@ static struct platform_driver s3c_ts_driver = { | |||
432 | .probe = s3c2410ts_probe, | 432 | .probe = s3c2410ts_probe, |
433 | .remove = __devexit_p(s3c2410ts_remove), | 433 | .remove = __devexit_p(s3c2410ts_remove), |
434 | }; | 434 | }; |
435 | 435 | module_platform_driver(s3c_ts_driver); | |
436 | static int __init s3c2410ts_init(void) | ||
437 | { | ||
438 | return platform_driver_register(&s3c_ts_driver); | ||
439 | } | ||
440 | |||
441 | static void __exit s3c2410ts_exit(void) | ||
442 | { | ||
443 | platform_driver_unregister(&s3c_ts_driver); | ||
444 | } | ||
445 | |||
446 | module_init(s3c2410ts_init); | ||
447 | module_exit(s3c2410ts_exit); | ||
448 | 436 | ||
449 | MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>, " | 437 | MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>, " |
450 | "Ben Dooks <ben@simtec.co.uk>, " | 438 | "Ben Dooks <ben@simtec.co.uk>, " |
diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c index ae88e13c99ff..692b685720ce 100644 --- a/drivers/input/touchscreen/stmpe-ts.c +++ b/drivers/input/touchscreen/stmpe-ts.c | |||
@@ -379,20 +379,7 @@ static struct platform_driver stmpe_ts_driver = { | |||
379 | .probe = stmpe_input_probe, | 379 | .probe = stmpe_input_probe, |
380 | .remove = __devexit_p(stmpe_ts_remove), | 380 | .remove = __devexit_p(stmpe_ts_remove), |
381 | }; | 381 | }; |
382 | 382 | module_platform_driver(stmpe_ts_driver); | |
383 | static int __init stmpe_ts_init(void) | ||
384 | { | ||
385 | return platform_driver_register(&stmpe_ts_driver); | ||
386 | } | ||
387 | |||
388 | module_init(stmpe_ts_init); | ||
389 | |||
390 | static void __exit stmpe_ts_exit(void) | ||
391 | { | ||
392 | platform_driver_unregister(&stmpe_ts_driver); | ||
393 | } | ||
394 | |||
395 | module_exit(stmpe_ts_exit); | ||
396 | 383 | ||
397 | MODULE_AUTHOR("Luotao Fu <l.fu@pengutronix.de>"); | 384 | MODULE_AUTHOR("Luotao Fu <l.fu@pengutronix.de>"); |
398 | MODULE_DESCRIPTION("STMPEXXX touchscreen driver"); | 385 | MODULE_DESCRIPTION("STMPEXXX touchscreen driver"); |
diff --git a/drivers/input/touchscreen/tnetv107x-ts.c b/drivers/input/touchscreen/tnetv107x-ts.c index 0e8f63e5b36f..7e7488097359 100644 --- a/drivers/input/touchscreen/tnetv107x-ts.c +++ b/drivers/input/touchscreen/tnetv107x-ts.c | |||
@@ -378,19 +378,7 @@ static struct platform_driver tsc_driver = { | |||
378 | .driver.name = "tnetv107x-ts", | 378 | .driver.name = "tnetv107x-ts", |
379 | .driver.owner = THIS_MODULE, | 379 | .driver.owner = THIS_MODULE, |
380 | }; | 380 | }; |
381 | 381 | module_platform_driver(tsc_driver); | |
382 | static int __init tsc_init(void) | ||
383 | { | ||
384 | return platform_driver_register(&tsc_driver); | ||
385 | } | ||
386 | |||
387 | static void __exit tsc_exit(void) | ||
388 | { | ||
389 | platform_driver_unregister(&tsc_driver); | ||
390 | } | ||
391 | |||
392 | module_init(tsc_init); | ||
393 | module_exit(tsc_exit); | ||
394 | 382 | ||
395 | MODULE_AUTHOR("Cyril Chemparathy"); | 383 | MODULE_AUTHOR("Cyril Chemparathy"); |
396 | MODULE_DESCRIPTION("TNETV107X Touchscreen Driver"); | 384 | MODULE_DESCRIPTION("TNETV107X Touchscreen Driver"); |
diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c index 43031492d733..6c6f6d8ea9b4 100644 --- a/drivers/input/touchscreen/tps6507x-ts.c +++ b/drivers/input/touchscreen/tps6507x-ts.c | |||
@@ -371,18 +371,7 @@ static struct platform_driver tps6507x_ts_driver = { | |||
371 | .probe = tps6507x_ts_probe, | 371 | .probe = tps6507x_ts_probe, |
372 | .remove = __devexit_p(tps6507x_ts_remove), | 372 | .remove = __devexit_p(tps6507x_ts_remove), |
373 | }; | 373 | }; |
374 | 374 | module_platform_driver(tps6507x_ts_driver); | |
375 | static int __init tps6507x_ts_init(void) | ||
376 | { | ||
377 | return platform_driver_register(&tps6507x_ts_driver); | ||
378 | } | ||
379 | module_init(tps6507x_ts_init); | ||
380 | |||
381 | static void __exit tps6507x_ts_exit(void) | ||
382 | { | ||
383 | platform_driver_unregister(&tps6507x_ts_driver); | ||
384 | } | ||
385 | module_exit(tps6507x_ts_exit); | ||
386 | 375 | ||
387 | MODULE_AUTHOR("Todd Fischer <todd.fischer@ridgerun.com>"); | 376 | MODULE_AUTHOR("Todd Fischer <todd.fischer@ridgerun.com>"); |
388 | MODULE_DESCRIPTION("TPS6507x - TouchScreen driver"); | 377 | MODULE_DESCRIPTION("TPS6507x - TouchScreen driver"); |
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c index 3b5b5df04dd6..d2b57536feea 100644 --- a/drivers/input/touchscreen/ucb1400_ts.c +++ b/drivers/input/touchscreen/ucb1400_ts.c | |||
@@ -20,24 +20,24 @@ | |||
20 | 20 | ||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/completion.h> | ||
24 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/sched.h> | ||
25 | #include <linux/wait.h> | ||
25 | #include <linux/input.h> | 26 | #include <linux/input.h> |
26 | #include <linux/device.h> | 27 | #include <linux/device.h> |
27 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
28 | #include <linux/suspend.h> | ||
29 | #include <linux/kthread.h> | ||
30 | #include <linux/freezer.h> | ||
31 | #include <linux/ucb1400.h> | 29 | #include <linux/ucb1400.h> |
32 | 30 | ||
31 | #define UCB1400_TS_POLL_PERIOD 10 /* ms */ | ||
32 | |||
33 | static int adcsync; | 33 | static int adcsync; |
34 | static int ts_delay = 55; /* us */ | 34 | static int ts_delay = 55; /* us */ |
35 | static int ts_delay_pressure; /* us */ | 35 | static int ts_delay_pressure; /* us */ |
36 | 36 | ||
37 | /* Switch to interrupt mode. */ | 37 | /* Switch to interrupt mode. */ |
38 | static inline void ucb1400_ts_mode_int(struct snd_ac97 *ac97) | 38 | static void ucb1400_ts_mode_int(struct ucb1400_ts *ucb) |
39 | { | 39 | { |
40 | ucb1400_reg_write(ac97, UCB_TS_CR, | 40 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, |
41 | UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW | | 41 | UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW | |
42 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND | | 42 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND | |
43 | UCB_TS_CR_MODE_INT); | 43 | UCB_TS_CR_MODE_INT); |
@@ -47,13 +47,15 @@ static inline void ucb1400_ts_mode_int(struct snd_ac97 *ac97) | |||
47 | * Switch to pressure mode, and read pressure. We don't need to wait | 47 | * Switch to pressure mode, and read pressure. We don't need to wait |
48 | * here, since both plates are being driven. | 48 | * here, since both plates are being driven. |
49 | */ | 49 | */ |
50 | static inline unsigned int ucb1400_ts_read_pressure(struct ucb1400_ts *ucb) | 50 | static unsigned int ucb1400_ts_read_pressure(struct ucb1400_ts *ucb) |
51 | { | 51 | { |
52 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, | 52 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, |
53 | UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW | | 53 | UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW | |
54 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND | | 54 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND | |
55 | UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); | 55 | UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); |
56 | |||
56 | udelay(ts_delay_pressure); | 57 | udelay(ts_delay_pressure); |
58 | |||
57 | return ucb1400_adc_read(ucb->ac97, UCB_ADC_INP_TSPY, adcsync); | 59 | return ucb1400_adc_read(ucb->ac97, UCB_ADC_INP_TSPY, adcsync); |
58 | } | 60 | } |
59 | 61 | ||
@@ -63,7 +65,7 @@ static inline unsigned int ucb1400_ts_read_pressure(struct ucb1400_ts *ucb) | |||
63 | * gives a faster response time. Even so, we need to wait about 55us | 65 | * gives a faster response time. Even so, we need to wait about 55us |
64 | * for things to stabilise. | 66 | * for things to stabilise. |
65 | */ | 67 | */ |
66 | static inline unsigned int ucb1400_ts_read_xpos(struct ucb1400_ts *ucb) | 68 | static unsigned int ucb1400_ts_read_xpos(struct ucb1400_ts *ucb) |
67 | { | 69 | { |
68 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, | 70 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, |
69 | UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | | 71 | UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | |
@@ -86,7 +88,7 @@ static inline unsigned int ucb1400_ts_read_xpos(struct ucb1400_ts *ucb) | |||
86 | * gives a faster response time. Even so, we need to wait about 55us | 88 | * gives a faster response time. Even so, we need to wait about 55us |
87 | * for things to stabilise. | 89 | * for things to stabilise. |
88 | */ | 90 | */ |
89 | static inline unsigned int ucb1400_ts_read_ypos(struct ucb1400_ts *ucb) | 91 | static int ucb1400_ts_read_ypos(struct ucb1400_ts *ucb) |
90 | { | 92 | { |
91 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, | 93 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, |
92 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | | 94 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | |
@@ -107,7 +109,7 @@ static inline unsigned int ucb1400_ts_read_ypos(struct ucb1400_ts *ucb) | |||
107 | * Switch to X plate resistance mode. Set MX to ground, PX to | 109 | * Switch to X plate resistance mode. Set MX to ground, PX to |
108 | * supply. Measure current. | 110 | * supply. Measure current. |
109 | */ | 111 | */ |
110 | static inline unsigned int ucb1400_ts_read_xres(struct ucb1400_ts *ucb) | 112 | static unsigned int ucb1400_ts_read_xres(struct ucb1400_ts *ucb) |
111 | { | 113 | { |
112 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, | 114 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, |
113 | UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | | 115 | UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | |
@@ -119,7 +121,7 @@ static inline unsigned int ucb1400_ts_read_xres(struct ucb1400_ts *ucb) | |||
119 | * Switch to Y plate resistance mode. Set MY to ground, PY to | 121 | * Switch to Y plate resistance mode. Set MY to ground, PY to |
120 | * supply. Measure current. | 122 | * supply. Measure current. |
121 | */ | 123 | */ |
122 | static inline unsigned int ucb1400_ts_read_yres(struct ucb1400_ts *ucb) | 124 | static unsigned int ucb1400_ts_read_yres(struct ucb1400_ts *ucb) |
123 | { | 125 | { |
124 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, | 126 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, |
125 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | | 127 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | |
@@ -127,26 +129,26 @@ static inline unsigned int ucb1400_ts_read_yres(struct ucb1400_ts *ucb) | |||
127 | return ucb1400_adc_read(ucb->ac97, 0, adcsync); | 129 | return ucb1400_adc_read(ucb->ac97, 0, adcsync); |
128 | } | 130 | } |
129 | 131 | ||
130 | static inline int ucb1400_ts_pen_up(struct snd_ac97 *ac97) | 132 | static int ucb1400_ts_pen_up(struct ucb1400_ts *ucb) |
131 | { | 133 | { |
132 | unsigned short val = ucb1400_reg_read(ac97, UCB_TS_CR); | 134 | unsigned short val = ucb1400_reg_read(ucb->ac97, UCB_TS_CR); |
133 | 135 | ||
134 | return val & (UCB_TS_CR_TSPX_LOW | UCB_TS_CR_TSMX_LOW); | 136 | return val & (UCB_TS_CR_TSPX_LOW | UCB_TS_CR_TSMX_LOW); |
135 | } | 137 | } |
136 | 138 | ||
137 | static inline void ucb1400_ts_irq_enable(struct snd_ac97 *ac97) | 139 | static void ucb1400_ts_irq_enable(struct ucb1400_ts *ucb) |
138 | { | 140 | { |
139 | ucb1400_reg_write(ac97, UCB_IE_CLEAR, UCB_IE_TSPX); | 141 | ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, UCB_IE_TSPX); |
140 | ucb1400_reg_write(ac97, UCB_IE_CLEAR, 0); | 142 | ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0); |
141 | ucb1400_reg_write(ac97, UCB_IE_FAL, UCB_IE_TSPX); | 143 | ucb1400_reg_write(ucb->ac97, UCB_IE_FAL, UCB_IE_TSPX); |
142 | } | 144 | } |
143 | 145 | ||
144 | static inline void ucb1400_ts_irq_disable(struct snd_ac97 *ac97) | 146 | static void ucb1400_ts_irq_disable(struct ucb1400_ts *ucb) |
145 | { | 147 | { |
146 | ucb1400_reg_write(ac97, UCB_IE_FAL, 0); | 148 | ucb1400_reg_write(ucb->ac97, UCB_IE_FAL, 0); |
147 | } | 149 | } |
148 | 150 | ||
149 | static void ucb1400_ts_evt_add(struct input_dev *idev, u16 pressure, u16 x, u16 y) | 151 | static void ucb1400_ts_report_event(struct input_dev *idev, u16 pressure, u16 x, u16 y) |
150 | { | 152 | { |
151 | input_report_abs(idev, ABS_X, x); | 153 | input_report_abs(idev, ABS_X, x); |
152 | input_report_abs(idev, ABS_Y, y); | 154 | input_report_abs(idev, ABS_Y, y); |
@@ -162,7 +164,7 @@ static void ucb1400_ts_event_release(struct input_dev *idev) | |||
162 | input_sync(idev); | 164 | input_sync(idev); |
163 | } | 165 | } |
164 | 166 | ||
165 | static void ucb1400_handle_pending_irq(struct ucb1400_ts *ucb) | 167 | static void ucb1400_clear_pending_irq(struct ucb1400_ts *ucb) |
166 | { | 168 | { |
167 | unsigned int isr; | 169 | unsigned int isr; |
168 | 170 | ||
@@ -171,32 +173,34 @@ static void ucb1400_handle_pending_irq(struct ucb1400_ts *ucb) | |||
171 | ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0); | 173 | ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0); |
172 | 174 | ||
173 | if (isr & UCB_IE_TSPX) | 175 | if (isr & UCB_IE_TSPX) |
174 | ucb1400_ts_irq_disable(ucb->ac97); | 176 | ucb1400_ts_irq_disable(ucb); |
175 | else | 177 | else |
176 | dev_dbg(&ucb->ts_idev->dev, "ucb1400: unexpected IE_STATUS = %#x\n", isr); | 178 | dev_dbg(&ucb->ts_idev->dev, |
177 | enable_irq(ucb->irq); | 179 | "ucb1400: unexpected IE_STATUS = %#x\n", isr); |
178 | } | 180 | } |
179 | 181 | ||
180 | static int ucb1400_ts_thread(void *_ucb) | 182 | /* |
183 | * A restriction with interrupts exists when using the ucb1400, as | ||
184 | * the codec read/write routines may sleep while waiting for codec | ||
185 | * access completion and uses semaphores for access control to the | ||
186 | * AC97 bus. Therefore the driver is forced to use threaded interrupt | ||
187 | * handler. | ||
188 | */ | ||
189 | static irqreturn_t ucb1400_irq(int irqnr, void *devid) | ||
181 | { | 190 | { |
182 | struct ucb1400_ts *ucb = _ucb; | 191 | struct ucb1400_ts *ucb = devid; |
183 | struct task_struct *tsk = current; | 192 | unsigned int x, y, p; |
184 | int valid = 0; | 193 | bool penup; |
185 | struct sched_param param = { .sched_priority = 1 }; | ||
186 | 194 | ||
187 | sched_setscheduler(tsk, SCHED_FIFO, ¶m); | 195 | if (unlikely(irqnr != ucb->irq)) |
196 | return IRQ_NONE; | ||
188 | 197 | ||
189 | set_freezable(); | 198 | ucb1400_clear_pending_irq(ucb); |
190 | while (!kthread_should_stop()) { | ||
191 | unsigned int x, y, p; | ||
192 | long timeout; | ||
193 | 199 | ||
194 | ucb->ts_restart = 0; | 200 | /* Start with a small delay before checking pendown state */ |
201 | msleep(UCB1400_TS_POLL_PERIOD); | ||
195 | 202 | ||
196 | if (ucb->irq_pending) { | 203 | while (!ucb->stopped && !(penup = ucb1400_ts_pen_up(ucb))) { |
197 | ucb->irq_pending = 0; | ||
198 | ucb1400_handle_pending_irq(ucb); | ||
199 | } | ||
200 | 204 | ||
201 | ucb1400_adc_enable(ucb->ac97); | 205 | ucb1400_adc_enable(ucb->ac97); |
202 | x = ucb1400_ts_read_xpos(ucb); | 206 | x = ucb1400_ts_read_xpos(ucb); |
@@ -204,91 +208,62 @@ static int ucb1400_ts_thread(void *_ucb) | |||
204 | p = ucb1400_ts_read_pressure(ucb); | 208 | p = ucb1400_ts_read_pressure(ucb); |
205 | ucb1400_adc_disable(ucb->ac97); | 209 | ucb1400_adc_disable(ucb->ac97); |
206 | 210 | ||
207 | /* Switch back to interrupt mode. */ | 211 | ucb1400_ts_report_event(ucb->ts_idev, p, x, y); |
208 | ucb1400_ts_mode_int(ucb->ac97); | ||
209 | |||
210 | msleep(10); | ||
211 | |||
212 | if (ucb1400_ts_pen_up(ucb->ac97)) { | ||
213 | ucb1400_ts_irq_enable(ucb->ac97); | ||
214 | |||
215 | /* | ||
216 | * If we spat out a valid sample set last time, | ||
217 | * spit out a "pen off" sample here. | ||
218 | */ | ||
219 | if (valid) { | ||
220 | ucb1400_ts_event_release(ucb->ts_idev); | ||
221 | valid = 0; | ||
222 | } | ||
223 | |||
224 | timeout = MAX_SCHEDULE_TIMEOUT; | ||
225 | } else { | ||
226 | valid = 1; | ||
227 | ucb1400_ts_evt_add(ucb->ts_idev, p, x, y); | ||
228 | timeout = msecs_to_jiffies(10); | ||
229 | } | ||
230 | 212 | ||
231 | wait_event_freezable_timeout(ucb->ts_wait, | 213 | wait_event_timeout(ucb->ts_wait, ucb->stopped, |
232 | ucb->irq_pending || ucb->ts_restart || | 214 | msecs_to_jiffies(UCB1400_TS_POLL_PERIOD)); |
233 | kthread_should_stop(), timeout); | ||
234 | } | 215 | } |
235 | 216 | ||
236 | /* Send the "pen off" if we are stopping with the pen still active */ | 217 | ucb1400_ts_event_release(ucb->ts_idev); |
237 | if (valid) | ||
238 | ucb1400_ts_event_release(ucb->ts_idev); | ||
239 | 218 | ||
240 | ucb->ts_task = NULL; | 219 | if (!ucb->stopped) { |
241 | return 0; | 220 | /* Switch back to interrupt mode. */ |
221 | ucb1400_ts_mode_int(ucb); | ||
222 | ucb1400_ts_irq_enable(ucb); | ||
223 | } | ||
224 | |||
225 | return IRQ_HANDLED; | ||
242 | } | 226 | } |
243 | 227 | ||
244 | /* | 228 | static void ucb1400_ts_stop(struct ucb1400_ts *ucb) |
245 | * A restriction with interrupts exists when using the ucb1400, as | ||
246 | * the codec read/write routines may sleep while waiting for codec | ||
247 | * access completion and uses semaphores for access control to the | ||
248 | * AC97 bus. A complete codec read cycle could take anywhere from | ||
249 | * 60 to 100uSec so we *definitely* don't want to spin inside the | ||
250 | * interrupt handler waiting for codec access. So, we handle the | ||
251 | * interrupt by scheduling a RT kernel thread to run in process | ||
252 | * context instead of interrupt context. | ||
253 | */ | ||
254 | static irqreturn_t ucb1400_hard_irq(int irqnr, void *devid) | ||
255 | { | 229 | { |
256 | struct ucb1400_ts *ucb = devid; | 230 | /* Signal IRQ thread to stop polling and disable the handler. */ |
231 | ucb->stopped = true; | ||
232 | mb(); | ||
233 | wake_up(&ucb->ts_wait); | ||
234 | disable_irq(ucb->irq); | ||
257 | 235 | ||
258 | if (irqnr == ucb->irq) { | 236 | ucb1400_ts_irq_disable(ucb); |
259 | disable_irq_nosync(ucb->irq); | 237 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, 0); |
260 | ucb->irq_pending = 1; | 238 | } |
261 | wake_up(&ucb->ts_wait); | 239 | |
262 | return IRQ_HANDLED; | 240 | /* Must be called with ts->lock held */ |
263 | } | 241 | static void ucb1400_ts_start(struct ucb1400_ts *ucb) |
264 | return IRQ_NONE; | 242 | { |
243 | /* Tell IRQ thread that it may poll the device. */ | ||
244 | ucb->stopped = false; | ||
245 | mb(); | ||
246 | |||
247 | ucb1400_ts_mode_int(ucb); | ||
248 | ucb1400_ts_irq_enable(ucb); | ||
249 | |||
250 | enable_irq(ucb->irq); | ||
265 | } | 251 | } |
266 | 252 | ||
267 | static int ucb1400_ts_open(struct input_dev *idev) | 253 | static int ucb1400_ts_open(struct input_dev *idev) |
268 | { | 254 | { |
269 | struct ucb1400_ts *ucb = input_get_drvdata(idev); | 255 | struct ucb1400_ts *ucb = input_get_drvdata(idev); |
270 | int ret = 0; | ||
271 | 256 | ||
272 | BUG_ON(ucb->ts_task); | 257 | ucb1400_ts_start(ucb); |
273 | 258 | ||
274 | ucb->ts_task = kthread_run(ucb1400_ts_thread, ucb, "UCB1400_ts"); | 259 | return 0; |
275 | if (IS_ERR(ucb->ts_task)) { | ||
276 | ret = PTR_ERR(ucb->ts_task); | ||
277 | ucb->ts_task = NULL; | ||
278 | } | ||
279 | |||
280 | return ret; | ||
281 | } | 260 | } |
282 | 261 | ||
283 | static void ucb1400_ts_close(struct input_dev *idev) | 262 | static void ucb1400_ts_close(struct input_dev *idev) |
284 | { | 263 | { |
285 | struct ucb1400_ts *ucb = input_get_drvdata(idev); | 264 | struct ucb1400_ts *ucb = input_get_drvdata(idev); |
286 | 265 | ||
287 | if (ucb->ts_task) | 266 | ucb1400_ts_stop(ucb); |
288 | kthread_stop(ucb->ts_task); | ||
289 | |||
290 | ucb1400_ts_irq_disable(ucb->ac97); | ||
291 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, 0); | ||
292 | } | 267 | } |
293 | 268 | ||
294 | #ifndef NO_IRQ | 269 | #ifndef NO_IRQ |
@@ -299,7 +274,8 @@ static void ucb1400_ts_close(struct input_dev *idev) | |||
299 | * Try to probe our interrupt, rather than relying on lots of | 274 | * Try to probe our interrupt, rather than relying on lots of |
300 | * hard-coded machine dependencies. | 275 | * hard-coded machine dependencies. |
301 | */ | 276 | */ |
302 | static int ucb1400_ts_detect_irq(struct ucb1400_ts *ucb) | 277 | static int __devinit ucb1400_ts_detect_irq(struct ucb1400_ts *ucb, |
278 | struct platform_device *pdev) | ||
303 | { | 279 | { |
304 | unsigned long mask, timeout; | 280 | unsigned long mask, timeout; |
305 | 281 | ||
@@ -321,7 +297,7 @@ static int ucb1400_ts_detect_irq(struct ucb1400_ts *ucb) | |||
321 | UCB_ADC_DAT_VALID)) { | 297 | UCB_ADC_DAT_VALID)) { |
322 | cpu_relax(); | 298 | cpu_relax(); |
323 | if (time_after(jiffies, timeout)) { | 299 | if (time_after(jiffies, timeout)) { |
324 | printk(KERN_ERR "ucb1400: timed out in IRQ probe\n"); | 300 | dev_err(&pdev->dev, "timed out in IRQ probe\n"); |
325 | probe_irq_off(mask); | 301 | probe_irq_off(mask); |
326 | return -ENODEV; | 302 | return -ENODEV; |
327 | } | 303 | } |
@@ -342,11 +318,11 @@ static int ucb1400_ts_detect_irq(struct ucb1400_ts *ucb) | |||
342 | return 0; | 318 | return 0; |
343 | } | 319 | } |
344 | 320 | ||
345 | static int ucb1400_ts_probe(struct platform_device *dev) | 321 | static int __devinit ucb1400_ts_probe(struct platform_device *pdev) |
346 | { | 322 | { |
323 | struct ucb1400_ts *ucb = pdev->dev.platform_data; | ||
347 | int error, x_res, y_res; | 324 | int error, x_res, y_res; |
348 | u16 fcsr; | 325 | u16 fcsr; |
349 | struct ucb1400_ts *ucb = dev->dev.platform_data; | ||
350 | 326 | ||
351 | ucb->ts_idev = input_allocate_device(); | 327 | ucb->ts_idev = input_allocate_device(); |
352 | if (!ucb->ts_idev) { | 328 | if (!ucb->ts_idev) { |
@@ -356,27 +332,19 @@ static int ucb1400_ts_probe(struct platform_device *dev) | |||
356 | 332 | ||
357 | /* Only in case the IRQ line wasn't supplied, try detecting it */ | 333 | /* Only in case the IRQ line wasn't supplied, try detecting it */ |
358 | if (ucb->irq < 0) { | 334 | if (ucb->irq < 0) { |
359 | error = ucb1400_ts_detect_irq(ucb); | 335 | error = ucb1400_ts_detect_irq(ucb, pdev); |
360 | if (error) { | 336 | if (error) { |
361 | printk(KERN_ERR "UCB1400: IRQ probe failed\n"); | 337 | dev_err(&pdev->dev, "IRQ probe failed\n"); |
362 | goto err_free_devs; | 338 | goto err_free_devs; |
363 | } | 339 | } |
364 | } | 340 | } |
341 | dev_dbg(&pdev->dev, "found IRQ %d\n", ucb->irq); | ||
365 | 342 | ||
366 | init_waitqueue_head(&ucb->ts_wait); | 343 | init_waitqueue_head(&ucb->ts_wait); |
367 | 344 | ||
368 | error = request_irq(ucb->irq, ucb1400_hard_irq, IRQF_TRIGGER_RISING, | ||
369 | "UCB1400", ucb); | ||
370 | if (error) { | ||
371 | printk(KERN_ERR "ucb1400: unable to grab irq%d: %d\n", | ||
372 | ucb->irq, error); | ||
373 | goto err_free_devs; | ||
374 | } | ||
375 | printk(KERN_DEBUG "UCB1400: found IRQ %d\n", ucb->irq); | ||
376 | |||
377 | input_set_drvdata(ucb->ts_idev, ucb); | 345 | input_set_drvdata(ucb->ts_idev, ucb); |
378 | 346 | ||
379 | ucb->ts_idev->dev.parent = &dev->dev; | 347 | ucb->ts_idev->dev.parent = &pdev->dev; |
380 | ucb->ts_idev->name = "UCB1400 touchscreen interface"; | 348 | ucb->ts_idev->name = "UCB1400 touchscreen interface"; |
381 | ucb->ts_idev->id.vendor = ucb1400_reg_read(ucb->ac97, | 349 | ucb->ts_idev->id.vendor = ucb1400_reg_read(ucb->ac97, |
382 | AC97_VENDOR_ID1); | 350 | AC97_VENDOR_ID1); |
@@ -398,12 +366,23 @@ static int ucb1400_ts_probe(struct platform_device *dev) | |||
398 | x_res = ucb1400_ts_read_xres(ucb); | 366 | x_res = ucb1400_ts_read_xres(ucb); |
399 | y_res = ucb1400_ts_read_yres(ucb); | 367 | y_res = ucb1400_ts_read_yres(ucb); |
400 | ucb1400_adc_disable(ucb->ac97); | 368 | ucb1400_adc_disable(ucb->ac97); |
401 | printk(KERN_DEBUG "UCB1400: x/y = %d/%d\n", x_res, y_res); | 369 | dev_dbg(&pdev->dev, "x/y = %d/%d\n", x_res, y_res); |
402 | 370 | ||
403 | input_set_abs_params(ucb->ts_idev, ABS_X, 0, x_res, 0, 0); | 371 | input_set_abs_params(ucb->ts_idev, ABS_X, 0, x_res, 0, 0); |
404 | input_set_abs_params(ucb->ts_idev, ABS_Y, 0, y_res, 0, 0); | 372 | input_set_abs_params(ucb->ts_idev, ABS_Y, 0, y_res, 0, 0); |
405 | input_set_abs_params(ucb->ts_idev, ABS_PRESSURE, 0, 0, 0, 0); | 373 | input_set_abs_params(ucb->ts_idev, ABS_PRESSURE, 0, 0, 0, 0); |
406 | 374 | ||
375 | ucb1400_ts_stop(ucb); | ||
376 | |||
377 | error = request_threaded_irq(ucb->irq, NULL, ucb1400_irq, | ||
378 | IRQF_TRIGGER_RISING | IRQF_ONESHOT, | ||
379 | "UCB1400", ucb); | ||
380 | if (error) { | ||
381 | dev_err(&pdev->dev, | ||
382 | "unable to grab irq%d: %d\n", ucb->irq, error); | ||
383 | goto err_free_devs; | ||
384 | } | ||
385 | |||
407 | error = input_register_device(ucb->ts_idev); | 386 | error = input_register_device(ucb->ts_idev); |
408 | if (error) | 387 | if (error) |
409 | goto err_free_irq; | 388 | goto err_free_irq; |
@@ -416,56 +395,61 @@ err_free_devs: | |||
416 | input_free_device(ucb->ts_idev); | 395 | input_free_device(ucb->ts_idev); |
417 | err: | 396 | err: |
418 | return error; | 397 | return error; |
419 | |||
420 | } | 398 | } |
421 | 399 | ||
422 | static int ucb1400_ts_remove(struct platform_device *dev) | 400 | static int __devexit ucb1400_ts_remove(struct platform_device *pdev) |
423 | { | 401 | { |
424 | struct ucb1400_ts *ucb = dev->dev.platform_data; | 402 | struct ucb1400_ts *ucb = pdev->dev.platform_data; |
425 | 403 | ||
426 | free_irq(ucb->irq, ucb); | 404 | free_irq(ucb->irq, ucb); |
427 | input_unregister_device(ucb->ts_idev); | 405 | input_unregister_device(ucb->ts_idev); |
406 | |||
428 | return 0; | 407 | return 0; |
429 | } | 408 | } |
430 | 409 | ||
431 | #ifdef CONFIG_PM | 410 | #ifdef CONFIG_PM_SLEEP |
432 | static int ucb1400_ts_resume(struct platform_device *dev) | 411 | static int ucb1400_ts_suspend(struct device *dev) |
433 | { | 412 | { |
434 | struct ucb1400_ts *ucb = dev->dev.platform_data; | 413 | struct ucb1400_ts *ucb = dev->platform_data; |
435 | 414 | struct input_dev *idev = ucb->ts_idev; | |
436 | if (ucb->ts_task) { | 415 | |
437 | /* | 416 | mutex_lock(&idev->mutex); |
438 | * Restart the TS thread to ensure the | 417 | |
439 | * TS interrupt mode is set up again | 418 | if (idev->users) |
440 | * after sleep. | 419 | ucb1400_ts_start(ucb); |
441 | */ | 420 | |
442 | ucb->ts_restart = 1; | 421 | mutex_unlock(&idev->mutex); |
443 | wake_up(&ucb->ts_wait); | 422 | return 0; |
444 | } | 423 | } |
424 | |||
425 | static int ucb1400_ts_resume(struct device *dev) | ||
426 | { | ||
427 | struct ucb1400_ts *ucb = dev->platform_data; | ||
428 | struct input_dev *idev = ucb->ts_idev; | ||
429 | |||
430 | mutex_lock(&idev->mutex); | ||
431 | |||
432 | if (idev->users) | ||
433 | ucb1400_ts_stop(ucb); | ||
434 | |||
435 | mutex_unlock(&idev->mutex); | ||
445 | return 0; | 436 | return 0; |
446 | } | 437 | } |
447 | #else | ||
448 | #define ucb1400_ts_resume NULL | ||
449 | #endif | 438 | #endif |
450 | 439 | ||
440 | static SIMPLE_DEV_PM_OPS(ucb1400_ts_pm_ops, | ||
441 | ucb1400_ts_suspend, ucb1400_ts_resume); | ||
442 | |||
451 | static struct platform_driver ucb1400_ts_driver = { | 443 | static struct platform_driver ucb1400_ts_driver = { |
452 | .probe = ucb1400_ts_probe, | 444 | .probe = ucb1400_ts_probe, |
453 | .remove = ucb1400_ts_remove, | 445 | .remove = __devexit_p(ucb1400_ts_remove), |
454 | .resume = ucb1400_ts_resume, | ||
455 | .driver = { | 446 | .driver = { |
456 | .name = "ucb1400_ts", | 447 | .name = "ucb1400_ts", |
448 | .owner = THIS_MODULE, | ||
449 | .pm = &ucb1400_ts_pm_ops, | ||
457 | }, | 450 | }, |
458 | }; | 451 | }; |
459 | 452 | module_platform_driver(ucb1400_ts_driver); | |
460 | static int __init ucb1400_ts_init(void) | ||
461 | { | ||
462 | return platform_driver_register(&ucb1400_ts_driver); | ||
463 | } | ||
464 | |||
465 | static void __exit ucb1400_ts_exit(void) | ||
466 | { | ||
467 | platform_driver_unregister(&ucb1400_ts_driver); | ||
468 | } | ||
469 | 453 | ||
470 | module_param(adcsync, bool, 0444); | 454 | module_param(adcsync, bool, 0444); |
471 | MODULE_PARM_DESC(adcsync, "Synchronize touch readings with ADCSYNC pin."); | 455 | MODULE_PARM_DESC(adcsync, "Synchronize touch readings with ADCSYNC pin."); |
@@ -479,8 +463,5 @@ MODULE_PARM_DESC(ts_delay_pressure, | |||
479 | "delay between panel setup and pressure read." | 463 | "delay between panel setup and pressure read." |
480 | " Default = 0us."); | 464 | " Default = 0us."); |
481 | 465 | ||
482 | module_init(ucb1400_ts_init); | ||
483 | module_exit(ucb1400_ts_exit); | ||
484 | |||
485 | MODULE_DESCRIPTION("Philips UCB1400 touchscreen driver"); | 466 | MODULE_DESCRIPTION("Philips UCB1400 touchscreen driver"); |
486 | MODULE_LICENSE("GPL"); | 467 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index e539d92cc626..06cef3ccc63a 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
@@ -16,6 +16,7 @@ | |||
16 | * - JASTEC USB touch controller/DigiTech DTR-02U | 16 | * - JASTEC USB touch controller/DigiTech DTR-02U |
17 | * - Zytronic capacitive touchscreen | 17 | * - Zytronic capacitive touchscreen |
18 | * - NEXIO/iNexio | 18 | * - NEXIO/iNexio |
19 | * - Elo TouchSystems 2700 IntelliTouch | ||
19 | * | 20 | * |
20 | * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> | 21 | * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> |
21 | * Copyright (C) by Todd E. Johnson (mtouchusb.c) | 22 | * Copyright (C) by Todd E. Johnson (mtouchusb.c) |
@@ -138,6 +139,7 @@ enum { | |||
138 | DEVTYPE_ZYTRONIC, | 139 | DEVTYPE_ZYTRONIC, |
139 | DEVTYPE_TC45USB, | 140 | DEVTYPE_TC45USB, |
140 | DEVTYPE_NEXIO, | 141 | DEVTYPE_NEXIO, |
142 | DEVTYPE_ELO, | ||
141 | }; | 143 | }; |
142 | 144 | ||
143 | #define USB_DEVICE_HID_CLASS(vend, prod) \ | 145 | #define USB_DEVICE_HID_CLASS(vend, prod) \ |
@@ -239,6 +241,10 @@ static const struct usb_device_id usbtouch_devices[] = { | |||
239 | .driver_info = DEVTYPE_NEXIO}, | 241 | .driver_info = DEVTYPE_NEXIO}, |
240 | #endif | 242 | #endif |
241 | 243 | ||
244 | #ifdef CONFIG_TOUCHSCREEN_USB_ELO | ||
245 | {USB_DEVICE(0x04e7, 0x0020), .driver_info = DEVTYPE_ELO}, | ||
246 | #endif | ||
247 | |||
242 | {} | 248 | {} |
243 | }; | 249 | }; |
244 | 250 | ||
@@ -945,6 +951,24 @@ static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt) | |||
945 | 951 | ||
946 | 952 | ||
947 | /***************************************************************************** | 953 | /***************************************************************************** |
954 | * ELO part | ||
955 | */ | ||
956 | |||
957 | #ifdef CONFIG_TOUCHSCREEN_USB_ELO | ||
958 | |||
959 | static int elo_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | ||
960 | { | ||
961 | dev->x = (pkt[3] << 8) | pkt[2]; | ||
962 | dev->y = (pkt[5] << 8) | pkt[4]; | ||
963 | dev->touch = pkt[6] > 0; | ||
964 | dev->press = pkt[6]; | ||
965 | |||
966 | return 1; | ||
967 | } | ||
968 | #endif | ||
969 | |||
970 | |||
971 | /***************************************************************************** | ||
948 | * the different device descriptors | 972 | * the different device descriptors |
949 | */ | 973 | */ |
950 | #ifdef MULTI_PACKET | 974 | #ifdef MULTI_PACKET |
@@ -953,6 +977,18 @@ static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, | |||
953 | #endif | 977 | #endif |
954 | 978 | ||
955 | static struct usbtouch_device_info usbtouch_dev_info[] = { | 979 | static struct usbtouch_device_info usbtouch_dev_info[] = { |
980 | #ifdef CONFIG_TOUCHSCREEN_USB_ELO | ||
981 | [DEVTYPE_ELO] = { | ||
982 | .min_xc = 0x0, | ||
983 | .max_xc = 0x0fff, | ||
984 | .min_yc = 0x0, | ||
985 | .max_yc = 0x0fff, | ||
986 | .max_press = 0xff, | ||
987 | .rept_size = 8, | ||
988 | .read_data = elo_read_data, | ||
989 | }, | ||
990 | #endif | ||
991 | |||
956 | #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX | 992 | #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX |
957 | [DEVTYPE_EGALAX] = { | 993 | [DEVTYPE_EGALAX] = { |
958 | .min_xc = 0x0, | 994 | .min_xc = 0x0, |
diff --git a/drivers/input/touchscreen/w90p910_ts.c b/drivers/input/touchscreen/w90p910_ts.c index 217aa51135c5..9396b21d0e8f 100644 --- a/drivers/input/touchscreen/w90p910_ts.c +++ b/drivers/input/touchscreen/w90p910_ts.c | |||
@@ -331,19 +331,7 @@ static struct platform_driver w90x900ts_driver = { | |||
331 | .owner = THIS_MODULE, | 331 | .owner = THIS_MODULE, |
332 | }, | 332 | }, |
333 | }; | 333 | }; |
334 | 334 | module_platform_driver(w90x900ts_driver); | |
335 | static int __init w90x900ts_init(void) | ||
336 | { | ||
337 | return platform_driver_register(&w90x900ts_driver); | ||
338 | } | ||
339 | |||
340 | static void __exit w90x900ts_exit(void) | ||
341 | { | ||
342 | platform_driver_unregister(&w90x900ts_driver); | ||
343 | } | ||
344 | |||
345 | module_init(w90x900ts_init); | ||
346 | module_exit(w90x900ts_exit); | ||
347 | 335 | ||
348 | MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); | 336 | MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); |
349 | MODULE_DESCRIPTION("w90p910 touch screen driver!"); | 337 | MODULE_DESCRIPTION("w90p910 touch screen driver!"); |
diff --git a/drivers/input/touchscreen/wm831x-ts.c b/drivers/input/touchscreen/wm831x-ts.c index 9175d49d2546..4bc851a9dc3d 100644 --- a/drivers/input/touchscreen/wm831x-ts.c +++ b/drivers/input/touchscreen/wm831x-ts.c | |||
@@ -401,18 +401,7 @@ static struct platform_driver wm831x_ts_driver = { | |||
401 | .probe = wm831x_ts_probe, | 401 | .probe = wm831x_ts_probe, |
402 | .remove = __devexit_p(wm831x_ts_remove), | 402 | .remove = __devexit_p(wm831x_ts_remove), |
403 | }; | 403 | }; |
404 | 404 | module_platform_driver(wm831x_ts_driver); | |
405 | static int __init wm831x_ts_init(void) | ||
406 | { | ||
407 | return platform_driver_register(&wm831x_ts_driver); | ||
408 | } | ||
409 | module_init(wm831x_ts_init); | ||
410 | |||
411 | static void __exit wm831x_ts_exit(void) | ||
412 | { | ||
413 | platform_driver_unregister(&wm831x_ts_driver); | ||
414 | } | ||
415 | module_exit(wm831x_ts_exit); | ||
416 | 405 | ||
417 | /* Module information */ | 406 | /* Module information */ |
418 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); | 407 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); |
diff --git a/drivers/input/touchscreen/zylonite-wm97xx.c b/drivers/input/touchscreen/zylonite-wm97xx.c index 0a707bbbbea6..bf0869a7a78e 100644 --- a/drivers/input/touchscreen/zylonite-wm97xx.c +++ b/drivers/input/touchscreen/zylonite-wm97xx.c | |||
@@ -224,19 +224,7 @@ static struct platform_driver zylonite_wm97xx_driver = { | |||
224 | .name = "wm97xx-touch", | 224 | .name = "wm97xx-touch", |
225 | }, | 225 | }, |
226 | }; | 226 | }; |
227 | 227 | module_platform_driver(zylonite_wm97xx_driver); | |
228 | static int __init zylonite_wm97xx_init(void) | ||
229 | { | ||
230 | return platform_driver_register(&zylonite_wm97xx_driver); | ||
231 | } | ||
232 | |||
233 | static void __exit zylonite_wm97xx_exit(void) | ||
234 | { | ||
235 | platform_driver_unregister(&zylonite_wm97xx_driver); | ||
236 | } | ||
237 | |||
238 | module_init(zylonite_wm97xx_init); | ||
239 | module_exit(zylonite_wm97xx_exit); | ||
240 | 228 | ||
241 | /* Module information */ | 229 | /* Module information */ |
242 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); | 230 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); |
diff --git a/include/linux/input/auo-pixcir-ts.h b/include/linux/input/auo-pixcir-ts.h new file mode 100644 index 000000000000..75d4be717714 --- /dev/null +++ b/include/linux/input/auo-pixcir-ts.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Driver for AUO in-cell touchscreens | ||
3 | * | ||
4 | * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de> | ||
5 | * | ||
6 | * based on auo_touch.h from Dell Streak kernel | ||
7 | * | ||
8 | * Copyright (c) 2008 QUALCOMM Incorporated. | ||
9 | * Copyright (c) 2008 QUALCOMM USA, INC. | ||
10 | * | ||
11 | * | ||
12 | * This software is licensed under the terms of the GNU General Public | ||
13 | * License version 2, as published by the Free Software Foundation, and | ||
14 | * may be copied, distributed, and modified under those terms. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #ifndef __AUO_PIXCIR_TS_H__ | ||
24 | #define __AUO_PIXCIR_TS_H__ | ||
25 | |||
26 | /* | ||
27 | * Interrupt modes: | ||
28 | * periodical: interrupt is asserted periodicaly | ||
29 | * compare coordinates: interrupt is asserted when coordinates change | ||
30 | * indicate touch: interrupt is asserted during touch | ||
31 | */ | ||
32 | #define AUO_PIXCIR_INT_PERIODICAL 0x00 | ||
33 | #define AUO_PIXCIR_INT_COMP_COORD 0x01 | ||
34 | #define AUO_PIXCIR_INT_TOUCH_IND 0x02 | ||
35 | |||
36 | /* | ||
37 | * @gpio_int interrupt gpio | ||
38 | * @int_setting one of AUO_PIXCIR_INT_* | ||
39 | * @init_hw hardwarespecific init | ||
40 | * @exit_hw hardwarespecific shutdown | ||
41 | * @x_max x-resolution | ||
42 | * @y_max y-resolution | ||
43 | */ | ||
44 | struct auo_pixcir_ts_platdata { | ||
45 | int gpio_int; | ||
46 | |||
47 | int int_setting; | ||
48 | |||
49 | void (*init_hw)(struct i2c_client *); | ||
50 | void (*exit_hw)(struct i2c_client *); | ||
51 | |||
52 | unsigned int x_max; | ||
53 | unsigned int y_max; | ||
54 | }; | ||
55 | |||
56 | #endif | ||
diff --git a/include/linux/input/gp2ap002a00f.h b/include/linux/input/gp2ap002a00f.h new file mode 100644 index 000000000000..aad2fd44a61a --- /dev/null +++ b/include/linux/input/gp2ap002a00f.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef _GP2AP002A00F_H_ | ||
2 | #define _GP2AP002A00F_H_ | ||
3 | |||
4 | #include <linux/i2c.h> | ||
5 | |||
6 | #define GP2A_I2C_NAME "gp2ap002a00f" | ||
7 | |||
8 | /** | ||
9 | * struct gp2a_platform_data - Sharp gp2ap002a00f proximity platform data | ||
10 | * @vout_gpio: The gpio connected to the object detected pin (VOUT) | ||
11 | * @wakeup: Set to true if the proximity can wake the device from suspend | ||
12 | * @hw_setup: Callback for setting up hardware such as gpios and vregs | ||
13 | * @hw_shutdown: Callback for properly shutting down hardware | ||
14 | */ | ||
15 | struct gp2a_platform_data { | ||
16 | int vout_gpio; | ||
17 | bool wakeup; | ||
18 | int (*hw_setup)(struct i2c_client *client); | ||
19 | int (*hw_shutdown)(struct i2c_client *client); | ||
20 | }; | ||
21 | |||
22 | #endif | ||
diff --git a/include/linux/input/gpio_tilt.h b/include/linux/input/gpio_tilt.h new file mode 100644 index 000000000000..c1cc52d380e0 --- /dev/null +++ b/include/linux/input/gpio_tilt.h | |||
@@ -0,0 +1,73 @@ | |||
1 | #ifndef _INPUT_GPIO_TILT_H | ||
2 | #define _INPUT_GPIO_TILT_H | ||
3 | |||
4 | /** | ||
5 | * struct gpio_tilt_axis - Axis used by the tilt switch | ||
6 | * @axis: Constant describing the axis, e.g. ABS_X | ||
7 | * @min: minimum value for abs_param | ||
8 | * @max: maximum value for abs_param | ||
9 | * @fuzz: fuzz value for abs_param | ||
10 | * @flat: flat value for abs_param | ||
11 | */ | ||
12 | struct gpio_tilt_axis { | ||
13 | int axis; | ||
14 | int min; | ||
15 | int max; | ||
16 | int fuzz; | ||
17 | int flat; | ||
18 | }; | ||
19 | |||
20 | /** | ||
21 | * struct gpio_tilt_state - state description | ||
22 | * @gpios: bitfield of gpio target-states for the value | ||
23 | * @axes: array containing the axes settings for the gpio state | ||
24 | * The array indizes must correspond to the axes defined | ||
25 | * in platform_data | ||
26 | * | ||
27 | * This structure describes a supported axis settings | ||
28 | * and the necessary gpio-state which represent it. | ||
29 | * | ||
30 | * The n-th bit in the bitfield describes the state of the n-th GPIO | ||
31 | * from the gpios-array defined in gpio_regulator_config below. | ||
32 | */ | ||
33 | struct gpio_tilt_state { | ||
34 | int gpios; | ||
35 | int *axes; | ||
36 | }; | ||
37 | |||
38 | /** | ||
39 | * struct gpio_tilt_platform_data | ||
40 | * @gpios: Array containing the gpios determining the tilt state | ||
41 | * @nr_gpios: Number of gpios | ||
42 | * @axes: Array of gpio_tilt_axis descriptions | ||
43 | * @nr_axes: Number of axes | ||
44 | * @states: Array of gpio_tilt_state entries describing | ||
45 | * the gpio state for specific tilts | ||
46 | * @nr_states: Number of states available | ||
47 | * @debounce_interval: debounce ticks interval in msecs | ||
48 | * @poll_interval: polling interval in msecs - for polling driver only | ||
49 | * @enable: callback to enable the tilt switch | ||
50 | * @disable: callback to disable the tilt switch | ||
51 | * | ||
52 | * This structure contains gpio-tilt-switch configuration | ||
53 | * information that must be passed by platform code to the | ||
54 | * gpio-tilt input driver. | ||
55 | */ | ||
56 | struct gpio_tilt_platform_data { | ||
57 | struct gpio *gpios; | ||
58 | int nr_gpios; | ||
59 | |||
60 | struct gpio_tilt_axis *axes; | ||
61 | int nr_axes; | ||
62 | |||
63 | struct gpio_tilt_state *states; | ||
64 | int nr_states; | ||
65 | |||
66 | int debounce_interval; | ||
67 | |||
68 | unsigned int poll_interval; | ||
69 | int (*enable)(struct device *dev); | ||
70 | void (*disable)(struct device *dev); | ||
71 | }; | ||
72 | |||
73 | #endif | ||
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h new file mode 100644 index 000000000000..7163d91c0373 --- /dev/null +++ b/include/linux/input/pixcir_ts.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef _PIXCIR_I2C_TS_H | ||
2 | #define _PIXCIR_I2C_TS_H | ||
3 | |||
4 | struct pixcir_ts_platform_data { | ||
5 | int (*attb_read_val)(void); | ||
6 | int x_max; | ||
7 | int y_max; | ||
8 | }; | ||
9 | |||
10 | #endif | ||
diff --git a/include/linux/input/samsung-keypad.h b/include/linux/input/samsung-keypad.h new file mode 100644 index 000000000000..f25619bfd8a8 --- /dev/null +++ b/include/linux/input/samsung-keypad.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Samsung Keypad platform data definitions | ||
3 | * | ||
4 | * Copyright (C) 2010 Samsung Electronics Co.Ltd | ||
5 | * Author: Joonyoung Shim <jy0922.shim@samsung.com> | ||
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 as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef __SAMSUNG_KEYPAD_H | ||
14 | #define __SAMSUNG_KEYPAD_H | ||
15 | |||
16 | #include <linux/input/matrix_keypad.h> | ||
17 | |||
18 | #define SAMSUNG_MAX_ROWS 8 | ||
19 | #define SAMSUNG_MAX_COLS 8 | ||
20 | |||
21 | /** | ||
22 | * struct samsung_keypad_platdata - Platform device data for Samsung Keypad. | ||
23 | * @keymap_data: pointer to &matrix_keymap_data. | ||
24 | * @rows: number of keypad row supported. | ||
25 | * @cols: number of keypad col supported. | ||
26 | * @no_autorepeat: disable key autorepeat. | ||
27 | * @wakeup: controls whether the device should be set up as wakeup source. | ||
28 | * @cfg_gpio: configure the GPIO. | ||
29 | * | ||
30 | * Initialisation data specific to either the machine or the platform | ||
31 | * for the device driver to use or call-back when configuring gpio. | ||
32 | */ | ||
33 | struct samsung_keypad_platdata { | ||
34 | const struct matrix_keymap_data *keymap_data; | ||
35 | unsigned int rows; | ||
36 | unsigned int cols; | ||
37 | bool no_autorepeat; | ||
38 | bool wakeup; | ||
39 | |||
40 | void (*cfg_gpio)(unsigned int rows, unsigned int cols); | ||
41 | }; | ||
42 | |||
43 | #endif /* __SAMSUNG_KEYPAD_H */ | ||
diff --git a/include/linux/input/tca8418_keypad.h b/include/linux/input/tca8418_keypad.h new file mode 100644 index 000000000000..e71a85dc2cbd --- /dev/null +++ b/include/linux/input/tca8418_keypad.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * TCA8418 keypad platform support | ||
3 | * | ||
4 | * Copyright (C) 2011 Fuel7, Inc. All rights reserved. | ||
5 | * | ||
6 | * Author: Kyle Manna <kyle.manna@fuel7.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public | ||
10 | * License v2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public | ||
18 | * License along with this program; if not, write to the | ||
19 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
20 | * Boston, MA 021110-1307, USA. | ||
21 | * | ||
22 | * If you can't comply with GPLv2, alternative licensing terms may be | ||
23 | * arranged. Please contact Fuel7, Inc. (http://fuel7.com/) for proprietary | ||
24 | * alternative licensing inquiries. | ||
25 | */ | ||
26 | |||
27 | #ifndef _TCA8418_KEYPAD_H | ||
28 | #define _TCA8418_KEYPAD_H | ||
29 | |||
30 | #include <linux/types.h> | ||
31 | #include <linux/input/matrix_keypad.h> | ||
32 | |||
33 | #define TCA8418_I2C_ADDR 0x34 | ||
34 | #define TCA8418_NAME "tca8418_keypad" | ||
35 | |||
36 | struct tca8418_keypad_platform_data { | ||
37 | const struct matrix_keymap_data *keymap_data; | ||
38 | unsigned rows; | ||
39 | unsigned cols; | ||
40 | bool rep; | ||
41 | bool irq_is_gpio; | ||
42 | }; | ||
43 | |||
44 | #endif | ||
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h index 5c75153f9441..d21b33c4c6ca 100644 --- a/include/linux/ucb1400.h +++ b/include/linux/ucb1400.h | |||
@@ -96,13 +96,11 @@ struct ucb1400_gpio { | |||
96 | 96 | ||
97 | struct ucb1400_ts { | 97 | struct ucb1400_ts { |
98 | struct input_dev *ts_idev; | 98 | struct input_dev *ts_idev; |
99 | struct task_struct *ts_task; | ||
100 | int id; | 99 | int id; |
101 | wait_queue_head_t ts_wait; | ||
102 | unsigned int ts_restart:1; | ||
103 | int irq; | 100 | int irq; |
104 | unsigned int irq_pending; /* not bit field shared */ | ||
105 | struct snd_ac97 *ac97; | 101 | struct snd_ac97 *ac97; |
102 | wait_queue_head_t ts_wait; | ||
103 | bool stopped; | ||
106 | }; | 104 | }; |
107 | 105 | ||
108 | struct ucb1400 { | 106 | struct ucb1400 { |