Julian Calaby <[email protected]> writes:

> Hi Jens,

Hi,

[...]

> IMHO we should have access to all the parameters that can be
> configured per-device in the DTS. That we don't is a bug that arguably
> should be fixed. Again, I urge you to make that parameter available in
> device tree as it'll be useful for you in conjunction with device tree
> overlays.

ok, I thought I will give it a try and that it should be trivial to at
least add a property for TP_SENSITIVE_ADJUST in a few minutes. But it
looks like the details need some more knowledge/thinking (I am a kernel
and device tree noob).  My current diff is attached (inline), any review
/ comments are very welcome (especially the "todo:" points).

thanks,
jens

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
Changes at prisirah
        Modified   Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt 
b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
index aef5779..b4ea9c4 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
@@ -7,9 +7,13 @@ Required properties:
  - interrupts: interrupt to which the chip is connected
 
 Optional properties:
- - allwinner,ts-attached: boolean indicating that an actual touchscreen is
-                         attached to the controller
-
+ - allwinner,ts-attached        : boolean indicating that an actual touchscreen
+                                  is attached to the controller
+ - allwinner,ts-sensitive-adjust : integer (4 bits), adjust sensitivity
+                                  between 0 (least sensitive) and 15
+                                  (defaults to 15)
+                                  todo: added in 4.x?
+                                  is there some "standard" way to track this?
 Example:
 
        rtp: rtp@01c25000 {
@@ -17,4 +21,5 @@ Example:
                reg = <0x01c25000 0x100>;
                interrupts = <29>;
                allwinner,ts-attached;
+               allwinner,ts-sensitive-adjust = <0>;
        };
        Modified   drivers/input/touchscreen/sun4i-ts.c
diff --git a/drivers/input/touchscreen/sun4i-ts.c 
b/drivers/input/touchscreen/sun4i-ts.c
index e692f8e..9ffff73 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -216,6 +216,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)
        struct device *hwmon;
        int error;
        bool ts_attached;
+       u32 ts_sensitive_adjust = 15; /* use old fixed value as default */
 
        ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL);
        if (!ts)
@@ -263,11 +264,19 @@ static int sun4i_ts_probe(struct platform_device *pdev)
        writel(ADC_CLK_SEL(0) | ADC_CLK_DIV(2) | FS_DIV(7) | T_ACQ(63),
               ts->base + TP_CTRL0);
 
+       /* optional property
+          todo:
+          - use of_property_read_u8 ?
+          - check range / 4bits, 0 - 15 ?
+            "device tree schemas and validation"
+            http://lwn.net/Articles/568217/
+            or clamp? or ... */
+       of_property_read_u32(np, "allwinner,ts-sensitive-adjust", 
&ts_sensitive_adjust);
+
        /*
-        * sensitive_adjust = 15 : max, which is not all that sensitive,
         * tp_mode = 0 : only x and y coordinates, as we don't use dual touch
         */
-       writel(TP_SENSITIVE_ADJUST(0) | TP_MODE_SELECT(0),
+       writel(TP_SENSITIVE_ADJUST(ts_sensitive_adjust) | TP_MODE_SELECT(0),
               ts->base + TP_CTRL2);
 
        /* Enable median filter, type 1 : 5/3 */

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to