linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] tsc2007: reduced number of I2C transfers
@ 2009-07-24 16:14 Richard Röjfors
  2009-07-24 18:00 ` Dmitry Torokhov
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Röjfors @ 2009-07-24 16:14 UTC (permalink / raw)
  To: linux-input
  Cc: Linux Kernel Mailing List, Andrew Morton, Dmitry Torokhov,
	kwangwoo.lee, Thierry Reding, Trilok Soni

Decreases the number of I2C transactions transferred by the driver.
During probe we don't need to ask for the coordinates from the controller.
When polling the controller we don't need to power down and enable IRQ 
if we are going to poll again.

Signed-off-by: Richard Röjfors <richard.rojfors.ext@mocean-labs.com>
---
Index: linux-2.6.31-rc2/drivers/input/touchscreen/tsc2007.c
===================================================================
--- linux-2.6.31-rc2/drivers/input/touchscreen/tsc2007.c	(revision 1040)
+++ linux-2.6.31-rc2/drivers/input/touchscreen/tsc2007.c	(revision 1053)
@@ -178,6 +178,12 @@
  		ts->penstate = PEN_STATE_UP;
  }

+static void tsc2007_power_down(struct tsc2007 *tsc)
+{
+	/* power down */
+	tsc2007_xfer(tsc, PWRDOWN);
+}
+
  static int tsc2007_read_values(struct tsc2007 *tsc)
  {
  	/* y- still on; turn on only y+ (and ADC) */
@@ -188,11 +194,8 @@

  	/* turn y+ off, x- on; we'll use formula #1 */
  	tsc->tc.z1 = tsc2007_xfer(tsc, READ_Z1);
-	tsc->tc.z2 = tsc2007_xfer(tsc, READ_Z2);
+	tsc->tc.z2 = tsc2007_xfer(tsc, READ_Z2 | TSC2007_POWER_OFF_IRQ_EN);

-	/* power down */
-	tsc2007_xfer(tsc, PWRDOWN);
-
  	return 0;
  }

@@ -217,6 +220,7 @@
  		input_sync(input);

  		ts->penstate = PEN_STATE_UP;
+		tsc2007_power_down(ts);
  		enable_irq(ts->irq);
  	} else {
  		/* pen is still down, continue with the measurement */
@@ -305,7 +309,7 @@
  	input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, 0, 0);
  	input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_12BIT, 0, 0);

-	tsc2007_read_values(ts);
+	tsc2007_power_down(ts);

  	ts->irq = client->irq;
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2009-08-05  5:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-24 16:14 [PATCH 2/2] tsc2007: reduced number of I2C transfers Richard Röjfors
2009-07-24 18:00 ` Dmitry Torokhov
2009-07-24 19:37   ` Richard Röjfors
2009-07-26  8:02     ` Dmitry Torokhov
2009-08-04 12:12       ` Richard Röjfors
2009-08-05  5:04         ` 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).