aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVignesh R <vigneshr@ti.com>2015-02-03 14:45:34 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-02-03 14:50:38 -0500
commitbf223612a4cd65d5eb15d6adc8422c7d61ae75dd (patch)
treef4c31201c77ba2e66cd78495ec3aa1efc630df53
parent344d635b9a41b19837ccf8083a99ea688027019c (diff)
Input: ti_am335x_tsc - read charge delay from DT
This patch reads charge delay from tsc DT node and writes to REG_CHARGEDELAY register. If the charge delay is not specified in DT then default value of 0x400(CHARGEDLY_OPENDLY) is used. Signed-off-by: Vignesh R <vigneshr@ti.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt15
-rw-r--r--drivers/input/touchscreen/ti_am335x_tsc.c14
2 files changed, 28 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
index 878549ba814d..6c4fb34823d3 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
@@ -28,6 +28,20 @@ Required properties:
28 ti,adc-channels: List of analog inputs available for ADC. 28 ti,adc-channels: List of analog inputs available for ADC.
29 AIN0 = 0, AIN1 = 1 and so on till AIN7 = 7. 29 AIN0 = 0, AIN1 = 1 and so on till AIN7 = 7.
30 30
31Optional properties:
32- child "tsc"
33 ti,charge-delay: Length of touch screen charge delay step in terms of
34 ADC clock cycles. Charge delay value should be large
35 in order to avoid false pen-up events. This value
36 effects the overall sampling speed, hence need to be
37 kept as low as possible, while avoiding false pen-up
38 event. Start from a lower value, say 0x400, and
39 increase value until false pen-up events are avoided.
40 The pen-up detection happens immediately after the
41 charge step, so this does in fact function as a
42 hardware knob for adjusting the amount of "settling
43 time".
44
31Example: 45Example:
32 tscadc: tscadc@44e0d000 { 46 tscadc: tscadc@44e0d000 {
33 compatible = "ti,am3359-tscadc"; 47 compatible = "ti,am3359-tscadc";
@@ -36,6 +50,7 @@ Example:
36 ti,x-plate-resistance = <200>; 50 ti,x-plate-resistance = <200>;
37 ti,coordiante-readouts = <5>; 51 ti,coordiante-readouts = <5>;
38 ti,wire-config = <0x00 0x11 0x22 0x33>; 52 ti,wire-config = <0x00 0x11 0x22 0x33>;
53 ti,charge-delay = <0x400>;
39 }; 54 };
40 55
41 adc { 56 adc {
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index 0625c102a1d0..7c0f6b21559d 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -52,6 +52,7 @@ struct titsc {
52 u32 bit_xp, bit_xn, bit_yp, bit_yn; 52 u32 bit_xp, bit_xn, bit_yp, bit_yn;
53 u32 inp_xp, inp_xn, inp_yp, inp_yn; 53 u32 inp_xp, inp_xn, inp_yp, inp_yn;
54 u32 step_mask; 54 u32 step_mask;
55 u32 charge_delay;
55}; 56};
56 57
57static unsigned int titsc_readl(struct titsc *ts, unsigned int reg) 58static unsigned int titsc_readl(struct titsc *ts, unsigned int reg)
@@ -177,7 +178,7 @@ static void titsc_step_config(struct titsc *ts_dev)
177 178
178 config = titsc_readl(ts_dev, REG_IDLECONFIG); 179 config = titsc_readl(ts_dev, REG_IDLECONFIG);
179 titsc_writel(ts_dev, REG_CHARGECONFIG, config); 180 titsc_writel(ts_dev, REG_CHARGECONFIG, config);
180 titsc_writel(ts_dev, REG_CHARGEDELAY, CHARGEDLY_OPENDLY); 181 titsc_writel(ts_dev, REG_CHARGEDELAY, ts_dev->charge_delay);
181 182
182 /* coordinate_readouts + 1 ... coordinate_readouts + 2 is for Z */ 183 /* coordinate_readouts + 1 ... coordinate_readouts + 2 is for Z */
183 config = STEPCONFIG_MODE_HWSYNC | 184 config = STEPCONFIG_MODE_HWSYNC |
@@ -368,6 +369,17 @@ static int titsc_parse_dt(struct platform_device *pdev,
368 if (err < 0) 369 if (err < 0)
369 return err; 370 return err;
370 371
372 err = of_property_read_u32(node, "ti,charge-delay",
373 &ts_dev->charge_delay);
374 /*
375 * If ti,charge-delay value is not specified, then use
376 * CHARGEDLY_OPENDLY as the default value.
377 */
378 if (err < 0) {
379 ts_dev->charge_delay = CHARGEDLY_OPENDLY;
380 dev_warn(&pdev->dev, "ti,charge-delay not specified\n");
381 }
382
371 return of_property_read_u32_array(node, "ti,wire-config", 383 return of_property_read_u32_array(node, "ti,wire-config",
372 ts_dev->config_inp, ARRAY_SIZE(ts_dev->config_inp)); 384 ts_dev->config_inp, ARRAY_SIZE(ts_dev->config_inp));
373} 385}