Commit c028c44f authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: jornada680_kbd - 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 jornada680_kbd driver to use the
polling mode of standard input devices and removes dependency on
INPUT_POLLDEV.
Acked-by: default avatarMarco Felsch <m.felsch@pengutronix.de>
Link: https://lore.kernel.org/r/20191017204217.106453-8-dmitry.torokhov@gmail.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent ea6c52ae
...@@ -340,7 +340,6 @@ config KEYBOARD_HIL ...@@ -340,7 +340,6 @@ config KEYBOARD_HIL
config KEYBOARD_HP6XX config KEYBOARD_HP6XX
tristate "HP Jornada 6xx keyboard" tristate "HP Jornada 6xx keyboard"
depends on SH_HP6XX depends on SH_HP6XX
select INPUT_POLLDEV
help help
Say Y here if you have a HP Jornada 620/660/680/690 and want to Say Y here if you have a HP Jornada 620/660/680/690 and want to
support the built-in keyboard. support the built-in keyboard.
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/input-polldev.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -64,7 +63,7 @@ static const unsigned short jornada_scancodes[] = { ...@@ -64,7 +63,7 @@ static const unsigned short jornada_scancodes[] = {
#define JORNADA_SCAN_SIZE 18 #define JORNADA_SCAN_SIZE 18
struct jornadakbd { struct jornadakbd {
struct input_polled_dev *poll_dev; struct input_dev *input;
unsigned short keymap[ARRAY_SIZE(jornada_scancodes)]; unsigned short keymap[ARRAY_SIZE(jornada_scancodes)];
unsigned char length; unsigned char length;
unsigned char old_scan[JORNADA_SCAN_SIZE]; unsigned char old_scan[JORNADA_SCAN_SIZE];
...@@ -73,7 +72,7 @@ struct jornadakbd { ...@@ -73,7 +72,7 @@ struct jornadakbd {
static void jornada_parse_kbd(struct jornadakbd *jornadakbd) static void jornada_parse_kbd(struct jornadakbd *jornadakbd)
{ {
struct input_dev *input_dev = jornadakbd->poll_dev->input; struct input_dev *input_dev = jornadakbd->input;
unsigned short *keymap = jornadakbd->keymap; unsigned short *keymap = jornadakbd->keymap;
unsigned int sync_me = 0; unsigned int sync_me = 0;
unsigned int i, j; unsigned int i, j;
...@@ -167,9 +166,9 @@ static void jornada_scan_keyb(unsigned char *s) ...@@ -167,9 +166,9 @@ static void jornada_scan_keyb(unsigned char *s)
*s++ = __raw_readb(PHDR); *s++ = __raw_readb(PHDR);
} }
static void jornadakbd680_poll(struct input_polled_dev *dev) static void jornadakbd680_poll(struct input_dev *input)
{ {
struct jornadakbd *jornadakbd = dev->private; struct jornadakbd *jornadakbd = input_get_drvdata(input);
jornada_scan_keyb(jornadakbd->new_scan); jornada_scan_keyb(jornadakbd->new_scan);
jornada_parse_kbd(jornadakbd); jornada_parse_kbd(jornadakbd);
...@@ -179,7 +178,6 @@ static void jornadakbd680_poll(struct input_polled_dev *dev) ...@@ -179,7 +178,6 @@ static void jornadakbd680_poll(struct input_polled_dev *dev)
static int jornada680kbd_probe(struct platform_device *pdev) static int jornada680kbd_probe(struct platform_device *pdev)
{ {
struct jornadakbd *jornadakbd; struct jornadakbd *jornadakbd;
struct input_polled_dev *poll_dev;
struct input_dev *input_dev; struct input_dev *input_dev;
int i, error; int i, error;
...@@ -188,29 +186,24 @@ static int jornada680kbd_probe(struct platform_device *pdev) ...@@ -188,29 +186,24 @@ static int jornada680kbd_probe(struct platform_device *pdev)
if (!jornadakbd) if (!jornadakbd)
return -ENOMEM; return -ENOMEM;
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(&pdev->dev, "failed to allocate polled input device\n"); dev_err(&pdev->dev, "failed to allocate input device\n");
return -ENOMEM; return -ENOMEM;
} }
jornadakbd->poll_dev = poll_dev; jornadakbd->input = input_dev;
memcpy(jornadakbd->keymap, jornada_scancodes, memcpy(jornadakbd->keymap, jornada_scancodes,
sizeof(jornadakbd->keymap)); sizeof(jornadakbd->keymap));
poll_dev->private = jornadakbd; input_set_drvdata(input_dev, jornadakbd);
poll_dev->poll = jornadakbd680_poll;
poll_dev->poll_interval = 50; /* msec */
input_dev = poll_dev->input;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
input_dev->name = "HP Jornada 680 keyboard"; input_dev->name = "HP Jornada 680 keyboard";
input_dev->phys = "jornadakbd/input0"; input_dev->phys = "jornadakbd/input0";
input_dev->keycode = jornadakbd->keymap; input_dev->keycode = jornadakbd->keymap;
input_dev->keycodesize = sizeof(unsigned short); input_dev->keycodesize = sizeof(unsigned short);
input_dev->keycodemax = ARRAY_SIZE(jornada_scancodes); input_dev->keycodemax = ARRAY_SIZE(jornada_scancodes);
input_dev->dev.parent = &pdev->dev;
input_dev->id.bustype = BUS_HOST; input_dev->id.bustype = BUS_HOST;
for (i = 0; i < 128; i++) for (i = 0; i < 128; i++)
...@@ -220,9 +213,17 @@ static int jornada680kbd_probe(struct platform_device *pdev) ...@@ -220,9 +213,17 @@ static int jornada680kbd_probe(struct platform_device *pdev)
input_set_capability(input_dev, EV_MSC, MSC_SCAN); input_set_capability(input_dev, EV_MSC, MSC_SCAN);
error = input_register_polled_device(jornadakbd->poll_dev); error = input_setup_polling(input_dev, jornadakbd680_poll);
if (error) {
dev_err(&pdev->dev, "failed to set up polling\n");
return error;
}
input_set_poll_interval(input_dev, 50 /* msec */);
error = input_register_device(input_dev);
if (error) { if (error) {
dev_err(&pdev->dev, "failed to register polled input device\n"); dev_err(&pdev->dev, "failed to register input device\n");
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment