public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ads7846: pressure value limitation
@ 2006-03-21 18:56 Imre Deak
  2006-03-21 19:23 ` [PATCH] ads7846: pressure value limitationads Imre Deak
  0 siblings, 1 reply; 3+ messages in thread
From: Imre Deak @ 2006-03-21 18:56 UTC (permalink / raw)
  To: omap-linux; +Cc: Paul.Mundt, Dmitry Torokhov, Yrjola Juha (Nokia-M/Helsinki)

[-- Attachment #1: Type: text/plain, Size: 252 bytes --]

Limit the pressure value to the maximum specified in the board-*
specific file. Samples with pressure values beyond the maximum are
considered non-reliable. For these report the x,y values measured last.

Signed-off-by: Imre Deak <imre.deak@nokia.com>

[-- Attachment #2: ads7846-pressure_max-patch.diff --]
[-- Type: text/x-patch, Size: 1392 bytes --]

diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 2b9a521..02f4cdc 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -81,10 +83,14 @@ struct ads7846 {
 	u16			model;
 	u16			vref_delay_usecs;
 	u16			x_plate_ohms;
+	u16			pressure_max;
 
 	u8			read_x, read_y, read_z1, read_z2, pwrdown;
 	u16			dummy;		/* for the pwrdown read */
 	struct ts_event		tc;
+	u16			last_x;
+	u16			last_y;
+	u16			last_pressure;
 
 	struct spi_transfer	xfer[10];
 	struct spi_message	msg[5];
@@ -345,6 +351,18 @@ static void ads7846_rx(void *ads)
 	} else
 		Rt = 0;
 
+	if (Rt > ts->pressure_max) {
+		if (ts->last_pressure) {
+			x = ts->last_x;
+			y = ts->last_y;
+		}
+		Rt = ts->pressure_max;
+	}
+
+	ts->last_x = x;
+	ts->last_y = y;
+	ts->last_pressure = Rt;
+
 	/* NOTE:  "pendown" is inferred from pressure; we don't rely on
 	 * being able to check nPENIRQ status, or "friendly" trigger modes
 	 * (both-edges is much better than just-falling or low-level).
@@ -596,6 +615,7 @@ static int __devinit ads7846_probe(struc
 	ts->model = pdata->model ? : 7846;
 	ts->vref_delay_usecs = pdata->vref_delay_usecs ? : 100;
 	ts->x_plate_ohms = pdata->x_plate_ohms ? : 400;
+	ts->pressure_max = pdata->pressure_max ? : 255;
 	ts->debounce_max = pdata->debounce_max ? : 1;
 	ts->debounce_tol = pdata->debounce_tol ? : 10;
 


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH] ads7846: pressure value limitationads
  2006-03-21 18:56 [PATCH] ads7846: pressure value limitation Imre Deak
@ 2006-03-21 19:23 ` Imre Deak
  2006-03-23 10:49   ` andrzej zaborowski
  0 siblings, 1 reply; 3+ messages in thread
From: Imre Deak @ 2006-03-21 19:23 UTC (permalink / raw)
  To: omap-linux; +Cc: Paul.Mundt, Dmitry Torokhov, Yrjola Juha (Nokia-M/Helsinki)

[-- Attachment #1: Type: text/plain, Size: 395 bytes --]

Resending the patch, by default there should be no limit on the pressure
value.

On Tue, 2006-03-21 at 20:56 +0200, Imre Deak wrote:
> Limit the pressure value to the maximum specified in the board-*
> specific file. Samples with pressure values beyond the maximum are
> considered non-reliable. For these report the x,y values measured last.
> 
> Signed-off-by: Imre Deak <imre.deak@nokia.com>

[-- Attachment #2: ads7846-pressure_max-patch.diff --]
[-- Type: text/x-patch, Size: 1390 bytes --]

diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 2b9a521..447992e 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -81,10 +81,14 @@ struct ads7846 {
 	u16			model;
 	u16			vref_delay_usecs;
 	u16			x_plate_ohms;
+	u16			pressure_max;
 
 	u8			read_x, read_y, read_z1, read_z2, pwrdown;
 	u16			dummy;		/* for the pwrdown read */
 	struct ts_event		tc;
+	u16			last_x;
+	u16			last_y;
+	u16			last_pressure;
 
 	struct spi_transfer	xfer[10];
 	struct spi_message	msg[5];
@@ -345,6 +349,18 @@ static void ads7846_rx(void *ads)
 	} else
 		Rt = 0;
 
+	if (Rt > ts->pressure_max) {
+		if (ts->last_pressure) {
+			x = ts->last_x;
+			y = ts->last_y;
+		}
+		Rt = ts->pressure_max;
+	}
+
+	ts->last_x = x;
+	ts->last_y = y;
+	ts->last_pressure = Rt;
+
 	/* NOTE:  "pendown" is inferred from pressure; we don't rely on
 	 * being able to check nPENIRQ status, or "friendly" trigger modes
 	 * (both-edges is much better than just-falling or low-level).
@@ -596,6 +612,7 @@ static int __devinit ads7846_probe(struc
 	ts->model = pdata->model ? : 7846;
 	ts->vref_delay_usecs = pdata->vref_delay_usecs ? : 100;
 	ts->x_plate_ohms = pdata->x_plate_ohms ? : 400;
+	ts->pressure_max = pdata->pressure_max ? : ~0;
 	ts->debounce_max = pdata->debounce_max ? : 1;
 	ts->debounce_tol = pdata->debounce_tol ? : 10;
 

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH] ads7846: pressure value limitationads
  2006-03-21 19:23 ` [PATCH] ads7846: pressure value limitationads Imre Deak
@ 2006-03-23 10:49   ` andrzej zaborowski
  0 siblings, 0 replies; 3+ messages in thread
From: andrzej zaborowski @ 2006-03-23 10:49 UTC (permalink / raw)
  To: Imre Deak; +Cc: omap-linux

[-- Attachment #1: Type: text/plain, Size: 735 bytes --]

> On Tue, 2006-03-21 at 20:56 +0200, Imre Deak wrote:
> > Limit the pressure value to the maximum specified in the board-*
> > specific file. Samples with pressure values beyond the maximum are
> > considered non-reliable. For these report the x,y values measured last.
Note that this can be also done entirely in userspace.

> >
> > Signed-off-by: Imre Deak <imre.deak@nokia.com>
>
>
> _______________________________________________
> Linux-omap-open-source mailing list
> Linux-omap-open-source@linux.omap.com
> http://linux.omap.com/mailman/listinfo/linux-omap-open-source
>
>
>
>

Regards,
Andrew
--
balrog 2oo6

Dear Outlook users: Please remove me from your address books
http://www.newsforge.com/article.pl?sid=03/08/21/143258

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2006-03-23 10:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-21 18:56 [PATCH] ads7846: pressure value limitation Imre Deak
2006-03-21 19:23 ` [PATCH] ads7846: pressure value limitationads Imre Deak
2006-03-23 10:49   ` andrzej zaborowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox