* [PATCH 06/22] Input: clps711x-keypad - switch to using polled mode of input devices
2019-10-17 20:41 [PATCH 00/22] Stop using input_polled_dev in polling drivers Dmitry Torokhov
@ 2019-10-17 20:42 ` Dmitry Torokhov
2019-10-18 8:44 ` [PATCH 00/22] Stop using input_polled_dev in polling drivers Andy Shevchenko
1 sibling, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2019-10-17 20:42 UTC (permalink / raw)
To: linux-input
Cc: Jacky Bai, Alexander Shiyan, Anson Huang, Ronald Tschalär,
YueHaibing, Marco Felsch, Stefan Agner, linux-kernel,
linux-arm-kernel, Andy Shevchenko, Allison Randal
We have added polled mode to the normal input devices with the intent of
retiring input_polled_dev. This converts clps711x-keypad driver to use the
polling mode of standard input devices and removes dependency on
INPUT_POLLDEV.
Also use managed API when allocating input device, this allows us to remove
clps711x_keypad_remove() method.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/keyboard/Kconfig | 1 -
drivers/input/keyboard/clps711x-keypad.c | 70 ++++++++++--------------
2 files changed, 29 insertions(+), 42 deletions(-)
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index c6bf99d23b1a..0e7368288dae 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -190,7 +190,6 @@ config KEYBOARD_CLPS711X
tristate "CLPS711X Keypad support"
depends on OF_GPIO && (ARCH_CLPS711X || COMPILE_TEST)
select INPUT_MATRIXKMAP
- select INPUT_POLLDEV
help
Say Y here to enable the matrix keypad on the Cirrus Logic
CLPS711X CPUs.
diff --git a/drivers/input/keyboard/clps711x-keypad.c b/drivers/input/keyboard/clps711x-keypad.c
index c4a5c07a4b98..019dd6ed2c29 100644
--- a/drivers/input/keyboard/clps711x-keypad.c
+++ b/drivers/input/keyboard/clps711x-keypad.c
@@ -6,7 +6,6 @@
*/
#include <linux/input.h>
-#include <linux/input-polldev.h>
#include <linux/module.h>
#include <linux/of_gpio.h>
#include <linux/platform_device.h>
@@ -30,10 +29,10 @@ struct clps711x_keypad_data {
struct clps711x_gpio_data *gpio_data;
};
-static void clps711x_keypad_poll(struct input_polled_dev *dev)
+static void clps711x_keypad_poll(struct input_dev *input)
{
- const unsigned short *keycodes = dev->input->keycode;
- struct clps711x_keypad_data *priv = dev->private;
+ const unsigned short *keycodes = input->keycode;
+ struct clps711x_keypad_data *priv = input_get_drvdata(input);
bool sync = false;
int col, row;
@@ -61,14 +60,14 @@ static void clps711x_keypad_poll(struct input_polled_dev *dev)
if (state) {
set_bit(col, data->last_state);
- input_event(dev->input, EV_MSC,
- MSC_SCAN, code);
+ input_event(input,
+ EV_MSC, MSC_SCAN, code);
} else {
clear_bit(col, data->last_state);
}
if (keycodes[code])
- input_report_key(dev->input,
+ input_report_key(input,
keycodes[code], state);
sync = true;
}
@@ -80,7 +79,7 @@ static void clps711x_keypad_poll(struct input_polled_dev *dev)
}
if (sync)
- input_sync(dev->input);
+ input_sync(input);
}
static int clps711x_keypad_probe(struct platform_device *pdev)
@@ -88,7 +87,7 @@ static int clps711x_keypad_probe(struct platform_device *pdev)
struct clps711x_keypad_data *priv;
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
- struct input_polled_dev *poll_dev;
+ struct input_dev *input;
u32 poll_interval;
int i, err;
@@ -125,53 +124,43 @@ static int clps711x_keypad_probe(struct platform_device *pdev)
if (err)
return err;
- poll_dev = input_allocate_polled_device();
- if (!poll_dev)
+ input = devm_input_allocate_device(dev);
+ if (!input)
return -ENOMEM;
- poll_dev->private = priv;
- poll_dev->poll = clps711x_keypad_poll;
- poll_dev->poll_interval = poll_interval;
- poll_dev->input->name = pdev->name;
- poll_dev->input->dev.parent = dev;
- poll_dev->input->id.bustype = BUS_HOST;
- poll_dev->input->id.vendor = 0x0001;
- poll_dev->input->id.product = 0x0001;
- poll_dev->input->id.version = 0x0100;
+ input_set_drvdata(input, priv);
+
+ input->name = pdev->name;
+ input->dev.parent = dev;
+ input->id.bustype = BUS_HOST;
+ input->id.vendor = 0x0001;
+ input->id.product = 0x0001;
+ input->id.version = 0x0100;
err = matrix_keypad_build_keymap(NULL, NULL, priv->row_count,
CLPS711X_KEYPAD_COL_COUNT,
- NULL, poll_dev->input);
+ NULL, input);
if (err)
- goto out_err;
+ return err;
- input_set_capability(poll_dev->input, EV_MSC, MSC_SCAN);
+ input_set_capability(input, EV_MSC, MSC_SCAN);
if (of_property_read_bool(np, "autorepeat"))
- __set_bit(EV_REP, poll_dev->input->evbit);
-
- platform_set_drvdata(pdev, poll_dev);
+ __set_bit(EV_REP, input->evbit);
/* Set all columns to low */
regmap_update_bits(priv->syscon, SYSCON_OFFSET, SYSCON1_KBDSCAN_MASK,
SYSCON1_KBDSCAN(1));
- err = input_register_polled_device(poll_dev);
- if (err)
- goto out_err;
-
- return 0;
-out_err:
- input_free_polled_device(poll_dev);
- return err;
-}
+ err = input_setup_polling(input, clps711x_keypad_poll);
+ if (err)
+ return err;
-static int clps711x_keypad_remove(struct platform_device *pdev)
-{
- struct input_polled_dev *poll_dev = platform_get_drvdata(pdev);
+ input_set_poll_interval(input, poll_interval);
- input_unregister_polled_device(poll_dev);
- input_free_polled_device(poll_dev);
+ err = input_register_device(input);
+ if (err)
+ return err;
return 0;
}
@@ -188,7 +177,6 @@ static struct platform_driver clps711x_keypad_driver = {
.of_match_table = clps711x_keypad_of_match,
},
.probe = clps711x_keypad_probe,
- .remove = clps711x_keypad_remove,
};
module_platform_driver(clps711x_keypad_driver);
--
2.23.0.866.gb869b98d4c-goog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 00/22] Stop using input_polled_dev in polling drivers
2019-10-17 20:41 [PATCH 00/22] Stop using input_polled_dev in polling drivers Dmitry Torokhov
2019-10-17 20:42 ` [PATCH 06/22] Input: clps711x-keypad - switch to using polled mode of input devices Dmitry Torokhov
@ 2019-10-18 8:44 ` Andy Shevchenko
2019-10-21 8:03 ` Marco Felsch
1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2019-10-18 8:44 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Sven Van Asbroeck, Jacky Bai, Gustavo A. R. Silva,
Jonathan Bakker, Marco Felsch, Stefan Agner, Eric Anholt,
Jilayne Lovejoy, Mauro Carvalho Chehab, Miloslav Trmac,
Anders Roxell, Alexander Shiyan, YueHaibing, Luca Weiss,
Bartosz Golaszewski, linux-arm-kernel, linux-input, Jeff LaBundy,
Mukesh Ojha, Brian Masney, Pavel Machek, Alexios Zavras,
Steve Winslow, Ronald Tschalär, Martin Kepplinger,
Allison Randal, Dong Aisheng, Anson Huang, Richard Fontana,
Maximilian Luz, linux-kernel, Luis Chamberlain, Hans Verkuil,
Paweł Chmiel, Enrico Weigelt, Nicolas Saenz Julienne
On Thu, Oct 17, 2019 at 01:41:54PM -0700, Dmitry Torokhov wrote:
> Input devices now support polling mode natively (via input_setup_polling
> API), and input_polled_dev implementation is going away. This series
> switches drivers found in drivers/input to the new scheme.
>
For all I have been Cc'ed
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Dmitry Torokhov (21):
> Input: raspberrypi-ts - switch to using polled mode of input devices
> Input: sur40 - switch to using polled mode of input devices
> Input: ts4800-ts - switch to using polled mode of input devices
> Input: tsc6507x-ts - switch to using polled mode of input devices
> Input: adc-keys - switch to using polled mode of input devices
> Input: clps711x-keypad - switch to using polled mode of input devices
> Input: jornada680_kbd - switch to using polled mode of input devices
> Input: gpio_keys_polled - switch to using polled mode of input devices
> Input: apanel - switch to using polled mode of input devices
> Input: wistron_btns - switch to using polled mode of input devices
> Input: cobalt_btns - convert to use managed resources
> Input: cobalt_btns - switch to using polled mode of input devices
> Input: sgi_btns - switch to using managed resources
> Input: sgi_btns - switch to using polled mode of input devices
> Input: rb532_button - switch to using managed resources
> Input: rb532_button - switch to using polled mode of input devices
> Input: gpio_decoder - switch to using polled mode of input devices
> Input: mma8450 - switch to using polled mode of input devices
> Input: bma150 - switch to using polled mode of input devices
> Input: kxtj9 - switch to using managed resources
> Input: kxtj9 - switch to using polled mode of input devices
>
> Jonathan Bakker (1):
> Input: bma150 - use managed resources helpers
>
> drivers/input/keyboard/Kconfig | 4 -
> drivers/input/keyboard/adc-keys.c | 36 ++--
> drivers/input/keyboard/clps711x-keypad.c | 70 +++----
> drivers/input/keyboard/gpio_keys_polled.c | 65 +++---
> drivers/input/keyboard/jornada680_kbd.c | 37 ++--
> drivers/input/misc/Kconfig | 15 --
> drivers/input/misc/apanel.c | 153 ++++++--------
> drivers/input/misc/bma150.c | 190 +++++------------
> drivers/input/misc/cobalt_btns.c | 73 +++----
> drivers/input/misc/gpio_decoder.c | 42 ++--
> drivers/input/misc/kxtj9.c | 224 ++++++---------------
> drivers/input/misc/mma8450.c | 101 +++++-----
> drivers/input/misc/rb532_button.c | 48 ++---
> drivers/input/misc/sgi_btns.c | 54 ++---
> drivers/input/misc/wistron_btns.c | 51 ++---
> drivers/input/touchscreen/Kconfig | 4 -
> drivers/input/touchscreen/raspberrypi-ts.c | 38 ++--
> drivers/input/touchscreen/sur40.c | 92 +++++----
> drivers/input/touchscreen/tps6507x-ts.c | 36 ++--
> drivers/input/touchscreen/ts4800-ts.c | 68 ++++---
> 20 files changed, 557 insertions(+), 844 deletions(-)
>
> --
> 2.23.0.866.gb869b98d4c-goog
>
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread