summaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-rmi.c
Commit message (Collapse)AuthorAgeFilesLines
* HID: rmi: Check that the device is a RMI device in suspend and resume callbacksAndrew Duggan2016-01-271-0/+11
| | | | | | | | | | | | | | Commit 092563604217 ("HID: rmi: Disable scanning if the device is not a wake source") introduced a regression for devices which use hid-rmi to handle composite USB devices. The suspend or resume callbacks are not checking that the device is a RMI device before calling rmi_read or rmi_write. This results in dereferencing uninitialized variables on non RMI devices. This patch checks that the RMI_DEVICE flag is set before sending RMI commands to the device. Reported-by: Rodrigo Gomes <rodrigo.toste.gomes@gmail.com> Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: hid-input: allow input_configured callback return errorsDmitry Torokhov2015-11-051-4/+7
| | | | | | | | | | | | | | | | When configuring input device via input_configured callback we may encounter errors (for example input_mt_init_slots() may fail). Instead of continuing with half-initialized input device let's allow driver indicate failures. Signed-off-by: Jaikumar Ganesh <jaikumarg@android.com> Signed-off-by: Arve Hjønnevåg <arve@android.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Acked-by: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com> Acked-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: Set F01 interrupt enable register when not setAndrew Duggan2015-07-171-5/+52
| | | | | | | | | | | | | A firmware bug in some touchpads causes the F01 interrupt enable register to be cleared on reset. This register controls which RMI functions generate interrupts and when it is cleared, the touchpad stops reporting all data. This patch looks for the cleared F01 control register and writes the correct value based on interrupt mask computed while scanning the PDT. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91102 Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
* HID: rmi: Write updated F11 control registers after resetAndrew Duggan2015-07-131-13/+43
| | | | | | | | | | When a device is reset the values of control registers will be reset to the defaults. This patch reapplies the control register values set for F11 by the driver. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
* HID: rmi: Disable scanning if the device is not a wake sourceAndrew Duggan2015-07-091-1/+55
| | | | | | | | | | | Some touchpads are configured with firmware which continues to scan for fingers at a minimal scan rate even after receiving the HID power sleep command. This allows a finger touching the touchpad to genrate a wake event. This patch ensures that scanning is disabled if the touchpad is not a wake source and ensures scanning is enabled on resume. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
*-. Merge branches 'for-4.2/i2c-hid', 'for-4.2/lenovo', 'for-4.2/plantronics', ↵Jiri Kosina2015-06-221-3/+6
|\ \ | | | | | | | | | | | | | | | | | | 'for-4.2/rmi', 'for-4.2/sensor-hub', 'for-4.2/sjoy', 'for-4.2/sony' and 'for-4.2/wacom' into for-linus Conflicts: drivers/hid/wacom_wac.c
| | * HID: rmi: Disable populating F30 when the touchpad has physical buttonsAndrew Duggan2015-06-161-3/+6
| |/ | | | | | | | | | | | | | | | | | | | | Physical buttons do not use F30 to report their state and in some cases the data reported in F30 is incorrect and inconsistent with what is reported by the HID descriptor. When physical buttons are present, ignore F30 and let hid-input report buttons based on what is defined in the 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: rmi: fix some harmless BIT() mistakesDan Carpenter2015-05-181-3/+3
|/ | | | | | | | | | | | | | | These defines are used like this: if (!(test_bit(RMI_STARTED, &hdata->flags))) So the intent was to use bits 0, 1 and 2 but because of the extra BIT() shifts we're actually using 1, 2 and 4. It's harmless because it's done consistently but static checkers will complain. Fixes: 9fb6bf02e3ad ('HID: rmi: introduce RMI driver for Synaptics touchpads') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: disable palm detect gesture when presentAndrew Duggan2015-02-251-3/+16
| | | | | | | | | | | | | | | A touchpad may have firmware based palm detection code enabled which suppresses 2D data from being reported when the firmware believes a palm is on the touchpad. This functionality is meant to be used in mouse mode without a driver. When a driver is present, the driver can do a better job of determining if a contact is a palm. If this gesture is enabled on a touchpad operating in rmi mode then the firmware will not properly clear the palm detect interrupt, causing the touchpad to interrupt indefinately. This patch disables the palm detect gesture when the touchpad is operating in rmi mode. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: disable dribble packets on Synaptics touchpadsAndrew Duggan2015-02-251-0/+19
| | | | | | | | | | | | | When a finger is lifted from a Synaptics touchpad the firmware will continue to interrupts for up to a second. These additional interrupts are know and dribble interrupts. Since the data read from the touchpad does not change the input subsystem only reports a single event. This makes the servicing of dribble interrupts on Linux unnecessary. This patch simply disables dribble interupts when configuring the touchpad. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: Add functions for writing to registersAndrew Duggan2015-02-251-0/+40
| | | | | | | | Writing to registers is needed for setting configuration parameters. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: Print the firmware id of the touchpadAndrew Duggan2015-02-171-0/+99
| | | | | | | | | | | Knowing the firmware id is extremely useful when debugging issues related to the touchpad. It can be used to determine the hardware, firmware version, and configuation of the touchpad. This patch queries the firmware id and prints it as the touchpad is starting so that it will show up in the dmesg output included in bug reports. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: Add support for the touchpad in the Razer Blade 14 laptopAndrew Duggan2015-01-121-0/+2
| | | | | | | | | Have hid-rmi handle all of the Razer Blade HID devices that are part of the composite USB device. This will allow hid-rmi to operate the touchpad in rmi mode while passing events from the other devices to hid-input. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: Support touchpads with external buttonsAndrew Duggan2015-01-121-1/+19
| | | | | | | | | | | | The external buttons on HID touchpads are connected as pass through devices and button events are not reported in the rmi registers. As a result on these devices we need to allow the HID generic desktop button events to be processed by hid-input. Unfortunately, there is no way to query the touchpad to determine that it has pass through buttons so the RMI_DEVICE_HAS_PHYS_BUTTONS should be set manually when adding the device to rmi_id[]. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: Use hid_report_len to compute the size of reportsAndrew Duggan2015-01-121-3/+2
| | | | | | | | Now that hid_report_len is in hid.h we can use this function instead of duplicating the code which computes it. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: Support non rmi devices by passing events to hid-inputAndrew Duggan2014-12-221-17/+76
| | | | | | | | | | | | | | Allowing hid-rmi to bind to non rmi devices allows us to support composite USB devices which contain several HID devices one of which is a HID touchpad. Since all of the devices have the same VID and PID we can add the device to the hid_have_special_driver list and have hid-rmi handle all of the devices. Then hid-rmi's probe can look for the rmi specific HID report IDs and decide if it should handle the device as a rmi device or simply report that the events needs additional processing. 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: rmi: The address of query8 must be calculated based on which query ↵Andrew Duggan2014-12-121-12/+12
| | | | | | | | | | | registers are present If a touchpad does not report relative data then query 6 will not be present and the address of query 8 will be one less. This patches calculates the location of query 8 instead of hardcoding the offset. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: Check for additional ACM registers appended to F11 data reportAndrew Duggan2014-12-121-9/+52
| | | | | | | | | | | | | | If a touchpad reports the F11 data40 register then this indicates that the touchpad reports additional ACM (Accidental Contact Mitigation) data after the F11 data in the HID attention report. These additional bytes shift the position of the F30 button data causing the driver to incorrectly report button state when this functionality is present. This patch accounts for the additional data in the report. Fixes: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1398533 Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: check sanity of the incoming reportBenjamin Tissoires2014-09-121-6/+38
| | | | | | | | | | | | | | | | | | | In the Dell XPS 13 9333, it appears that sometimes the bus get confused and corrupts the incoming data. It fills the input report with the sentinel value "ff". Synaptics told us that such behavior does not comes from the touchpad itself, so we filter out such reports here. Unfortunately, we can not simply discard the incoming data because they may contain useful information. Most of the time, the misbehavior is quite near the end of the report, so we can still use the valid part of it. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1123584 Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: print an error if F11 is not found instead of stopping the deviceAndrew Duggan2014-08-141-4/+9
| | | | | | | | | | | | Currently rmi_probe will return -EIO if the device doesn't report that it has F11. This would indicate that something happened and the device is in the bootloader. We can recover the device using a userspace firmware update tool, but it needs access to the device through the hidraw device file. If the probe returns -EIO the hidraw device won't be created. So instead of failing the probe, just print an error message, but leave the device accessible from userspace. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: check that report ids exist in the report_id_hash before accessing ↵Andrew Duggan2014-07-291-6/+22
| | | | | | | | | | | | | | | | their size It is possible that the hid-rmi driver could get loaded onto a device which does not have the expected report ids. This should not happen because it would indicate that the hid-rmi driver is not compatible with that device. However, if it does happen it should return an error from probe instead of dereferencing a null pointer. related bug: https://bugzilla.kernel.org/show_bug.cgi?id=80091 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: rmi: change logging level of log messages related to unexpected reportsAndrew Duggan2014-07-291-2/+2
| | | | | | | | | | | | | | Userspace tools may use hidraw to perform operations on the device from userspace while hid-rmi is bound to the device. This can cause hid-rmi to print error messages when its ->raw_event() callback gets called as the reports pass through the HID stack. In this case receiving responses which were not initiated by hid-rmi is not actually an error so the resulting error messages are incorrect and misleading. This patch changes the log messages to debug so that the messages can be turned on in the event that there is a problem and there is not a userspace tool running. 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: rmi: make compututation of the address of Query 12 more carefulAndrew Duggan2014-07-291-10/+25
| | | | | | | | | | | | There are additional queries which are optional and may not be present depending on the configuration of the firmware. Knowing which queries are present is needed to properly compute the address of Query 12 and all subsequent queries. Additional bits in Query 1 are used to indicate the presence of these optional queries. 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: rmi: Protect PM-only functions by #ifdef CONFIG_PMGeert Uytterhoeven2014-06-121-0/+2
| | | | | | | | | | If CONFIG_PM=n: drivers/hid/hid-rmi.c:432: warning: ‘rmi_post_reset’ defined but not used drivers/hid/hid-rmi.c:437: warning: ‘rmi_post_resume’ defined but not used Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: do not handle touchscreens through hid-rmiBenjamin Tissoires2014-05-221-2/+1
| | | | | | | | | | | | | | | | Currently, hid-rmi drives every Synaptics product, but the touchscreens on the Windows tablets should be handled through hid-multitouch. Instead of providing a long list of PIDs, rely on the scan_report capability to detect which should go to hid-multitouch, and which should not go to hid-rmi. related bug: https://bugzilla.kernel.org/show_bug.cgi?id=74241 https://bugzilla.redhat.com/show_bug.cgi?id=1089583 Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: fix masks for x and w_x dataAndrew Duggan2014-05-161-2/+2
| | | | | | | | | | The F11 data in the HID report contains four bits of data for w_x and the least significant bits of x. Currently only the first three bits are being used which is resulting in small jumps in the position data on the x axis and in the w_x data. 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: rmi: fix wrong struct field nameJiri Kosina2014-05-131-2/+2
| | | | | | | | x_size_mm should be y_size_mm, otherwise neither the duplicated condition nor the assignment make any sense whatsoever. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: do not fetch more than 16 bytes in a queryBenjamin Tissoires2014-05-131-3/+8
| | | | | | | | | | | | | | | | | | | A firmware bug is present on the XPS Haswell edition which silently split the request in two responses when the caller ask for a read of more than 16 bytes. The FW sends the first 16 then the 4 next, but it says that it answered the 20 bytes in the first report. This occurs only on the retrieving of the min/max of X and Y of the F11 function. We only use the first 10 bytes of the Ctrl register, so we can get only those 10 bytes to prevent the bug from happening. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1090161 Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: check for the existence of some optional queries before reading ↵Andrew Duggan2014-05-131-4/+32
| | | | | | | | | | | | query 12 The rmi4 spec defines some optional query registers in F11 which appear before query 12. This patch checks for the existence of some of the lesser used queries to compute the location of query12 and all subsequent query registers. 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: rmi: do not stop the device at the end of probeBenjamin Tissoires2014-04-091-1/+0
| | | | | | | | | | | Well, this is embarrassing, if the device is stopped at the end of probe, we get into big trouble. This was a leftover of an attempt to be smart when sending the patch, I deeply apologies. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: rmi: introduce RMI driver for Synaptics touchpadsBenjamin Tissoires2014-04-091-0/+889
This driver add support for RMI4 over USB or I2C. The current state is that it uses its own RMI4 implementation, but once RMI4 is merged upstream, the driver will be a transport driver for the RMI4 library. Part of this driver should be considered as temporary. Most of the RMI4 processing and input handling will be deleted at some point. I based my work on Andrew's regarding its port of RMI4 over HID (see https://github.com/mightybigcar/synaptics-rmi4/tree/rmihid ) This repo presents how the driver may looks like at the end: https://github.com/mightybigcar/synaptics-rmi4/blob/rmihid/drivers/input/rmi4/rmi_hid.c Without this temporary solution, the workaround we gave to users is to disable i2c-hid, which leads to disabling the touchscreen on the XPS 11 and 12 (Haswell generation). Related bugs: https://bugzilla.redhat.com/show_bug.cgi?id=1048314 https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1218973 Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
OpenPOWER on IntegriCloud