linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: eric.y.miao@gmail.com (Eric Miao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/7] [ARM] locomo: avoid the unnecessary cascade of keyboard IRQ
Date: Fri, 1 Jan 2010 11:35:06 +0800	[thread overview]
Message-ID: <f17812d70912311935m3069a99ei1720bd9981102982@mail.gmail.com> (raw)
In-Reply-To: <4B3CAB66.6060102@gmx.de>

On Thu, Dec 31, 2009 at 9:47 PM, Thomas Kunze <thommycheck@gmx.de> wrote:
> Eric Miao wrote:
>>
>> It is not necessary and over-complicated that IRQ_LOCOMO_KEY is a cascaded
>> IRQ of IRQ_LOCOMO_KEY_BASE. Removed and introduced locomokbd_{open,close}
>> for masking/unmasking of the keyboard IRQ.
>>
>> Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
>>
>
> I think sth. similar could be done for the other locomo. But I don't see why
> this is
> preferable to the chained irq handlers.
>

That's just un-necessary, think about a keypad controller. Why would it
bother to introduce another level provided there is only one IRQ for it.

And the SPI, it looks to me one IRQ for the SPI is enough instead of
another level detailed in what caused that SPI IRQ, which can just be
read from the status register.

So just a simplification, but I may overlooked something.

> Regards,
> Thomas
>>
>> ---
>> ?arch/arm/common/locomo.c ? ? ? ? ? | ? ?5 +++--
>> ?drivers/input/keyboard/locomokbd.c | ? 32
>> +++++++++++++++++++++++++++++++-
>> ?2 files changed, 34 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
>> index bd36c77..43cdb5a 100644
>> --- a/arch/arm/common/locomo.c
>> +++ b/arch/arm/common/locomo.c
>> @@ -82,7 +82,7 @@ static struct locomo_dev_info locomo_devices[] = {
>> ? ? ? ?{
>> ? ? ? ? ? ? ? ?.devid ? ? ? ? ?= LOCOMO_DEVID_KEYBOARD,
>> ? ? ? ? ? ? ? ?.irq = {
>> - ? ? ? ? ? ? ? ? ? ? ? IRQ_LOCOMO_KEY,
>> + ? ? ? ? ? ? ? ? ? ? ? IRQ_LOCOMO_KEY_BASE,
>> ? ? ? ? ? ? ? ?},
>> ? ? ? ? ? ? ? ?.name ? ? ? ? ? = "locomo-keyboard",
>> ? ? ? ? ? ? ? ?.offset ? ? ? ? = LOCOMO_KEYBOARD,
>> @@ -470,7 +470,8 @@ static void locomo_setup_irq(struct locomo *lchip)
>> ? ? ? ?/* Install handlers for IRQ_LOCOMO_*_BASE */
>> ? ? ? ?set_irq_chip(IRQ_LOCOMO_KEY_BASE, &locomo_chip);
>> ? ? ? ?set_irq_chip_data(IRQ_LOCOMO_KEY_BASE, irqbase);
>> - ? ? ? set_irq_chained_handler(IRQ_LOCOMO_KEY_BASE, locomo_key_handler);
>> + ? ? ? set_irq_handler(IRQ_LOCOMO_KEY_BASE, handle_level_irq);
>> + ? ? ? set_irq_flags(IRQ_LOCOMO_KEY_BASE, IRQF_VALID | IRQF_PROBE);
>> ? ? ? ? ?set_irq_chip(IRQ_LOCOMO_GPIO_BASE, &locomo_chip);
>> ? ? ? ?set_irq_chip_data(IRQ_LOCOMO_GPIO_BASE, irqbase);
>> diff --git a/drivers/input/keyboard/locomokbd.c
>> b/drivers/input/keyboard/locomokbd.c
>> index 9caed30..b1ab298 100644
>> --- a/drivers/input/keyboard/locomokbd.c
>> +++ b/drivers/input/keyboard/locomokbd.c
>> @@ -192,11 +192,18 @@ static void locomokbd_scankeyboard(struct locomokbd
>> *locomokbd)
>> ?static irqreturn_t locomokbd_interrupt(int irq, void *dev_id)
>> ?{
>> ? ? ? ?struct locomokbd *locomokbd = dev_id;
>> + ? ? ? u16 r;
>> +
>> + ? ? ? r = locomo_readl(locomokbd->base + LOCOMO_KIC);
>> + ? ? ? if ((r & 0x0001) == 0)
>> + ? ? ? ? ? ? ? return IRQ_HANDLED;
>> +
>> + ? ? ? locomo_writel(r & ~0x0100, locomokbd->base + LOCOMO_KIC); /* Ack
>> */
>> +
>> ? ? ? ?/** wait chattering delay **/
>> ? ? ? ?udelay(100);
>> ? ? ? ? ?locomokbd_scankeyboard(locomokbd);
>> -
>> ? ? ? ?return IRQ_HANDLED;
>> ?}
>> ?@@ -210,6 +217,25 @@ static void locomokbd_timer_callback(unsigned long
>> data)
>> ? ? ? ?locomokbd_scankeyboard(locomokbd);
>> ?}
>> ?+static int locomokbd_open(struct input_dev *dev)
>> +{
>> + ? ? ? struct locomokbd *locomokbd = input_get_drvdata(dev);
>> + ? ? ? u16 r;
>> +
>> + ? ? ? r = locomo_readl(locomokbd->base + LOCOMO_KIC) | 0x0010;
>> + ? ? ? locomo_writel(r, locomokbd->base + LOCOMO_KIC);
>> + ? ? ? return 0;
>> +}
>> +
>> +static void locomokbd_close(struct input_dev *dev)
>> +{
>> + ? ? ? struct locomokbd *locomokbd = input_get_drvdata(dev);
>> + ? ? ? u16 r;
>> +
>> + ? ? ? r = locomo_readl(locomokbd->base + LOCOMO_KIC) & ~0x0010;
>> + ? ? ? locomo_writel(r, locomokbd->base + LOCOMO_KIC);
>> +}
>> +
>> ?static int __devinit locomokbd_probe(struct locomo_dev *dev)
>> ?{
>> ? ? ? ?struct locomokbd *locomokbd;
>> @@ -253,6 +279,8 @@ static int __devinit locomokbd_probe(struct locomo_dev
>> *dev)
>> ? ? ? ?input_dev->id.vendor = 0x0001;
>> ? ? ? ?input_dev->id.product = 0x0001;
>> ? ? ? ?input_dev->id.version = 0x0100;
>> + ? ? ? input_dev->open = locomokbd_open;
>> + ? ? ? input_dev->close = locomokbd_close;
>> ? ? ? ?input_dev->dev.parent = &dev->dev;
>> ? ? ? ? ?input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) |
>> @@ -261,6 +289,8 @@ static int __devinit locomokbd_probe(struct locomo_dev
>> *dev)
>> ? ? ? ?input_dev->keycodesize = sizeof(locomokbd_keycode[0]);
>> ? ? ? ?input_dev->keycodemax = ARRAY_SIZE(locomokbd_keycode);
>> ?+ ? ? ? input_set_drvdata(input_dev, locomokbd);
>> +
>> ? ? ? ?memcpy(locomokbd->keycode, locomokbd_keycode,
>> sizeof(locomokbd->keycode));
>> ? ? ? ?for (i = 0; i < LOCOMOKBD_NUMKEYS; i++)
>> ? ? ? ? ? ? ? ?set_bit(locomokbd->keycode[i], input_dev->keybit);
>>
>
>

  reply	other threads:[~2010-01-01  3:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-28  5:18 [PATCH 0/7] pxa/sa1100: irqs.h cleanup Eric Miao
2009-12-28  5:18 ` [PATCH 1/7] [ARM] sa1100: remove unreferenced IRQ definitions Eric Miao
2009-12-31 13:23   ` Thomas Kunze
2010-01-10 17:04     ` Marek Vasut
2010-01-21 18:01       ` Thomas Kunze
2009-12-28  5:18 ` [PATCH 2/7] [ARM] locomo: avoid the unnecessary cascade of keyboard IRQ Eric Miao
2009-12-31 13:47   ` Thomas Kunze
2010-01-01  3:35     ` Eric Miao [this message]
2010-01-02 11:43   ` Russell King - ARM Linux
2010-01-03  8:07     ` Eric Miao
2009-12-28  5:18 ` [PATCH 3/7] [ARM] locomo: remove unused IRQs and avoid unnecessary cascade Eric Miao
2009-12-31 13:42   ` Thomas Kunze
2010-01-01  2:59     ` Eric Miao
2010-01-10 14:31       ` Thomas Kunze
2010-01-02 11:45   ` Russell King - ARM Linux
2009-12-28  5:18 ` [PATCH 4/7] [ARM] locomo: allow cascaded IRQ base to be specified by platforms Eric Miao
2009-12-28 21:14   ` Pavel Machek
2009-12-29  1:07     ` Eric Miao
2009-12-28  5:18 ` [PATCH 5/7] [ARM] sa1111: avoid using hardcoded IRQ numbers for PCMCIA driver Eric Miao
2009-12-28  5:18 ` [PATCH 6/7] [ARM] sa1111: allow cascaded IRQs to be used by platforms Eric Miao
2009-12-28  5:18 ` [PATCH 7/7] [ARM] pxa: move board board IRQ definitions out of irqs.h Eric Miao

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=f17812d70912311935m3069a99ei1720bd9981102982@mail.gmail.com \
    --to=eric.y.miao@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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).