Input: raspberrypi-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 raspberrypi-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-2-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
@@ -700,7 +700,6 @@ config TOUCHSCREEN_EDT_FT5X06
|
|||||||
config TOUCHSCREEN_RASPBERRYPI_FW
|
config TOUCHSCREEN_RASPBERRYPI_FW
|
||||||
tristate "Raspberry Pi's firmware base touch screen support"
|
tristate "Raspberry Pi's firmware base touch screen support"
|
||||||
depends on RASPBERRYPI_FIRMWARE || (RASPBERRYPI_FIRMWARE=n && COMPILE_TEST)
|
depends on RASPBERRYPI_FIRMWARE || (RASPBERRYPI_FIRMWARE=n && COMPILE_TEST)
|
||||||
select INPUT_POLLDEV
|
|
||||||
help
|
help
|
||||||
Say Y here if you have the official Raspberry Pi 7 inch screen on
|
Say Y here if you have the official Raspberry Pi 7 inch screen on
|
||||||
your system.
|
your system.
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <linux/input/mt.h>
|
#include <linux/input/mt.h>
|
||||||
#include <linux/input-polldev.h>
|
|
||||||
#include <linux/input/touchscreen.h>
|
#include <linux/input/touchscreen.h>
|
||||||
#include <soc/bcm2835/raspberrypi-firmware.h>
|
#include <soc/bcm2835/raspberrypi-firmware.h>
|
||||||
|
|
||||||
@@ -34,7 +33,7 @@
|
|||||||
|
|
||||||
struct rpi_ts {
|
struct rpi_ts {
|
||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
struct input_polled_dev *poll_dev;
|
struct input_dev *input;
|
||||||
struct touchscreen_properties prop;
|
struct touchscreen_properties prop;
|
||||||
|
|
||||||
void __iomem *fw_regs_va;
|
void __iomem *fw_regs_va;
|
||||||
@@ -57,10 +56,9 @@ struct rpi_ts_regs {
|
|||||||
} point[RPI_TS_MAX_SUPPORTED_POINTS];
|
} point[RPI_TS_MAX_SUPPORTED_POINTS];
|
||||||
};
|
};
|
||||||
|
|
||||||
static void rpi_ts_poll(struct input_polled_dev *dev)
|
static void rpi_ts_poll(struct input_dev *input)
|
||||||
{
|
{
|
||||||
struct input_dev *input = dev->input;
|
struct rpi_ts *ts = input_get_drvdata(input);
|
||||||
struct rpi_ts *ts = dev->private;
|
|
||||||
struct rpi_ts_regs regs;
|
struct rpi_ts_regs regs;
|
||||||
int modified_ids = 0;
|
int modified_ids = 0;
|
||||||
long released_ids;
|
long released_ids;
|
||||||
@@ -123,10 +121,9 @@ static int rpi_ts_probe(struct platform_device *pdev)
|
|||||||
{
|
{
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct device_node *np = dev->of_node;
|
struct device_node *np = dev->of_node;
|
||||||
struct input_polled_dev *poll_dev;
|
struct input_dev *input;
|
||||||
struct device_node *fw_node;
|
struct device_node *fw_node;
|
||||||
struct rpi_firmware *fw;
|
struct rpi_firmware *fw;
|
||||||
struct input_dev *input;
|
|
||||||
struct rpi_ts *ts;
|
struct rpi_ts *ts;
|
||||||
u32 touchbuf;
|
u32 touchbuf;
|
||||||
int error;
|
int error;
|
||||||
@@ -160,7 +157,6 @@ static int rpi_ts_probe(struct platform_device *pdev)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
touchbuf = (u32)ts->fw_regs_phys;
|
touchbuf = (u32)ts->fw_regs_phys;
|
||||||
error = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_SET_TOUCHBUF,
|
error = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_SET_TOUCHBUF,
|
||||||
&touchbuf, sizeof(touchbuf));
|
&touchbuf, sizeof(touchbuf));
|
||||||
@@ -170,19 +166,17 @@ static int rpi_ts_probe(struct platform_device *pdev)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
poll_dev = devm_input_allocate_polled_device(dev);
|
input = devm_input_allocate_device(dev);
|
||||||
if (!poll_dev) {
|
if (!input) {
|
||||||
dev_err(dev, "Failed to allocate input device\n");
|
dev_err(dev, "Failed to allocate input device\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
ts->poll_dev = poll_dev;
|
|
||||||
input = poll_dev->input;
|
ts->input = input;
|
||||||
|
input_set_drvdata(input, ts);
|
||||||
|
|
||||||
input->name = "raspberrypi-ts";
|
input->name = "raspberrypi-ts";
|
||||||
input->id.bustype = BUS_HOST;
|
input->id.bustype = BUS_HOST;
|
||||||
poll_dev->poll_interval = RPI_TS_POLL_INTERVAL;
|
|
||||||
poll_dev->poll = rpi_ts_poll;
|
|
||||||
poll_dev->private = ts;
|
|
||||||
|
|
||||||
input_set_abs_params(input, ABS_MT_POSITION_X, 0,
|
input_set_abs_params(input, ABS_MT_POSITION_X, 0,
|
||||||
RPI_TS_DEFAULT_WIDTH, 0, 0);
|
RPI_TS_DEFAULT_WIDTH, 0, 0);
|
||||||
@@ -197,7 +191,15 @@ static int rpi_ts_probe(struct platform_device *pdev)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = input_register_polled_device(poll_dev);
|
error = input_setup_polling(input, rpi_ts_poll);
|
||||||
|
if (error) {
|
||||||
|
dev_err(dev, "could not set up polling mode, %d\n", error);
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
input_set_poll_interval(input, RPI_TS_POLL_INTERVAL);
|
||||||
|
|
||||||
|
error = input_register_device(input);
|
||||||
if (error) {
|
if (error) {
|
||||||
dev_err(dev, "could not register input device, %d\n", error);
|
dev_err(dev, "could not register input device, %d\n", error);
|
||||||
return error;
|
return error;
|
||||||
@@ -214,10 +216,10 @@ MODULE_DEVICE_TABLE(of, rpi_ts_match);
|
|||||||
|
|
||||||
static struct platform_driver rpi_ts_driver = {
|
static struct platform_driver rpi_ts_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "raspberrypi-ts",
|
.name = "raspberrypi-ts",
|
||||||
.of_match_table = rpi_ts_match,
|
.of_match_table = rpi_ts_match,
|
||||||
},
|
},
|
||||||
.probe = rpi_ts_probe,
|
.probe = rpi_ts_probe,
|
||||||
};
|
};
|
||||||
module_platform_driver(rpi_ts_driver);
|
module_platform_driver(rpi_ts_driver);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user