summaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/edt-ft5x06.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'input-for-v6.12-rc5' of ↵Linus Torvalds2024-11-031-1/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input Pull input fixes from Dmitry Torokhov: - a fix for regression in input core introduced in 6.11 preventing re-registering input handlers - a fix for adp5588-keys driver tyring to disable interrupt 0 at suspend when devices is used without interrupt - a fix for edt-ft5x06 to stop leaking regmap structure when probing fails and to make sure it is not released too early on removal. * tag 'input-for-v6.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: fix regression when re-registering input handlers Input: adp5588-keys - do not try to disable interrupt 0 Input: edt-ft5x06 - fix regmap leak when probe fails
| * Input: edt-ft5x06 - fix regmap leak when probe failsDmitry Torokhov2024-10-251-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driver neglects to free the instance of I2C regmap constructed at the beginning of the edt_ft5x06_ts_probe() method when probe fails. Additionally edt_ft5x06_ts_remove() is freeing the regmap too early, before the rest of the device resources that are managed by devm are released. Fix this by installing a custom devm action that will ensure that the regmap is released at the right time during normal teardown as well as in case of probe failure. Note that devm_regmap_init_i2c() could not be used because the driver may replace the original regmap with a regmap specific for M06 devices in the middle of the probe, and using devm_regmap_init_i2c() would result in releasing the M06 regmap too early. Reported-by: Li Zetao <lizetao1@huawei.com> Fixes: 9dfd9708ffba ("Input: edt-ft5x06 - convert to use regmap API") Cc: stable@vger.kernel.org Reviewed-by: Oliver Graute <oliver.graute@kococonnector.com> Link: https://lore.kernel.org/r/ZxL6rIlVlgsAu-Jv@google.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* | move asm/unaligned.h to linux/unaligned.hAl Viro2024-10-021-1/+1
|/ | | | | | | | | | | | | | | | | | | asm/unaligned.h is always an include of asm-generic/unaligned.h; might as well move that thing to linux/unaligned.h and include that - there's nothing arch-specific in that header. auto-generated by the following: for i in `git grep -l -w asm/unaligned.h`; do sed -i -e "s/asm\/unaligned.h/linux\/unaligned.h/" $i done for i in `git grep -l -w asm-generic/unaligned.h`; do sed -i -e "s/asm-generic\/unaligned.h/linux\/unaligned.h/" $i done git mv include/asm-generic/unaligned.h include/linux/unaligned.h git mv tools/include/asm-generic/unaligned.h tools/include/linux/unaligned.h sed -i -e "/unaligned.h/d" include/asm-generic/Kbuild sed -i -e "s/__ASM_GENERIC/__LINUX/" include/linux/unaligned.h tools/include/linux/unaligned.h
* Input: edt-ft5x06 - add support for FocalTech FT8201Felix Kaechele2024-08-051-0/+6
| | | | | | | | | | | The driver supports the FT8201 chip as well. It registers up to 10 touch points. Tested on: Lenovo ThinkSmart View (CD-18781Y), LCM: BOE TV080WXM-LL4 Signed-off-by: Felix Kaechele <felix@kaechele.ca> Link: https://lore.kernel.org/r/20240804031310.331871-3-felix@kaechele.ca Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - add ft5426Andreas Kemnade2024-06-221-0/+1
| | | | | | | | | | As ft5426 seems to be compatible with this driver, add it. Debug output during identification: Model "generic ft5x06 (79)", Rev. " Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Reviewed-by: Oliver Graute <oliver.graute@kococonnector.com> Link: https://lore.kernel.org/r/20240501204758.758537-3-andreas@kemnade.info Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - add support for FocalTech FT5452 and FT8719Joel Selvaraj2024-05-221-0/+12
| | | | | | | | | | The driver is compatible with FocalTech FT5452 and FT8719 touchscreens too. FT5452 supports up to 5 touch points. FT8719 supports up to 10 touch points. Add compatible data for both of them. Signed-off-by: Joel Selvaraj <joelselvaraj.oss@gmail.com> Link: https://lore.kernel.org/r/20240521-add-support-ft5452-and-ft8719-touchscreen-v1-2-2a648ac7176b@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: touchscreen - use sysfs_emit[_at]() instead of scnprintf()ye xingchen2023-12-141-1/+1
| | | | | | | | | | | Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Oliver Graute <oliver.graute@kococonnector.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - use device core to create driver-specific device attributesDmitry Torokhov2023-09-061-8/+2
| | | | | | | | | | 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20230729005133.1095051-8-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edf-ft5x06 - simplify with dev_err_probe()Krzysztof Kozlowski2023-07-081-7/+3
| | | | | | | | | | | Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20230625162817.100397-11-krzysztof.kozlowski@linaro.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: Switch i2c drivers back to use .probe()Uwe Kleine-König2023-05-171-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>
* Input: edt-ft5x06 - add delay after waking upPhilipp Puschmann2023-05-051-0/+1
| | | | | | | | | | | | | | The touch controller needs some time to wake-up after setting the wake-up gpio. Without having a delay after wake-up probing regularly fails in edt_ft5x06_ts_identify() with an error (i.e. EREMOTEIO) that was caused by a failed i2c transfer. The datasheet sets the wake-up time to 5 ms, although it is not entirely clear. Signed-off-by: Philipp Puschmann <p.puschmann@pironex.com> Link: https://lore.kernel.org/r/20230505115823.545803-1-p.puschmann@pironex.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - calculate points data length only onceDario Binacchi2023-04-031-28/+28
| | | | | | | | | | | | It is pointless and expensive to calculate data in the interrupt that depends on the type of touchscreen, which is detected on the driver probe and cannot then be changed. So calculate the size of the data buffer on the driver probe, as well as the data retrieval command, and then use them in the ISR. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Link: https://lore.kernel.org/r/20230402200951.1032513-10-dario.binacchi@amarulasolutions.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - unify the crc checkDario Binacchi2023-04-031-6/+3
| | | | | | | | | With this patch, the CRC is always verified by the same function, even in the case of accessing registers where the number of bytes is minimal. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Link: https://lore.kernel.org/r/20230402200951.1032513-9-dario.binacchi@amarulasolutions.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - convert to use regmap APIDario Binacchi2023-04-031-210/+214
| | | | | | | | | It replaces custom read/write functions with regmap API, making the driver code more generic. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Link: https://lore.kernel.org/r/20230402200951.1032513-8-dario.binacchi@amarulasolutions.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - don't print error messages with dev_dbg()Dario Binacchi2023-04-031-3/+3
| | | | | | | | | | In some parts of the code, error messages were improperly printed with dev_dbg() calls. In those cases, dev_dbg() has been replaced with dev_err(). Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Link: https://lore.kernel.org/r/20230402200951.1032513-7-dario.binacchi@amarulasolutions.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - remove code duplicationDario Binacchi2023-04-031-4/+7
| | | | | | | | | | The use of the macros M06_REG_ADDR and M06_REG_CMD avoids code duplication without impacting the application load, and reduces the chances of errors or mistakes. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Link: https://lore.kernel.org/r/20230402200951.1032513-6-dario.binacchi@amarulasolutions.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - don't recalculate the CRCDario Binacchi2023-04-031-4/+4
| | | | | | | | There is no need to recalculate the CRC when the data has not changed. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Link: https://lore.kernel.org/r/20230402200951.1032513-5-dario.binacchi@amarulasolutions.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - add spaces to ensure format specificationDario Binacchi2023-04-031-2/+2
| | | | | | | | It adds spaces around '-' as recommended by the Linux coding style. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Link: https://lore.kernel.org/r/20230402200951.1032513-4-dario.binacchi@amarulasolutions.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - remove unnecessary blank linesDario Binacchi2023-04-031-2/+0
| | | | | | | | | It removes unnecessary blank lines so that checkpatch doesn't complain anymore. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Link: https://lore.kernel.org/r/20230402200951.1032513-3-dario.binacchi@amarulasolutions.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - fix indentationDario Binacchi2023-04-031-16/+20
| | | | | | | | | Matches the alignment to the open parenthesis as suggested by checkpatch. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Link: https://lore.kernel.org/r/20230402200951.1032513-2-dario.binacchi@amarulasolutions.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - fix typo in a commentDario Binacchi2023-01-301-1/+1
| | | | | | | | Replace 'firmares' with 'firmwares'. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Link: https://lore.kernel.org/r/20230128162325.64467-1-dario.binacchi@amarulasolutions.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()Jonathan Cameron2023-01-101-5/+5
| | | | | | | | | | | | | | | 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: Michael Trimarchi <michael@amarulasolutions.com> Cc: Dario Binacchi <dario.binacchi@amarulasolutions.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230102181842.718010-42-jic23@kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - Convert to i2c's .probe_new()Uwe Kleine-König2022-12-021-3/+3
| | | | | | | | | | .probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Oliver Graute <oliver.graute@kococonnector.com> Link: https://lore.kernel.org/r/20221118224540.619276-238-uwe@kleine-koenig.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: move from strlcpy with unused retval to strscpyWolfram Sang2022-08-191-6/+6
| | | | | | | | | | Follow the advice of the below link and prefer 'strscpy' in this subsystem. Conversion is 1:1 because the return value is not used. Generated by a coccinelle script. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20220818210022.6865-1-wsa+renesas@sang-engineering.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* i2c: Make remove callback return voidUwe Kleine-König2022-08-161-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The value returned by an i2c driver's remove function is mostly ignored. (Only an error message is printed if the value is non-zero that the error is ignored.) So change the prototype of the remove function to return no value. This way driver authors are not tempted to assume that passing an error to the upper layer is a good idea. All drivers are adapted accordingly. There is no intended change of behaviour, all callbacks were prepared to return 0 before. Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com> Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au> Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Crt Mori <cmo@melexis.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013 Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/* Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5 Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860 Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power Acked-by: Krzysztof Hałasa <khalasa@piap.pl> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
* Input: edt-ft5x06 - show crc and header errors by sysfsDario Binacchi2022-06-291-0/+30
| | | | | | | | | | | M06 sends packets with header and crc for data verification. Now you can check at runtime how many packets have been dropped. Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Link: https://lore.kernel.org/r/20220621123937.1330389-7-dario.binacchi@amarulasolutions.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - show firmware version by sysfsDario Binacchi2022-06-291-5/+17
| | | | | | | | | | | | The firmware version was printed only if debug mode was enabled. Now you can always get it from sysfs. Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Acked-by: Oliver Graute <oliver.graute@kococonnector.com> Link: https://lore.kernel.org/r/20220621123937.1330389-6-dario.binacchi@amarulasolutions.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - show model name by sysfsDario Binacchi2022-06-291-0/+12
| | | | | | | | | | | | The model name was printed only if debug mode was enabled. Now you can always get it from sysfs. Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Acked-by: Oliver Graute <oliver.graute@kococonnector.com> Link: https://lore.kernel.org/r/20220621123937.1330389-5-dario.binacchi@amarulasolutions.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - set report rate by dts propertyDario Binacchi2022-06-291-0/+23
| | | | | | | | | | It allows to change the M06/M12 default scan rate on driver probing. Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Link: https://lore.kernel.org/r/20220621123937.1330389-4-dario.binacchi@amarulasolutions.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - get/set M12 report rate by sysfsDario Binacchi2022-06-291-3/+6
| | | | | | | | | | | | | Add support for reading/writing scan rate (SC) register for M12 by sysfs. The register value is equal to the SC (Hz), unlike M06, where instead it is equal to SC / 10. Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com> Tested-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Link: https://lore.kernel.org/r/20220621123937.1330389-3-dario.binacchi@amarulasolutions.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - added case for EDT EP0110M09Oliver Graute2021-09-061-0/+1
| | | | | | | | | Add Support for EP011M09 Firmware Signed-off-by: Oliver Graute <oliver.graute@kococonnector.com> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.kernel.org/r/20210813062110.13950-1-oliver.graute@kococonnector.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - add support for iovcc-supplyStephan Gerhold2021-06-021-2/+36
| | | | | | | | | | | | | | | | | | At the moment, the edt-ft5x06 driver can control a single regulator ("vcc"). However, some FocalTech touch controllers have an additional IOVCC pin that should be supplied with the digital I/O voltage. The I/O voltage might be provided by another regulator that should also be kept on. Otherwise, the touchscreen can randomly stop functioning if the regulator is turned off because no other components still require it. Implement (optional) support for also enabling an "iovcc-supply". The datasheet specifies a delay of ~ 10us before enabling VDD/VCC after IOVCC is enabled, so make sure to enable IOVCC first. Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Link: https://lore.kernel.org/r/20210510193108.50178-2-stephan@gerhold.net Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - consolidate handling of number of electrodesDmitry Torokhov2020-12-111-26/+17
| | | | | | | | | | | | | | | Instead of special-casing retrieval of number of X/Y electrodes based on the firmware, let's select default values and mark registers as non-existent on firmwares that do not support this operation. Also mark "report rate" register as non-existent for generic firmwares as having it set to 0 does not make sense. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Marco Felsch <m.felsch@pengutronix.de> Reviewed-by: Simon Budig <simon.budig@kernelconcepts.de> Link: https://lore.kernel.org/r/X9FZFs3NZADoIhhH@google.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: Use fallthrough pseudo-keywordGustavo A. R. Silva2020-07-071-2/+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>
* Input: edt-ft5x06 - prefer asynchronous probeAhmad Fatoum2020-05-091-0/+1
| | | | | | | | | | | Probing the device takes a while, because we sleep for 300 ms after a reset; allow asynchronous probing so this can happen in the background while other devices are being probed. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.kernel.org/r/20200227112819.16754-5-m.felsch@pengutronix.de Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - improve power management operationsMarco Felsch2020-05-091-10/+132
| | | | | | | | | | | | | | | | | | | | | | | | It is possible to bring the device into a deep sleep state. To exit this state the reset or wakeup pin must be toggeled as documented in [1]. Because of the poor documentation I used the several downstream kernels [2] and other applications notes [3] to indentify the related registers. Furthermore I added the support to disable the device completely which is obviously the most effective power-saving mechanism. This mechanism needs the reset pin to ensure the power-up/down sequence. We can't apply any of these power-saving mechanism if both pins are missing (not connected) or if it is a wakeup device. [1] https://www.newhavendisplay.com/appnotes/datasheets/touchpanel/FT5x26.pdf https://www.newhavendisplay.com/appnotes/datasheets/touchpanel/FT5x06.pdf [2] https://github.com/linux-sunxi/linux-sunxi/blob/sunxi-3.4/drivers/input/touchscreen/ft5x_ts.c https://github.com/Pablito2020/focaltech-touch-driver/blob/master/ft5336_driver.c [3] https://www.newhavendisplay.com/appnotes/datasheets/touchpanel/FT5x16_registers.pdf Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.kernel.org/r/20200227112819.16754-4-m.felsch@pengutronix.de Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - move parameter restore into helperMarco Felsch2020-05-091-19/+24
| | | | | | | | | | | We need to restore the parameters if we switch between the factory/work mode and during the resume process if we switched off the power-supply. Therefore refactor edt_ft5x06_work_mode() and move the "restore the parameters" into a helper routine so we can reuse it later. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.kernel.org/r/20200227112819.16754-3-m.felsch@pengutronix.de Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - fix get_default register write accessMarco Felsch2020-05-091-3/+9
| | | | | | | | | | | | Since commit b6eba86030bf ("Input: edt-ft5x06 - add offset support for ev-ft5726") offset-x and offset-y is supported. Devices using those offset parameters don't support the offset parameter so we need to add the NO_REGISTER check for edt_ft5x06_ts_get_defaults(). Fixes: b6eba86030bf ("Input: edt-ft5x06 - add offset support for ev-ft5726") Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.kernel.org/r/20200227112819.16754-2-m.felsch@pengutronix.de Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - use pm core to enable/disable the wake irqMarco Felsch2020-01-101-24/+0
| | | | | | | | | We do not have to handle the wake-irq within the driver because the pm core can handle this for us. The only use case for the suspend/resume callbacks was to handle the wake-irq so we can remove the callbacks. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - make wakeup-source switchableMarco Felsch2020-01-101-1/+0
| | | | | | | | | | | | | | | | | | Since day one the touch controller acts as wakeup-source. This seems to be wrong since the device supports deep-sleep mechanism [1] which requires a reset to leave it. Also some designs won't use the touchscreen as wakeup-source. According discussion [2] we decided to break backward compatibility and go the common way by using the 'wakeup-source' device-property. [1] https://www.newhavendisplay.com/appnotes/datasheets/touchpanel/FT5x26.pdf [2] https://patchwork.kernel.org/patch/11149037/ Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - alphabetical include reorderMarco Felsch2020-01-101-11/+12
| | | | | | | | | | | It seems that the include order is historical increased and no one takes care of it. Fix this to align it with the common rule to be in a alphabetical order. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - work around first register access errorPhilipp Zabel2020-01-101-0/+7
| | | | | | | | | | | | | | | | The EP0700MLP1 returns bogus data on the first register read access (reading the threshold parameter from register 0x00): edt_ft5x06 2-0038: crc error: 0xfc expected, got 0x40 It ignores writes until then. This patch adds a dummy read after which the number of sensors and parameter read/writes work correctly. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - add support for regulatorMylène Josserand2019-10-291-0/+30
| | | | | | | | | | | Add the support for enabling optional regulator that may be used as VCC source. Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com> Signed-off-by: Ondrej Jirman <megous@megous.com> Reviewed-by: Rob Herring <robh@kernel.org> # bindings Link: https://lore.kernel.org/r/20191029005806.3577376-2-megous@megous.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - no need to check return value of debugfs_create functionsGreg Kroah-Hartman2019-08-121-2/+0
| | | | | | | | | When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - simplify event reporting codeDmitry Torokhov2019-07-051-9/+4
| | | | | | | Now that input_mt_report_slot_state() returns true if slot is active we no longer need a temporary for the slot state. Tested-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - use get_unaligned_be16()Dmitry Torokhov2019-06-301-2/+3
| | | | | | | | Instead of doing conversion by hand, let's use the proper accessors. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Tested-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - convert to use SPDX identifierAndy Shevchenko2019-03-041-14/+2
| | | | | | | | | | | Reduce size of duplicated comments by switching to use SPDX identifier. No functional change. While here, correct MODULE_LICENSE() string to be aligned with license text. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - enable ACPI enumerationAndy Shevchenko2019-03-041-5/+2
| | | | | | | | ACPI allows to enumerate specific devices by using compatible strings. Enable that enumeration for EDT touchscreen devices. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - add offset support for ev-ft5726Marco Felsch2019-01-141-0/+46
| | | | | | | | | | | Unfortunately the evervision focaltech implementation uses two offset registers, one for the x coordinate and one for y. This patch extends the driver to handle those offset registers only for devices that support these. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: edt-ft5x06 - add support to update ev-ft5726 registersMarco Felsch2019-01-141-5/+15
| | | | | | Currently only the threshold and gain parameters can be read. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>