lkml.org 
[lkml]   [2006]   [Dec]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [patch 2.6.20-rc1 6/6] input: ads7846 directly senses PENUP state
On Fri, Dec 22, 2006 at 12:40:20PM -0800, David Brownell wrote:
> On Friday 22 December 2006 12:35 pm, Dmitry Torokhov wrote:
> > On 12/22/06, David Brownell <david-b@pacbell.net> wrote:
> > >
> > > +static void ads7846_report_pen_state(struct ads7846 *ts, int down)
> > > +{
> > > + struct input_dev *input_dev = ts->input;
> > > +
> > > + input_report_key(input_dev, BTN_TOUCH, down);
> > > + if (!down)
> > > + input_report_abs(input_dev, ABS_PRESSURE, 0);
> > > +#ifdef VERBOSE
> > > + pr_debug("%s: %s\n", ts->spi->dev.bus_id, down ? "DOWN" : "UP");
> > > +#endif
> > > +}
> > > +
> > > +static void ads7846_report_pen_position(struct ads7846 *ts, int x, int y,
> > > + int pressure)
> > > +{
> > > + struct input_dev *input_dev = ts->input;
> > > +
> > > + input_report_abs(input_dev, ABS_X, x);
> > > + input_report_abs(input_dev, ABS_Y, y);
> > > + input_report_abs(input_dev, ABS_PRESSURE, pressure);
> > > +
> > > +#ifdef VERBOSE
> > > + pr_debug("%s: %d/%d/%d\n", ts->spi->dev.bus_id, x, y, pressure);
> > > +#endif
> > > +}
> > > +
> > > +static void ads7846_sync_events(struct ads7846 *ts)
> > > +{
> > > + struct input_dev *input_dev = ts->input;
> > > +
> > > + input_sync(input_dev);
> > > +}
> >
> > I think these helpers just obfuscate the code, just call
> > input_report_*() and input_sync() drectly like you used to do.
>
> Fair enough, I had a similar thought. Imre, could you do that update?

Yes, the patch is against the OMAP tree.

--Imre
From 34c26895c2cfb2bcc1a1d7994ad695e26b8eaeef Mon Sep 17 00:00:00 2001
From: Imre Deak <imre.deak@solidboot.com>
Date: Wed, 27 Dec 2006 16:07:32 +0200
Subject: [PATCH] Input: ads7846: call input layer functions directly

This reverts an earlier abstraction of these calls, which only
obfuscated the code.

Signed-off-by: Imre Deak <imre.deak@solidboot.com>
---
drivers/input/touchscreen/ads7846.c | 56 +++++++++++-----------------------
1 files changed, 18 insertions(+), 38 deletions(-)

diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index a47c95e..d6251ef 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -375,39 +375,6 @@ static DEVICE_ATTR(disable, 0664, ads7846_disable_show, ads7846_disable_store);

/*--------------------------------------------------------------------------*/

-static void ads7846_report_pen_state(struct ads7846 *ts, int down)
-{
- struct input_dev *input_dev = ts->input;
-
- input_report_key(input_dev, BTN_TOUCH, down);
- if (!down)
- input_report_abs(input_dev, ABS_PRESSURE, 0);
-#ifdef VERBOSE
- pr_debug("%s: %s\n", ts->spi->dev.bus_id, down ? "DOWN" : "UP");
-#endif
-}
-
-static void ads7846_report_pen_position(struct ads7846 *ts, int x, int y,
- int pressure)
-{
- struct input_dev *input_dev = ts->input;
-
- input_report_abs(input_dev, ABS_X, x);
- input_report_abs(input_dev, ABS_Y, y);
- input_report_abs(input_dev, ABS_PRESSURE, pressure);
-
-#ifdef VERBOSE
- pr_debug("%s: %d/%d/%d\n", ts->spi->dev.bus_id, x, y, pressure);
-#endif
-}
-
-static void ads7846_sync_events(struct ads7846 *ts)
-{
- struct input_dev *input_dev = ts->input;
-
- input_sync(input_dev);
-}
-
/*
* PENIRQ only kicks the timer. The timer only reissues the SPI transfer,
* to retrieve touchscreen status.
@@ -466,11 +433,20 @@ static void ads7846_rx(void *ads)
*/
if (Rt) {
if (!ts->pendown) {
- ads7846_report_pen_state(ts, 1);
+ input_report_key(ts->input, BTN_TOUCH, 1);
ts->pendown = 1;
+#ifdef VERBOSE
+ dev_dbg(&ts->spi->dev, "DOWN\n");
+#endif
}
- ads7846_report_pen_position(ts, x, y, Rt);
- ads7846_sync_events(ts);
+ input_report_abs(ts->input, ABS_X, x);
+ input_report_abs(ts->input, ABS_Y, y);
+ input_report_abs(ts->input, ABS_PRESSURE, Rt);
+
+ input_sync(ts->input);
+#ifdef VERBOSE
+ dev_dbg(&ts->spi->dev, "%4d/%4d/%4d\n", x, y, Rt);
+#endif
}

hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD), HRTIMER_REL);
@@ -568,9 +544,13 @@ static int ads7846_timer(struct hrtimer *handle)
if (unlikely(!ts->get_pendown_state() ||
device_suspended(&ts->spi->dev))) {
if (ts->pendown) {
- ads7846_report_pen_state(ts, 0);
- ads7846_sync_events(ts);
+ input_report_key(ts->input, BTN_TOUCH, 0);
+ input_report_abs(ts->input, ABS_PRESSURE, 0);
+ input_sync(ts->input);
ts->pendown = 0;
+#ifdef VERBOSE
+ dev_dbg(&ts->spi->dev, "UP\n");
+#endif
}

/* measurment cycle ended */
--
1.4.4.2
\
 
 \ /
  Last update: 2006-12-27 15:37    [W:0.059 / U:0.908 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site