linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: tca8418 - Add support for shared interrupt
@ 2012-11-05 16:14 Alban Bedel
  2012-11-05 18:58 ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Alban Bedel @ 2012-11-05 16:14 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, Alban Bedel

Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
---
 drivers/input/keyboard/tca8418_keypad.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/input/keyboard/tca8418_keypad.c b/drivers/input/keyboard/tca8418_keypad.c
index fc9cc94..5adc655 100644
--- a/drivers/input/keyboard/tca8418_keypad.c
+++ b/drivers/input/keyboard/tca8418_keypad.c
@@ -225,16 +225,18 @@ static irqreturn_t tca8418_irq_handler(int irq, void *dev_id)
 	if (error) {
 		dev_err(&keypad_data->client->dev,
 			"unable to read REG_INT_STAT\n");
-		goto exit;
+		return IRQ_NONE;
 	}
 
+	if (!reg)
+		return IRQ_NONE;
+
 	if (reg & INT_STAT_OVR_FLOW_INT)
 		dev_warn(&keypad_data->client->dev, "overflow occurred\n");
 
 	if (reg & INT_STAT_K_INT)
 		tca8418_read_keypad(keypad_data);
 
-exit:
 	/* Clear all interrupts, even IRQs we didn't check (GPI, CAD, LCK) */
 	reg = 0xff;
 	error = tca8418_write_byte(keypad_data, REG_INT_STAT, reg);
@@ -377,7 +379,9 @@ static int __devinit tca8418_keypad_probe(struct i2c_client *client,
 		client->irq = gpio_to_irq(client->irq);
 
 	error = request_threaded_irq(client->irq, NULL, tca8418_irq_handler,
-				     IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+				     IRQF_TRIGGER_FALLING |
+				     IRQF_SHARED |
+				     IRQF_ONESHOT,
 				     client->name, keypad_data);
 	if (error) {
 		dev_dbg(&client->dev,
-- 
1.7.0.4


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

* Re: [PATCH] Input: tca8418 - Add support for shared interrupt
  2012-11-05 16:14 [PATCH] Input: tca8418 - Add support for shared interrupt Alban Bedel
@ 2012-11-05 18:58 ` Dmitry Torokhov
  2012-11-06 16:34   ` Alban Bedel
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2012-11-05 18:58 UTC (permalink / raw)
  To: Alban Bedel; +Cc: linux-input

Hi Alban,

On Mon, Nov 05, 2012 at 05:14:12PM +0100, Alban Bedel wrote:
> Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
> ---
>  drivers/input/keyboard/tca8418_keypad.c |   10 +++++++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/keyboard/tca8418_keypad.c b/drivers/input/keyboard/tca8418_keypad.c
> index fc9cc94..5adc655 100644
> --- a/drivers/input/keyboard/tca8418_keypad.c
> +++ b/drivers/input/keyboard/tca8418_keypad.c
> @@ -225,16 +225,18 @@ static irqreturn_t tca8418_irq_handler(int irq, void *dev_id)
>  	if (error) {
>  		dev_err(&keypad_data->client->dev,
>  			"unable to read REG_INT_STAT\n");
> -		goto exit;
> +		return IRQ_NONE;
>  	}
>  
> +	if (!reg)
> +		return IRQ_NONE;
> +
>  	if (reg & INT_STAT_OVR_FLOW_INT)
>  		dev_warn(&keypad_data->client->dev, "overflow occurred\n");
>  
>  	if (reg & INT_STAT_K_INT)
>  		tca8418_read_keypad(keypad_data);
>  
> -exit:
>  	/* Clear all interrupts, even IRQs we didn't check (GPI, CAD, LCK) */
>  	reg = 0xff;
>  	error = tca8418_write_byte(keypad_data, REG_INT_STAT, reg);
> @@ -377,7 +379,9 @@ static int __devinit tca8418_keypad_probe(struct i2c_client *client,
>  		client->irq = gpio_to_irq(client->irq);
>  
>  	error = request_threaded_irq(client->irq, NULL, tca8418_irq_handler,
> -				     IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> +				     IRQF_TRIGGER_FALLING |
> +				     IRQF_SHARED |
> +				     IRQF_ONESHOT,
>  				     client->name, keypad_data);

I do not think that using ONESHOT IRQ handlers in shared interrupt
configuration is a good idea as that interrupt will stay masked until
the keypad is done processing it, which may take some time.

Thanks.

-- 
Dmitry

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

* Re: [PATCH] Input: tca8418 - Add support for shared interrupt
  2012-11-05 18:58 ` Dmitry Torokhov
@ 2012-11-06 16:34   ` Alban Bedel
  2012-11-08 16:45     ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Alban Bedel @ 2012-11-06 16:34 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input

On Mon, 5 Nov 2012 10:58:06 -0800
Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:

> I do not think that using ONESHOT IRQ handlers in shared interrupt
> configuration is a good idea as that interrupt will stay masked until
> the keypad is done processing it, which may take some time.

I don't really see what the problem is, shared ONESHOT handlers are
supported by the IRQ framework. The IRQ line of this device is an open
drain and so can be shared, and is shared on the hardware I'm using!

I agree that the interrupt masking time might rise a little if many
devices share the same line, but that's the normal drawback of shared
interrupts.

Alban

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

* Re: [PATCH] Input: tca8418 - Add support for shared interrupt
  2012-11-06 16:34   ` Alban Bedel
@ 2012-11-08 16:45     ` Dmitry Torokhov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2012-11-08 16:45 UTC (permalink / raw)
  To: Alban Bedel; +Cc: linux-input

On Tue, Nov 06, 2012 at 05:34:30PM +0100, Alban Bedel wrote:
> On Mon, 5 Nov 2012 10:58:06 -0800
> Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> 
> > I do not think that using ONESHOT IRQ handlers in shared interrupt
> > configuration is a good idea as that interrupt will stay masked until
> > the keypad is done processing it, which may take some time.
> 
> I don't really see what the problem is, shared ONESHOT handlers are
> supported by the IRQ framework. The IRQ line of this device is an open
> drain and so can be shared, and is shared on the hardware I'm using!
> 
> I agree that the interrupt masking time might rise a little if many
> devices share the same line, but that's the normal drawback of shared
> interrupts.

OK, fair enough.

-- 
Dmitry

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

end of thread, other threads:[~2012-11-08 16:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-05 16:14 [PATCH] Input: tca8418 - Add support for shared interrupt Alban Bedel
2012-11-05 18:58 ` Dmitry Torokhov
2012-11-06 16:34   ` Alban Bedel
2012-11-08 16:45     ` 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).