History

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.

Dmitry Torokhov committed 11 years ago

Commit 4200e831 parent 51717866 files · +37 −40Browse files

Unified · Split

6 files
  1. drivers/input/touchscreen/Kconfig +2 −2
  2. drivers/input/touchscreen/Makefile +1 −1
  3. drivers/input/touchscreen/edt-ft5x06.c +1 −1
  4. drivers/input/touchscreen/of_touchscreen.c +30 −26
  5. drivers/input/touchscreen/tsc2005.c +1 −1
  6. include/linux/input/touchscreen.h +2 −9
drivers/input/touchscreen/Kconfig+2−2
@@ -11,9 +11,9 @@ menuconfig INPUT_TOUCHSCREEN · 10 unmodified lines
1111
1212 if INPUT_TOUCHSCREEN
1313
14−config OF_TOUCHSCREEN
14+config TOUCHSCREEN_PROPERTIES
1515 def_tristate INPUT
16− depends on INPUT && OF
16+ depends on INPUT
1717
1818 config TOUCHSCREEN_88PM860X
1919 tristate "Marvell 88PM860x touchscreen"
drivers/input/touchscreen/Makefile+1−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
66
77 wm97xx-ts-y := wm97xx-core.o
88
9−obj-$(CONFIG_OF_TOUCHSCREEN) += of_touchscreen.o
9+obj-$(CONFIG_TOUCHSCREEN_PROPERTIES) += of_touchscreen.o
1010 obj-$(CONFIG_TOUCHSCREEN_88PM860X) += 88pm860x-ts.o
1111 obj-$(CONFIG_TOUCHSCREEN_AD7877) += ad7877.o
1212 obj-$(CONFIG_TOUCHSCREEN_AD7879) += ad7879.o
drivers/input/touchscreen/edt-ft5x06.c+1−1
@@ -1041,7 +1041,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, · 1040 unmodified lines
10411041 0, tsdata->num_y * 64 - 1, 0, 0);
10421042
10431043 if (!pdata)
1044− touchscreen_parse_of_params(input, true);
1044+ touchscreen_parse_properties(input, true);
10451045
10461046 error = input_mt_init_slots(input, MAX_SUPPORT_POINTS, INPUT_MT_DIRECT);
10471047 if (error) {
drivers/input/touchscreen/of_touchscreen.c+30−26
@@ -9,12 +9,12 @@ · 8 unmodified lines
99 *
1010 */
1111
12−#include <linux/of.h>
12+#include <linux/property.h>
1313 #include <linux/input.h>
1414 #include <linux/input/mt.h>
1515 #include <linux/input/touchscreen.h>
1616
17−static bool touchscreen_get_prop_u32(struct device_node *np,
17+static bool touchscreen_get_prop_u32(struct device *dev,
1818 const char *property,
1919 unsigned int default_value,
2020 unsigned int *value)
@@ -22,7 +22,7 @@ static bool touchscreen_get_prop_u32(struct device_node *np, · 1 unmodified line
2222 u32 val;
2323 int error;
2424
25− error = of_property_read_u32(np, property, &val);
25+ error = device_property_read_u32(dev, property, &val);
2626 if (error) {
2727 *value = default_value;
2828 return false;
@@ -51,54 +51,58 @@ static void touchscreen_set_params(struct input_dev *dev, · 22 unmodified lines
5151 }
5252
5353 /**
54− * touchscreen_parse_of_params - parse common touchscreen DT properties
55− * @dev: device that should be parsed
54+ * touchscreen_parse_properties - parse common touchscreen DT properties
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
5658 *
5759 * 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
5961 * values if no value is specified via DT.
6062 */
61−void touchscreen_parse_of_params(struct input_dev *dev, bool multitouch)
63+void touchscreen_parse_properties(struct input_dev *input, bool multitouch)
6264 {
63− struct device_node *np = dev->dev.parent->of_node;
65+ struct device *dev = input->dev.parent;
6466 unsigned int axis;
6567 unsigned int maximum, fuzz;
6668 bool data_present;
6769
68− input_alloc_absinfo(dev);
69− if (!dev->absinfo)
70+ input_alloc_absinfo(input);
71+ if (!input->absinfo)
7072 return;
7173
7274 axis = multitouch ? ABS_MT_POSITION_X : ABS_X;
73− data_present = touchscreen_get_prop_u32(np, "touchscreen-size-x",
74− input_abs_get_max(dev,
75+ data_present = touchscreen_get_prop_u32(dev, "touchscreen-size-x",
76+ input_abs_get_max(input,
7577 axis) + 1,
7678 &maximum) |
77− touchscreen_get_prop_u32(np, "touchscreen-fuzz-x",
78− input_abs_get_fuzz(dev, axis),
79+ touchscreen_get_prop_u32(dev, "touchscreen-fuzz-x",
80+ input_abs_get_fuzz(input, axis),
7981 &fuzz);
8082 if (data_present)
81− touchscreen_set_params(dev, axis, maximum - 1, fuzz);
83+ touchscreen_set_params(input, axis, maximum - 1, fuzz);
8284
8385 axis = multitouch ? ABS_MT_POSITION_Y : ABS_Y;
84− data_present = touchscreen_get_prop_u32(np, "touchscreen-size-y",
85− input_abs_get_max(dev,
86+ data_present = touchscreen_get_prop_u32(dev, "touchscreen-size-y",
87+ input_abs_get_max(input,
8688 axis) + 1,
8789 &maximum) |
88− touchscreen_get_prop_u32(np, "touchscreen-fuzz-y",
89− input_abs_get_fuzz(dev, axis),
90+ touchscreen_get_prop_u32(dev, "touchscreen-fuzz-y",
91+ input_abs_get_fuzz(input, axis),
9092 &fuzz);
9193 if (data_present)
92− touchscreen_set_params(dev, axis, maximum - 1, fuzz);
94+ touchscreen_set_params(input, axis, maximum - 1, fuzz);
9395
9496 axis = multitouch ? ABS_MT_PRESSURE : ABS_PRESSURE;
95− data_present = touchscreen_get_prop_u32(np, "touchscreen-max-pressure",
96− input_abs_get_max(dev, axis),
97+ data_present = touchscreen_get_prop_u32(dev,
98+ "touchscreen-max-pressure",
99+ input_abs_get_max(input, axis),
97100 &maximum) |
98− touchscreen_get_prop_u32(np, "touchscreen-fuzz-pressure",
99− input_abs_get_fuzz(dev, axis),
101+ touchscreen_get_prop_u32(dev,
102+ "touchscreen-fuzz-pressure",
103+ input_abs_get_fuzz(input, axis),
100104 &fuzz);
101105 if (data_present)
102− touchscreen_set_params(dev, axis, maximum, fuzz);
106+ touchscreen_set_params(input, axis, maximum, fuzz);
103107 }
104−EXPORT_SYMBOL(touchscreen_parse_of_params);
108+EXPORT_SYMBOL(touchscreen_parse_properties);
drivers/input/touchscreen/tsc2005.c+1−1
@@ -709,7 +709,7 @@ static int tsc2005_probe(struct spi_device *spi) · 708 unmodified lines
709709 input_set_abs_params(input_dev, ABS_PRESSURE, 0, max_p, fudge_p, 0);
710710
711711 if (np)
712− touchscreen_parse_of_params(input_dev, false);
712+ touchscreen_parse_properties(input_dev, false);
713713
714714 input_dev->open = tsc2005_open;
715715 input_dev->close = tsc2005_close;
include/linux/input/touchscreen.h+2−9
@@ -9,15 +9,8 @@ · 8 unmodified lines
99 #ifndef _TOUCHSCREEN_H
1010 #define _TOUCHSCREEN_H
1111
12−#include <linux/input.h>
12+struct input_dev;
1313
14−#ifdef CONFIG_OF
15−void touchscreen_parse_of_params(struct input_dev *dev, bool multitouch);
16−#else
17−static inline void touchscreen_parse_of_params(struct input_dev *dev,
18− bool multitouch)
19−{
20−}
21−#endif
14+void touchscreen_parse_properties(struct input_dev *dev, bool multitouch);
2215
2316 #endif