LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Imre Deak <imre.deak@solidboot.com>
To: David Brownell <david-b@pacbell.net>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	nicolas.ferre@rfo.atmel.com, linux-kernel@vger.kernel.org,
	tony@atomide.com
Subject: Re: [patch 2.6.20-rc1 6/6] input: ads7846 directly senses PENUP state
Date: Wed, 27 Dec 2006 16:14:30 +0200	[thread overview]
Message-ID: <20061227141430.GB9009@mammoth.research.nokia.com> (raw)
In-Reply-To: <200612221240.20768.david-b@pacbell.net>

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

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

[-- Attachment #2: 0001-Input-ads7846-call-input-layer-functions-directly.txt --]
[-- Type: text/plain, Size: 2990 bytes --]

>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


  reply	other threads:[~2006-12-27 14:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-22 19:25 David Brownell
2006-12-22 20:35 ` Dmitry Torokhov
2006-12-22 20:40   ` David Brownell
2006-12-27 14:14     ` Imre Deak [this message]
2006-12-28 22:37       ` David Brownell
2006-12-29  6:22         ` Dmitry Torokhov
2006-12-29 20:26           ` David Brownell
2007-01-04 13:49             ` Nicolas Ferre
2007-01-10 20:04               ` David Brownell
2007-02-16 17:37             ` [PATCH] input/spi: add ads7843 support to ads7846 touchscreen driver Nicolas Ferre
2007-02-16 19:08               ` David Brownell
2007-02-19 12:48                 ` Nicolas Ferre
2007-02-19 18:46                   ` David Brownell
2007-02-20  9:19                     ` Nicolas Ferre
2007-03-01  4:49                       ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061227141430.GB9009@mammoth.research.nokia.com \
    --to=imre.deak@solidboot.com \
    --cc=david-b@pacbell.net \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@rfo.atmel.com \
    --cc=tony@atomide.com \
    --subject='Re: [patch 2.6.20-rc1 6/6] input: ads7846 directly senses PENUP state' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).