aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAge
* Input: uinput - specify exact bit sizes on userspace APIsDmitry Torokhov2012-08-22
| | | | | | | | | Switch to using __u32/__s32 instead of ordinary 'int' in structures forming userspace API. Also internally make request_id unsigned int. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: uinput - mark failed submission requests as freeDmitry Torokhov2012-08-22
| | | | | | | | If uinput_request_submit() fails after new request ID was allocated we need to mark that request ID as free, otherwise it will always stay occupied and we may run out of available IDs. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: uinput - fix race that can block nonblocking readDmitry Torokhov2012-08-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider two threads calling read() on the same uinput-fd, both non-blocking. Assume there is data-available so both will simultaneously pass: udev->head == udev->tail Then the first thread goes to sleep and the second one pops the message from the queue. Now assume udev->head == udev->tail. If the first thread wakes up it will call wait_event_*() and sleep in the waitq. This effectively turns the non-blocking FD into a blocking one. We fix this by attempting to fetch events from the queue first and only if we fail to retrieve any events we either return -EAGAIN (in case of non-blocing read) or wait until there are more events. This also fixes incorrect return code (we were returning 0 instead of -EAGAIN for non-blocking reads) when an event is "stolen" by another thread. Blocking reads will now continue to wait instead of returning 0 in this scenario. Count of 0 continues to be a special case, as per spec: we will check for device existence and whether there are events in the queue, but no events will be actually retrieved. Reported-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: uinput - return -EINVAL when read buffer size is too smallDavid Herrmann2012-08-22
| | | | | | | | | | | | | | | | | | Let's check whether the user-supplied buffer is actually big enough and return -EINVAL if it is not. This differs from current behavior, which caused 0 to be returned and actually does not make any sense, as broken application will simply repeat the read getting into endless loop. Note that we treat 0 as a special case, according to the standard: "Before any action described below is taken, and if nbyte is zero, the read() function may detect and return errors as described below. In the absence of errors, or if error detection is not performed, the read() function shall return zero and have no other results." Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: uinput - take event lock when fetching events from bufferDmitry Torokhov2012-08-22
| | | | | | | When fetching events form device's buffer in uinput_read() we need to take input device's event_lock to avoid racing with new event delivery. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: get rid of MATCH_BIT() macroDmitry Torokhov2012-08-22
| | | | | | | | MATCH_BIT() is ugly and stupid, we have much nicer bitmap_subset() which does the same and does not hide control flow. Reported-by: Baodong Chen <chenbdchenbd@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: rotary-encoder - add DT bindingsDaniel Mack2012-08-22
| | | | | | | | This adds devicetree bindings to the rotary encoder driver and some documentation about how to use them. Tested on a PXA3xx platform. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: rotary-encoder - constify platform data pointersDmitry Torokhov2012-08-22
| | | | | | | Drivers should not be changing platform data attached to the device because they do not own it. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: rotary-encoder - use gpio_request_one()Daniel Mack2012-08-22
| | | | | | | | Use gpio_request_one() instead of separate calls to gpio_request() and gpio_direction_input() to simplify the code. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: rotary-encoder - defer calls gpio_to_irq()Daniel Mack2012-08-22
| | | | | | | | Don't call gpio_to_irq() on GPIOs before gpio_request() succeeded on them. This avoids Ooopses with incorrect DT bindings. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: gpio_keys_polled - convert to dtAlexandre Pereira da Silva2012-08-22
| | | | | Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: gpio-keys-polled - constify pointers to platform dataDmitry Torokhov2012-08-22
| | | | Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: random formatting fixesBaodong Chen2012-08-22
| | | | | | | | Fixes for some coding style issues reported by scripts/checkpatch.pl utility. Signed-off-by: Baodong Chen <chenbdchenbd@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: twl4030-pwrbutton - report a wakeup_event on button pressNeilBrown2012-08-22
| | | | | | | | | | | As the power button causes a wake from suspend, we need to register the event with the pm sustem to avoid racing with suspend. As the input event is reported in the interrupt handler, as simple pm_wakeup_event() is sufficient. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: gpio_keys - report a wakeup_event for a button pressNeilBrown2012-08-22
| | | | | | | | | | | | | | | | | In order to avoid races with suspend, a wakeup event must register as such by calling pm_wakeup_event() or pm_stay_awake(). This will ensure that the current suspend cycle aborts. When the user-space visible event is created in the interrupt handler (gpio_keys_irq_isr), a simple pm_wakeup_event() with no delay is sufficient as suspend will synchronise with all interrupt delivery. When the user-space visible event is created later (gpio_keys_gpio_isr), we need to bracket the event with pm_stay_awake() and pm_relax(). Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: gpio_keys - clean up device tree parserAlexandre Pereira da Silva2012-08-22
| | | | | | | | | | | | | | - fix sizeof in memset; - clean up dt properties extraction; - use for_each_chil_of_node macro; - use of_get_child_count(); - use of_match_ptr macro. Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com> Acked-by: Rob Herring <rob.herring@calxeda.com> [Fabio Estevam <fabio.estevam@freescale.com>: fix fix NULL pointer dereference for dt case - pdata->buttons wasn't initialized] Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: synaptics - handle out of bounds values from the hardwareSeth Forshee2012-07-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The touchpad on the Acer Aspire One D250 will report out of range values in the extreme lower portion of the touchpad. These appear as abrupt changes in the values reported by the hardware from very low values to very high values, which can cause unexpected vertical jumps in the position of the mouse pointer. What seems to be happening is that the value is wrapping to a two's compliment negative value of higher resolution than the 13-bit value reported by the hardware, with the high-order bits being truncated. This patch adds handling for these values by converting them to the appropriate negative values. The only tricky part about this is deciding when to treat a number as negative. It stands to reason that if out of range values can be reported on the low end then it could also happen on the high end, so not all out of range values should be treated as negative. The approach taken here is to split the difference between the maximum legitimate value for the axis and the maximum possible value that the hardware can report, treating values greater than this number as negative and all other values as positive. This can be tweaked later if hardware is found that operates outside of these parameters. BugLink: http://bugs.launchpad.net/bugs/1001251 Cc: stable@vger.kernel.org Signed-off-by: Seth Forshee <seth.forshee@canonical.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: wacom - add support to Cintiq 22HDPing Cheng2012-07-25
| | | | | Signed-off-by: Ping Cheng <pingc@wacom.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: add driver for FT5x06 based EDT displaysSimon Budig2012-07-25
| | | | | | | | | This is a driver for the EDT "Polytouch" family of touch controllers based on the FocalTech FT5x06 line of chips. Signed-off-by: Simon Budig <simon.budig@kernelconcepts.de> Reviewed-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: add MELFAS mms114 touchscreen driverJoonyoung Shim2012-07-18
| | | | | | | | | This is a initial driver for new touchscreen chip mms114 of MELFAS. It uses I2C interface and supports 10 multi touch. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: add support for key scan interface of the LPC32xx SoCRoland Stigge2012-07-18
| | | | | | | This is a driver for the key scan interface of the LPC32xx SoC Signed-off-by: Roland Stigge <stigge@antcom.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: omap4-keypad - add device tree supportSourav Poddar2012-07-18
| | | | | | | | | | Add device tree support for omap4 keypad driver and update the Documentation with omap4 keypad device tree binding information. Tested on omap4430 sdp. Signed-off-by: Sourav Poddar <sourav.poddar@ti.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: hanwang - add support for Art Master II tabletweixing2012-07-13
| | | | | | | This change adds support for old Hanwang Art master II tablet Signed-off-by: weixing <weixing@hanwang.com.cn> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: spear_keyboard - reconfigure operating frequency on suspendShiraz Hashim2012-07-13
| | | | | | | | | | | | | | | On some platform it may happen that the input clock to keyboard may change during suspend, thus impacting its wakeup capability. There is no means for keyboard driver to know this frequency before hand. Hence introduce a platform data 'suspended_rate' which indicates the frequency during suspend at which keyboard operates. Accordingly reprogram keyboard while going into suspend and restore original configuration at the time of resume. Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: spear_keyboard - fix clock handling during suspend/resumeShiraz Hashim2012-07-13
| | | | | | | | | | | SPEAr keyboard should normally disable clock during suspend and enable it during resume. For cases where it is expected to act as a wakeup source the clock can remain in the same state i.e. kept enabled if it is being used. Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: ff-memless - fix a couple min_t() castsDan Carpenter2012-07-07
| | | | | | | | | | | envelope->attack_level is a u16 type. We're trying to clamp it here so it's between 0 and 0x7fff. Unfortunately, the cast to __s16 turns all the values larger than 0x7fff into negative numbers and min_t() thinks they are less than 0x7fff. envelope_level is an int so now we've got negative values stored there. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: synaptics - print firmware ID and board number at initDaniel Kurtz2012-07-07
| | | | | | | | | | | | | Read the Firmware ID and Board Number from a synaptics device at init and display them in the system log. Device behavior is very board and firmware dependent. It may prove useful for users to include this information when providing bug reports or other feedback. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Acked-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: spear_keyboard - generalize keyboard frequency configurationShiraz Hashim2012-07-07
| | | | | | | | | Current implementation hard coded keyboard frequency configuration assuming input clock as fixed APB (83 MHz). Generalize the configuration using clock framework APIs. Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: spear_keyboard - rename bit definitions to reflect registerShiraz Hashim2012-07-07
| | | | | | | | Rename bit definition macros to reflect keyboard registers clearly thus being more readable. Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: spear_keyboard - use correct io accessorsShiraz Hashim2012-07-07
| | | | | | | | | All SPEAr keyboard registers are 32 bit wide and are word aligned. This patch aligns all io access to be word size using relaxed version of readl/writel. Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: spear-keyboard - fix disable device_init_wakeup in removeVipul Kumar Samar2012-07-07
| | | | | | | This patch is to disable device wakeup while removing keyboard. Signed-off-by: Vipul Kumar Samar <vipulkumar.samar@st.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: wacom_i2c - fix compiler warningDmitry Torokhov2012-07-07
| | | | | | | | | | | Apparently GCC can't figure out that we bail if we fail to query device and will not try to use 'features': drivers/input/touchscreen/wacom_i2c.c: In function ‘wacom_i2c_probe’: drivers/input/touchscreen/wacom_i2c.c:177:20: warning: ‘features.fw_version’ may be used uninitialized in this function [-Wmaybe-uninitialized] Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Pull input changes from Henrik Rydberg, including large update toDmitry Torokhov2012-07-07
|\ | | | | | | | | | | | | atmel_mxt_ts driver by Daniel and MT protocol addition for win8 devices. Conflicts: drivers/input/touchscreen/atmel_mxt_ts.c
| * Revert "Input: atmel_mxt_ts - warn if sysfs could not be created"Henrik Rydberg2012-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Dmitry: I understand that I am a bit late to the party :) but I do not agree with this change. Failure to create attributes is not sometihng that user could cause (at least not easily) and thus would not be a setup issue but something more severe. I believe we should fail loading the driver so sysfs attribute breakage will be noticed as soon as possible, instead of discovering it much much later in the process. This reverts commit 639900380062ecd78ee8b265ea23929c565469b4. Requested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| * Input: MT - Include win8 supportHenrik Rydberg2012-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The newly released HID protocol for win8 multitouch devices is capable of transmitting more information about each touch. In particular, it includes details useful for touch alignment. This patch completes the MT protocol with the ABS_MT_TOOL_X/Y events, and documents how to map win8 devices. Cc: Stephane Chatty <chatty@enac.fr> Cc: Benjamin Tissoires <benjamin.tissoires@enac.fr> Cc: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| * Input: atmel_mxt_ts - parse T6 reportsDaniel Kurtz2012-06-29
| | | | | | | | | | | | | | | | | | | | | | The normal messages sent after boot or NVRAM update are T6 reports, containing a status, and the config memory checksum. Parse them and dump a useful info message. This patch tested on an MXT224E. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| * Input: atmel_mxt_ts - send all MT-B slots in one input reportDaniel Kurtz2012-06-29
| | | | | | | | | | | | | | | | | | | | | | Each interrupt contains information for all contacts with changing properties. Process all of this information at once, and send it all in a a single input report (ie input events ending in EV_SYN/SYN_REPORT). This patch was tested using an MXT224E. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| * Input: atmel_mxt_ts - use T9 reportid range to init number of mt slotsDaniel Kurtz2012-06-29
| | | | | | | | | | | | | | | | | | | | | | | | Atmel mxt devices can report one finger for each T9 reportid. Therefore, this range can be used to report the max number of MT-B slots to userspace instead of assuming a fixed 10. Note that mxt_initialized() must complete early, since the input_dev properties now depend on values in the object table. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| * Input: atmel_mxt_ts - refactor reportid checking in mxt_interruptDaniel Kurtz2012-06-29
| | | | | | | | | | | | | | | | This small refactor is in preparation for checking more report types in the mxt_interrupt message processing loop. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| * Input: atmel_mxt_ts - cache T9 reportid range when reading object tableDaniel Kurtz2012-06-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Streamline interrupt processing by caching the T9 reportid range when first reading the object table. In the process, refactor reading the object descriptor table. First, since the object_table entries are now exactly the same layout in device memory and in the driver, allocate an appropriately sized array and fetch the entire table directly into it in a single i2c transaction. Since a 6 byte table object requires 10 bytes to read, doing this dramatically reduces overhead. Note: The cached T9 reportid's are initialized to 0, which is an invalid reportid. Thus, the checks in the interrupt handler will always fail for devices that do not support the T9 object. Therefore, after doing a firmware update, the old object table is destroyed and all cached object values are reset to 0, before reading the new object table, in case the new firmware does not have the old objects. This patch tested on an MXT224E. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| * Input: atmel_mxt_ts - refactor when and how object table is freedDaniel Kurtz2012-06-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Object Table is freed in three cases: 1) When the driver is being removed. 2) In the error path of mxt_initialize(). 3) Just after a firmware update, when a new object table is about to be read. For cases 2 & 3, the driver is not immediately unloaded, so this patch refactors these cases to use a common cleanup function. It also refactors the mxt_initialize error paths to ensure that this cleanup happens. Note: mxt_update_fw_store() does not handle errors during mxt_initialize(). A proposed fix for this is in a subsequent patchset. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| * Input: atmel_mxt_ts - add detail to touchevent debug messageDaniel Kurtz2012-06-29
| | | | | | | | | | | | | | | | | | | | Update the debug message: * print inidividual status bits * print the pressure value * use '%u' for unsigned quantities Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| * Input: atmel_mxt_ts - simplify event reportingDaniel Kurtz2012-06-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of carrying around per-finger state in the driver instance, just report each finger as it arrives to the input layer, and let the input layer (evdev) hold the event state (which it does anyway). Note: this driver does not really do MT-B properly. Each input report (a group of input events followed by a SYN_REPORT) only contains data for a single contact. When multiple fingers are present on a device, each is properly reported in its own MT_SLOT. However, there is only ever one MT_SLOT per SYN_REPORT. This is fixed in a subsequent patch. This patch was tested with an mXT224E. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| * Input: atmel_mxt_ts - add sysfs entries to read fw and hw versionDaniel Kurtz2012-06-29
| | | | | | | | | | | | | | | | | | | | Make firmware and hardware version strings available to userspace. This is useful, for example, to allow a userspace program to implement a firwmare update policy. Change-Id: I1eddb4bbf5f3f9ae6947a8528598973ddead18cf Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| * Input: atmel_mxt_ts - update driver ID info loggingDaniel Kurtz2012-06-29
| | | | | | | | | | | | | | | | | | Print unsigned values as '%u'. Also, parse and print the firmware version in its canonical format, as suggested by Nick Dyer. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| * Input: atmel_mxt_ts - read ID information block in one i2c transactionDaniel Kurtz2012-06-29
| | | | | | | | | | | | | | | | Reading the whole info block in one i2c transaction speeds up driver probe significantly, especially on slower i2c busses. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| * Input: atmel_mxt_ts - optimize writing of object table entriesDaniel Kurtz2012-06-29
| | | | | | | | | | | | | | | | Write each object using a single bulk i2c write transfer. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Reviewed-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| * Input: atmel_mxt_ts - add variable length __mxt_write_regDaniel Kurtz2012-06-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The i2c bus requires 4 bytes to do a 1-byte write (1 byte i2c address + 2 byte offset + 1 byte data). By taking a length with writes, the driver can amortize transaction overhead by performing larger transactions where appropriate. This patch just sets up the new API. Later patches refactor writes to take advantage of the larger transactions. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| * Input: atmel_mxt_ts - return errors from i2c layerDaniel Kurtz2012-06-29
| | | | | | | | | | | | | | | | | | | | | | | | The i2c layer can report a variety of errors, including -ENXIO for an i2c NAK. Instead of treating them all as -EIO, pass the actual i2c layer error up to the caller. However, still report as -EIO the unlikely case that a transaction was partially completed, and no error message was returned from i2c_*(). Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| * Input: atmel_mxt_ts - print all instances when dumping objectsDaniel Kurtz2012-06-29
| | | | | | | | | | | | | | | | | | For objects with multiple instances, dump them all, prepending each with its "Instance #". [rydberg@euromail.se: break out mxt_show_instance()] Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>