summaryrefslogtreecommitdiffstats
path: root/drivers/hid/i2c-hid
Commit message (Collapse)AuthorAgeFilesLines
...
| | | * HID: i2c: use generic hidinput_input_event()David Herrmann2013-07-311-24/+0Star
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | HID core provides the same functionality, so drop the custom handler. Besides, the current handler doesn't schedule any outgoing report so it did not work, anyway. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * / HID: i2c-hid: add DT bindingsBenjamin Tissoires2013-07-311-1/+43
| |/ | | | | | | | | | | | | | | | | Add device tree based support for HID over I2C devices. Tested on an Odroid-X board with a Synaptics touchpad. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* / HID: i2c-hid: use correct type for ACPI _DSM parameterMika Westerberg2013-08-201-2/+3
|/ | | | | | | | | | | | | | | | | ACPI 5.0 specification requires the fourth parameter to the _DSM (Device Specific Method) to be of type package instead of integer. Failing to do that we get following warning on the console: ACPI Warning: \_SB_.PCI0.I2C1.TPL0._DSM: Argument #4 type mismatch - Found [Integer], ACPI requires [Package] (20130517/nsarguments-95) Fix this by passing an empty package to the _DSM method. The HID over I2C specification doesn't require any specific values to be passed with this parameter. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: support sending HID output reports using the output registerAndrew Duggan2013-07-041-3/+17
| | | | | | | | | | | The current i2c hid driver does not support sending HID output reports using the output register for devices which support receiving reports through this method. This patch determines which method to use to send output reports based on the value of wMaxOutputLength in the device's HID descriptor. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: fix length for set/get report in i2c hidHuzefa Kankroliwala2013-04-041-5/+4Star
| | | | | | | | | | | | | | | | With the current i2c hid driver set/get report does not work as expected, for e.g sensor hub properties like power state, frequency etc is not set properly on the device as a result we do not get events. The problem is that i2c hid driver in function i2c_hid_request sets length equal to default buffer size for which the sensor hub does not respond on get/set commands. Use report length and calculate it based on report size and id. Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Huzefa Kankroliwala <huzefa.nomanx.kankroliwala@intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: implement request() callbackBenjamin Tissoires2013-02-251-0/+32
| | | | | | | | | This allows HID drivers to also get/set reports through hid_hw_request(). Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
*-. Merge branches 'for-3.8/upstream-fixes', 'for-3.9/hid-sensor', ↵Jiri Kosina2013-02-211-12/+87
|\ \ | | | | | | | | | | | | | | | | | | 'for-3.9/hidraw' and 'for-3.9/i2c-hid' into for-linus Conflicts: drivers/hid/i2c-hid/i2c-hid.c
| | * HID: i2c-hid: add ACPI supportMika Westerberg2013-01-181-6/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The HID over I2C protocol specification states that when the device is enumerated from ACPI the HID descriptor address can be obtained by executing "_DSM" for the device with function 1. Enable this. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * | Merge branch 'for-3.8/upstream-fixes' of ↵Linus Torvalds2013-01-311-1/+12
| |\ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid PullHID fixes from Jiri Kosina: - fix i2c-hid and hidraw interaction, by Benjamin Tissoires - a quirk to make a particular device (Formosa IR receiver) work properly, by Nicholas Santos * 'for-3.8/upstream-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: HID: i2c-hid: fix i2c_hid_output_raw_report HID: usbhid: quirk for Formosa IR receiver HID: remove x bit from sensor doc
| * | Drivers: misc: remove __dev* attributes.Greg Kroah-Hartman2013-01-041-6/+6
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | CONFIG_HOTPLUG is going away as an option. As a result, the __dev* markings need to be removed. This change removes the use of __devinit, __devexit_p, __devinitdata, __devinitconst, and __devexit from these drivers. Based on patches originally written by Bill Pemberton, but redone by me in order to handle some of the coding style issues better, by hand. Cc: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* / HID: i2c-hid: fix i2c_hid_output_raw_reportBenjamin Tissoires2013-01-311-1/+12
|/ | | | | | | | | | | | | | i2c_hid_output_raw_report is used by hidraw to forward set_report requests. The current implementation of i2c_hid_set_report needs to take the report_id as an argument. The report_id is stored in the first byte of the buffer in argument of i2c_hid_output_raw_report. Not removing the report_id from the given buffer adds this byte 2 times in the command, leading to a non working command. Reported-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: add mutex protecting open/close raceBenjamin Tissoires2012-12-121-3/+11
| | | | | | | | | | | | We should not enter close function while someone else is in open. This mutex prevents this race. There is also no need to override the ret value with -EIO in case of a failure of i2c_hid_set_power. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: fix ret_count checkJiri Kosina2012-12-061-1/+1
| | | | | | | | | ret_count has to be at least 3, as we have to count the 2 bytes that are used for the size of the reply. Without this, memcpy() might be called with zero or negative count. Reported-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: fix i2c_hid_get_raw_report count mismatchesBenjamin Tissoires2012-12-061-4/+12
| | | | | | | | | | | | The previous memcpy implementation relied on the size advertized by the device. There were no guarantees that buf was big enough. Some gymnastic is also required with the +2/-2 to take into account the first 2 bytes of the returned buffer where the total returned length is supplied by the device. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: remove extra .irq field in struct i2c_hidBenjamin Tissoires2012-12-061-10/+5Star
| | | | | | | | | There is no point in keeping the irq in i2c_hid as it's already there in client. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: reorder allocation/free of buffersBenjamin Tissoires2012-12-061-40/+28Star
| | | | | | | | | | Simplifies i2c_hid_alloc_buffers tests, and makes this function responsible of the assignment of ihid->bufsize. The condition for the reallocation in i2c_hid_start is then simpler. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: fix memory corruption due to missing hid declarationBenjamin Tissoires2012-12-061-1/+8
| | | | | | | | | HID descriptors contains 4 bytes of reserved field. The previous implementation was overriding the next fields in struct i2c_hid. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: remove superfluous includeJiri Kosina2012-12-051-1/+0Star
| | | | | | | | The pointless WARN_ON() has been removed from i2c_hid_remove(), so we don't need bug.h any more. Reported-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: remove unneeded test in i2c_hid_removeBenjamin Tissoires2012-12-051-3/+0Star
| | | | | | | ihid can not be null, so there are no reasons to test it. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: i2c_hid_get_report may failBenjamin Tissoires2012-12-051-2/+3
| | | | | | | | | | If i2c_hid_get_report fails, exit i2c_hid_init_report. The printk log is already called by i2c_hid_get_report, so no need to add some more printks. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: also call i2c_hid_free_buffers in i2c_hid_removeBenjamin Tissoires2012-12-051-0/+3
| | | | | | | | | | In the case where the hid driver in charge of handling the hid part of the device (hid-generic for instance) fails at probe, neither i2c_hid_start nor i2c_hid_stop are called. Thus, the buffers allocated in i2c_hid_probe are never freed. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: fix error messagesBenjamin Tissoires2012-12-051-5/+6
| | | | | | Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: fix return pathsBenjamin Tissoires2012-12-051-12/+12
| | | | | | | | | | Forwards appropriate return values. As noone use the error returned by i2c_hid_get_input, let's make it returning void. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: remove unused static declarationsBenjamin Tissoires2012-12-051-15/+10Star
| | | | | | | | | These definitions are not used here, but are defined by the specification. Keeping some of them for documentation purposes. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: fix i2c_hid_dbg macroBenjamin Tissoires2012-12-051-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | This avoids the problematic case: if (condition) i2c_hid_dbg(ihid, "Blah blah %d\n", i); else do_something_very_important(); Which looks correct, however with the previous macro definition, this expands to the unexpected: if (condition) { if (debug) \ dev_printk(KERN_DEBUG, &ihid->client->dev, "Blah blah %d\n", i); else do_something_very_important(); } Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: fix checkpatch.pl warningBenjamin Tissoires2012-12-051-1/+1
| | | | | | | | We should not initialize to 0 static declarations. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: enhance KconfigBenjamin Tissoires2012-12-051-5/+2Star
| | | | | | | | The "comment" part can never be displayed, so we can remove it. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: change I2C nameBenjamin Tissoires2012-12-051-1/+1
| | | | | | | | | no I2C driver has "i2c" in its name. It makes more sense to call this i2c driver "hid". Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: fix memory leak during probeJiri Kosina2012-11-201-0/+1
| | | | | | | | | In case we are returning from i2c_hid_probe() through the 'err' or 'err_mem_free' labels, there is noone freeing the buffers allocated by i2c_hid_alloc_buffers(). Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: i2c-hid: introduce HID over i2c specification implementationBenjamin Tissoires2012-11-193-0/+1000
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>