linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: edt-ft5x06 - fix setting gain, offset, and threshold via device tree
@ 2016-02-09 17:22 Philipp Zabel
  2016-02-09 17:33 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Philipp Zabel @ 2016-02-09 17:22 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Franklin S Cooper Jr, linux-input, kernel, Philipp Zabel

A recent patch broke parsing the gain, offset, and threshold parameters
from device tree. Instead of setting the cached values and writing them
to the correct registers during probe, it would write the values from DT
into the register address variables and never write them to the chip
during normal operation.

Fixes: 2e23b7a96372 ("Input: edt-ft5x06 - use generic properties API")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/input/touchscreen/edt-ft5x06.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index 0b0f8c1..23fbe38 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -822,16 +822,22 @@ static void edt_ft5x06_ts_get_defaults(struct device *dev,
 	int error;
 
 	error = device_property_read_u32(dev, "threshold", &val);
-	if (!error)
-		reg_addr->reg_threshold = val;
+	if (!error) {
+		edt_ft5x06_register_write(tsdata, reg_addr->reg_threshold, val);
+		tsdata->threshold = val;
+	}
 
 	error = device_property_read_u32(dev, "gain", &val);
-	if (!error)
-		reg_addr->reg_gain = val;
+	if (!error) {
+		edt_ft5x06_register_write(tsdata, reg_addr->reg_gain, val);
+		tsdata->gain = val;
+	}
 
 	error = device_property_read_u32(dev, "offset", &val);
-	if (!error)
-		reg_addr->reg_offset = val;
+	if (!error) {
+		edt_ft5x06_register_write(tsdata, reg_addr->reg_offset, val);
+		tsdata->offset = val;
+	}
 }
 
 static void
-- 
2.7.0.rc3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Input: edt-ft5x06 - fix setting gain, offset, and threshold via device tree
  2016-02-09 17:22 [PATCH] Input: edt-ft5x06 - fix setting gain, offset, and threshold via device tree Philipp Zabel
@ 2016-02-09 17:33 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2016-02-09 17:33 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: Franklin S Cooper Jr, linux-input, kernel

On Tue, Feb 09, 2016 at 06:22:38PM +0100, Philipp Zabel wrote:
> A recent patch broke parsing the gain, offset, and threshold parameters
> from device tree. Instead of setting the cached values and writing them
> to the correct registers during probe, it would write the values from DT
> into the register address variables and never write them to the chip
> during normal operation.
> 
> Fixes: 2e23b7a96372 ("Input: edt-ft5x06 - use generic properties API")
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>

Applied, thank you.

> ---
>  drivers/input/touchscreen/edt-ft5x06.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
> index 0b0f8c1..23fbe38 100644
> --- a/drivers/input/touchscreen/edt-ft5x06.c
> +++ b/drivers/input/touchscreen/edt-ft5x06.c
> @@ -822,16 +822,22 @@ static void edt_ft5x06_ts_get_defaults(struct device *dev,
>  	int error;
>  
>  	error = device_property_read_u32(dev, "threshold", &val);
> -	if (!error)
> -		reg_addr->reg_threshold = val;
> +	if (!error) {
> +		edt_ft5x06_register_write(tsdata, reg_addr->reg_threshold, val);
> +		tsdata->threshold = val;
> +	}
>  
>  	error = device_property_read_u32(dev, "gain", &val);
> -	if (!error)
> -		reg_addr->reg_gain = val;
> +	if (!error) {
> +		edt_ft5x06_register_write(tsdata, reg_addr->reg_gain, val);
> +		tsdata->gain = val;
> +	}
>  
>  	error = device_property_read_u32(dev, "offset", &val);
> -	if (!error)
> -		reg_addr->reg_offset = val;
> +	if (!error) {
> +		edt_ft5x06_register_write(tsdata, reg_addr->reg_offset, val);
> +		tsdata->offset = val;
> +	}
>  }
>  
>  static void
> -- 
> 2.7.0.rc3
> 

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-09 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-09 17:22 [PATCH] Input: edt-ft5x06 - fix setting gain, offset, and threshold via device tree Philipp Zabel
2016-02-09 17:33 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).