linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko.stuebner@bq.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Dirk Behme <dirk.behme@de.bosch.com>, linux-input@vger.kernel.org
Subject: Re: [PATCH] Input: zforce - make the interrupt GPIO optional
Date: Wed, 29 Jul 2015 20:17:10 +0200	[thread overview]
Message-ID: <143822119.SjJP6yKATN@diego> (raw)
In-Reply-To: <20150729175304.GD23178@dtor-ws>

Hi Dmitry,

Am Mittwoch, 29. Juli 2015, 10:53:04 schrieb Dmitry Torokhov:
> On Tue, Jul 28, 2015 at 11:43:20PM +0200, Heiko Stübner wrote:

[snip]

> > > > @@ -510,7 +511,18 @@ static irqreturn_t zforce_irq_thread(int irq,
> > > > void
> > > > *dev_id)>
> > > > 
> > > >  	if (!ts->suspending && device_may_wakeup(&client->dev))
> > > >  	
> > > >  		pm_stay_awake(&client->dev);
> > > > 
> > > > -	while (gpiod_get_value_cansleep(ts->gpio_int)) {
> > > > +	while (run) {
> > > > +		/*
> > > > +		 * Exit the loop if either
> > > > +		 * - the optional interrupt GPIO isn't specified
> > > > +		 *   (there is only one packet read per ISR invocation, 
then)
> > > > +		 * or
> > > > +		 * - the GPIO isn't active any more
> > > > +		 *   (packet read until the level GPIO indicates that there 
is
> > > > +		 *    no IRQ any more)
> > > > +		 */
> > > > +		run = gpiod_get_value_cansleep(ts->gpio_int);
> > > > +
> > 
> > alteratively you could simply convert to a
> > 
> > 	/* Run at least once, or as long as the interrupt gpio is active. */
> > 	do {
> > 	
> > 		...
> > 	
> > 	} while(gpiod_get_value_cansleep(ts->gpio_int));
> > 
> > saving the additional variable run and a lot of lines, while still running
> > at least once.
> 
> But I think that means that we'll try to read even if gpio is not active
> anymore on the first iteration.

I don't think this is a possible scenario :-)

The interrupt is only used for transmission of touch-data and is pulled low as 
long as the host hasn't fetched all touch-packages. So if nothing else except 
the zforce-driver talks to the chip, the gpio will stay on.

And when we're entering the interrupt handler, there is at least one touch-
data package waiting.


> So maybe we need to factor out the body
> and do:
> 
> 	if (!ts->gpio_int)
> 		zforce_report_data(...)
> 	else
> 		while (gpiod_get_value_cansleep(ts->gpio_int))
> 			zforce_report_data(...);
> 
> Or we could install 2 different interrupt handlers, depending on the
> presence of interrupt gpio.


Heiko
--
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

  reply	other threads:[~2015-07-29 18:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28  8:26 [PATCH] Input: zforce - make the interrupt GPIO optional Dirk Behme
2015-07-28 21:06 ` Dmitry Torokhov
2015-07-28 21:43   ` Heiko Stübner
2015-07-29 17:53     ` Dmitry Torokhov
2015-07-29 18:17       ` Heiko Stübner [this message]
2015-07-29 18:35         ` 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=143822119.SjJP6yKATN@diego \
    --to=heiko.stuebner@bq.com \
    --cc=dirk.behme@de.bosch.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).