All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Illia Smyrnov <illia.smyrnov@globallogic.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	<linux-input@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-omap@vger.kernel.org>
Subject: Re: [PATCH 2/2] Input: omap-keypad: Cleanup - remove unnecessary IRQ enabling/disabling
Date: Fri, 19 Jul 2013 16:26:48 +0300	[thread overview]
Message-ID: <20130719132648.GB17188@arwen.pp.htv.fi> (raw)
In-Reply-To: <1374239027-3927-3-git-send-email-illia.smyrnov@globallogic.com>

[-- Attachment #1: Type: text/plain, Size: 2259 bytes --]

Hi,

On Fri, Jul 19, 2013 at 04:03:47PM +0300, Illia Smyrnov wrote:
> From: Illia Smyrnov <illia.smyrnov@ti.com>
> 
> Remove unnecessary IRQ enabling/disabling for certain keyboard events.
> 
> Signed-off-by: Illia Smyrnov <illia.smyrnov@ti.com>
> ---
>  drivers/input/keyboard/omap4-keypad.c |   15 ++++-----------
>  1 files changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
> index c727548..73813b6 100644
> --- a/drivers/input/keyboard/omap4-keypad.c
> +++ b/drivers/input/keyboard/omap4-keypad.c
> @@ -121,10 +121,6 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
>  	unsigned int col, row, code, changed;
>  	u32 *new_state = (u32 *) key_state;
>  
> -	/* Disable interrupts */
> -	kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
> -			 OMAP4_VAL_IRQDISABLE);
> -
>  	*new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0);
>  	*(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32);
>  
> @@ -154,11 +150,6 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
>  	kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS,
>  			 kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS));
>  
> -	/* enable interrupts */
> -	kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
> -		OMAP4_DEF_IRQENABLE_EVENTEN |
> -				OMAP4_DEF_IRQENABLE_LONGKEY);
> -

please don't remove this code. It'll be good to have this around when we
move the driver to threaded IRQs without IRQF_ONESHOT. In fact, it would
be very simple to implement such a change, wanna take it up ?

It should be doable in few patches:

1) switch over to request_threaded_irq()

	just blind move to a thread, without hardirq handler, so
	IRQF_ONESHOT is mandatory.

2) add hardirq handler

	read IRQSTATUS to check if our device has generated IRQs
	returning IRQ_WAKE_THREAD if true

3) move 'IRQ masking logic' to hardirq handler, before returning
IRQ_WAKE_THREAD

	this will let you remove IRQF_ONESHOT

4) finally remove IRQF_ONESHOT

	this makes sure that IRQs aren't kept disabled until we have
	time to iterate over the entire keypad matrix. Only the keypad
	IRQ will be masked.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Felipe Balbi <balbi@ti.com>
To: Illia Smyrnov <illia.smyrnov@globallogic.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org
Subject: Re: [PATCH 2/2] Input: omap-keypad: Cleanup - remove unnecessary IRQ enabling/disabling
Date: Fri, 19 Jul 2013 16:26:48 +0300	[thread overview]
Message-ID: <20130719132648.GB17188@arwen.pp.htv.fi> (raw)
In-Reply-To: <1374239027-3927-3-git-send-email-illia.smyrnov@globallogic.com>

[-- Attachment #1: Type: text/plain, Size: 2259 bytes --]

Hi,

On Fri, Jul 19, 2013 at 04:03:47PM +0300, Illia Smyrnov wrote:
> From: Illia Smyrnov <illia.smyrnov@ti.com>
> 
> Remove unnecessary IRQ enabling/disabling for certain keyboard events.
> 
> Signed-off-by: Illia Smyrnov <illia.smyrnov@ti.com>
> ---
>  drivers/input/keyboard/omap4-keypad.c |   15 ++++-----------
>  1 files changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
> index c727548..73813b6 100644
> --- a/drivers/input/keyboard/omap4-keypad.c
> +++ b/drivers/input/keyboard/omap4-keypad.c
> @@ -121,10 +121,6 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
>  	unsigned int col, row, code, changed;
>  	u32 *new_state = (u32 *) key_state;
>  
> -	/* Disable interrupts */
> -	kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
> -			 OMAP4_VAL_IRQDISABLE);
> -
>  	*new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0);
>  	*(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32);
>  
> @@ -154,11 +150,6 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
>  	kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS,
>  			 kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS));
>  
> -	/* enable interrupts */
> -	kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
> -		OMAP4_DEF_IRQENABLE_EVENTEN |
> -				OMAP4_DEF_IRQENABLE_LONGKEY);
> -

please don't remove this code. It'll be good to have this around when we
move the driver to threaded IRQs without IRQF_ONESHOT. In fact, it would
be very simple to implement such a change, wanna take it up ?

It should be doable in few patches:

1) switch over to request_threaded_irq()

	just blind move to a thread, without hardirq handler, so
	IRQF_ONESHOT is mandatory.

2) add hardirq handler

	read IRQSTATUS to check if our device has generated IRQs
	returning IRQ_WAKE_THREAD if true

3) move 'IRQ masking logic' to hardirq handler, before returning
IRQ_WAKE_THREAD

	this will let you remove IRQF_ONESHOT

4) finally remove IRQF_ONESHOT

	this makes sure that IRQs aren't kept disabled until we have
	time to iterate over the entire keypad matrix. Only the keypad
	IRQ will be masked.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-07-19 13:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19 13:03 [PATCH 0/2] Input: omap-keypad: Cleanup - remove hardcoded values and IRQ enabling/disabling Illia Smyrnov
2013-07-19 13:03 ` Illia Smyrnov
2013-07-19 13:03 ` [PATCH 1/2] Input: omap-keypad: Cleanup - use bitfiled instead of hardcoded values Illia Smyrnov
2013-07-19 13:03   ` Illia Smyrnov
2013-07-19 13:03 ` [PATCH 2/2] Input: omap-keypad: Cleanup - remove unnecessary IRQ enabling/disabling Illia Smyrnov
2013-07-19 13:03   ` Illia Smyrnov
2013-07-19 13:26   ` Felipe Balbi [this message]
2013-07-19 13:26     ` Felipe Balbi
2013-07-22 17:25     ` Illia Smyrnov
2013-07-22 17:25       ` Illia Smyrnov
2013-07-22 21:04       ` Felipe Balbi
2013-07-22 21:04         ` Felipe Balbi
2013-07-19 13:10 ` [PATCH 0/2] Input: omap-keypad: Cleanup - remove hardcoded values and " Illia Smyrnov
2013-07-19 13:10   ` Illia Smyrnov

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=20130719132648.GB17188@arwen.pp.htv.fi \
    --to=balbi@ti.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=illia.smyrnov@globallogic.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.