hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/input/touchscreen/tps6507x-ts.c
....@@ -17,7 +17,6 @@
1717 #include <linux/workqueue.h>
1818 #include <linux/slab.h>
1919 #include <linux/input.h>
20
-#include <linux/input-polldev.h>
2120 #include <linux/platform_device.h>
2221 #include <linux/mfd/tps6507x.h>
2322 #include <linux/input/tps6507x-ts.h>
....@@ -40,7 +39,7 @@
4039
4140 struct tps6507x_ts {
4241 struct device *dev;
43
- struct input_polled_dev *poll_dev;
42
+ struct input_dev *input;
4443 struct tps6507x_dev *mfd;
4544 char phys[32];
4645 struct ts_event tc;
....@@ -148,10 +147,9 @@
148147 return ret;
149148 }
150149
151
-static void tps6507x_ts_poll(struct input_polled_dev *poll_dev)
150
+static void tps6507x_ts_poll(struct input_dev *input_dev)
152151 {
153
- struct tps6507x_ts *tsc = poll_dev->private;
154
- struct input_dev *input_dev = poll_dev->input;
152
+ struct tps6507x_ts *tsc = input_get_drvdata(input_dev);
155153 bool pendown;
156154 s32 ret;
157155
....@@ -205,7 +203,6 @@
205203 const struct tps6507x_board *tps_board;
206204 const struct touchscreen_init_data *init_data;
207205 struct tps6507x_ts *tsc;
208
- struct input_polled_dev *poll_dev;
209206 struct input_dev *input_dev;
210207 int error;
211208
....@@ -240,23 +237,16 @@
240237 snprintf(tsc->phys, sizeof(tsc->phys),
241238 "%s/input0", dev_name(tsc->dev));
242239
243
- poll_dev = devm_input_allocate_polled_device(&pdev->dev);
244
- if (!poll_dev) {
240
+ input_dev = devm_input_allocate_device(&pdev->dev);
241
+ if (!input_dev) {
245242 dev_err(tsc->dev, "Failed to allocate polled input device.\n");
246243 return -ENOMEM;
247244 }
248245
249
- tsc->poll_dev = poll_dev;
246
+ tsc->input = input_dev;
247
+ input_set_drvdata(input_dev, tsc);
250248
251
- poll_dev->private = tsc;
252
- poll_dev->poll = tps6507x_ts_poll;
253
- poll_dev->poll_interval = init_data ?
254
- init_data->poll_period : TSC_DEFAULT_POLL_PERIOD;
255
-
256
- input_dev = poll_dev->input;
257
- input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
258
- input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
259
-
249
+ input_set_capability(input_dev, EV_KEY, BTN_TOUCH);
260250 input_set_abs_params(input_dev, ABS_X, 0, MAX_10BIT, 0, 0);
261251 input_set_abs_params(input_dev, ABS_Y, 0, MAX_10BIT, 0, 0);
262252 input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_10BIT, 0, 0);
....@@ -275,7 +265,15 @@
275265 if (error)
276266 return error;
277267
278
- error = input_register_polled_device(poll_dev);
268
+ error = input_setup_polling(input_dev, tps6507x_ts_poll);
269
+ if (error)
270
+ return error;
271
+
272
+ input_set_poll_interval(input_dev,
273
+ init_data ? init_data->poll_period :
274
+ TSC_DEFAULT_POLL_PERIOD);
275
+
276
+ error = input_register_device(input_dev);
279277 if (error)
280278 return error;
281279