* [PATCH] Input: sun4i-ts - allow to adjust some settings via device-tree properties.
@ 2015-03-12 15:45 Jens Thiele
[not found] ` <1426175150-27005-1-git-send-email-karme-k/3wkfGq5Xs@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Jens Thiele @ 2015-03-12 15:45 UTC (permalink / raw)
To: Maxime Ripard, Dmitry Torokhov, Hans de Goede, Chen-Yu Tsai,
Eduardo Valentin, Wolfram Sang,
devicetree-u79uwXL29TY76Z2rM5mHXA, dev-3kdeTeqwOZ9EV1b7eY7vFQ,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
Cc: Jens Thiele
This commit introduces two new optional device-tree properties:
"tp-sensitive-adjust": adjust sensitivity of pen down detection
"filter-type": select median and averaging filter
The previous fixed defaults, didn't work well for the Olimex
A13-LCD10TS (I have).
Signed-off-by: Jens Thiele <karme-k/3wkfGq5Xs@public.gmane.org>
---
.../devicetree/bindings/input/touchscreen/sun4i.txt | 19 +++++++++++++++++--
drivers/input/touchscreen/sun4i-ts.c | 17 +++++++++++++----
2 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
index 433332d..c93edfa 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
@@ -8,8 +8,20 @@ Required properties:
- #thermal-sensor-cells: shall be 0
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,tp-sensitive-adjust : integer (4 bits)
+ adjust sensitivity of pen down detection
+ between 0 (least sensitive) and 15
+ (defaults to 15)
+ - allwinner,filter-type : integer (2 bits)
+ select median and averaging filter
+ samples used for median / averaging filter
+ 0: 4/2
+ 1: 5/3
+ 2: 8/4
+ 3: 16/8
+ (defaults to 1)
Example:
@@ -19,4 +31,7 @@ Example:
interrupts = <29>;
allwinner,ts-attached;
#thermal-sensor-cells = <0>;
+ /* sensitive/noisy touch panel */
+ allwinner,tp-sensitive-adjust = <0>;
+ allwinner,filter-type = <3>;
};
diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
index b93a28b..d1cf847 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -30,6 +30,10 @@
* These kinds of heuristics are just asking for trouble (and don't belong
* in the kernel). So this driver offers straight forward, reliable single
* touch functionality only.
+ *
+ * s.a. A20 User Manual "1.15 TP" (Documentation/arm/sunxi/README)
+ * (looks like the description in the A20 User Manual v1.3 is better
+ * than the one in the A10 User Manual v.1.5)
*/
#include <linux/err.h>
@@ -246,6 +250,9 @@ static int sun4i_ts_probe(struct platform_device *pdev)
int error;
u32 reg;
bool ts_attached;
+ /* optional device-tree properties, use old fixed values as default */
+ u32 tp_sensitive_adjust = 15;
+ u32 filter_type = 1;
ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL);
if (!ts)
@@ -313,14 +320,16 @@ static int sun4i_ts_probe(struct platform_device *pdev)
ts->base + TP_CTRL0);
/*
- * sensitive_adjust = 15 : max, which is not all that sensitive,
+ * tp_sensitive_adjust is an optional property
* tp_mode = 0 : only x and y coordinates, as we don't use dual touch
*/
- writel(TP_SENSITIVE_ADJUST(15) | TP_MODE_SELECT(0),
+ of_property_read_u32(np, "allwinner,tp-sensitive-adjust", &tp_sensitive_adjust);
+ writel(TP_SENSITIVE_ADJUST(tp_sensitive_adjust) | TP_MODE_SELECT(0),
ts->base + TP_CTRL2);
- /* Enable median filter, type 1 : 5/3 */
- writel(FILTER_EN(1) | FILTER_TYPE(1), ts->base + TP_CTRL3);
+ /* Enable median and averaging filter, optional property for filter type */
+ of_property_read_u32(np, "allwinner,filter-type", &filter_type);
+ writel(FILTER_EN(1) | FILTER_TYPE(filter_type), ts->base + TP_CTRL3);
/* Enable temperature measurement, period 1953 (2 seconds) */
writel(TEMP_ENABLE(1) | TEMP_PERIOD(1953), ts->base + TP_TPR);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Input: sun4i-ts - allow to adjust some settings via device-tree properties.
[not found] ` <1426175150-27005-1-git-send-email-karme-k/3wkfGq5Xs@public.gmane.org>
@ 2015-03-16 10:25 ` Hans de Goede
2015-03-18 10:37 ` Maxime Ripard
1 sibling, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2015-03-16 10:25 UTC (permalink / raw)
To: Jens Thiele, Maxime Ripard, Dmitry Torokhov, Chen-Yu Tsai,
Eduardo Valentin, Wolfram Sang,
devicetree-u79uwXL29TY76Z2rM5mHXA, dev-3kdeTeqwOZ9EV1b7eY7vFQ,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
Hi,
On 12-03-15 16:45, Jens Thiele wrote:
> This commit introduces two new optional device-tree properties:
> "tp-sensitive-adjust": adjust sensitivity of pen down detection
> "filter-type": select median and averaging filter
>
> The previous fixed defaults, didn't work well for the Olimex
> A13-LCD10TS (I have).
>
> Signed-off-by: Jens Thiele <karme-k/3wkfGq5Xs@public.gmane.org>
Thanks for working on this, this patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Regards,
Hans
> ---
> .../devicetree/bindings/input/touchscreen/sun4i.txt | 19 +++++++++++++++++--
> drivers/input/touchscreen/sun4i-ts.c | 17 +++++++++++++----
> 2 files changed, 30 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> index 433332d..c93edfa 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> +++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> @@ -8,8 +8,20 @@ Required properties:
> - #thermal-sensor-cells: shall be 0
>
> 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,tp-sensitive-adjust : integer (4 bits)
> + adjust sensitivity of pen down detection
> + between 0 (least sensitive) and 15
> + (defaults to 15)
> + - allwinner,filter-type : integer (2 bits)
> + select median and averaging filter
> + samples used for median / averaging filter
> + 0: 4/2
> + 1: 5/3
> + 2: 8/4
> + 3: 16/8
> + (defaults to 1)
>
> Example:
>
> @@ -19,4 +31,7 @@ Example:
> interrupts = <29>;
> allwinner,ts-attached;
> #thermal-sensor-cells = <0>;
> + /* sensitive/noisy touch panel */
> + allwinner,tp-sensitive-adjust = <0>;
> + allwinner,filter-type = <3>;
> };
> diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
> index b93a28b..d1cf847 100644
> --- a/drivers/input/touchscreen/sun4i-ts.c
> +++ b/drivers/input/touchscreen/sun4i-ts.c
> @@ -30,6 +30,10 @@
> * These kinds of heuristics are just asking for trouble (and don't belong
> * in the kernel). So this driver offers straight forward, reliable single
> * touch functionality only.
> + *
> + * s.a. A20 User Manual "1.15 TP" (Documentation/arm/sunxi/README)
> + * (looks like the description in the A20 User Manual v1.3 is better
> + * than the one in the A10 User Manual v.1.5)
> */
>
> #include <linux/err.h>
> @@ -246,6 +250,9 @@ static int sun4i_ts_probe(struct platform_device *pdev)
> int error;
> u32 reg;
> bool ts_attached;
> + /* optional device-tree properties, use old fixed values as default */
> + u32 tp_sensitive_adjust = 15;
> + u32 filter_type = 1;
>
> ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL);
> if (!ts)
> @@ -313,14 +320,16 @@ static int sun4i_ts_probe(struct platform_device *pdev)
> ts->base + TP_CTRL0);
>
> /*
> - * sensitive_adjust = 15 : max, which is not all that sensitive,
> + * tp_sensitive_adjust is an optional property
> * tp_mode = 0 : only x and y coordinates, as we don't use dual touch
> */
> - writel(TP_SENSITIVE_ADJUST(15) | TP_MODE_SELECT(0),
> + of_property_read_u32(np, "allwinner,tp-sensitive-adjust", &tp_sensitive_adjust);
> + writel(TP_SENSITIVE_ADJUST(tp_sensitive_adjust) | TP_MODE_SELECT(0),
> ts->base + TP_CTRL2);
>
> - /* Enable median filter, type 1 : 5/3 */
> - writel(FILTER_EN(1) | FILTER_TYPE(1), ts->base + TP_CTRL3);
> + /* Enable median and averaging filter, optional property for filter type */
> + of_property_read_u32(np, "allwinner,filter-type", &filter_type);
> + writel(FILTER_EN(1) | FILTER_TYPE(filter_type), ts->base + TP_CTRL3);
>
> /* Enable temperature measurement, period 1953 (2 seconds) */
> writel(TEMP_ENABLE(1) | TEMP_PERIOD(1953), ts->base + TP_TPR);
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Input: sun4i-ts - allow to adjust some settings via device-tree properties.
[not found] ` <1426175150-27005-1-git-send-email-karme-k/3wkfGq5Xs@public.gmane.org>
2015-03-16 10:25 ` Hans de Goede
@ 2015-03-18 10:37 ` Maxime Ripard
2015-03-18 11:01 ` Hans de Goede
1 sibling, 1 reply; 5+ messages in thread
From: Maxime Ripard @ 2015-03-18 10:37 UTC (permalink / raw)
To: Jens Thiele
Cc: Dmitry Torokhov, Hans de Goede, Chen-Yu Tsai, Eduardo Valentin,
Wolfram Sang, devicetree-u79uwXL29TY76Z2rM5mHXA,
dev-3kdeTeqwOZ9EV1b7eY7vFQ, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1: Type: text/plain, Size: 1971 bytes --]
On Thu, Mar 12, 2015 at 04:45:50PM +0100, Jens Thiele wrote:
> This commit introduces two new optional device-tree properties:
> "tp-sensitive-adjust": adjust sensitivity of pen down detection
> "filter-type": select median and averaging filter
>
> The previous fixed defaults, didn't work well for the Olimex
> A13-LCD10TS (I have).
>
> Signed-off-by: Jens Thiele <karme-k/3wkfGq5Xs@public.gmane.org>
> ---
> .../devicetree/bindings/input/touchscreen/sun4i.txt | 19 +++++++++++++++++--
> drivers/input/touchscreen/sun4i-ts.c | 17 +++++++++++++----
> 2 files changed, 30 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> index 433332d..c93edfa 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> +++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> @@ -8,8 +8,20 @@ Required properties:
> - #thermal-sensor-cells: shall be 0
>
> 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,tp-sensitive-adjust : integer (4 bits)
> + adjust sensitivity of pen down detection
> + between 0 (least sensitive) and 15
> + (defaults to 15)
> + - allwinner,filter-type : integer (2 bits)
> + select median and averaging filter
> + samples used for median / averaging filter
> + 0: 4/2
> + 1: 5/3
> + 2: 8/4
> + 3: 16/8
> + (defaults to 1)
You shouldn't rely on any bits length in your binding.
And this looks really more of a configuration option, and would be
better exposed through sysfs.
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: [PATCH] Input: sun4i-ts - allow to adjust some settings via device-tree properties.
2015-03-18 10:37 ` Maxime Ripard
@ 2015-03-18 11:01 ` Hans de Goede
[not found] ` <55095B26.209-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Hans de Goede @ 2015-03-18 11:01 UTC (permalink / raw)
To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Jens Thiele
Cc: Dmitry Torokhov, Chen-Yu Tsai, Eduardo Valentin, Wolfram Sang,
devicetree-u79uwXL29TY76Z2rM5mHXA, dev-3kdeTeqwOZ9EV1b7eY7vFQ
Hi,
On 18-03-15 11:37, Maxime Ripard wrote:
> On Thu, Mar 12, 2015 at 04:45:50PM +0100, Jens Thiele wrote:
>> This commit introduces two new optional device-tree properties:
>> "tp-sensitive-adjust": adjust sensitivity of pen down detection
>> "filter-type": select median and averaging filter
>>
>> The previous fixed defaults, didn't work well for the Olimex
>> A13-LCD10TS (I have).
>>
>> Signed-off-by: Jens Thiele <karme-k/3wkfGq5Xs@public.gmane.org>
>> ---
>> .../devicetree/bindings/input/touchscreen/sun4i.txt | 19 +++++++++++++++++--
>> drivers/input/touchscreen/sun4i-ts.c | 17 +++++++++++++----
>> 2 files changed, 30 insertions(+), 6 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
>> index 433332d..c93edfa 100644
>> --- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
>> +++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
>> @@ -8,8 +8,20 @@ Required properties:
>> - #thermal-sensor-cells: shall be 0
>>
>> 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,tp-sensitive-adjust : integer (4 bits)
>> + adjust sensitivity of pen down detection
>> + between 0 (least sensitive) and 15
>> + (defaults to 15)
>> + - allwinner,filter-type : integer (2 bits)
>> + select median and averaging filter
>> + samples used for median / averaging filter
>> + 0: 4/2
>> + 1: 5/3
>> + 2: 8/4
>> + 3: 16/8
>> + (defaults to 1)
>
> You shouldn't rely on any bits length in your binding.
>
> And this looks really more of a configuration option, and would be
> better exposed through sysfs.
Erm, no, this is to adjust for properties of the touchscreen, so this is
hardware configuration, and as such definitely belongs in the dts.
Regards,
Hans
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: [PATCH] Input: sun4i-ts - allow to adjust some settings via device-tree properties.
[not found] ` <55095B26.209-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-03-23 16:12 ` Dmitry Torokhov
0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2015-03-23 16:12 UTC (permalink / raw)
To: Hans de Goede
Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Jens Thiele, Chen-Yu Tsai,
Eduardo Valentin, Wolfram Sang,
devicetree-u79uwXL29TY76Z2rM5mHXA, dev-3kdeTeqwOZ9EV1b7eY7vFQ
On Wed, Mar 18, 2015 at 12:01:58PM +0100, Hans de Goede wrote:
> Hi,
>
> On 18-03-15 11:37, Maxime Ripard wrote:
> >On Thu, Mar 12, 2015 at 04:45:50PM +0100, Jens Thiele wrote:
> >>This commit introduces two new optional device-tree properties:
> >>"tp-sensitive-adjust": adjust sensitivity of pen down detection
> >>"filter-type": select median and averaging filter
> >>
> >>The previous fixed defaults, didn't work well for the Olimex
> >>A13-LCD10TS (I have).
> >>
> >>Signed-off-by: Jens Thiele <karme-k/3wkfGq5Xs@public.gmane.org>
> >>---
> >> .../devicetree/bindings/input/touchscreen/sun4i.txt | 19 +++++++++++++++++--
> >> drivers/input/touchscreen/sun4i-ts.c | 17 +++++++++++++----
> >> 2 files changed, 30 insertions(+), 6 deletions(-)
> >>
> >>diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> >>index 433332d..c93edfa 100644
> >>--- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> >>+++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
> >>@@ -8,8 +8,20 @@ Required properties:
> >> - #thermal-sensor-cells: shall be 0
> >>
> >> 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,tp-sensitive-adjust : integer (4 bits)
> >>+ adjust sensitivity of pen down detection
> >>+ between 0 (least sensitive) and 15
> >>+ (defaults to 15)
> >>+ - allwinner,filter-type : integer (2 bits)
> >>+ select median and averaging filter
> >>+ samples used for median / averaging filter
> >>+ 0: 4/2
> >>+ 1: 5/3
> >>+ 2: 8/4
> >>+ 3: 16/8
> >>+ (defaults to 1)
> >
> >You shouldn't rely on any bits length in your binding.
> >
> >And this looks really more of a configuration option, and would be
> >better exposed through sysfs.
>
> Erm, no, this is to adjust for properties of the touchscreen, so this is
> hardware configuration, and as such definitely belongs in the dts.
Applied, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-03-23 16:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-12 15:45 [PATCH] Input: sun4i-ts - allow to adjust some settings via device-tree properties Jens Thiele
[not found] ` <1426175150-27005-1-git-send-email-karme-k/3wkfGq5Xs@public.gmane.org>
2015-03-16 10:25 ` Hans de Goede
2015-03-18 10:37 ` Maxime Ripard
2015-03-18 11:01 ` Hans de Goede
[not found] ` <55095B26.209-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-23 16:12 ` Dmitry Torokhov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.