Thread (7 messages) 7 messages, 6 authors, 2009-03-14

RE: [patch 22/22] input: ads7846: introduce platform specific way to synchronize sampling

From: Eric Miao <hidden>
Date: 2009-03-13 02:42:35

-----Original Message-----
From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com]
Sent: 2009年3月13日 10:34
To: akpm@linux-foundation.org
Cc: linux-input@vger.kernel.org; Eric Miao; david-b@pacbell.net
Subject: Re: [patch 22/22] input: ads7846: introduce platform specific way
to synchronize sampling

Hi,

On Wed, Mar 04, 2009 at 11:59:13AM -0800, akpm@linux-foundation.org wrote:
quoted
From: Eric Miao <redacted>

Noises can be introduced when LCD signals are being driven, some platforms
provide a signal to assist the synchronization of this sampling procedure.

Signed-off-by: Eric Miao <redacted>
Cc: David Brownell <redacted>
Cc: Dmitry Torokhov <redacted>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/input/touchscreen/ads7846.c |   10 ++++++++++
 include/linux/spi/ads7846.h         |    2 ++
 2 files changed, 12 insertions(+)

diff -puN drivers/input/touchscreen/ads7846.c~input-ads7846-introduce-
platform-specific-way-to-synchronize-sampling
drivers/input/touchscreen/ads7846.c
quoted
--- a/drivers/input/touchscreen/ads7846.c~input-ads7846-introduce-
platform-specific-way-to-synchronize-sampling
quoted
+++ a/drivers/input/touchscreen/ads7846.c
@@ -127,6 +127,8 @@ struct ads7846 {
      void                    (*filter_cleanup)(void *data);
      int                     (*get_pendown_state)(void);
      int                     gpio_pendown;
+
+     void                    (*wait_for_sync)(void);
 };

 /* leave chip selected when we're done, for quicker re-select? */
@@ -511,6 +513,10 @@ static int get_pendown_state(struct ads7
      return !gpio_get_value(ts->gpio_pendown);
 }

+static void null_wait_for_sync(void)
+{
+}
+
 /*
  * PENIRQ only kicks the timer.  The timer only reissues the SPI transfer,
  * to retrieve touchscreen status.
@@ -686,6 +692,7 @@ static void ads7846_rx_val(void *ads)
      default:
              BUG();
      }
+     ts->wait_for_sync();
      status = spi_async(ts->spi, m);
      if (status)
              dev_err(&ts->spi->dev, "spi_async --> %d\n",
@@ -723,6 +730,7 @@ static enum hrtimer_restart ads7846_time
      } else {
              /* pen is still down, continue with the measurement */
              ts->msg_idx = 0;
+             ts->wait_for_sync();
We are in hard IRQ context here. What is the expectation of
wait_for_sync()? How long are we waiting here?
This should be a workaround for broken hardware and I don't expect
this sync time on every boards.
--
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help