Re: [PATCH] Input: zforce - make the interrupt GPIO optional
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2015-07-29 18:35:54
On Wed, Jul 29, 2015 at 08:17:10PM +0200, Heiko Stübner wrote:
Hi Dmitry, Am Mittwoch, 29. Juli 2015, 10:53:04 schrieb Dmitry Torokhov:quoted
On Tue, Jul 28, 2015 at 11:43:20PM +0200, Heiko Stübner wrote:[snip]quoted
quoted
quoted
quoted
@@ -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)quoted
quoted
quoted
quoted
+ * or + * - the GPIO isn't active any more + * (packet read until the level GPIO indicates that thereisquoted
quoted
quoted
quoted
+ * 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.
I see. Then please ignore me ;) -- Dmitry -- 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