Commit 4a200c3b9a40242652b5734630bdd0bcf3aca75f

Authored by Benjamin Tissoires
Committed by Jiri Kosina
1 parent 1a1e8c6fad

HID: i2c-hid: introduce HID over i2c specification implementation

Microsoft published the protocol specification of HID over i2c:
http://msdn.microsoft.com/en-us/library/windows/hardware/hh852380.aspx

This patch introduces an implementation of this protocol.

This implementation does not includes the ACPI part of the specification.
This will come when ACPI 5.0 devices enumeration will be available.

Once the ACPI part is done, OEM will not have to declare HID over I2C
devices in their platform specific driver.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

Showing 6 changed files with 1038 additions and 0 deletions Inline Diff

1 # 1 #
2 # HID driver configuration 2 # HID driver configuration
3 # 3 #
4 menu "HID support" 4 menu "HID support"
5 depends on INPUT 5 depends on INPUT
6 6
7 config HID 7 config HID
8 tristate "HID bus support" 8 tristate "HID bus support"
9 depends on INPUT 9 depends on INPUT
10 default y 10 default y
11 ---help--- 11 ---help---
12 A human interface device (HID) is a type of computer device that 12 A human interface device (HID) is a type of computer device that
13 interacts directly with and takes input from humans. The term "HID" 13 interacts directly with and takes input from humans. The term "HID"
14 most commonly used to refer to the USB-HID specification, but other 14 most commonly used to refer to the USB-HID specification, but other
15 devices (such as, but not strictly limited to, Bluetooth) are 15 devices (such as, but not strictly limited to, Bluetooth) are
16 designed using HID specification (this involves certain keyboards, 16 designed using HID specification (this involves certain keyboards,
17 mice, tablets, etc). This option adds the HID bus to the kernel, 17 mice, tablets, etc). This option adds the HID bus to the kernel,
18 together with generic HID layer code. The HID devices are added and 18 together with generic HID layer code. The HID devices are added and
19 removed from the HID bus by the transport-layer drivers, such as 19 removed from the HID bus by the transport-layer drivers, such as
20 usbhid (USB_HID) and hidp (BT_HIDP). 20 usbhid (USB_HID) and hidp (BT_HIDP).
21 21
22 For docs and specs, see http://www.usb.org/developers/hidpage/ 22 For docs and specs, see http://www.usb.org/developers/hidpage/
23 23
24 If unsure, say Y. 24 If unsure, say Y.
25 25
26 if HID 26 if HID
27 27
28 config HID_BATTERY_STRENGTH 28 config HID_BATTERY_STRENGTH
29 bool "Battery level reporting for HID devices" 29 bool "Battery level reporting for HID devices"
30 depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY 30 depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY
31 default n 31 default n
32 ---help--- 32 ---help---
33 This option adds support of reporting battery strength (for HID devices 33 This option adds support of reporting battery strength (for HID devices
34 that support this feature) through power_supply class so that userspace 34 that support this feature) through power_supply class so that userspace
35 tools, such as upower, can display it. 35 tools, such as upower, can display it.
36 36
37 config HIDRAW 37 config HIDRAW
38 bool "/dev/hidraw raw HID device support" 38 bool "/dev/hidraw raw HID device support"
39 depends on HID 39 depends on HID
40 ---help--- 40 ---help---
41 Say Y here if you want to support HID devices (from the USB 41 Say Y here if you want to support HID devices (from the USB
42 specification standpoint) that aren't strictly user interface 42 specification standpoint) that aren't strictly user interface
43 devices, like monitor controls and Uninterruptable Power Supplies. 43 devices, like monitor controls and Uninterruptable Power Supplies.
44 44
45 This module supports these devices separately using a separate 45 This module supports these devices separately using a separate
46 event interface on /dev/hidraw. 46 event interface on /dev/hidraw.
47 47
48 There is also a /dev/hiddev configuration option in the USB HID 48 There is also a /dev/hiddev configuration option in the USB HID
49 configuration menu. In comparison to hiddev, this device does not process 49 configuration menu. In comparison to hiddev, this device does not process
50 the hid events at all (no parsing, no lookups). This lets applications 50 the hid events at all (no parsing, no lookups). This lets applications
51 to work on raw hid events when they want to, and avoid using transport-specific 51 to work on raw hid events when they want to, and avoid using transport-specific
52 userspace libhid/libusb libraries. 52 userspace libhid/libusb libraries.
53 53
54 If unsure, say Y. 54 If unsure, say Y.
55 55
56 config UHID 56 config UHID
57 tristate "User-space I/O driver support for HID subsystem" 57 tristate "User-space I/O driver support for HID subsystem"
58 depends on HID 58 depends on HID
59 default n 59 default n
60 ---help--- 60 ---help---
61 Say Y here if you want to provide HID I/O Drivers from user-space. 61 Say Y here if you want to provide HID I/O Drivers from user-space.
62 This allows to write I/O drivers in user-space and feed the data from 62 This allows to write I/O drivers in user-space and feed the data from
63 the device into the kernel. The kernel parses the HID reports, loads the 63 the device into the kernel. The kernel parses the HID reports, loads the
64 corresponding HID Device Driver or provides input devices on top of your 64 corresponding HID Device Driver or provides input devices on top of your
65 user-space device. 65 user-space device.
66 66
67 This driver cannot be used to parse HID-reports in user-space and write 67 This driver cannot be used to parse HID-reports in user-space and write
68 special HID-drivers. You should use hidraw for that. 68 special HID-drivers. You should use hidraw for that.
69 Instead, this driver allows to write the transport-layer driver in 69 Instead, this driver allows to write the transport-layer driver in
70 user-space like USB-HID and Bluetooth-HID do in kernel-space. 70 user-space like USB-HID and Bluetooth-HID do in kernel-space.
71 71
72 If unsure, say N. 72 If unsure, say N.
73 73
74 To compile this driver as a module, choose M here: the 74 To compile this driver as a module, choose M here: the
75 module will be called uhid. 75 module will be called uhid.
76 76
77 config HID_GENERIC 77 config HID_GENERIC
78 tristate "Generic HID driver" 78 tristate "Generic HID driver"
79 depends on HID 79 depends on HID
80 default HID 80 default HID
81 ---help--- 81 ---help---
82 Support for generic devices on the HID bus. This includes most 82 Support for generic devices on the HID bus. This includes most
83 keyboards and mice, joysticks, tablets and digitizers. 83 keyboards and mice, joysticks, tablets and digitizers.
84 84
85 To compile this driver as a module, choose M here: the module 85 To compile this driver as a module, choose M here: the module
86 will be called hid-generic. 86 will be called hid-generic.
87 87
88 If unsure, say Y. 88 If unsure, say Y.
89 89
90 menu "Special HID drivers" 90 menu "Special HID drivers"
91 depends on HID 91 depends on HID
92 92
93 config HID_A4TECH 93 config HID_A4TECH
94 tristate "A4 tech mice" if EXPERT 94 tristate "A4 tech mice" if EXPERT
95 depends on USB_HID 95 depends on USB_HID
96 default !EXPERT 96 default !EXPERT
97 ---help--- 97 ---help---
98 Support for A4 tech X5 and WOP-35 / Trust 450L mice. 98 Support for A4 tech X5 and WOP-35 / Trust 450L mice.
99 99
100 config HID_ACRUX 100 config HID_ACRUX
101 tristate "ACRUX game controller support" 101 tristate "ACRUX game controller support"
102 depends on USB_HID 102 depends on USB_HID
103 ---help--- 103 ---help---
104 Say Y here if you want to enable support for ACRUX game controllers. 104 Say Y here if you want to enable support for ACRUX game controllers.
105 105
106 config HID_ACRUX_FF 106 config HID_ACRUX_FF
107 bool "ACRUX force feedback support" 107 bool "ACRUX force feedback support"
108 depends on HID_ACRUX 108 depends on HID_ACRUX
109 select INPUT_FF_MEMLESS 109 select INPUT_FF_MEMLESS
110 ---help--- 110 ---help---
111 Say Y here if you want to enable force feedback support for ACRUX 111 Say Y here if you want to enable force feedback support for ACRUX
112 game controllers. 112 game controllers.
113 113
114 config HID_APPLE 114 config HID_APPLE
115 tristate "Apple {i,Power,Mac}Books" if EXPERT 115 tristate "Apple {i,Power,Mac}Books" if EXPERT
116 depends on (USB_HID || BT_HIDP) 116 depends on (USB_HID || BT_HIDP)
117 default !EXPERT 117 default !EXPERT
118 ---help--- 118 ---help---
119 Support for some Apple devices which less or more break 119 Support for some Apple devices which less or more break
120 HID specification. 120 HID specification.
121 121
122 Say Y here if you want support for keyboards of Apple iBooks, PowerBooks, 122 Say Y here if you want support for keyboards of Apple iBooks, PowerBooks,
123 MacBooks, MacBook Pros and Apple Aluminum. 123 MacBooks, MacBook Pros and Apple Aluminum.
124 124
125 config HID_AUREAL 125 config HID_AUREAL
126 tristate "Aureal" 126 tristate "Aureal"
127 depends on USB_HID 127 depends on USB_HID
128 ---help--- 128 ---help---
129 Support for Aureal Cy se W-01RN Remote Controller and other Aureal derived remotes. 129 Support for Aureal Cy se W-01RN Remote Controller and other Aureal derived remotes.
130 130
131 config HID_BELKIN 131 config HID_BELKIN
132 tristate "Belkin Flip KVM and Wireless keyboard" if EXPERT 132 tristate "Belkin Flip KVM and Wireless keyboard" if EXPERT
133 depends on USB_HID 133 depends on USB_HID
134 default !EXPERT 134 default !EXPERT
135 ---help--- 135 ---help---
136 Support for Belkin Flip KVM and Wireless keyboard. 136 Support for Belkin Flip KVM and Wireless keyboard.
137 137
138 config HID_CHERRY 138 config HID_CHERRY
139 tristate "Cherry Cymotion keyboard" if EXPERT 139 tristate "Cherry Cymotion keyboard" if EXPERT
140 depends on USB_HID 140 depends on USB_HID
141 default !EXPERT 141 default !EXPERT
142 ---help--- 142 ---help---
143 Support for Cherry Cymotion keyboard. 143 Support for Cherry Cymotion keyboard.
144 144
145 config HID_CHICONY 145 config HID_CHICONY
146 tristate "Chicony Tactical pad" if EXPERT 146 tristate "Chicony Tactical pad" if EXPERT
147 depends on USB_HID 147 depends on USB_HID
148 default !EXPERT 148 default !EXPERT
149 ---help--- 149 ---help---
150 Support for Chicony Tactical pad. 150 Support for Chicony Tactical pad.
151 151
152 config HID_PRODIKEYS 152 config HID_PRODIKEYS
153 tristate "Prodikeys PC-MIDI Keyboard support" 153 tristate "Prodikeys PC-MIDI Keyboard support"
154 depends on USB_HID && SND 154 depends on USB_HID && SND
155 select SND_RAWMIDI 155 select SND_RAWMIDI
156 ---help--- 156 ---help---
157 Support for Prodikeys PC-MIDI Keyboard device support. 157 Support for Prodikeys PC-MIDI Keyboard device support.
158 Say Y here to enable support for this device. 158 Say Y here to enable support for this device.
159 - Prodikeys PC-MIDI keyboard. 159 - Prodikeys PC-MIDI keyboard.
160 The Prodikeys PC-MIDI acts as a USB Audio device, with one MIDI 160 The Prodikeys PC-MIDI acts as a USB Audio device, with one MIDI
161 input and one MIDI output. These MIDI jacks appear as 161 input and one MIDI output. These MIDI jacks appear as
162 a sound "card" in the ALSA sound system. 162 a sound "card" in the ALSA sound system.
163 Note: if you say N here, this device will still function as a basic 163 Note: if you say N here, this device will still function as a basic
164 multimedia keyboard, but will lack support for the musical keyboard 164 multimedia keyboard, but will lack support for the musical keyboard
165 and some additional multimedia keys. 165 and some additional multimedia keys.
166 166
167 config HID_CYPRESS 167 config HID_CYPRESS
168 tristate "Cypress mouse and barcode readers" if EXPERT 168 tristate "Cypress mouse and barcode readers" if EXPERT
169 depends on USB_HID 169 depends on USB_HID
170 default !EXPERT 170 default !EXPERT
171 ---help--- 171 ---help---
172 Support for cypress mouse and barcode readers. 172 Support for cypress mouse and barcode readers.
173 173
174 config HID_DRAGONRISE 174 config HID_DRAGONRISE
175 tristate "DragonRise Inc. game controller" 175 tristate "DragonRise Inc. game controller"
176 depends on USB_HID 176 depends on USB_HID
177 ---help--- 177 ---help---
178 Say Y here if you have DragonRise Inc. game controllers. 178 Say Y here if you have DragonRise Inc. game controllers.
179 These might be branded as: 179 These might be branded as:
180 - Tesun USB-703 180 - Tesun USB-703
181 - Media-tech MT1504 "Rogue" 181 - Media-tech MT1504 "Rogue"
182 - DVTech JS19 "Gear" 182 - DVTech JS19 "Gear"
183 - Defender Game Master 183 - Defender Game Master
184 184
185 config DRAGONRISE_FF 185 config DRAGONRISE_FF
186 bool "DragonRise Inc. force feedback" 186 bool "DragonRise Inc. force feedback"
187 depends on HID_DRAGONRISE 187 depends on HID_DRAGONRISE
188 select INPUT_FF_MEMLESS 188 select INPUT_FF_MEMLESS
189 ---help--- 189 ---help---
190 Say Y here if you want to enable force feedback support for DragonRise Inc. 190 Say Y here if you want to enable force feedback support for DragonRise Inc.
191 game controllers. 191 game controllers.
192 192
193 config HID_EMS_FF 193 config HID_EMS_FF
194 tristate "EMS Production Inc. force feedback support" 194 tristate "EMS Production Inc. force feedback support"
195 depends on USB_HID 195 depends on USB_HID
196 select INPUT_FF_MEMLESS 196 select INPUT_FF_MEMLESS
197 ---help--- 197 ---help---
198 Say Y here if you want to enable force feedback support for devices by 198 Say Y here if you want to enable force feedback support for devices by
199 EMS Production Ltd. 199 EMS Production Ltd.
200 Currently the following devices are known to be supported: 200 Currently the following devices are known to be supported:
201 - Trio Linker Plus II 201 - Trio Linker Plus II
202 202
203 config HID_ELECOM 203 config HID_ELECOM
204 tristate "ELECOM BM084 bluetooth mouse" 204 tristate "ELECOM BM084 bluetooth mouse"
205 depends on BT_HIDP 205 depends on BT_HIDP
206 ---help--- 206 ---help---
207 Support for the ELECOM BM084 (bluetooth mouse). 207 Support for the ELECOM BM084 (bluetooth mouse).
208 208
209 config HID_EZKEY 209 config HID_EZKEY
210 tristate "Ezkey BTC 8193 keyboard" if EXPERT 210 tristate "Ezkey BTC 8193 keyboard" if EXPERT
211 depends on USB_HID 211 depends on USB_HID
212 default !EXPERT 212 default !EXPERT
213 ---help--- 213 ---help---
214 Support for Ezkey BTC 8193 keyboard. 214 Support for Ezkey BTC 8193 keyboard.
215 215
216 config HID_HOLTEK 216 config HID_HOLTEK
217 tristate "Holtek HID devices" 217 tristate "Holtek HID devices"
218 depends on USB_HID 218 depends on USB_HID
219 ---help--- 219 ---help---
220 Support for Holtek based devices: 220 Support for Holtek based devices:
221 - Holtek On Line Grip based game controller 221 - Holtek On Line Grip based game controller
222 - Trust GXT 18 Gaming Keyboard 222 - Trust GXT 18 Gaming Keyboard
223 223
224 config HOLTEK_FF 224 config HOLTEK_FF
225 bool "Holtek On Line Grip force feedback support" 225 bool "Holtek On Line Grip force feedback support"
226 depends on HID_HOLTEK 226 depends on HID_HOLTEK
227 select INPUT_FF_MEMLESS 227 select INPUT_FF_MEMLESS
228 ---help--- 228 ---help---
229 Say Y here if you have a Holtek On Line Grip based game controller 229 Say Y here if you have a Holtek On Line Grip based game controller
230 and want to have force feedback support for it. 230 and want to have force feedback support for it.
231 231
232 config HID_KEYTOUCH 232 config HID_KEYTOUCH
233 tristate "Keytouch HID devices" 233 tristate "Keytouch HID devices"
234 depends on USB_HID 234 depends on USB_HID
235 ---help--- 235 ---help---
236 Support for Keytouch HID devices not fully compliant with 236 Support for Keytouch HID devices not fully compliant with
237 the specification. Currently supported: 237 the specification. Currently supported:
238 - Keytouch IEC 60945 238 - Keytouch IEC 60945
239 239
240 config HID_KYE 240 config HID_KYE
241 tristate "KYE/Genius devices" 241 tristate "KYE/Genius devices"
242 depends on USB_HID 242 depends on USB_HID
243 ---help--- 243 ---help---
244 Support for KYE/Genius devices not fully compliant with HID standard: 244 Support for KYE/Genius devices not fully compliant with HID standard:
245 - Ergo Mouse 245 - Ergo Mouse
246 - EasyPen i405X tablet 246 - EasyPen i405X tablet
247 - MousePen i608X tablet 247 - MousePen i608X tablet
248 - EasyPen M610X tablet 248 - EasyPen M610X tablet
249 249
250 config HID_UCLOGIC 250 config HID_UCLOGIC
251 tristate "UC-Logic" 251 tristate "UC-Logic"
252 depends on USB_HID 252 depends on USB_HID
253 ---help--- 253 ---help---
254 Support for UC-Logic tablets. 254 Support for UC-Logic tablets.
255 255
256 config HID_WALTOP 256 config HID_WALTOP
257 tristate "Waltop" 257 tristate "Waltop"
258 depends on USB_HID 258 depends on USB_HID
259 ---help--- 259 ---help---
260 Support for Waltop tablets. 260 Support for Waltop tablets.
261 261
262 config HID_GYRATION 262 config HID_GYRATION
263 tristate "Gyration remote control" 263 tristate "Gyration remote control"
264 depends on USB_HID 264 depends on USB_HID
265 ---help--- 265 ---help---
266 Support for Gyration remote control. 266 Support for Gyration remote control.
267 267
268 config HID_TWINHAN 268 config HID_TWINHAN
269 tristate "Twinhan IR remote control" 269 tristate "Twinhan IR remote control"
270 depends on USB_HID 270 depends on USB_HID
271 ---help--- 271 ---help---
272 Support for Twinhan IR remote control. 272 Support for Twinhan IR remote control.
273 273
274 config HID_KENSINGTON 274 config HID_KENSINGTON
275 tristate "Kensington Slimblade Trackball" if EXPERT 275 tristate "Kensington Slimblade Trackball" if EXPERT
276 depends on USB_HID 276 depends on USB_HID
277 default !EXPERT 277 default !EXPERT
278 ---help--- 278 ---help---
279 Support for Kensington Slimblade Trackball. 279 Support for Kensington Slimblade Trackball.
280 280
281 config HID_LCPOWER 281 config HID_LCPOWER
282 tristate "LC-Power" 282 tristate "LC-Power"
283 depends on USB_HID 283 depends on USB_HID
284 ---help--- 284 ---help---
285 Support for LC-Power RC1000MCE RF remote control. 285 Support for LC-Power RC1000MCE RF remote control.
286 286
287 config HID_LENOVO_TPKBD 287 config HID_LENOVO_TPKBD
288 tristate "Lenovo ThinkPad USB Keyboard with TrackPoint" 288 tristate "Lenovo ThinkPad USB Keyboard with TrackPoint"
289 depends on USB_HID 289 depends on USB_HID
290 select NEW_LEDS 290 select NEW_LEDS
291 select LEDS_CLASS 291 select LEDS_CLASS
292 ---help--- 292 ---help---
293 Support for the Lenovo ThinkPad USB Keyboard with TrackPoint. 293 Support for the Lenovo ThinkPad USB Keyboard with TrackPoint.
294 294
295 Say Y here if you have a Lenovo ThinkPad USB Keyboard with TrackPoint 295 Say Y here if you have a Lenovo ThinkPad USB Keyboard with TrackPoint
296 and would like to use device-specific features like changing the 296 and would like to use device-specific features like changing the
297 sensitivity of the trackpoint, using the microphone mute button or 297 sensitivity of the trackpoint, using the microphone mute button or
298 controlling the mute and microphone mute LEDs. 298 controlling the mute and microphone mute LEDs.
299 299
300 config HID_LOGITECH 300 config HID_LOGITECH
301 tristate "Logitech devices" if EXPERT 301 tristate "Logitech devices" if EXPERT
302 depends on USB_HID 302 depends on USB_HID
303 default !EXPERT 303 default !EXPERT
304 ---help--- 304 ---help---
305 Support for Logitech devices that are not fully compliant with HID standard. 305 Support for Logitech devices that are not fully compliant with HID standard.
306 306
307 config HID_LOGITECH_DJ 307 config HID_LOGITECH_DJ
308 tristate "Logitech Unifying receivers full support" 308 tristate "Logitech Unifying receivers full support"
309 depends on HID_LOGITECH 309 depends on HID_LOGITECH
310 ---help--- 310 ---help---
311 Say Y if you want support for Logitech Unifying receivers and devices. 311 Say Y if you want support for Logitech Unifying receivers and devices.
312 Unifying receivers are capable of pairing up to 6 Logitech compliant 312 Unifying receivers are capable of pairing up to 6 Logitech compliant
313 devices to the same receiver. Without this driver it will be handled by 313 devices to the same receiver. Without this driver it will be handled by
314 generic USB_HID driver and all incomming events will be multiplexed 314 generic USB_HID driver and all incomming events will be multiplexed
315 into a single mouse and a single keyboard device. 315 into a single mouse and a single keyboard device.
316 316
317 config LOGITECH_FF 317 config LOGITECH_FF
318 bool "Logitech force feedback support" 318 bool "Logitech force feedback support"
319 depends on HID_LOGITECH 319 depends on HID_LOGITECH
320 select INPUT_FF_MEMLESS 320 select INPUT_FF_MEMLESS
321 help 321 help
322 Say Y here if you have one of these devices: 322 Say Y here if you have one of these devices:
323 - Logitech WingMan Cordless RumblePad 323 - Logitech WingMan Cordless RumblePad
324 - Logitech WingMan Cordless RumblePad 2 324 - Logitech WingMan Cordless RumblePad 2
325 - Logitech WingMan Force 3D 325 - Logitech WingMan Force 3D
326 - Logitech Formula Force EX 326 - Logitech Formula Force EX
327 - Logitech WingMan Formula Force GP 327 - Logitech WingMan Formula Force GP
328 - Logitech MOMO Force wheel 328 - Logitech MOMO Force wheel
329 329
330 and if you want to enable force feedback for them. 330 and if you want to enable force feedback for them.
331 Note: if you say N here, this device will still be supported, but without 331 Note: if you say N here, this device will still be supported, but without
332 force feedback. 332 force feedback.
333 333
334 config LOGIRUMBLEPAD2_FF 334 config LOGIRUMBLEPAD2_FF
335 bool "Logitech RumblePad/Rumblepad 2 force feedback support" 335 bool "Logitech RumblePad/Rumblepad 2 force feedback support"
336 depends on HID_LOGITECH 336 depends on HID_LOGITECH
337 select INPUT_FF_MEMLESS 337 select INPUT_FF_MEMLESS
338 help 338 help
339 Say Y here if you want to enable force feedback support for Logitech 339 Say Y here if you want to enable force feedback support for Logitech
340 RumblePad and Rumblepad 2 devices. 340 RumblePad and Rumblepad 2 devices.
341 341
342 config LOGIG940_FF 342 config LOGIG940_FF
343 bool "Logitech Flight System G940 force feedback support" 343 bool "Logitech Flight System G940 force feedback support"
344 depends on HID_LOGITECH 344 depends on HID_LOGITECH
345 select INPUT_FF_MEMLESS 345 select INPUT_FF_MEMLESS
346 help 346 help
347 Say Y here if you want to enable force feedback support for Logitech 347 Say Y here if you want to enable force feedback support for Logitech
348 Flight System G940 devices. 348 Flight System G940 devices.
349 349
350 config LOGIWHEELS_FF 350 config LOGIWHEELS_FF
351 bool "Logitech wheels configuration and force feedback support" 351 bool "Logitech wheels configuration and force feedback support"
352 depends on HID_LOGITECH 352 depends on HID_LOGITECH
353 select INPUT_FF_MEMLESS 353 select INPUT_FF_MEMLESS
354 default LOGITECH_FF 354 default LOGITECH_FF
355 help 355 help
356 Say Y here if you want to enable force feedback and range setting 356 Say Y here if you want to enable force feedback and range setting
357 support for following Logitech wheels: 357 support for following Logitech wheels:
358 - Logitech Driving Force 358 - Logitech Driving Force
359 - Logitech Driving Force Pro 359 - Logitech Driving Force Pro
360 - Logitech Driving Force GT 360 - Logitech Driving Force GT
361 - Logitech G25 361 - Logitech G25
362 - Logitech G27 362 - Logitech G27
363 - Logitech MOMO/MOMO 2 363 - Logitech MOMO/MOMO 2
364 - Logitech Formula Force EX 364 - Logitech Formula Force EX
365 365
366 config HID_MAGICMOUSE 366 config HID_MAGICMOUSE
367 tristate "Apple MagicMouse multi-touch support" 367 tristate "Apple MagicMouse multi-touch support"
368 depends on BT_HIDP 368 depends on BT_HIDP
369 ---help--- 369 ---help---
370 Support for the Apple Magic Mouse multi-touch. 370 Support for the Apple Magic Mouse multi-touch.
371 371
372 Say Y here if you want support for the multi-touch features of the 372 Say Y here if you want support for the multi-touch features of the
373 Apple Wireless "Magic" Mouse. 373 Apple Wireless "Magic" Mouse.
374 374
375 config HID_MICROSOFT 375 config HID_MICROSOFT
376 tristate "Microsoft non-fully HID-compliant devices" if EXPERT 376 tristate "Microsoft non-fully HID-compliant devices" if EXPERT
377 depends on USB_HID 377 depends on USB_HID
378 default !EXPERT 378 default !EXPERT
379 ---help--- 379 ---help---
380 Support for Microsoft devices that are not fully compliant with HID standard. 380 Support for Microsoft devices that are not fully compliant with HID standard.
381 381
382 config HID_MONTEREY 382 config HID_MONTEREY
383 tristate "Monterey Genius KB29E keyboard" if EXPERT 383 tristate "Monterey Genius KB29E keyboard" if EXPERT
384 depends on USB_HID 384 depends on USB_HID
385 default !EXPERT 385 default !EXPERT
386 ---help--- 386 ---help---
387 Support for Monterey Genius KB29E. 387 Support for Monterey Genius KB29E.
388 388
389 config HID_MULTITOUCH 389 config HID_MULTITOUCH
390 tristate "HID Multitouch panels" 390 tristate "HID Multitouch panels"
391 depends on USB_HID 391 depends on USB_HID
392 ---help--- 392 ---help---
393 Generic support for HID multitouch panels. 393 Generic support for HID multitouch panels.
394 394
395 Say Y here if you have one of the following devices: 395 Say Y here if you have one of the following devices:
396 - 3M PCT touch screens 396 - 3M PCT touch screens
397 - ActionStar dual touch panels 397 - ActionStar dual touch panels
398 - Atmel panels 398 - Atmel panels
399 - Cando dual touch panels 399 - Cando dual touch panels
400 - Chunghwa panels 400 - Chunghwa panels
401 - CVTouch panels 401 - CVTouch panels
402 - Cypress TrueTouch panels 402 - Cypress TrueTouch panels
403 - Elo TouchSystems IntelliTouch Plus panels 403 - Elo TouchSystems IntelliTouch Plus panels
404 - GeneralTouch 'Sensing Win7-TwoFinger' panels 404 - GeneralTouch 'Sensing Win7-TwoFinger' panels
405 - GoodTouch panels 405 - GoodTouch panels
406 - Hanvon dual touch panels 406 - Hanvon dual touch panels
407 - Ilitek dual touch panels 407 - Ilitek dual touch panels
408 - IrTouch Infrared USB panels 408 - IrTouch Infrared USB panels
409 - LG Display panels (Dell ST2220Tc) 409 - LG Display panels (Dell ST2220Tc)
410 - Lumio CrystalTouch panels 410 - Lumio CrystalTouch panels
411 - MosArt dual-touch panels 411 - MosArt dual-touch panels
412 - Panasonic multitouch panels 412 - Panasonic multitouch panels
413 - PenMount dual touch panels 413 - PenMount dual touch panels
414 - Perixx Peripad 701 touchpad 414 - Perixx Peripad 701 touchpad
415 - PixArt optical touch screen 415 - PixArt optical touch screen
416 - Pixcir dual touch panels 416 - Pixcir dual touch panels
417 - Quanta panels 417 - Quanta panels
418 - eGalax dual-touch panels, including the Joojoo and Wetab tablets 418 - eGalax dual-touch panels, including the Joojoo and Wetab tablets
419 - Stantum multitouch panels 419 - Stantum multitouch panels
420 - Touch International Panels 420 - Touch International Panels
421 - Unitec Panels 421 - Unitec Panels
422 - XAT optical touch panels 422 - XAT optical touch panels
423 - Xiroku optical touch panels 423 - Xiroku optical touch panels
424 - Zytronic touch panels 424 - Zytronic touch panels
425 425
426 If unsure, say N. 426 If unsure, say N.
427 427
428 To compile this driver as a module, choose M here: the 428 To compile this driver as a module, choose M here: the
429 module will be called hid-multitouch. 429 module will be called hid-multitouch.
430 430
431 config HID_NTRIG 431 config HID_NTRIG
432 tristate "N-Trig touch screen" 432 tristate "N-Trig touch screen"
433 depends on USB_HID 433 depends on USB_HID
434 ---help--- 434 ---help---
435 Support for N-Trig touch screen. 435 Support for N-Trig touch screen.
436 436
437 config HID_ORTEK 437 config HID_ORTEK
438 tristate "Ortek PKB-1700/WKB-2000/Skycable wireless keyboard and mouse trackpad" 438 tristate "Ortek PKB-1700/WKB-2000/Skycable wireless keyboard and mouse trackpad"
439 depends on USB_HID 439 depends on USB_HID
440 ---help--- 440 ---help---
441 There are certain devices which have LogicalMaximum wrong in the keyboard 441 There are certain devices which have LogicalMaximum wrong in the keyboard
442 usage page of their report descriptor. The most prevailing ones so far 442 usage page of their report descriptor. The most prevailing ones so far
443 are manufactured by Ortek, thus the name of the driver. Currently 443 are manufactured by Ortek, thus the name of the driver. Currently
444 supported devices by this driver are 444 supported devices by this driver are
445 445
446 - Ortek PKB-1700 446 - Ortek PKB-1700
447 - Ortek WKB-2000 447 - Ortek WKB-2000
448 - Skycable wireless presenter 448 - Skycable wireless presenter
449 449
450 config HID_PANTHERLORD 450 config HID_PANTHERLORD
451 tristate "Pantherlord/GreenAsia game controller" 451 tristate "Pantherlord/GreenAsia game controller"
452 depends on USB_HID 452 depends on USB_HID
453 ---help--- 453 ---help---
454 Say Y here if you have a PantherLord/GreenAsia based game controller 454 Say Y here if you have a PantherLord/GreenAsia based game controller
455 or adapter. 455 or adapter.
456 456
457 config PANTHERLORD_FF 457 config PANTHERLORD_FF
458 bool "Pantherlord force feedback support" 458 bool "Pantherlord force feedback support"
459 depends on HID_PANTHERLORD 459 depends on HID_PANTHERLORD
460 select INPUT_FF_MEMLESS 460 select INPUT_FF_MEMLESS
461 ---help--- 461 ---help---
462 Say Y here if you have a PantherLord/GreenAsia based game controller 462 Say Y here if you have a PantherLord/GreenAsia based game controller
463 or adapter and want to enable force feedback support for it. 463 or adapter and want to enable force feedback support for it.
464 464
465 config HID_PETALYNX 465 config HID_PETALYNX
466 tristate "Petalynx Maxter remote control" 466 tristate "Petalynx Maxter remote control"
467 depends on USB_HID 467 depends on USB_HID
468 ---help--- 468 ---help---
469 Support for Petalynx Maxter remote control. 469 Support for Petalynx Maxter remote control.
470 470
471 config HID_PICOLCD 471 config HID_PICOLCD
472 tristate "PicoLCD (graphic version)" 472 tristate "PicoLCD (graphic version)"
473 depends on USB_HID 473 depends on USB_HID
474 ---help--- 474 ---help---
475 This provides support for Minibox PicoLCD devices, currently 475 This provides support for Minibox PicoLCD devices, currently
476 only the graphical ones are supported. 476 only the graphical ones are supported.
477 477
478 This includes support for the following device features: 478 This includes support for the following device features:
479 - Keypad 479 - Keypad
480 - Switching between Firmware and Flash mode 480 - Switching between Firmware and Flash mode
481 - EEProm / Flash access (via debugfs) 481 - EEProm / Flash access (via debugfs)
482 Features selectively enabled: 482 Features selectively enabled:
483 - Framebuffer for monochrome 256x64 display 483 - Framebuffer for monochrome 256x64 display
484 - Backlight control 484 - Backlight control
485 - Contrast control 485 - Contrast control
486 - General purpose outputs 486 - General purpose outputs
487 Features that are not (yet) supported: 487 Features that are not (yet) supported:
488 - IR 488 - IR
489 489
490 config HID_PICOLCD_FB 490 config HID_PICOLCD_FB
491 bool "Framebuffer support" if EXPERT 491 bool "Framebuffer support" if EXPERT
492 default !EXPERT 492 default !EXPERT
493 depends on HID_PICOLCD 493 depends on HID_PICOLCD
494 depends on HID_PICOLCD=FB || FB=y 494 depends on HID_PICOLCD=FB || FB=y
495 select FB_DEFERRED_IO 495 select FB_DEFERRED_IO
496 select FB_SYS_FILLRECT 496 select FB_SYS_FILLRECT
497 select FB_SYS_COPYAREA 497 select FB_SYS_COPYAREA
498 select FB_SYS_IMAGEBLIT 498 select FB_SYS_IMAGEBLIT
499 select FB_SYS_FOPS 499 select FB_SYS_FOPS
500 ---help--- 500 ---help---
501 Provide access to PicoLCD's 256x64 monochrome display via a 501 Provide access to PicoLCD's 256x64 monochrome display via a
502 framebuffer device. 502 framebuffer device.
503 503
504 config HID_PICOLCD_BACKLIGHT 504 config HID_PICOLCD_BACKLIGHT
505 bool "Backlight control" if EXPERT 505 bool "Backlight control" if EXPERT
506 default !EXPERT 506 default !EXPERT
507 depends on HID_PICOLCD 507 depends on HID_PICOLCD
508 depends on HID_PICOLCD=BACKLIGHT_CLASS_DEVICE || BACKLIGHT_CLASS_DEVICE=y 508 depends on HID_PICOLCD=BACKLIGHT_CLASS_DEVICE || BACKLIGHT_CLASS_DEVICE=y
509 ---help--- 509 ---help---
510 Provide access to PicoLCD's backlight control via backlight 510 Provide access to PicoLCD's backlight control via backlight
511 class. 511 class.
512 512
513 config HID_PICOLCD_LCD 513 config HID_PICOLCD_LCD
514 bool "Contrast control" if EXPERT 514 bool "Contrast control" if EXPERT
515 default !EXPERT 515 default !EXPERT
516 depends on HID_PICOLCD 516 depends on HID_PICOLCD
517 depends on HID_PICOLCD=LCD_CLASS_DEVICE || LCD_CLASS_DEVICE=y 517 depends on HID_PICOLCD=LCD_CLASS_DEVICE || LCD_CLASS_DEVICE=y
518 ---help--- 518 ---help---
519 Provide access to PicoLCD's LCD contrast via lcd class. 519 Provide access to PicoLCD's LCD contrast via lcd class.
520 520
521 config HID_PICOLCD_LEDS 521 config HID_PICOLCD_LEDS
522 bool "GPO via leds class" if EXPERT 522 bool "GPO via leds class" if EXPERT
523 default !EXPERT 523 default !EXPERT
524 depends on HID_PICOLCD 524 depends on HID_PICOLCD
525 depends on HID_PICOLCD=LEDS_CLASS || LEDS_CLASS=y 525 depends on HID_PICOLCD=LEDS_CLASS || LEDS_CLASS=y
526 ---help--- 526 ---help---
527 Provide access to PicoLCD's GPO pins via leds class. 527 Provide access to PicoLCD's GPO pins via leds class.
528 528
529 config HID_PICOLCD_CIR 529 config HID_PICOLCD_CIR
530 bool "CIR via RC class" if EXPERT 530 bool "CIR via RC class" if EXPERT
531 default !EXPERT 531 default !EXPERT
532 depends on HID_PICOLCD 532 depends on HID_PICOLCD
533 depends on HID_PICOLCD=RC_CORE || RC_CORE=y 533 depends on HID_PICOLCD=RC_CORE || RC_CORE=y
534 ---help--- 534 ---help---
535 Provide access to PicoLCD's CIR interface via remote control (LIRC). 535 Provide access to PicoLCD's CIR interface via remote control (LIRC).
536 536
537 config HID_PRIMAX 537 config HID_PRIMAX
538 tristate "Primax non-fully HID-compliant devices" 538 tristate "Primax non-fully HID-compliant devices"
539 depends on USB_HID 539 depends on USB_HID
540 ---help--- 540 ---help---
541 Support for Primax devices that are not fully compliant with the 541 Support for Primax devices that are not fully compliant with the
542 HID standard. 542 HID standard.
543 543
544 config HID_PS3REMOTE 544 config HID_PS3REMOTE
545 tristate "Sony PS3 BD Remote Control" 545 tristate "Sony PS3 BD Remote Control"
546 depends on BT_HIDP 546 depends on BT_HIDP
547 ---help--- 547 ---help---
548 Support for the Sony PS3 Blue-ray Disk Remote Control and Logitech 548 Support for the Sony PS3 Blue-ray Disk Remote Control and Logitech
549 Harmony Adapter for PS3, which connect over Bluetooth. 549 Harmony Adapter for PS3, which connect over Bluetooth.
550 550
551 Support for the 6-axis controllers is provided by HID_SONY. 551 Support for the 6-axis controllers is provided by HID_SONY.
552 552
553 config HID_ROCCAT 553 config HID_ROCCAT
554 tristate "Roccat device support" 554 tristate "Roccat device support"
555 depends on USB_HID 555 depends on USB_HID
556 ---help--- 556 ---help---
557 Support for Roccat devices. 557 Support for Roccat devices.
558 Say Y here if you have a Roccat mouse or keyboard and want 558 Say Y here if you have a Roccat mouse or keyboard and want
559 support for its special functionalities. 559 support for its special functionalities.
560 560
561 config HID_SAITEK 561 config HID_SAITEK
562 tristate "Saitek non-fully HID-compliant devices" 562 tristate "Saitek non-fully HID-compliant devices"
563 depends on USB_HID 563 depends on USB_HID
564 ---help--- 564 ---help---
565 Support for Saitek devices that are not fully compliant with the 565 Support for Saitek devices that are not fully compliant with the
566 HID standard. 566 HID standard.
567 567
568 Currently only supports the PS1000 controller. 568 Currently only supports the PS1000 controller.
569 569
570 config HID_SAMSUNG 570 config HID_SAMSUNG
571 tristate "Samsung InfraRed remote control or keyboards" 571 tristate "Samsung InfraRed remote control or keyboards"
572 depends on USB_HID 572 depends on USB_HID
573 ---help--- 573 ---help---
574 Support for Samsung InfraRed remote control or keyboards. 574 Support for Samsung InfraRed remote control or keyboards.
575 575
576 config HID_SONY 576 config HID_SONY
577 tristate "Sony PS3 controller" 577 tristate "Sony PS3 controller"
578 depends on USB_HID 578 depends on USB_HID
579 ---help--- 579 ---help---
580 Support for Sony PS3 6-axis controllers. 580 Support for Sony PS3 6-axis controllers.
581 581
582 Support for the Sony PS3 BD Remote is provided by HID_PS3REMOTE. 582 Support for the Sony PS3 BD Remote is provided by HID_PS3REMOTE.
583 583
584 config HID_SPEEDLINK 584 config HID_SPEEDLINK
585 tristate "Speedlink VAD Cezanne mouse support" 585 tristate "Speedlink VAD Cezanne mouse support"
586 depends on USB_HID 586 depends on USB_HID
587 ---help--- 587 ---help---
588 Support for Speedlink Vicious and Divine Cezanne mouse. 588 Support for Speedlink Vicious and Divine Cezanne mouse.
589 589
590 config HID_SUNPLUS 590 config HID_SUNPLUS
591 tristate "Sunplus wireless desktop" 591 tristate "Sunplus wireless desktop"
592 depends on USB_HID 592 depends on USB_HID
593 ---help--- 593 ---help---
594 Support for Sunplus wireless desktop. 594 Support for Sunplus wireless desktop.
595 595
596 config HID_GREENASIA 596 config HID_GREENASIA
597 tristate "GreenAsia (Product ID 0x12) game controller support" 597 tristate "GreenAsia (Product ID 0x12) game controller support"
598 depends on USB_HID 598 depends on USB_HID
599 ---help--- 599 ---help---
600 Say Y here if you have a GreenAsia (Product ID 0x12) based game 600 Say Y here if you have a GreenAsia (Product ID 0x12) based game
601 controller or adapter. 601 controller or adapter.
602 602
603 config GREENASIA_FF 603 config GREENASIA_FF
604 bool "GreenAsia (Product ID 0x12) force feedback support" 604 bool "GreenAsia (Product ID 0x12) force feedback support"
605 depends on HID_GREENASIA 605 depends on HID_GREENASIA
606 select INPUT_FF_MEMLESS 606 select INPUT_FF_MEMLESS
607 ---help--- 607 ---help---
608 Say Y here if you have a GreenAsia (Product ID 0x12) based game controller 608 Say Y here if you have a GreenAsia (Product ID 0x12) based game controller
609 (like MANTA Warrior MM816 and SpeedLink Strike2 SL-6635) or adapter 609 (like MANTA Warrior MM816 and SpeedLink Strike2 SL-6635) or adapter
610 and want to enable force feedback support for it. 610 and want to enable force feedback support for it.
611 611
612 config HID_HYPERV_MOUSE 612 config HID_HYPERV_MOUSE
613 tristate "Microsoft Hyper-V mouse driver" 613 tristate "Microsoft Hyper-V mouse driver"
614 depends on HYPERV 614 depends on HYPERV
615 ---help--- 615 ---help---
616 Select this option to enable the Hyper-V mouse driver. 616 Select this option to enable the Hyper-V mouse driver.
617 617
618 config HID_SMARTJOYPLUS 618 config HID_SMARTJOYPLUS
619 tristate "SmartJoy PLUS PS2/USB adapter support" 619 tristate "SmartJoy PLUS PS2/USB adapter support"
620 depends on USB_HID 620 depends on USB_HID
621 ---help--- 621 ---help---
622 Support for SmartJoy PLUS PS2/USB adapter, Super Dual Box, 622 Support for SmartJoy PLUS PS2/USB adapter, Super Dual Box,
623 Super Joy Box 3 Pro, Super Dual Box Pro, and Super Joy Box 5 Pro. 623 Super Joy Box 3 Pro, Super Dual Box Pro, and Super Joy Box 5 Pro.
624 624
625 Note that DDR (Dance Dance Revolution) mode is not supported, nor 625 Note that DDR (Dance Dance Revolution) mode is not supported, nor
626 is pressure sensitive buttons on the pro models. 626 is pressure sensitive buttons on the pro models.
627 627
628 config SMARTJOYPLUS_FF 628 config SMARTJOYPLUS_FF
629 bool "SmartJoy PLUS PS2/USB adapter force feedback support" 629 bool "SmartJoy PLUS PS2/USB adapter force feedback support"
630 depends on HID_SMARTJOYPLUS 630 depends on HID_SMARTJOYPLUS
631 select INPUT_FF_MEMLESS 631 select INPUT_FF_MEMLESS
632 ---help--- 632 ---help---
633 Say Y here if you have a SmartJoy PLUS PS2/USB adapter and want to 633 Say Y here if you have a SmartJoy PLUS PS2/USB adapter and want to
634 enable force feedback support for it. 634 enable force feedback support for it.
635 635
636 config HID_TIVO 636 config HID_TIVO
637 tristate "TiVo Slide Bluetooth remote control support" 637 tristate "TiVo Slide Bluetooth remote control support"
638 depends on (USB_HID || BT_HIDP) 638 depends on (USB_HID || BT_HIDP)
639 ---help--- 639 ---help---
640 Say Y if you have a TiVo Slide Bluetooth remote control. 640 Say Y if you have a TiVo Slide Bluetooth remote control.
641 641
642 config HID_TOPSEED 642 config HID_TOPSEED
643 tristate "TopSeed Cyberlink, BTC Emprex, Conceptronic remote control support" 643 tristate "TopSeed Cyberlink, BTC Emprex, Conceptronic remote control support"
644 depends on USB_HID 644 depends on USB_HID
645 ---help--- 645 ---help---
646 Say Y if you have a TopSeed Cyberlink or BTC Emprex or Conceptronic 646 Say Y if you have a TopSeed Cyberlink or BTC Emprex or Conceptronic
647 CLLRCMCE remote control. 647 CLLRCMCE remote control.
648 648
649 config HID_THRUSTMASTER 649 config HID_THRUSTMASTER
650 tristate "ThrustMaster devices support" 650 tristate "ThrustMaster devices support"
651 depends on USB_HID 651 depends on USB_HID
652 ---help--- 652 ---help---
653 Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or 653 Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or
654 a THRUSTMASTER Ferrari GT Rumble Wheel. 654 a THRUSTMASTER Ferrari GT Rumble Wheel.
655 655
656 config THRUSTMASTER_FF 656 config THRUSTMASTER_FF
657 bool "ThrustMaster devices force feedback support" 657 bool "ThrustMaster devices force feedback support"
658 depends on HID_THRUSTMASTER 658 depends on HID_THRUSTMASTER
659 select INPUT_FF_MEMLESS 659 select INPUT_FF_MEMLESS
660 ---help--- 660 ---help---
661 Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or 3, 661 Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or 3,
662 a THRUSTMASTER Dual Trigger 3-in-1 or a THRUSTMASTER Ferrari GT 662 a THRUSTMASTER Dual Trigger 3-in-1 or a THRUSTMASTER Ferrari GT
663 Rumble Force or Force Feedback Wheel. 663 Rumble Force or Force Feedback Wheel.
664 664
665 config HID_WACOM 665 config HID_WACOM
666 tristate "Wacom Bluetooth devices support" 666 tristate "Wacom Bluetooth devices support"
667 depends on BT_HIDP 667 depends on BT_HIDP
668 depends on LEDS_CLASS 668 depends on LEDS_CLASS
669 select POWER_SUPPLY 669 select POWER_SUPPLY
670 ---help--- 670 ---help---
671 Support for Wacom Graphire Bluetooth and Intuos4 WL tablets. 671 Support for Wacom Graphire Bluetooth and Intuos4 WL tablets.
672 672
673 config HID_WIIMOTE 673 config HID_WIIMOTE
674 tristate "Nintendo Wii Remote support" 674 tristate "Nintendo Wii Remote support"
675 depends on BT_HIDP 675 depends on BT_HIDP
676 depends on LEDS_CLASS 676 depends on LEDS_CLASS
677 select POWER_SUPPLY 677 select POWER_SUPPLY
678 select INPUT_FF_MEMLESS 678 select INPUT_FF_MEMLESS
679 ---help--- 679 ---help---
680 Support for the Nintendo Wii Remote bluetooth device. 680 Support for the Nintendo Wii Remote bluetooth device.
681 681
682 config HID_WIIMOTE_EXT 682 config HID_WIIMOTE_EXT
683 bool "Nintendo Wii Remote Extension support" 683 bool "Nintendo Wii Remote Extension support"
684 depends on HID_WIIMOTE 684 depends on HID_WIIMOTE
685 default HID_WIIMOTE 685 default HID_WIIMOTE
686 ---help--- 686 ---help---
687 Support for extension controllers of the Nintendo Wii Remote. Say yes 687 Support for extension controllers of the Nintendo Wii Remote. Say yes
688 here if you want to use the Nintendo Motion+, Nunchuck or Classic 688 here if you want to use the Nintendo Motion+, Nunchuck or Classic
689 extension controllers with your Wii Remote. 689 extension controllers with your Wii Remote.
690 690
691 config HID_ZEROPLUS 691 config HID_ZEROPLUS
692 tristate "Zeroplus based game controller support" 692 tristate "Zeroplus based game controller support"
693 depends on USB_HID 693 depends on USB_HID
694 ---help--- 694 ---help---
695 Say Y here if you have a Zeroplus based game controller. 695 Say Y here if you have a Zeroplus based game controller.
696 696
697 config ZEROPLUS_FF 697 config ZEROPLUS_FF
698 bool "Zeroplus based game controller force feedback support" 698 bool "Zeroplus based game controller force feedback support"
699 depends on HID_ZEROPLUS 699 depends on HID_ZEROPLUS
700 select INPUT_FF_MEMLESS 700 select INPUT_FF_MEMLESS
701 ---help--- 701 ---help---
702 Say Y here if you have a Zeroplus based game controller and want 702 Say Y here if you have a Zeroplus based game controller and want
703 to have force feedback support for it. 703 to have force feedback support for it.
704 704
705 config HID_ZYDACRON 705 config HID_ZYDACRON
706 tristate "Zydacron remote control support" 706 tristate "Zydacron remote control support"
707 depends on USB_HID 707 depends on USB_HID
708 ---help--- 708 ---help---
709 Support for Zydacron remote control. 709 Support for Zydacron remote control.
710 710
711 config HID_SENSOR_HUB 711 config HID_SENSOR_HUB
712 tristate "HID Sensors framework support" 712 tristate "HID Sensors framework support"
713 depends on USB_HID 713 depends on USB_HID
714 select MFD_CORE 714 select MFD_CORE
715 default n 715 default n
716 -- help--- 716 -- help---
717 Support for HID Sensor framework. This creates a MFD instance 717 Support for HID Sensor framework. This creates a MFD instance
718 for a sensor hub and identifies all the sensors connected to it. 718 for a sensor hub and identifies all the sensors connected to it.
719 Each sensor is registered as a MFD cell, so that sensor specific 719 Each sensor is registered as a MFD cell, so that sensor specific
720 processing can be done in a separate driver. Each sensor 720 processing can be done in a separate driver. Each sensor
721 drivers can use the service provided by this driver to register 721 drivers can use the service provided by this driver to register
722 for events and handle data streams. Each sensor driver can format 722 for events and handle data streams. Each sensor driver can format
723 data and present to user mode using input or IIO interface. 723 data and present to user mode using input or IIO interface.
724 724
725 endmenu 725 endmenu
726 726
727 endif # HID 727 endif # HID
728 728
729 source "drivers/hid/usbhid/Kconfig" 729 source "drivers/hid/usbhid/Kconfig"
730 730
731 source "drivers/hid/i2c-hid/Kconfig"
732
731 endmenu 733 endmenu
732 734
drivers/hid/Makefile
1 # 1 #
2 # Makefile for the HID driver 2 # Makefile for the HID driver
3 # 3 #
4 hid-y := hid-core.o hid-input.o 4 hid-y := hid-core.o hid-input.o
5 5
6 ifdef CONFIG_DEBUG_FS 6 ifdef CONFIG_DEBUG_FS
7 hid-objs += hid-debug.o 7 hid-objs += hid-debug.o
8 endif 8 endif
9 9
10 obj-$(CONFIG_HID) += hid.o 10 obj-$(CONFIG_HID) += hid.o
11 obj-$(CONFIG_UHID) += uhid.o 11 obj-$(CONFIG_UHID) += uhid.o
12 12
13 obj-$(CONFIG_HID_GENERIC) += hid-generic.o 13 obj-$(CONFIG_HID_GENERIC) += hid-generic.o
14 14
15 hid-$(CONFIG_HIDRAW) += hidraw.o 15 hid-$(CONFIG_HIDRAW) += hidraw.o
16 16
17 hid-logitech-y := hid-lg.o 17 hid-logitech-y := hid-lg.o
18 ifdef CONFIG_LOGITECH_FF 18 ifdef CONFIG_LOGITECH_FF
19 hid-logitech-y += hid-lgff.o 19 hid-logitech-y += hid-lgff.o
20 endif 20 endif
21 ifdef CONFIG_LOGIRUMBLEPAD2_FF 21 ifdef CONFIG_LOGIRUMBLEPAD2_FF
22 hid-logitech-y += hid-lg2ff.o 22 hid-logitech-y += hid-lg2ff.o
23 endif 23 endif
24 ifdef CONFIG_LOGIG940_FF 24 ifdef CONFIG_LOGIG940_FF
25 hid-logitech-y += hid-lg3ff.o 25 hid-logitech-y += hid-lg3ff.o
26 endif 26 endif
27 ifdef CONFIG_LOGIWHEELS_FF 27 ifdef CONFIG_LOGIWHEELS_FF
28 hid-logitech-y += hid-lg4ff.o 28 hid-logitech-y += hid-lg4ff.o
29 endif 29 endif
30 30
31 hid-wiimote-y := hid-wiimote-core.o 31 hid-wiimote-y := hid-wiimote-core.o
32 ifdef CONFIG_HID_WIIMOTE_EXT 32 ifdef CONFIG_HID_WIIMOTE_EXT
33 hid-wiimote-y += hid-wiimote-ext.o 33 hid-wiimote-y += hid-wiimote-ext.o
34 endif 34 endif
35 ifdef CONFIG_DEBUG_FS 35 ifdef CONFIG_DEBUG_FS
36 hid-wiimote-y += hid-wiimote-debug.o 36 hid-wiimote-y += hid-wiimote-debug.o
37 endif 37 endif
38 38
39 obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o 39 obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o
40 obj-$(CONFIG_HID_ACRUX) += hid-axff.o 40 obj-$(CONFIG_HID_ACRUX) += hid-axff.o
41 obj-$(CONFIG_HID_APPLE) += hid-apple.o 41 obj-$(CONFIG_HID_APPLE) += hid-apple.o
42 obj-$(CONFIG_HID_AUREAL) += hid-aureal.o 42 obj-$(CONFIG_HID_AUREAL) += hid-aureal.o
43 obj-$(CONFIG_HID_BELKIN) += hid-belkin.o 43 obj-$(CONFIG_HID_BELKIN) += hid-belkin.o
44 obj-$(CONFIG_HID_CHERRY) += hid-cherry.o 44 obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
45 obj-$(CONFIG_HID_CHICONY) += hid-chicony.o 45 obj-$(CONFIG_HID_CHICONY) += hid-chicony.o
46 obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o 46 obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
47 obj-$(CONFIG_HID_DRAGONRISE) += hid-dr.o 47 obj-$(CONFIG_HID_DRAGONRISE) += hid-dr.o
48 obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o 48 obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o
49 obj-$(CONFIG_HID_ELECOM) += hid-elecom.o 49 obj-$(CONFIG_HID_ELECOM) += hid-elecom.o
50 obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o 50 obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
51 obj-$(CONFIG_HID_GYRATION) += hid-gyration.o 51 obj-$(CONFIG_HID_GYRATION) += hid-gyration.o
52 obj-$(CONFIG_HID_HOLTEK) += hid-holtek-kbd.o 52 obj-$(CONFIG_HID_HOLTEK) += hid-holtek-kbd.o
53 obj-$(CONFIG_HID_HOLTEK) += hid-holtekff.o 53 obj-$(CONFIG_HID_HOLTEK) += hid-holtekff.o
54 obj-$(CONFIG_HID_HYPERV_MOUSE) += hid-hyperv.o 54 obj-$(CONFIG_HID_HYPERV_MOUSE) += hid-hyperv.o
55 obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o 55 obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o
56 obj-$(CONFIG_HID_KEYTOUCH) += hid-keytouch.o 56 obj-$(CONFIG_HID_KEYTOUCH) += hid-keytouch.o
57 obj-$(CONFIG_HID_KYE) += hid-kye.o 57 obj-$(CONFIG_HID_KYE) += hid-kye.o
58 obj-$(CONFIG_HID_LCPOWER) += hid-lcpower.o 58 obj-$(CONFIG_HID_LCPOWER) += hid-lcpower.o
59 obj-$(CONFIG_HID_LENOVO_TPKBD) += hid-lenovo-tpkbd.o 59 obj-$(CONFIG_HID_LENOVO_TPKBD) += hid-lenovo-tpkbd.o
60 obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o 60 obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o
61 obj-$(CONFIG_HID_LOGITECH_DJ) += hid-logitech-dj.o 61 obj-$(CONFIG_HID_LOGITECH_DJ) += hid-logitech-dj.o
62 obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o 62 obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o
63 obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o 63 obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o
64 obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o 64 obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o
65 obj-$(CONFIG_HID_MULTITOUCH) += hid-multitouch.o 65 obj-$(CONFIG_HID_MULTITOUCH) += hid-multitouch.o
66 obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o 66 obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o
67 obj-$(CONFIG_HID_ORTEK) += hid-ortek.o 67 obj-$(CONFIG_HID_ORTEK) += hid-ortek.o
68 obj-$(CONFIG_HID_PRODIKEYS) += hid-prodikeys.o 68 obj-$(CONFIG_HID_PRODIKEYS) += hid-prodikeys.o
69 obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o 69 obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o
70 obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o 70 obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o
71 obj-$(CONFIG_HID_PICOLCD) += hid-picolcd.o 71 obj-$(CONFIG_HID_PICOLCD) += hid-picolcd.o
72 hid-picolcd-y += hid-picolcd_core.o 72 hid-picolcd-y += hid-picolcd_core.o
73 ifdef CONFIG_HID_PICOLCD_FB 73 ifdef CONFIG_HID_PICOLCD_FB
74 hid-picolcd-y += hid-picolcd_fb.o 74 hid-picolcd-y += hid-picolcd_fb.o
75 endif 75 endif
76 ifdef CONFIG_HID_PICOLCD_BACKLIGHT 76 ifdef CONFIG_HID_PICOLCD_BACKLIGHT
77 hid-picolcd-y += hid-picolcd_backlight.o 77 hid-picolcd-y += hid-picolcd_backlight.o
78 endif 78 endif
79 ifdef CONFIG_HID_PICOLCD_LCD 79 ifdef CONFIG_HID_PICOLCD_LCD
80 hid-picolcd-y += hid-picolcd_lcd.o 80 hid-picolcd-y += hid-picolcd_lcd.o
81 endif 81 endif
82 ifdef CONFIG_HID_PICOLCD_LEDS 82 ifdef CONFIG_HID_PICOLCD_LEDS
83 hid-picolcd-y += hid-picolcd_leds.o 83 hid-picolcd-y += hid-picolcd_leds.o
84 endif 84 endif
85 ifdef CONFIG_HID_PICOLCD_CIR 85 ifdef CONFIG_HID_PICOLCD_CIR
86 hid-picolcd-y += hid-picolcd_cir.o 86 hid-picolcd-y += hid-picolcd_cir.o
87 endif 87 endif
88 ifdef CONFIG_DEBUG_FS 88 ifdef CONFIG_DEBUG_FS
89 hid-picolcd-y += hid-picolcd_debugfs.o 89 hid-picolcd-y += hid-picolcd_debugfs.o
90 endif 90 endif
91 91
92 obj-$(CONFIG_HID_PRIMAX) += hid-primax.o 92 obj-$(CONFIG_HID_PRIMAX) += hid-primax.o
93 obj-$(CONFIG_HID_PS3REMOTE) += hid-ps3remote.o 93 obj-$(CONFIG_HID_PS3REMOTE) += hid-ps3remote.o
94 obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \ 94 obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \
95 hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \ 95 hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \
96 hid-roccat-koneplus.o hid-roccat-kovaplus.o hid-roccat-pyra.o \ 96 hid-roccat-koneplus.o hid-roccat-kovaplus.o hid-roccat-pyra.o \
97 hid-roccat-savu.o 97 hid-roccat-savu.o
98 obj-$(CONFIG_HID_SAITEK) += hid-saitek.o 98 obj-$(CONFIG_HID_SAITEK) += hid-saitek.o
99 obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o 99 obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o
100 obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o 100 obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o
101 obj-$(CONFIG_HID_SONY) += hid-sony.o 101 obj-$(CONFIG_HID_SONY) += hid-sony.o
102 obj-$(CONFIG_HID_SPEEDLINK) += hid-speedlink.o 102 obj-$(CONFIG_HID_SPEEDLINK) += hid-speedlink.o
103 obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o 103 obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o
104 obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o 104 obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o
105 obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o 105 obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o
106 obj-$(CONFIG_HID_TIVO) += hid-tivo.o 106 obj-$(CONFIG_HID_TIVO) += hid-tivo.o
107 obj-$(CONFIG_HID_TOPSEED) += hid-topseed.o 107 obj-$(CONFIG_HID_TOPSEED) += hid-topseed.o
108 obj-$(CONFIG_HID_TWINHAN) += hid-twinhan.o 108 obj-$(CONFIG_HID_TWINHAN) += hid-twinhan.o
109 obj-$(CONFIG_HID_UCLOGIC) += hid-uclogic.o 109 obj-$(CONFIG_HID_UCLOGIC) += hid-uclogic.o
110 obj-$(CONFIG_HID_ZEROPLUS) += hid-zpff.o 110 obj-$(CONFIG_HID_ZEROPLUS) += hid-zpff.o
111 obj-$(CONFIG_HID_ZYDACRON) += hid-zydacron.o 111 obj-$(CONFIG_HID_ZYDACRON) += hid-zydacron.o
112 obj-$(CONFIG_HID_WACOM) += hid-wacom.o 112 obj-$(CONFIG_HID_WACOM) += hid-wacom.o
113 obj-$(CONFIG_HID_WALTOP) += hid-waltop.o 113 obj-$(CONFIG_HID_WALTOP) += hid-waltop.o
114 obj-$(CONFIG_HID_WIIMOTE) += hid-wiimote.o 114 obj-$(CONFIG_HID_WIIMOTE) += hid-wiimote.o
115 obj-$(CONFIG_HID_SENSOR_HUB) += hid-sensor-hub.o 115 obj-$(CONFIG_HID_SENSOR_HUB) += hid-sensor-hub.o
116 116
117 obj-$(CONFIG_USB_HID) += usbhid/ 117 obj-$(CONFIG_USB_HID) += usbhid/
118 obj-$(CONFIG_USB_MOUSE) += usbhid/ 118 obj-$(CONFIG_USB_MOUSE) += usbhid/
119 obj-$(CONFIG_USB_KBD) += usbhid/ 119 obj-$(CONFIG_USB_KBD) += usbhid/
120
121 obj-$(CONFIG_I2C_HID) += i2c-hid/
120 122
drivers/hid/i2c-hid/Kconfig
File was created 1 menu "I2C HID support"
2 depends on I2C
3
4 config I2C_HID
5 tristate "HID over I2C transport layer"
6 default n
7 depends on I2C && INPUT
8 select HID
9 ---help---
10 Say Y here if you want to use the HID over i2c protocol
11 implementation.
12
13 If unsure, say N.
14
15 This support is also available as a module. If so, the module
16 will be called i2c-hid.
17
18 comment "Input core support is needed for HID over I2C input layer"
19 depends on I2C_HID && INPUT=n
20
21 endmenu
22
drivers/hid/i2c-hid/Makefile
File was created 1 #
2 # Makefile for the I2C input drivers
3 #
4
5 obj-$(CONFIG_I2C_HID) += i2c-hid.o
6
drivers/hid/i2c-hid/i2c-hid.c
File was created 1 /*
2 * HID over I2C protocol implementation
3 *
4 * Copyright (c) 2012 Benjamin Tissoires <benjamin.tissoires@gmail.com>
5 * Copyright (c) 2012 Ecole Nationale de l'Aviation Civile, France
6 * Copyright (c) 2012 Red Hat, Inc
7 *
8 * This code is partly based on "USB HID support for Linux":
9 *
10 * Copyright (c) 1999 Andreas Gal
11 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
12 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
13 * Copyright (c) 2007-2008 Oliver Neukum
14 * Copyright (c) 2006-2010 Jiri Kosina
15 *
16 * This file is subject to the terms and conditions of the GNU General Public
17 * License. See the file COPYING in the main directory of this archive for
18 * more details.
19 */
20
21 #include <linux/module.h>
22 #include <linux/i2c.h>
23 #include <linux/interrupt.h>
24 #include <linux/input.h>
25 #include <linux/delay.h>
26 #include <linux/slab.h>
27 #include <linux/pm.h>
28 #include <linux/device.h>
29 #include <linux/wait.h>
30 #include <linux/err.h>
31 #include <linux/string.h>
32 #include <linux/list.h>
33 #include <linux/jiffies.h>
34 #include <linux/kernel.h>
35 #include <linux/bug.h>
36 #include <linux/hid.h>
37
38 #include <linux/i2c/i2c-hid.h>
39
40 /* flags */
41 #define I2C_HID_STARTED (1 << 0)
42 #define I2C_HID_RESET_PENDING (1 << 1)
43 #define I2C_HID_READ_PENDING (1 << 2)
44
45 #define I2C_HID_PWR_ON 0x00
46 #define I2C_HID_PWR_SLEEP 0x01
47
48 /* debug option */
49 static bool debug = false;
50 module_param(debug, bool, 0444);
51 MODULE_PARM_DESC(debug, "print a lot of debug information");
52
53 #define i2c_hid_dbg(ihid, fmt, arg...) \
54 if (debug) \
55 dev_printk(KERN_DEBUG, &(ihid)->client->dev, fmt, ##arg)
56
57 struct i2c_hid_desc {
58 __le16 wHIDDescLength;
59 __le16 bcdVersion;
60 __le16 wReportDescLength;
61 __le16 wReportDescRegister;
62 __le16 wInputRegister;
63 __le16 wMaxInputLength;
64 __le16 wOutputRegister;
65 __le16 wMaxOutputLength;
66 __le16 wCommandRegister;
67 __le16 wDataRegister;
68 __le16 wVendorID;
69 __le16 wProductID;
70 __le16 wVersionID;
71 } __packed;
72
73 struct i2c_hid_cmd {
74 unsigned int registerIndex;
75 __u8 opcode;
76 unsigned int length;
77 bool wait;
78 };
79
80 union command {
81 u8 data[0];
82 struct cmd {
83 __le16 reg;
84 __u8 reportTypeID;
85 __u8 opcode;
86 } __packed c;
87 };
88
89 #define I2C_HID_CMD(opcode_) \
90 .opcode = opcode_, .length = 4, \
91 .registerIndex = offsetof(struct i2c_hid_desc, wCommandRegister)
92
93 /* fetch HID descriptor */
94 static const struct i2c_hid_cmd hid_descr_cmd = { .length = 2 };
95 /* fetch report descriptors */
96 static const struct i2c_hid_cmd hid_report_descr_cmd = {
97 .registerIndex = offsetof(struct i2c_hid_desc,
98 wReportDescRegister),
99 .opcode = 0x00,
100 .length = 2 };
101 /* commands */
102 static const struct i2c_hid_cmd hid_reset_cmd = { I2C_HID_CMD(0x01),
103 .wait = true };
104 static const struct i2c_hid_cmd hid_get_report_cmd = { I2C_HID_CMD(0x02) };
105 static const struct i2c_hid_cmd hid_set_report_cmd = { I2C_HID_CMD(0x03) };
106 static const struct i2c_hid_cmd hid_get_idle_cmd = { I2C_HID_CMD(0x04) };
107 static const struct i2c_hid_cmd hid_set_idle_cmd = { I2C_HID_CMD(0x05) };
108 static const struct i2c_hid_cmd hid_get_protocol_cmd = { I2C_HID_CMD(0x06) };
109 static const struct i2c_hid_cmd hid_set_protocol_cmd = { I2C_HID_CMD(0x07) };
110 static const struct i2c_hid_cmd hid_set_power_cmd = { I2C_HID_CMD(0x08) };
111 /* read/write data register */
112 static const struct i2c_hid_cmd hid_data_cmd = {
113 .registerIndex = offsetof(struct i2c_hid_desc, wDataRegister),
114 .opcode = 0x00,
115 .length = 2 };
116 /* write output reports */
117 static const struct i2c_hid_cmd hid_out_cmd = {
118 .registerIndex = offsetof(struct i2c_hid_desc,
119 wOutputRegister),
120 .opcode = 0x00,
121 .length = 2 };
122
123 /* The main device structure */
124 struct i2c_hid {
125 struct i2c_client *client; /* i2c client */
126 struct hid_device *hid; /* pointer to corresponding HID dev */
127 union {
128 __u8 hdesc_buffer[sizeof(struct i2c_hid_desc)];
129 struct i2c_hid_desc hdesc; /* the HID Descriptor */
130 };
131 __le16 wHIDDescRegister; /* location of the i2c
132 * register of the HID
133 * descriptor. */
134 unsigned int bufsize; /* i2c buffer size */
135 char *inbuf; /* Input buffer */
136 char *cmdbuf; /* Command buffer */
137 char *argsbuf; /* Command arguments buffer */
138
139 unsigned long flags; /* device flags */
140
141 int irq; /* the interrupt line irq */
142
143 wait_queue_head_t wait; /* For waiting the interrupt */
144 };
145
146 static int __i2c_hid_command(struct i2c_client *client,
147 const struct i2c_hid_cmd *command, u8 reportID,
148 u8 reportType, u8 *args, int args_len,
149 unsigned char *buf_recv, int data_len)
150 {
151 struct i2c_hid *ihid = i2c_get_clientdata(client);
152 union command *cmd = (union command *)ihid->cmdbuf;
153 int ret;
154 struct i2c_msg msg[2];
155 int msg_num = 1;
156
157 int length = command->length;
158 bool wait = command->wait;
159 unsigned int registerIndex = command->registerIndex;
160
161 /* special case for hid_descr_cmd */
162 if (command == &hid_descr_cmd) {
163 cmd->c.reg = ihid->wHIDDescRegister;
164 } else {
165 cmd->data[0] = ihid->hdesc_buffer[registerIndex];
166 cmd->data[1] = ihid->hdesc_buffer[registerIndex + 1];
167 }
168
169 if (length > 2) {
170 cmd->c.opcode = command->opcode;
171 cmd->c.reportTypeID = reportID | reportType << 4;
172 }
173
174 memcpy(cmd->data + length, args, args_len);
175 length += args_len;
176
177 i2c_hid_dbg(ihid, "%s: cmd=%*ph\n", __func__, length, cmd->data);
178
179 msg[0].addr = client->addr;
180 msg[0].flags = client->flags & I2C_M_TEN;
181 msg[0].len = length;
182 msg[0].buf = cmd->data;
183 if (data_len > 0) {
184 msg[1].addr = client->addr;
185 msg[1].flags = client->flags & I2C_M_TEN;
186 msg[1].flags |= I2C_M_RD;
187 msg[1].len = data_len;
188 msg[1].buf = buf_recv;
189 msg_num = 2;
190 set_bit(I2C_HID_READ_PENDING, &ihid->flags);
191 }
192
193 if (wait)
194 set_bit(I2C_HID_RESET_PENDING, &ihid->flags);
195
196 ret = i2c_transfer(client->adapter, msg, msg_num);
197
198 if (data_len > 0)
199 clear_bit(I2C_HID_READ_PENDING, &ihid->flags);
200
201 if (ret != msg_num)
202 return ret < 0 ? ret : -EIO;
203
204 ret = 0;
205
206 if (wait) {
207 i2c_hid_dbg(ihid, "%s: waiting...\n", __func__);
208 if (!wait_event_timeout(ihid->wait,
209 !test_bit(I2C_HID_RESET_PENDING, &ihid->flags),
210 msecs_to_jiffies(5000)))
211 ret = -ENODATA;
212 i2c_hid_dbg(ihid, "%s: finished.\n", __func__);
213 }
214
215 return ret;
216 }
217
218 static int i2c_hid_command(struct i2c_client *client,
219 const struct i2c_hid_cmd *command,
220 unsigned char *buf_recv, int data_len)
221 {
222 return __i2c_hid_command(client, command, 0, 0, NULL, 0,
223 buf_recv, data_len);
224 }
225
226 static int i2c_hid_get_report(struct i2c_client *client, u8 reportType,
227 u8 reportID, unsigned char *buf_recv, int data_len)
228 {
229 struct i2c_hid *ihid = i2c_get_clientdata(client);
230 u8 args[3];
231 int ret;
232 int args_len = 0;
233 u16 readRegister = le16_to_cpu(ihid->hdesc.wDataRegister);
234
235 i2c_hid_dbg(ihid, "%s\n", __func__);
236
237 if (reportID >= 0x0F) {
238 args[args_len++] = reportID;
239 reportID = 0x0F;
240 }
241
242 args[args_len++] = readRegister & 0xFF;
243 args[args_len++] = readRegister >> 8;
244
245 ret = __i2c_hid_command(client, &hid_get_report_cmd, reportID,
246 reportType, args, args_len, buf_recv, data_len);
247 if (ret) {
248 dev_err(&client->dev,
249 "failed to retrieve report from device.\n");
250 return -EINVAL;
251 }
252
253 return 0;
254 }
255
256 static int i2c_hid_set_report(struct i2c_client *client, u8 reportType,
257 u8 reportID, unsigned char *buf, size_t data_len)
258 {
259 struct i2c_hid *ihid = i2c_get_clientdata(client);
260 u8 *args = ihid->argsbuf;
261 int ret;
262 u16 dataRegister = le16_to_cpu(ihid->hdesc.wDataRegister);
263
264 /* hidraw already checked that data_len < HID_MAX_BUFFER_SIZE */
265 u16 size = 2 /* size */ +
266 (reportID ? 1 : 0) /* reportID */ +
267 data_len /* buf */;
268 int args_len = (reportID >= 0x0F ? 1 : 0) /* optional third byte */ +
269 2 /* dataRegister */ +
270 size /* args */;
271 int index = 0;
272
273 i2c_hid_dbg(ihid, "%s\n", __func__);
274
275 if (reportID >= 0x0F) {
276 args[index++] = reportID;
277 reportID = 0x0F;
278 }
279
280 args[index++] = dataRegister & 0xFF;
281 args[index++] = dataRegister >> 8;
282
283 args[index++] = size & 0xFF;
284 args[index++] = size >> 8;
285
286 if (reportID)
287 args[index++] = reportID;
288
289 memcpy(&args[index], buf, data_len);
290
291 ret = __i2c_hid_command(client, &hid_set_report_cmd, reportID,
292 reportType, args, args_len, NULL, 0);
293 if (ret) {
294 dev_err(&client->dev, "failed to set a report to device.\n");
295 return -EINVAL;
296 }
297
298 return data_len;
299 }
300
301 static int i2c_hid_set_power(struct i2c_client *client, int power_state)
302 {
303 struct i2c_hid *ihid = i2c_get_clientdata(client);
304 int ret;
305
306 i2c_hid_dbg(ihid, "%s\n", __func__);
307
308 ret = __i2c_hid_command(client, &hid_set_power_cmd, power_state,
309 0, NULL, 0, NULL, 0);
310 if (ret)
311 dev_err(&client->dev, "failed to change power setting.\n");
312
313 return ret;
314 }
315
316 static int i2c_hid_hwreset(struct i2c_client *client)
317 {
318 struct i2c_hid *ihid = i2c_get_clientdata(client);
319 int ret;
320
321 i2c_hid_dbg(ihid, "%s\n", __func__);
322
323 ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
324 if (ret)
325 return ret;
326
327 i2c_hid_dbg(ihid, "resetting...\n");
328
329 ret = i2c_hid_command(client, &hid_reset_cmd, NULL, 0);
330 if (ret) {
331 dev_err(&client->dev, "failed to reset device.\n");
332 i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
333 return ret;
334 }
335
336 return 0;
337 }
338
339 static int i2c_hid_get_input(struct i2c_hid *ihid)
340 {
341 int ret, ret_size;
342 int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
343
344 ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
345 if (ret != size) {
346 if (ret < 0)
347 return ret;
348
349 dev_err(&ihid->client->dev, "%s: got %d data instead of %d\n",
350 __func__, ret, size);
351 return ret;
352 }
353
354 ret_size = ihid->inbuf[0] | ihid->inbuf[1] << 8;
355
356 if (!ret_size) {
357 /* host or device initiated RESET completed */
358 if (test_and_clear_bit(I2C_HID_RESET_PENDING, &ihid->flags))
359 wake_up(&ihid->wait);
360 return 0;
361 }
362
363 if (ret_size > size) {
364 dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
365 __func__, size, ret_size);
366 return -EIO;
367 }
368
369 i2c_hid_dbg(ihid, "input: %*ph\n", ret_size, ihid->inbuf);
370
371 if (test_bit(I2C_HID_STARTED, &ihid->flags))
372 hid_input_report(ihid->hid, HID_INPUT_REPORT, ihid->inbuf + 2,
373 ret_size - 2, 1);
374
375 return 0;
376 }
377
378 static irqreturn_t i2c_hid_irq(int irq, void *dev_id)
379 {
380 struct i2c_hid *ihid = dev_id;
381
382 if (test_bit(I2C_HID_READ_PENDING, &ihid->flags))
383 return IRQ_HANDLED;
384
385 i2c_hid_get_input(ihid);
386
387 return IRQ_HANDLED;
388 }
389
390 static int i2c_hid_get_report_length(struct hid_report *report)
391 {
392 return ((report->size - 1) >> 3) + 1 +
393 report->device->report_enum[report->type].numbered + 2;
394 }
395
396 static void i2c_hid_init_report(struct hid_report *report, u8 *buffer,
397 size_t bufsize)
398 {
399 struct hid_device *hid = report->device;
400 struct i2c_client *client = hid->driver_data;
401 struct i2c_hid *ihid = i2c_get_clientdata(client);
402 unsigned int size, ret_size;
403
404 size = i2c_hid_get_report_length(report);
405 i2c_hid_get_report(client,
406 report->type == HID_FEATURE_REPORT ? 0x03 : 0x01,
407 report->id, buffer, size);
408
409 i2c_hid_dbg(ihid, "report (len=%d): %*ph\n", size, size, ihid->inbuf);
410
411 ret_size = buffer[0] | (buffer[1] << 8);
412
413 if (ret_size != size) {
414 dev_err(&client->dev, "error in %s size:%d / ret_size:%d\n",
415 __func__, size, ret_size);
416 return;
417 }
418
419 /* hid->driver_lock is held as we are in probe function,
420 * we just need to setup the input fields, so using
421 * hid_report_raw_event is safe. */
422 hid_report_raw_event(hid, report->type, buffer + 2, size - 2, 1);
423 }
424
425 /*
426 * Initialize all reports
427 */
428 static void i2c_hid_init_reports(struct hid_device *hid)
429 {
430 struct hid_report *report;
431 struct i2c_client *client = hid->driver_data;
432 struct i2c_hid *ihid = i2c_get_clientdata(client);
433 u8 *inbuf = kzalloc(ihid->bufsize, GFP_KERNEL);
434
435 if (!inbuf)
436 return;
437
438 list_for_each_entry(report,
439 &hid->report_enum[HID_INPUT_REPORT].report_list, list)
440 i2c_hid_init_report(report, inbuf, ihid->bufsize);
441
442 list_for_each_entry(report,
443 &hid->report_enum[HID_FEATURE_REPORT].report_list, list)
444 i2c_hid_init_report(report, inbuf, ihid->bufsize);
445
446 kfree(inbuf);
447 }
448
449 /*
450 * Traverse the supplied list of reports and find the longest
451 */
452 static void i2c_hid_find_max_report(struct hid_device *hid, unsigned int type,
453 unsigned int *max)
454 {
455 struct hid_report *report;
456 unsigned int size;
457
458 /* We should not rely on wMaxInputLength, as some devices may set it to
459 * a wrong length. */
460 list_for_each_entry(report, &hid->report_enum[type].report_list, list) {
461 size = i2c_hid_get_report_length(report);
462 if (*max < size)
463 *max = size;
464 }
465 }
466
467 static int i2c_hid_alloc_buffers(struct i2c_hid *ihid)
468 {
469 /* the worst case is computed from the set_report command with a
470 * reportID > 15 and the maximum report length */
471 int args_len = sizeof(__u8) + /* optional ReportID byte */
472 sizeof(__u16) + /* data register */
473 sizeof(__u16) + /* size of the report */
474 ihid->bufsize; /* report */
475
476 ihid->inbuf = kzalloc(ihid->bufsize, GFP_KERNEL);
477
478 if (!ihid->inbuf)
479 return -ENOMEM;
480
481 ihid->argsbuf = kzalloc(args_len, GFP_KERNEL);
482
483 if (!ihid->argsbuf) {
484 kfree(ihid->inbuf);
485 return -ENOMEM;
486 }
487
488 ihid->cmdbuf = kzalloc(sizeof(union command) + args_len, GFP_KERNEL);
489
490 if (!ihid->cmdbuf) {
491 kfree(ihid->inbuf);
492 kfree(ihid->argsbuf);
493 ihid->inbuf = NULL;
494 ihid->argsbuf = NULL;
495 return -ENOMEM;
496 }
497
498 return 0;
499 }
500
501 static void i2c_hid_free_buffers(struct i2c_hid *ihid)
502 {
503 kfree(ihid->inbuf);
504 kfree(ihid->argsbuf);
505 kfree(ihid->cmdbuf);
506 ihid->inbuf = NULL;
507 ihid->cmdbuf = NULL;
508 ihid->argsbuf = NULL;
509 }
510
511 static int i2c_hid_get_raw_report(struct hid_device *hid,
512 unsigned char report_number, __u8 *buf, size_t count,
513 unsigned char report_type)
514 {
515 struct i2c_client *client = hid->driver_data;
516 struct i2c_hid *ihid = i2c_get_clientdata(client);
517 int ret;
518
519 if (report_type == HID_OUTPUT_REPORT)
520 return -EINVAL;
521
522 if (count > ihid->bufsize)
523 count = ihid->bufsize;
524
525 ret = i2c_hid_get_report(client,
526 report_type == HID_FEATURE_REPORT ? 0x03 : 0x01,
527 report_number, ihid->inbuf, count);
528
529 if (ret < 0)
530 return ret;
531
532 count = ihid->inbuf[0] | (ihid->inbuf[1] << 8);
533
534 memcpy(buf, ihid->inbuf + 2, count);
535
536 return count;
537 }
538
539 static int i2c_hid_output_raw_report(struct hid_device *hid, __u8 *buf,
540 size_t count, unsigned char report_type)
541 {
542 struct i2c_client *client = hid->driver_data;
543 int report_id = buf[0];
544
545 if (report_type == HID_INPUT_REPORT)
546 return -EINVAL;
547
548 return i2c_hid_set_report(client,
549 report_type == HID_FEATURE_REPORT ? 0x03 : 0x02,
550 report_id, buf, count);
551 }
552
553 static int i2c_hid_parse(struct hid_device *hid)
554 {
555 struct i2c_client *client = hid->driver_data;
556 struct i2c_hid *ihid = i2c_get_clientdata(client);
557 struct i2c_hid_desc *hdesc = &ihid->hdesc;
558 unsigned int rsize;
559 char *rdesc;
560 int ret;
561 int tries = 3;
562
563 i2c_hid_dbg(ihid, "entering %s\n", __func__);
564
565 rsize = le16_to_cpu(hdesc->wReportDescLength);
566 if (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) {
567 dbg_hid("weird size of report descriptor (%u)\n", rsize);
568 return -EINVAL;
569 }
570
571 do {
572 ret = i2c_hid_hwreset(client);
573 if (ret)
574 msleep(1000);
575 } while (tries-- > 0 && ret);
576
577 if (ret)
578 return ret;
579
580 rdesc = kzalloc(rsize, GFP_KERNEL);
581
582 if (!rdesc) {
583 dbg_hid("couldn't allocate rdesc memory\n");
584 return -ENOMEM;
585 }
586
587 i2c_hid_dbg(ihid, "asking HID report descriptor\n");
588
589 ret = i2c_hid_command(client, &hid_report_descr_cmd, rdesc, rsize);
590 if (ret) {
591 hid_err(hid, "reading report descriptor failed\n");
592 kfree(rdesc);
593 return -EIO;
594 }
595
596 i2c_hid_dbg(ihid, "Report Descriptor: %*ph\n", rsize, rdesc);
597
598 ret = hid_parse_report(hid, rdesc, rsize);
599 kfree(rdesc);
600 if (ret) {
601 dbg_hid("parsing report descriptor failed\n");
602 return ret;
603 }
604
605 return 0;
606 }
607
608 static int i2c_hid_start(struct hid_device *hid)
609 {
610 struct i2c_client *client = hid->driver_data;
611 struct i2c_hid *ihid = i2c_get_clientdata(client);
612 int ret;
613 int old_bufsize = ihid->bufsize;
614
615 ihid->bufsize = HID_MIN_BUFFER_SIZE;
616 i2c_hid_find_max_report(hid, HID_INPUT_REPORT, &ihid->bufsize);
617 i2c_hid_find_max_report(hid, HID_OUTPUT_REPORT, &ihid->bufsize);
618 i2c_hid_find_max_report(hid, HID_FEATURE_REPORT, &ihid->bufsize);
619
620 if (ihid->bufsize > old_bufsize || !ihid->inbuf || !ihid->cmdbuf) {
621 i2c_hid_free_buffers(ihid);
622
623 ret = i2c_hid_alloc_buffers(ihid);
624
625 if (ret) {
626 ihid->bufsize = old_bufsize;
627 return ret;
628 }
629 }
630
631 if (!(hid->quirks & HID_QUIRK_NO_INIT_REPORTS))
632 i2c_hid_init_reports(hid);
633
634 return 0;
635 }
636
637 static void i2c_hid_stop(struct hid_device *hid)
638 {
639 struct i2c_client *client = hid->driver_data;
640 struct i2c_hid *ihid = i2c_get_clientdata(client);
641
642 hid->claimed = 0;
643
644 i2c_hid_free_buffers(ihid);
645 }
646
647 static int i2c_hid_open(struct hid_device *hid)
648 {
649 struct i2c_client *client = hid->driver_data;
650 struct i2c_hid *ihid = i2c_get_clientdata(client);
651 int ret;
652
653 if (!hid->open++) {
654 ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
655 if (ret) {
656 hid->open--;
657 return -EIO;
658 }
659 set_bit(I2C_HID_STARTED, &ihid->flags);
660 }
661 return 0;
662 }
663
664 static void i2c_hid_close(struct hid_device *hid)
665 {
666 struct i2c_client *client = hid->driver_data;
667 struct i2c_hid *ihid = i2c_get_clientdata(client);
668
669 /* protecting hid->open to make sure we don't restart
670 * data acquistion due to a resumption we no longer
671 * care about
672 */
673 if (!--hid->open) {
674 clear_bit(I2C_HID_STARTED, &ihid->flags);
675
676 /* Save some power */
677 i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
678 }
679 }
680
681 static int i2c_hid_power(struct hid_device *hid, int lvl)
682 {
683 struct i2c_client *client = hid->driver_data;
684 struct i2c_hid *ihid = i2c_get_clientdata(client);
685 int ret = 0;
686
687 i2c_hid_dbg(ihid, "%s lvl:%d\n", __func__, lvl);
688
689 switch (lvl) {
690 case PM_HINT_FULLON:
691 ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
692 break;
693 case PM_HINT_NORMAL:
694 ret = i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
695 break;
696 }
697 return ret;
698 }
699
700 static int i2c_hid_hidinput_input_event(struct input_dev *dev,
701 unsigned int type, unsigned int code, int value)
702 {
703 struct hid_device *hid = input_get_drvdata(dev);
704 struct hid_field *field;
705 int offset;
706
707 if (type == EV_FF)
708 return input_ff_event(dev, type, code, value);
709
710 if (type != EV_LED)
711 return -1;
712
713 offset = hidinput_find_field(hid, type, code, &field);
714
715 if (offset == -1) {
716 hid_warn(dev, "event field not found\n");
717 return -1;
718 }
719
720 hid_set_field(field, offset, value);
721
722 return 0;
723 }
724
725 static struct hid_ll_driver i2c_hid_ll_driver = {
726 .parse = i2c_hid_parse,
727 .start = i2c_hid_start,
728 .stop = i2c_hid_stop,
729 .open = i2c_hid_open,
730 .close = i2c_hid_close,
731 .power = i2c_hid_power,
732 .hidinput_input_event = i2c_hid_hidinput_input_event,
733 };
734
735 static int __devinit i2c_hid_init_irq(struct i2c_client *client)
736 {
737 struct i2c_hid *ihid = i2c_get_clientdata(client);
738 int ret;
739
740 dev_dbg(&client->dev, "Requesting IRQ: %d\n", client->irq);
741
742 ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq,
743 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
744 client->name, ihid);
745 if (ret < 0) {
746 dev_dbg(&client->dev,
747 "Could not register for %s interrupt, irq = %d,"
748 " ret = %d\n",
749 client->name, client->irq, ret);
750
751 return ret;
752 }
753
754 ihid->irq = client->irq;
755
756 return 0;
757 }
758
759 static int __devinit i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid)
760 {
761 struct i2c_client *client = ihid->client;
762 struct i2c_hid_desc *hdesc = &ihid->hdesc;
763 unsigned int dsize;
764 int ret;
765
766 /* Fetch the length of HID description, retrieve the 4 first bytes:
767 * bytes 0-1 -> length
768 * bytes 2-3 -> bcdVersion (has to be 1.00) */
769 ret = i2c_hid_command(client, &hid_descr_cmd, ihid->hdesc_buffer, 4);
770
771 i2c_hid_dbg(ihid, "%s, ihid->hdesc_buffer: %*ph\n",
772 __func__, 4, ihid->hdesc_buffer);
773
774 if (ret) {
775 dev_err(&client->dev, "HID_DESCR_LENGTH_CMD Fail (ret=%d)\n",
776 ret);
777 return -ENODEV;
778 }
779
780 dsize = le16_to_cpu(hdesc->wHIDDescLength);
781 if (!dsize || dsize > HID_MAX_DESCRIPTOR_SIZE) {
782 dev_err(&client->dev, "weird size of HID descriptor (%u)\n",
783 dsize);
784 return -ENODEV;
785 }
786
787 /* check bcdVersion == 1.0 */
788 if (le16_to_cpu(hdesc->bcdVersion) != 0x0100) {
789 dev_err(&client->dev,
790 "unexpected HID descriptor bcdVersion (0x%04x)\n",
791 le16_to_cpu(hdesc->bcdVersion));
792 return -ENODEV;
793 }
794
795 i2c_hid_dbg(ihid, "Fetching the HID descriptor\n");
796
797 ret = i2c_hid_command(client, &hid_descr_cmd, ihid->hdesc_buffer,
798 dsize);
799 if (ret) {
800 dev_err(&client->dev, "hid_descr_cmd Fail\n");
801 return -ENODEV;
802 }
803
804 i2c_hid_dbg(ihid, "HID Descriptor: %*ph\n", dsize, ihid->hdesc_buffer);
805
806 return 0;
807 }
808
809 static int __devinit i2c_hid_probe(struct i2c_client *client,
810 const struct i2c_device_id *dev_id)
811 {
812 int ret;
813 struct i2c_hid *ihid;
814 struct hid_device *hid;
815 __u16 hidRegister;
816 struct i2c_hid_platform_data *platform_data = client->dev.platform_data;
817
818 dbg_hid("HID probe called for i2c 0x%02x\n", client->addr);
819
820 if (!platform_data) {
821 dev_err(&client->dev, "HID register address not provided\n");
822 return -EINVAL;
823 }
824
825 if (!client->irq) {
826 dev_err(&client->dev,
827 "HID over i2c has not been provided an Int IRQ\n");
828 return -EINVAL;
829 }
830
831 ihid = kzalloc(sizeof(struct i2c_hid), GFP_KERNEL);
832 if (!ihid)
833 return -ENOMEM;
834
835 i2c_set_clientdata(client, ihid);
836
837 ihid->client = client;
838
839 hidRegister = platform_data->hid_descriptor_address;
840 ihid->wHIDDescRegister = cpu_to_le16(hidRegister);
841
842 init_waitqueue_head(&ihid->wait);
843
844 /* we need to allocate the command buffer without knowing the maximum
845 * size of the reports. Let's use HID_MIN_BUFFER_SIZE, then we do the
846 * real computation later. */
847 ihid->bufsize = HID_MIN_BUFFER_SIZE;
848 i2c_hid_alloc_buffers(ihid);
849
850 ret = i2c_hid_fetch_hid_descriptor(ihid);
851 if (ret < 0)
852 goto err;
853
854 ret = i2c_hid_init_irq(client);
855 if (ret < 0)
856 goto err;
857
858 hid = hid_allocate_device();
859 if (IS_ERR(hid)) {
860 ret = PTR_ERR(hid);
861 goto err;
862 }
863
864 ihid->hid = hid;
865
866 hid->driver_data = client;
867 hid->ll_driver = &i2c_hid_ll_driver;
868 hid->hid_get_raw_report = i2c_hid_get_raw_report;
869 hid->hid_output_raw_report = i2c_hid_output_raw_report;
870 hid->dev.parent = &client->dev;
871 hid->bus = BUS_I2C;
872 hid->version = le16_to_cpu(ihid->hdesc.bcdVersion);
873 hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID);
874 hid->product = le16_to_cpu(ihid->hdesc.wProductID);
875
876 snprintf(hid->name, sizeof(hid->name), "%s %04X:%04X",
877 client->name, hid->vendor, hid->product);
878
879 ret = hid_add_device(hid);
880 if (ret) {
881 if (ret != -ENODEV)
882 hid_err(client, "can't add hid device: %d\n", ret);
883 goto err_mem_free;
884 }
885
886 return 0;
887
888 err_mem_free:
889 hid_destroy_device(hid);
890
891 err:
892 if (ihid->irq)
893 free_irq(ihid->irq, ihid);
894
895 kfree(ihid);
896 return ret;
897 }
898
899 static int __devexit i2c_hid_remove(struct i2c_client *client)
900 {
901 struct i2c_hid *ihid = i2c_get_clientdata(client);
902 struct hid_device *hid;
903
904 if (WARN_ON(!ihid))
905 return -1;
906
907 hid = ihid->hid;
908 hid_destroy_device(hid);
909
910 free_irq(client->irq, ihid);
911
912 kfree(ihid);
913
914 return 0;
915 }
916
917 #ifdef CONFIG_PM_SLEEP
918 static int i2c_hid_suspend(struct device *dev)
919 {
920 struct i2c_client *client = to_i2c_client(dev);
921 struct i2c_hid *ihid = i2c_get_clientdata(client);
922
923 if (device_may_wakeup(&client->dev))
924 enable_irq_wake(ihid->irq);
925
926 /* Save some power */
927 i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
928
929 return 0;
930 }
931
932 static int i2c_hid_resume(struct device *dev)
933 {
934 int ret;
935 struct i2c_client *client = to_i2c_client(dev);
936
937 ret = i2c_hid_hwreset(client);
938 if (ret)
939 return ret;
940
941 if (device_may_wakeup(&client->dev))
942 disable_irq_wake(client->irq);
943
944 return 0;
945 }
946 #endif
947
948 static SIMPLE_DEV_PM_OPS(i2c_hid_pm, i2c_hid_suspend, i2c_hid_resume);
949
950 static const struct i2c_device_id i2c_hid_id_table[] = {
951 { "i2c_hid", 0 },
952 { },
953 };
954 MODULE_DEVICE_TABLE(i2c, i2c_hid_id_table);
955
956
957 static struct i2c_driver i2c_hid_driver = {
958 .driver = {
959 .name = "i2c_hid",
960 .owner = THIS_MODULE,
961 .pm = &i2c_hid_pm,
962 },
963
964 .probe = i2c_hid_probe,
965 .remove = __devexit_p(i2c_hid_remove),
966
967 .id_table = i2c_hid_id_table,
968 };
969
970 module_i2c_driver(i2c_hid_driver);
971
972 MODULE_DESCRIPTION("HID over I2C core driver");
973 MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>");
974 MODULE_LICENSE("GPL");
975
include/linux/i2c/i2c-hid.h
File was created 1 /*
2 * HID over I2C protocol implementation
3 *
4 * Copyright (c) 2012 Benjamin Tissoires <benjamin.tissoires@gmail.com>
5 * Copyright (c) 2012 Ecole Nationale de l'Aviation Civile, France
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive for
9 * more details.
10 */
11
12 #ifndef __LINUX_I2C_HID_H
13 #define __LINUX_I2C_HID_H
14
15 #include <linux/types.h>
16
17 /**
18 * struct i2chid_platform_data - used by hid over i2c implementation.
19 * @hid_descriptor_address: i2c register where the HID descriptor is stored.
20 *
21 * Note that it is the responsibility of the platform driver (or the acpi 5.0
22 * driver) to setup the irq related to the gpio in the struct i2c_board_info.
23 * The platform driver should also setup the gpio according to the device:
24 *
25 * A typical example is the following:
26 * irq = gpio_to_irq(intr_gpio);
27 * hkdk4412_i2c_devs5[0].irq = irq; // store the irq in i2c_board_info
28 * gpio_request(intr_gpio, "elan-irq");
29 * s3c_gpio_setpull(intr_gpio, S3C_GPIO_PULL_UP);
30 */
31 struct i2c_hid_platform_data {
32 u16 hid_descriptor_address;
33 };
34
35 #endif /* __LINUX_I2C_HID_H */
36