aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/input/touchscreen/sun4i.txt19
-rw-r--r--drivers/input/touchscreen/sun4i-ts.c20
2 files changed, 33 insertions, 6 deletions
diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
index d59d25281e9f..89abecd938cb 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
@@ -9,8 +9,20 @@ Required properties:
9 - #thermal-sensor-cells: shall be 0 9 - #thermal-sensor-cells: shall be 0
10 10
11Optional properties: 11Optional properties:
12 - allwinner,ts-attached: boolean indicating that an actual touchscreen is 12 - allwinner,ts-attached : boolean indicating that an actual touchscreen
13 attached to the controller 13 is attached to the controller
14 - allwinner,tp-sensitive-adjust : integer (4 bits)
15 adjust sensitivity of pen down detection
16 between 0 (least sensitive) and 15
17 (defaults to 15)
18 - allwinner,filter-type : integer (2 bits)
19 select median and averaging filter
20 samples used for median / averaging filter
21 0: 4/2
22 1: 5/3
23 2: 8/4
24 3: 16/8
25 (defaults to 1)
14 26
15Example: 27Example:
16 28
@@ -20,4 +32,7 @@ Example:
20 interrupts = <29>; 32 interrupts = <29>;
21 allwinner,ts-attached; 33 allwinner,ts-attached;
22 #thermal-sensor-cells = <0>; 34 #thermal-sensor-cells = <0>;
35 /* sensitive/noisy touch panel */
36 allwinner,tp-sensitive-adjust = <0>;
37 allwinner,filter-type = <3>;
23 }; 38 };
diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
index 178d2efb8353..c0116994067d 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -30,6 +30,10 @@
30 * These kinds of heuristics are just asking for trouble (and don't belong 30 * These kinds of heuristics are just asking for trouble (and don't belong
31 * in the kernel). So this driver offers straight forward, reliable single 31 * in the kernel). So this driver offers straight forward, reliable single
32 * touch functionality only. 32 * touch functionality only.
33 *
34 * s.a. A20 User Manual "1.15 TP" (Documentation/arm/sunxi/README)
35 * (looks like the description in the A20 User Manual v1.3 is better
36 * than the one in the A10 User Manual v.1.5)
33 */ 37 */
34 38
35#include <linux/err.h> 39#include <linux/err.h>
@@ -246,6 +250,8 @@ static int sun4i_ts_probe(struct platform_device *pdev)
246 int error; 250 int error;
247 u32 reg; 251 u32 reg;
248 bool ts_attached; 252 bool ts_attached;
253 u32 tp_sensitive_adjust = 15;
254 u32 filter_type = 1;
249 255
250 ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL); 256 ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL);
251 if (!ts) 257 if (!ts)
@@ -322,14 +328,20 @@ static int sun4i_ts_probe(struct platform_device *pdev)
322 ts->base + TP_CTRL0); 328 ts->base + TP_CTRL0);
323 329
324 /* 330 /*
325 * sensitive_adjust = 15 : max, which is not all that sensitive, 331 * tp_sensitive_adjust is an optional property
326 * tp_mode = 0 : only x and y coordinates, as we don't use dual touch 332 * tp_mode = 0 : only x and y coordinates, as we don't use dual touch
327 */ 333 */
328 writel(TP_SENSITIVE_ADJUST(15) | TP_MODE_SELECT(0), 334 of_property_read_u32(np, "allwinner,tp-sensitive-adjust",
335 &tp_sensitive_adjust);
336 writel(TP_SENSITIVE_ADJUST(tp_sensitive_adjust) | TP_MODE_SELECT(0),
329 ts->base + TP_CTRL2); 337 ts->base + TP_CTRL2);
330 338
331 /* Enable median filter, type 1 : 5/3 */ 339 /*
332 writel(FILTER_EN(1) | FILTER_TYPE(1), ts->base + TP_CTRL3); 340 * Enable median and averaging filter, optional property for
341 * filter type.
342 */
343 of_property_read_u32(np, "allwinner,filter-type", &filter_type);
344 writel(FILTER_EN(1) | FILTER_TYPE(filter_type), ts->base + TP_CTRL3);
333 345
334 /* Enable temperature measurement, period 1953 (2 seconds) */ 346 /* Enable temperature measurement, period 1953 (2 seconds) */
335 writel(TEMP_ENABLE(1) | TEMP_PERIOD(1953), ts->base + TP_TPR); 347 writel(TEMP_ENABLE(1) | TEMP_PERIOD(1953), ts->base + TP_TPR);