mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-26 13:44:15 +08:00
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
|
||||
tristate "TPS6507x based touchscreens"
|
||||
depends on I2C
|
||||
select INPUT_POLLDEV
|
||||
help
|
||||
Say Y here if you have a TPS6507x based touchscreen
|
||||
controller.
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/input-polldev.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mfd/tps6507x.h>
|
||||
#include <linux/input/tps6507x-ts.h>
|
||||
@ -40,7 +39,7 @@ struct ts_event {
|
||||
|
||||
struct tps6507x_ts {
|
||||
struct device *dev;
|
||||
struct input_polled_dev *poll_dev;
|
||||
struct input_dev *input;
|
||||
struct tps6507x_dev *mfd;
|
||||
char phys[32];
|
||||
struct ts_event tc;
|
||||
@ -148,10 +147,9 @@ static s32 tps6507x_adc_standby(struct tps6507x_ts *tsc)
|
||||
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 input_dev *input_dev = poll_dev->input;
|
||||
struct tps6507x_ts *tsc = input_get_drvdata(input_dev);
|
||||
bool pendown;
|
||||
s32 ret;
|
||||
|
||||
@ -205,7 +203,6 @@ static int tps6507x_ts_probe(struct platform_device *pdev)
|
||||
const struct tps6507x_board *tps_board;
|
||||
const struct touchscreen_init_data *init_data;
|
||||
struct tps6507x_ts *tsc;
|
||||
struct input_polled_dev *poll_dev;
|
||||
struct input_dev *input_dev;
|
||||
int error;
|
||||
|
||||
@ -240,23 +237,16 @@ static int tps6507x_ts_probe(struct platform_device *pdev)
|
||||
snprintf(tsc->phys, sizeof(tsc->phys),
|
||||
"%s/input0", dev_name(tsc->dev));
|
||||
|
||||
poll_dev = devm_input_allocate_polled_device(&pdev->dev);
|
||||
if (!poll_dev) {
|
||||
input_dev = devm_input_allocate_device(&pdev->dev);
|
||||
if (!input_dev) {
|
||||
dev_err(tsc->dev, "Failed to allocate polled input device.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
tsc->poll_dev = poll_dev;
|
||||
|
||||
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);
|
||||
tsc->input = input_dev;
|
||||
input_set_drvdata(input_dev, tsc);
|
||||
|
||||
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_Y, 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)
|
||||
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)
|
||||
return error;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user