aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2015-07-06 18:18:24 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-07-11 20:26:45 -0400
commit4200e831e4a8fd09fa4e78de2e571ab270c12d06 (patch)
treeda07c4aee66dccb1613b86930637436070167f4c
parent517178692ccd730a95b278bd8cd67e11498a9a84 (diff)
Input: of_touchscreen - switch to using device properties
Let's switch form OF to device properties so that common parsing code could work not only on device tree but also on ACPI-based platforms. Reviewed-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/touchscreen/Kconfig4
-rw-r--r--drivers/input/touchscreen/Makefile2
-rw-r--r--drivers/input/touchscreen/edt-ft5x06.c2
-rw-r--r--drivers/input/touchscreen/of_touchscreen.c56
-rw-r--r--drivers/input/touchscreen/tsc2005.c2
-rw-r--r--include/linux/input/touchscreen.h11
6 files changed, 37 insertions, 40 deletions
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index aa2b5f21b89b..27035ecbd4f5 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -11,9 +11,9 @@ menuconfig INPUT_TOUCHSCREEN
11 11
12if INPUT_TOUCHSCREEN 12if INPUT_TOUCHSCREEN
13 13
14config OF_TOUCHSCREEN 14config TOUCHSCREEN_PROPERTIES
15 def_tristate INPUT 15 def_tristate INPUT
16 depends on INPUT && OF 16 depends on INPUT
17 17
18config TOUCHSCREEN_88PM860X 18config TOUCHSCREEN_88PM860X
19 tristate "Marvell 88PM860x touchscreen" 19 tristate "Marvell 88PM860x touchscreen"
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index fa3d33bac7fc..c85aae23e7f8 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -6,7 +6,7 @@
6 6
7wm97xx-ts-y := wm97xx-core.o 7wm97xx-ts-y := wm97xx-core.o
8 8
9obj-$(CONFIG_OF_TOUCHSCREEN) += of_touchscreen.o 9obj-$(CONFIG_TOUCHSCREEN_PROPERTIES) += of_touchscreen.o
10obj-$(CONFIG_TOUCHSCREEN_88PM860X) += 88pm860x-ts.o 10obj-$(CONFIG_TOUCHSCREEN_88PM860X) += 88pm860x-ts.o
11obj-$(CONFIG_TOUCHSCREEN_AD7877) += ad7877.o 11obj-$(CONFIG_TOUCHSCREEN_AD7877) += ad7877.o
12obj-$(CONFIG_TOUCHSCREEN_AD7879) += ad7879.o 12obj-$(CONFIG_TOUCHSCREEN_AD7879) += ad7879.o
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index 394b1de9a2a3..8f8f3199be39 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -1041,7 +1041,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
1041 0, tsdata->num_y * 64 - 1, 0, 0); 1041 0, tsdata->num_y * 64 - 1, 0, 0);
1042 1042
1043 if (!pdata) 1043 if (!pdata)
1044 touchscreen_parse_of_params(input, true); 1044 touchscreen_parse_properties(input, true);
1045 1045
1046 error = input_mt_init_slots(input, MAX_SUPPORT_POINTS, INPUT_MT_DIRECT); 1046 error = input_mt_init_slots(input, MAX_SUPPORT_POINTS, INPUT_MT_DIRECT);
1047 if (error) { 1047 if (error) {
diff --git a/drivers/input/touchscreen/of_touchscreen.c b/drivers/input/touchscreen/of_touchscreen.c
index 50bc0f219547..bb6f2fe14667 100644
--- a/drivers/input/touchscreen/of_touchscreen.c
+++ b/drivers/input/touchscreen/of_touchscreen.c
@@ -9,12 +9,12 @@
9 * 9 *
10 */ 10 */
11 11
12#include <linux/of.h> 12#include <linux/property.h>
13#include <linux/input.h> 13#include <linux/input.h>
14#include <linux/input/mt.h> 14#include <linux/input/mt.h>
15#include <linux/input/touchscreen.h> 15#include <linux/input/touchscreen.h>
16 16
17static bool touchscreen_get_prop_u32(struct device_node *np, 17static bool touchscreen_get_prop_u32(struct device *dev,
18 const char *property, 18 const char *property,
19 unsigned int default_value, 19 unsigned int default_value,
20 unsigned int *value) 20 unsigned int *value)
@@ -22,7 +22,7 @@ static bool touchscreen_get_prop_u32(struct device_node *np,
22 u32 val; 22 u32 val;
23 int error; 23 int error;
24 24
25 error = of_property_read_u32(np, property, &val); 25 error = device_property_read_u32(dev, property, &val);
26 if (error) { 26 if (error) {
27 *value = default_value; 27 *value = default_value;
28 return false; 28 return false;
@@ -51,54 +51,58 @@ static void touchscreen_set_params(struct input_dev *dev,
51} 51}
52 52
53/** 53/**
54 * touchscreen_parse_of_params - parse common touchscreen DT properties 54 * touchscreen_parse_properties - parse common touchscreen DT properties
55 * @dev: device that should be parsed 55 * @input: input device that should be parsed
56 * @multitouch: specifies whether parsed properties should be applied to
57 * single-touch or multi-touch axes
56 * 58 *
57 * This function parses common DT properties for touchscreens and setups the 59 * This function parses common DT properties for touchscreens and setups the
58 * input device accordingly. The function keeps previously setuped default 60 * input device accordingly. The function keeps previously set up default
59 * values if no value is specified via DT. 61 * values if no value is specified via DT.
60 */ 62 */
61void touchscreen_parse_of_params(struct input_dev *dev, bool multitouch) 63void touchscreen_parse_properties(struct input_dev *input, bool multitouch)
62{ 64{
63 struct device_node *np = dev->dev.parent->of_node; 65 struct device *dev = input->dev.parent;
64 unsigned int axis; 66 unsigned int axis;
65 unsigned int maximum, fuzz; 67 unsigned int maximum, fuzz;
66 bool data_present; 68 bool data_present;
67 69
68 input_alloc_absinfo(dev); 70 input_alloc_absinfo(input);
69 if (!dev->absinfo) 71 if (!input->absinfo)
70 return; 72 return;
71 73
72 axis = multitouch ? ABS_MT_POSITION_X : ABS_X; 74 axis = multitouch ? ABS_MT_POSITION_X : ABS_X;
73 data_present = touchscreen_get_prop_u32(np, "touchscreen-size-x", 75 data_present = touchscreen_get_prop_u32(dev, "touchscreen-size-x",
74 input_abs_get_max(dev, 76 input_abs_get_max(input,
75 axis) + 1, 77 axis) + 1,
76 &maximum) | 78 &maximum) |
77 touchscreen_get_prop_u32(np, "touchscreen-fuzz-x", 79 touchscreen_get_prop_u32(dev, "touchscreen-fuzz-x",
78 input_abs_get_fuzz(dev, axis), 80 input_abs_get_fuzz(input, axis),
79 &fuzz); 81 &fuzz);
80 if (data_present) 82 if (data_present)
81 touchscreen_set_params(dev, axis, maximum - 1, fuzz); 83 touchscreen_set_params(input, axis, maximum - 1, fuzz);
82 84
83 axis = multitouch ? ABS_MT_POSITION_Y : ABS_Y; 85 axis = multitouch ? ABS_MT_POSITION_Y : ABS_Y;
84 data_present = touchscreen_get_prop_u32(np, "touchscreen-size-y", 86 data_present = touchscreen_get_prop_u32(dev, "touchscreen-size-y",
85 input_abs_get_max(dev, 87 input_abs_get_max(input,
86 axis) + 1, 88 axis) + 1,
87 &maximum) | 89 &maximum) |
88 touchscreen_get_prop_u32(np, "touchscreen-fuzz-y", 90 touchscreen_get_prop_u32(dev, "touchscreen-fuzz-y",
89 input_abs_get_fuzz(dev, axis), 91 input_abs_get_fuzz(input, axis),
90 &fuzz); 92 &fuzz);
91 if (data_present) 93 if (data_present)
92 touchscreen_set_params(dev, axis, maximum - 1, fuzz); 94 touchscreen_set_params(input, axis, maximum - 1, fuzz);
93 95
94 axis = multitouch ? ABS_MT_PRESSURE : ABS_PRESSURE; 96 axis = multitouch ? ABS_MT_PRESSURE : ABS_PRESSURE;
95 data_present = touchscreen_get_prop_u32(np, "touchscreen-max-pressure", 97 data_present = touchscreen_get_prop_u32(dev,
96 input_abs_get_max(dev, axis), 98 "touchscreen-max-pressure",
99 input_abs_get_max(input, axis),
97 &maximum) | 100 &maximum) |
98 touchscreen_get_prop_u32(np, "touchscreen-fuzz-pressure", 101 touchscreen_get_prop_u32(dev,
99 input_abs_get_fuzz(dev, axis), 102 "touchscreen-fuzz-pressure",
103 input_abs_get_fuzz(input, axis),
100 &fuzz); 104 &fuzz);
101 if (data_present) 105 if (data_present)
102 touchscreen_set_params(dev, axis, maximum, fuzz); 106 touchscreen_set_params(input, axis, maximum, fuzz);
103} 107}
104EXPORT_SYMBOL(touchscreen_parse_of_params); 108EXPORT_SYMBOL(touchscreen_parse_properties);
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
index d8c025b0f88c..aaf947525cd9 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -709,7 +709,7 @@ static int tsc2005_probe(struct spi_device *spi)
709 input_set_abs_params(input_dev, ABS_PRESSURE, 0, max_p, fudge_p, 0); 709 input_set_abs_params(input_dev, ABS_PRESSURE, 0, max_p, fudge_p, 0);
710 710
711 if (np) 711 if (np)
712 touchscreen_parse_of_params(input_dev, false); 712 touchscreen_parse_properties(input_dev, false);
713 713
714 input_dev->open = tsc2005_open; 714 input_dev->open = tsc2005_open;
715 input_dev->close = tsc2005_close; 715 input_dev->close = tsc2005_close;