From: eric@eukrea.com (Eric Bénard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] ARM: imx: Add POWER_KEY to mx51 babbage board
Date: Fri, 15 Oct 2010 23:09:46 +0200 [thread overview]
Message-ID: <4CB8C31A.3000000@eukrea.com> (raw)
In-Reply-To: <1287173908-25758-2-git-send-email-Dinh.Nguyen@freescale.com>
Hi Dinh,
Le 15/10/2010 22:18, Dinh.Nguyen at freescale.com a ?crit :
> +/*!
> + * Power Key interrupt handler.
> + */
> +static irqreturn_t power_key_int(int irq, void *dev_id)
> +{
> + printk(KERN_INFO "PWR key pressed\n");
> + return 0;
> +}
> +
> +/*!
> + * Power Key initialization.
> + */
> +static int __init mxc_init_power_key(void)
> +{
> + /* Set power key as wakeup resource */
> + int irq, ret;
> +
> + /* power key */
> + ret = gpio_request(BABBAGE_POWER_KEY, "power-key");
> + if (ret) {
> + printk(KERN_ERR"failed to get BABBAGE_POWER_KEY: %d\n", ret);
> + return ret;
> + }
> + gpio_direction_input(BABBAGE_POWER_KEY);
> +
> + irq = IOMUX_TO_IRQ(BABBAGE_POWER_KEY);
> + set_irq_type(irq, IRQF_TRIGGER_RISING);
> + ret = request_irq(irq, power_key_int, 0, "power-key", 0);
> + if (ret)
> + pr_info("register on-off key interrupt failed\n");
> + else
> + enable_irq_wake(irq);
> + return ret;
> +}
> +late_initcall(mxc_init_power_key);
> +
instead of doing this, you could use the gpio-keys driver which will configure
the IRQ as a wakeup source and also send keys to the input layer.
You can have an example here :
http://git.pengutronix.de/?p=imx/linux-2.6.git;a=blob;f=arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c;h=2b48f5190830c7cbe2f11676a628c55e1531c133;hb=imx-for-2.6.37#l98
Eric
next prev parent reply other threads:[~2010-10-15 21:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-15 20:18 [PATCH 1/2] ARM: imx: Add wake functionality to GPIO Dinh.Nguyen at freescale.com
2010-10-15 20:18 ` [PATCH 2/2] ARM: imx: Add POWER_KEY to mx51 babbage board Dinh.Nguyen at freescale.com
2010-10-15 21:09 ` Eric Bénard [this message]
2010-10-15 20:23 ` [PATCH 1/2] ARM: imx: Add wake functionality to GPIO Russell King - ARM Linux
2010-10-16 18:49 ` Baruch Siach
2010-10-18 7:42 ` Sascha Hauer
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=4CB8C31A.3000000@eukrea.com \
--to=eric@eukrea.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).