]> git.kernelconcepts.de Git - meta-kc-bsp.git/blob - recipes-kernel/linux/linux-karo-4.9.11/edt-ft5x06-fixes.patch
fix machine definition substitution
[meta-kc-bsp.git] / recipes-kernel / linux / linux-karo-4.9.11 / edt-ft5x06-fixes.patch
1 From aa3d4409b664813ceb86a24bd09458cdd29cbb8a Mon Sep 17 00:00:00 2001
2 From: Martin Kepplinger <martin.kepplinger@ginzinger.com>
3 Date: Mon, 22 May 2017 17:19:45 -0700
4 Subject: [PATCH] Input: edt-ft5x06 - increase allowed data range for threshold
5  parameter
6
7 The datasheet and application note does not mention an allowed range for
8 the M09_REGISTER_THRESHOLD parameter. One of our customers needs to set
9 lower values than 20 and they seem to work just fine on EDT EP0xx0M09 with
10 T5x06 touch.
11
12 So, lacking a known lower limit, we increase the range for thresholds,
13 and set the lower limit to 0. The documentation is updated accordingly.
14
15 Signed-off-by: Schoefegger Stefan <stefan.schoefegger@ginzinger.com>
16 Signed-off-by: Manfred Schlaegl <manfred.schlaegl@ginzinger.com>
17 Signed-off-by: Martin Kepplinger <martin.kepplinger@ginzinger.com>
18 Acked-by: Rob Herring <robh@kernel.org>
19 Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
20 ---
21  Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt | 2 +-
22  drivers/input/touchscreen/edt-ft5x06.c                             | 2 +-
23  3 files changed, 3 insertions(+), 3 deletions(-)
24
25 diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
26 index 6db22103e2dd5..025cf8c9324ac 100644
27 --- a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
28 +++ b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
29 @@ -36,7 +36,7 @@ Optional properties:
30                  control gpios
31  
32   - threshold:   allows setting the "click"-threshold in the range
33 -                from 20 to 80.
34 +                from 0 to 80.
35  
36   - gain:        allows setting the sensitivity in the range from 0 to
37                  31. Note that lower values indicate higher
38 diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
39 index 8cf8d8d5d4ef4..f872817e81e46 100644
40 --- a/drivers/input/touchscreen/edt-ft5x06.c
41 +++ b/drivers/input/touchscreen/edt-ft5x06.c
42 @@ -471,7 +471,7 @@ static EDT_ATTR(gain, S_IWUSR | S_IRUGO, WORK_REGISTER_GAIN,
43  static EDT_ATTR(offset, S_IWUSR | S_IRUGO, WORK_REGISTER_OFFSET,
44                 M09_REGISTER_OFFSET, 0, 31);
45  static EDT_ATTR(threshold, S_IWUSR | S_IRUGO, WORK_REGISTER_THRESHOLD,
46 -               M09_REGISTER_THRESHOLD, 20, 80);
47 +               M09_REGISTER_THRESHOLD, 0, 80);
48  static EDT_ATTR(report_rate, S_IWUSR | S_IRUGO, WORK_REGISTER_REPORT_RATE,
49                 NO_REGISTER, 3, 14);
50  
51 From 47014752829ed1b52fa6f876b381774ae530503c Mon Sep 17 00:00:00 2001
52 From: Luca Ceresoli <luca@lucaceresoli.net>
53 Date: Thu, 7 Sep 2017 14:28:28 -0700
54 Subject: [PATCH] Input: edt-ft5x06 - fix access to non-existing register
55
56 reg_addr->reg_report_rate is supposed to exist in M06, not M09.
57
58 The driver is written to skip avoids access to non-existing registers
59 when the register address is NO_REGISTER (0xff). But
60 reg_addr->reg_report_rate is initialized to 0x00 by devm_kzalloc() (in
61 edt_ft5x06_ts_probe()) and not changed thereafter. So the checks do
62 not work and an access to register 0x00 is done.
63
64 Fix by setting reg_addr->reg_report_rate to NO_REGISTER.
65
66 Also fix the only place where reg_report_rate is checked against zero
67 instead of NO_REGISTER.
68
69 Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
70 Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
71 ---
72  drivers/input/touchscreen/edt-ft5x06.c | 3 ++-
73  1 file changed, 2 insertions(+), 1 deletion(-)
74
75 diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
76 index f872817e81e46..5bf63f76dddac 100644
77 --- a/drivers/input/touchscreen/edt-ft5x06.c
78 +++ b/drivers/input/touchscreen/edt-ft5x06.c
79 @@ -593,7 +593,7 @@ static int edt_ft5x06_work_mode(struct edt_ft5x06_ts_data *tsdata)
80                                   tsdata->gain);
81         edt_ft5x06_register_write(tsdata, reg_addr->reg_offset,
82                                   tsdata->offset);
83 -       if (reg_addr->reg_report_rate)
84 +       if (reg_addr->reg_report_rate != NO_REGISTER)
85                 edt_ft5x06_register_write(tsdata, reg_addr->reg_report_rate,
86                                   tsdata->report_rate);
87  
88 @@ -874,6 +874,7 @@ edt_ft5x06_ts_set_regs(struct edt_ft5x06_ts_data *tsdata)
89  
90         case M09:
91                 reg_addr->reg_threshold = M09_REGISTER_THRESHOLD;
92 +               reg_addr->reg_report_rate = NO_REGISTER;
93                 reg_addr->reg_gain = M09_REGISTER_GAIN;
94                 reg_addr->reg_offset = M09_REGISTER_OFFSET;
95                 reg_addr->reg_num_x = M09_REGISTER_NUM_X;