Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Vignesh R and committed by
Dmitry Torokhov
bf223612 344d635b

+28 -1
+15
Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
··· 28 28 ti,adc-channels: List of analog inputs available for ADC. 29 29 AIN0 = 0, AIN1 = 1 and so on till AIN7 = 7. 30 30 31 + Optional 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 + 31 45 Example: 32 46 tscadc: tscadc@44e0d000 { 33 47 compatible = "ti,am3359-tscadc"; ··· 50 36 ti,x-plate-resistance = <200>; 51 37 ti,coordiante-readouts = <5>; 52 38 ti,wire-config = <0x00 0x11 0x22 0x33>; 39 + ti,charge-delay = <0x400>; 53 40 }; 54 41 55 42 adc {
+13 -1
drivers/input/touchscreen/ti_am335x_tsc.c
··· 52 52 u32 bit_xp, bit_xn, bit_yp, bit_yn; 53 53 u32 inp_xp, inp_xn, inp_yp, inp_yn; 54 54 u32 step_mask; 55 + u32 charge_delay; 55 56 }; 56 57 57 58 static unsigned int titsc_readl(struct titsc *ts, unsigned int reg) ··· 178 177 179 178 config = titsc_readl(ts_dev, REG_IDLECONFIG); 180 179 titsc_writel(ts_dev, REG_CHARGECONFIG, config); 181 - titsc_writel(ts_dev, REG_CHARGEDELAY, CHARGEDLY_OPENDLY); 180 + titsc_writel(ts_dev, REG_CHARGEDELAY, ts_dev->charge_delay); 182 181 183 182 /* coordinate_readouts + 1 ... coordinate_readouts + 2 is for Z */ 184 183 config = STEPCONFIG_MODE_HWSYNC | ··· 368 367 369 368 if (err < 0) 370 369 return err; 370 + 371 + err = of_property_read_u32(node, "ti,charge-delay", 372 + &ts_dev->charge_delay); 373 + /* 374 + * If ti,charge-delay value is not specified, then use 375 + * CHARGEDLY_OPENDLY as the default value. 376 + */ 377 + if (err < 0) { 378 + ts_dev->charge_delay = CHARGEDLY_OPENDLY; 379 + dev_warn(&pdev->dev, "ti,charge-delay not specified\n"); 380 + } 371 381 372 382 return of_property_read_u32_array(node, "ti,wire-config", 373 383 ts_dev->config_inp, ARRAY_SIZE(ts_dev->config_inp));