summaryrefslogtreecommitdiff
path: root/drivers/input/touchscreen/resistive-adc-touch.c
AgeCommit message (Collapse)Author
2021-10-15Input: resistive-adc-touch - fix division by zero error on z1 == 0Oleksij Rempel
For proper pressure calculation we need at least x and z1 to be non zero. Even worse, in case z1 we may run in to division by zero error. Fixes: 60b7db914ddd ("Input: resistive-adc-touch - rework mapping of channels") Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.kernel.org/r/20211007095727.29579-1-o.rempel@pengutronix.de Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-06-05Input: resistive-adc-touch - fix uninitialized variable 'press'Colin Ian King
In the case where st->ch_map[GRTS_CH_PRESSURE] < GRTS_MAX_CHANNELS is false and also st->ch_map[GRTS_CH_Z1] < GRTS_MAX_CHANNELS is false the variable press is not initialized and contains garbage. In this situation st->pressure is also false, so we do not actually use press value, but it is impossible for the compiler to realize this, and it emits "uninitialized variable" warning. Fix this by initializing press to 0 and allows us to also remove an else clause that sets press to 0. Addresses-Coverity: ("Uninitialized scalar variable") Fixes: 60b7db914ddd ("Input: resistive-adc-touch - rework mapping of channels") Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20210603220809.155118-1-colin.king@canonical.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-06-01Input: resistive-adc-touch - rework mapping of channelsDmitry Torokhov
Instead of iterating over channels establish and use channel map to retrieve data. As a side effect this will silence "uninitialized variable" warnings. Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.kernel.org/r/YLXR2brkc4H54xtK@google.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-05-31Input: resistive-adc-touch - replace OF headers with proper onesAndy Shevchenko
The driver is actually OF independent and doesn't need anything from OF (*). Replace OF headers with mod_devicetable.h and property.h. *) use of of_match_ptr() is actually wrong here, since it may provoke a compiler to warn about unused variable. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20210528151113.85943-2-andriy.shevchenko@linux.intel.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-05-31Input: resistive-adc-touch - describe parameters in kernel docAndy Shevchenko
Validation script is not happy: resistive-adc-touch.c:53: warning: Function parameter or member 'x_plate_ohms' not described in 'grts_state' resistive-adc-touch.c:53: warning: Function parameter or member 'ch' not described in 'grts_state' Describe parameters in kernel doc to make it happy. Fixes: fb082cd59afa ("Input: resistive-adc-touch - add support for z1 and z2 channels") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20210528151113.85943-1-andriy.shevchenko@linux.intel.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-05-25Input: resistive-adc-touch - add support for z1 and z2 channelsOleksij Rempel
This patch adds support for the z1 and z2 channels. These are used to calculate the applied pressure. As there is no common order of the individual channels of a resistive touch ADC, support for io-channel-names is added (although the DT bindings stated the driver already supports these). Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20210525054634.9134-5-o.rempel@pengutronix.de Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-11-08Input: resistive-adc-touch - struct headers should start with 'struct <name>'Lee Jones
Fixes the following W=1 kernel build warning(s): drivers/input/touchscreen/resistive-adc-touch.c:34: warning: cannot understand function prototype: 'struct grts_state ' Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20201104162427.2984742-10-lee.jones@linaro.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2018-06-10input: touchscreen: resistive-adc-touch: add generic resistive ADC touchscreenEugen Hristev
This adds a generic resistive touchscreen (GRTS) driver, which is based on an IIO device (an ADC). It must be connected to the channels of an ADC to receive touch data. Then it will feed the data into the input subsystem where it registers an input device. It uses an IIO callback buffer to register to the IIO device Some parts of this patch are based on initial original work by Mohamed Jamsheeth Hajanajubudeen and Bandaru Venkateswara Swamy Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>