Input: tsc6507x-ts - switch to using polled mode of input devices
We have added polled mode to the normal input devices with the intent of retiring input_polled_dev. This converts tsc6507x-ts driver to use the polling mode of standard input devices and removes dependency on INPUT_POLLDEV. Link: https://lore.kernel.org/r/20191017204217.106453-5-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
9b587815dd
commit
7cca5a342e
|
@ -1243,7 +1243,6 @@ config TOUCHSCREEN_SX8654
|
||||||
config TOUCHSCREEN_TPS6507X
|
config TOUCHSCREEN_TPS6507X
|
||||||
tristate "TPS6507x based touchscreens"
|
tristate "TPS6507x based touchscreens"
|
||||||
depends on I2C
|
depends on I2C
|
||||||
select INPUT_POLLDEV
|
|
||||||
help
|
help
|
||||||
Say Y here if you have a TPS6507x based touchscreen
|
Say Y here if you have a TPS6507x based touchscreen
|
||||||
controller.
|
controller.
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <linux/input-polldev.h>
|
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/mfd/tps6507x.h>
|
#include <linux/mfd/tps6507x.h>
|
||||||
#include <linux/input/tps6507x-ts.h>
|
#include <linux/input/tps6507x-ts.h>
|
||||||
|
@ -40,7 +39,7 @@ struct ts_event {
|
||||||
|
|
||||||
struct tps6507x_ts {
|
struct tps6507x_ts {
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
struct input_polled_dev *poll_dev;
|
struct input_dev *input;
|
||||||
struct tps6507x_dev *mfd;
|
struct tps6507x_dev *mfd;
|
||||||
char phys[32];
|
char phys[32];
|
||||||
struct ts_event tc;
|
struct ts_event tc;
|
||||||
|
@ -148,10 +147,9 @@ static s32 tps6507x_adc_standby(struct tps6507x_ts *tsc)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tps6507x_ts_poll(struct input_polled_dev *poll_dev)
|
static void tps6507x_ts_poll(struct input_dev *input_dev)
|
||||||
{
|
{
|
||||||
struct tps6507x_ts *tsc = poll_dev->private;
|
struct tps6507x_ts *tsc = input_get_drvdata(input_dev);
|
||||||
struct input_dev *input_dev = poll_dev->input;
|
|
||||||
bool pendown;
|
bool pendown;
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
|
@ -205,7 +203,6 @@ static int tps6507x_ts_probe(struct platform_device *pdev)
|
||||||
const struct tps6507x_board *tps_board;
|
const struct tps6507x_board *tps_board;
|
||||||
const struct touchscreen_init_data *init_data;
|
const struct touchscreen_init_data *init_data;
|
||||||
struct tps6507x_ts *tsc;
|
struct tps6507x_ts *tsc;
|
||||||
struct input_polled_dev *poll_dev;
|
|
||||||
struct input_dev *input_dev;
|
struct input_dev *input_dev;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
@ -240,23 +237,16 @@ static int tps6507x_ts_probe(struct platform_device *pdev)
|
||||||
snprintf(tsc->phys, sizeof(tsc->phys),
|
snprintf(tsc->phys, sizeof(tsc->phys),
|
||||||
"%s/input0", dev_name(tsc->dev));
|
"%s/input0", dev_name(tsc->dev));
|
||||||
|
|
||||||
poll_dev = devm_input_allocate_polled_device(&pdev->dev);
|
input_dev = devm_input_allocate_device(&pdev->dev);
|
||||||
if (!poll_dev) {
|
if (!input_dev) {
|
||||||
dev_err(tsc->dev, "Failed to allocate polled input device.\n");
|
dev_err(tsc->dev, "Failed to allocate polled input device.\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
tsc->poll_dev = poll_dev;
|
tsc->input = input_dev;
|
||||||
|
input_set_drvdata(input_dev, tsc);
|
||||||
poll_dev->private = tsc;
|
|
||||||
poll_dev->poll = tps6507x_ts_poll;
|
|
||||||
poll_dev->poll_interval = init_data ?
|
|
||||||
init_data->poll_period : TSC_DEFAULT_POLL_PERIOD;
|
|
||||||
|
|
||||||
input_dev = poll_dev->input;
|
|
||||||
input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
|
|
||||||
input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
|
|
||||||
|
|
||||||
|
input_set_capability(input_dev, EV_KEY, BTN_TOUCH);
|
||||||
input_set_abs_params(input_dev, ABS_X, 0, MAX_10BIT, 0, 0);
|
input_set_abs_params(input_dev, ABS_X, 0, MAX_10BIT, 0, 0);
|
||||||
input_set_abs_params(input_dev, ABS_Y, 0, MAX_10BIT, 0, 0);
|
input_set_abs_params(input_dev, ABS_Y, 0, MAX_10BIT, 0, 0);
|
||||||
input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_10BIT, 0, 0);
|
input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_10BIT, 0, 0);
|
||||||
|
@ -275,7 +265,15 @@ static int tps6507x_ts_probe(struct platform_device *pdev)
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
error = input_register_polled_device(poll_dev);
|
error = input_setup_polling(input_dev, tps6507x_ts_poll);
|
||||||
|
if (error)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
input_set_poll_interval(input_dev,
|
||||||
|
init_data ? init_data->poll_period :
|
||||||
|
TSC_DEFAULT_POLL_PERIOD);
|
||||||
|
|
||||||
|
error = input_register_device(input_dev);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue