summaryrefslogtreecommitdiff
path: root/drivers/input/touchscreen/iqs5xx.c
AgeCommit message (Collapse)AuthorFilesLines
2023-09-07Input: iqs5xx - use device core to create driver-specific device attributesDmitry Torokhov1-7/+3
Instead of creating driver-specific device attributes with devm_device_add_group() have device core do this by setting up dev_groups pointer in the driver structure. Reviewed-by: Jeff LaBundy <jeff@labundy.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20230729005133.1095051-15-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2023-07-17Input: Explicitly include correct DT includesRob Herring1-1/+1
The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes. Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20230714174633.4058096-1-robh@kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2023-05-17Input: Switch i2c drivers back to use .probe()Uwe Kleine-König1-1/+1
After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type"), all drivers being converted to .probe_new() and then 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert back to (the new) .probe() to be able to eventually drop .probe_new() from struct i2c_driver. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230517164645.162294-1-u.kleine-koenig@pengutronix.de Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2023-01-10Input: iqs5xx - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()Jonathan Cameron1-4/+4
SIMPLE_DEV_PM_OPS() is deprecated as it requires explicit protection against unused function warnings. The new combination of pm_sleep_ptr() and DEFINE_SIMPLE_DEV_PM_OPS() allows the compiler to see the functions, thus suppressing the warning, but still allowing the unused code to be removed. Thus also drop the __maybe_unused markings. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Jeff LaBundy <jeff@labundy.com> Reviewed-by: Jeff LaBundy <jeff@labundy.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230102181842.718010-52-jic23@kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2022-12-03Input: iqs5xx - Convert to i2c's .probe_new()Uwe Kleine-König1-3/+2
The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/20221118224540.619276-248-uwe@kleine-koenig.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2022-03-21Input: iqs5xx - use local input_dev pointerJeff LaBundy1-8/+8
Both iqs5xx_axis_init() and iqs5xx_irq() already define a local input_dev pointer 'input'. Use this instead of iqs5xx->input so as to make the code a bit smaller. Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/20220320025707.404544-1-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-03-25Input: iqs5xx - make reset GPIO optionalJeff LaBundy1-8/+17
The device's hardware reset pin is only required if the platform must be able to update the device's firmware. As such, demote the reset GPIO to optional in support of devices that ship with pre-programmed firmware and don't route the reset pin back to the SoC. In that case, the 'fw_file' attribute is hidden because there is no way to open the bootloader. The logic is extended to the case in which the device does not advertise bootloader support in the first place. Last but not least, remove the hardware reset performed at probe because there is no reason to reset the device manually. A power on reset function already ensures a clean reset at start-up. Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/20210323021006.367-1-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-03-25Input: iqs5xx - close bootloader using hardware resetJeff LaBundy1-17/+7
The bootloader can be closed using the 'execute' command (0x02) or hardware reset. Rather than using the former option for successful firmware update procedures and reserving the latter for recovering the device upon failure, simply use hardware reset for all cases. The post-bootloader initialization delay increases marginally when triggered by a hardware reset, so increase the wait time to ensure the device does not subsequently fail to respond. As part of this change, refactor the return path to avoid an extra assignment and to make the logic a bit smaller. Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/20210313191236.4366-6-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-03-25Input: iqs5xx - remove superfluous revision validationJeff LaBundy1-32/+8
The vendor-assigned firmware project number is restricted to the generic project number (15); however the vendor may assign other project numbers to specific applications and customers. These custom project numbers may be based on forwards-compatible firmware revision 1.x. However, the driver unnecessarily rejects anything older than firmware revision 2.0. To support other applications, remove these unnecessarily strict checks and enter the bootloader only for truly incompatible A000 devices. Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/20210313191236.4366-5-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-03-25Input: iqs5xx - expose firmware revision to user spaceJeff LaBundy1-16/+40
Add the read-only 'fw_info' attribute which reports information about the device's firmware in the following format: a.b.c.d:e.f Where: a = Product number (e.g. 40 for IQS550) b = Project number (e.g. 15) c = Firmware revision (major) d = Firmware revision (minor) e = Customer-assigned exported file version (major) f = Customer-assigned exported file version (minor) As part of the corresponding rework to uses of 'bl_status', the IQS5XX_BL_STATUS_RESET definition is dropped with 0 used in its place instead. Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/20210313191236.4366-4-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-03-25Input: iqs5xx - optimize axis definition and validationJeff LaBundy1-16/+14
Set the maximum ABS_MT_PRESSURE value and use the existing U16_MAX definition instead of a magic number to validate ABS_MT_POSITION_X and ABS_MT_POSITION_Y. Also use input_set_abs_params() rather than input_abs_set_max() to avoid having to call input_set_capability() separately. Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/20210313191236.4366-3-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-03-25Input: iqs5xx - update vendor's URLJeff LaBundy1-1/+1
Replace 'http' with 'https' and correct the spelling of the nearby word 'datasheet'. Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/20210313191236.4366-2-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-01-28Input: iqs5xx - initialize an uninitialized variableJeff LaBundy1-1/+1
If execution jumps to the err_kfree label, error_bl is evaluated before it is initialized. Fix this by initializing it to zero. Fixes: 2539da6677b6 ("Input: iqs5xx - preserve bootloader errors") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/1611592500-32209-1-git-send-email-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-01-25Input: iqs5xx - allow device to be a wake-up sourceJeff LaBundy1-2/+2
Avoid placing the device in suspend mode (from which it cannot generate interrupts) if it is defined as a wake-up source. The device is still permitted to enter a low-power sensing mode on its own. Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/1611002626-5889-11-git-send-email-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-01-25Input: iqs5xx - allow more time for ATI to completeJeff LaBundy1-6/+5
After the device is initialized, it runs ATI (calibration) during which it cannot readily respond to I2C communication. To keep the open and close callbacks from writing to the device too soon, the driver waits 100 ms before returning from probe. The vendor reports that ATI may actually take up to 250 ms to run (including margin), so increase the delay accordingly. Update the comments to clarify the reason for the delay as well. Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/1611002626-5889-9-git-send-email-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-01-25Input: iqs5xx - eliminate unnecessary register readJeff LaBundy1-19/+12
Instead of relying on firmware to enable important register fields and performing read-modify-write operations to additionally enable the fields the driver cares about, it's much simpler just to write all of the pertinent fields explicitly. This avoids an unnecessary register read operation at start-up and makes way for the iqs5xx_read_byte() helper to be dropped. Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/1611002626-5889-8-git-send-email-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-01-25Input: iqs5xx - simplify axis setup logicJeff LaBundy1-79/+21
The present implementation manipulates axis swap and inversion fields in the device to more or less duplicate what touchscreen_report_pos() does. The resulting logic is convoluted and difficult to follow. Instead report the maximum X and Y coordinates in earnest as they are read from the device, then let touchscreen_parse_properties() fix the axes up as necessary. Finally, use touchscreen_report_pos() to report the transformed coordinates. Last but not least, the maximum X and Y coordinates are not functions of the number of rows/columns that comprise the touch surface. Either coordinate is simply limited to 1 below what is reported for absolute X or Y coordinates when no fingers are present (0xFFFF). Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/1611002626-5889-7-git-send-email-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-01-25Input: iqs5xx - re-initialize device upon warm resetJeff LaBundy1-11/+41
The device may be inadvertently reset during runtime in the event of ESD strike, etc. To protect against this case, acknowledge the SHOW_RESET interrupt and re-initialize the device. To facilitate this change, expand the range of registers that are read in the interrupt handler to include the system status fields. Also, update the unrelated (but nearby) SUSPEND register field to use the BIT() macro. The remaining register fields are cleaned up in another patch. Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/1611002626-5889-6-git-send-email-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-01-25Input: iqs5xx - accommodate bootloader latencyJeff LaBundy1-2/+7
The bootloader NAK's all I2C communication after the first 64-byte bulk write if the bus frequency is equal to 400 kHz. This prevents the platform from pushing updated firmware to the device. The vendor's USB bootloader programming dongle appears to insert a delay between the "open" command and the first 64-byte bulk write. Adding a similar delay to the driver seems to eliminate the issue. Furthermore, the dongle does not access the bootloader immediately after powering up the device. Follow suit by adding a delay before the "open" command to avoid wasted retries at 400 kHz. Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/1611002626-5889-4-git-send-email-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-01-25Input: iqs5xx - preserve bootloader errorsJeff LaBundy1-1/+5
After user space writes the fw_file attribute to push new firmware to the device, the driver calls iqs5xx_dev_init() to re-initialize the device with the updated firmware or recover the device in case the update failed. In the case of the latter, however, iqs5xx_fw_file_write() returns zero (success) so long as iqs5xx_dev_init() does not fail, and any error encountered during the update process is lost. Solve this by saving the error before calling iqs5xx_dev_init(). Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/1611002626-5889-3-git-send-email-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-01-25Input: iqs5xx - minor cosmetic improvementsJeff LaBundy1-4/+4
Copyrights are generally followed by the name of a person or a company (i.e. the copyright holder) but that was not done here. Fix this by squashing the 'copyright' and 'author' lines. Also, trim some leading whitespace ahead of the parameters for the fw_file_store() function and re-align them for readability. Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/1611002626-5889-2-git-send-email-jeff@labundy.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-12-03Input: use input_device_enabled()Andrzej Pietrasiewicz1-2/+2
Use the newly added helper in relevant input drivers. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Link: https://lore.kernel.org/r/20200608112211.12125-3-andrzej.p@collabora.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-07-07Input: Use fallthrough pseudo-keywordGustavo A. R. Silva1-1/+1
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20200707180857.GA30600@embeddedor Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2019-07-15Merge tag 'v5.2' into nextDmitry Torokhov1-11/+13
Sync up with mainline to resolve conflicts in iforce driver.
2019-06-09Input: iqs5xx - get axis info before calling input_mt_init_slots()Jeff LaBundy1-11/+13
Calling input_mt_init_slots() copies ABS_MT_POSITION_X to ABS_X and so on, but doing so before calling touchscreen_parse_properties() leaves ABS_X min = max = 0 which may prompt an X server to ignore the device. To solve this problem, wait to call input_mt_init_slots() until all absolute axis information has been resolved (whether that's through device tree via touchscreen_parse_properties() or from reading from the device directly). Signed-off-by: Jeff LaBundy <jeff@labundy.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2019-05-23Input: iqs5xx - remove redundant dev_set_drvdata callAxel Lin1-2/+0
Calling i2c_set_clientdata() is enough. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Jeff LaBundy <jeff@labundy.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2019-04-30Input: add support for Azoteq IQS550/572/525Jeff LaBundy1-0/+1133
This patch adds support for the Azoteq IQS550/572/525 family of trackpad/touchscreen controllers. The driver has been tested with an IQS550EV02 evaluation board. A demonstration of the driver's capabilities is available here: https://youtu.be/sRNNx4XZBts Signed-off-by: Jeff LaBundy <jeff@labundy.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>