[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4CB8C31A.3000000@eukrea.com>
Date: Fri, 15 Oct 2010 23:09:46 +0200
From: Eric Bénard <eric@...rea.com>
To: Dinh.Nguyen@...escale.com
CC: linux-kernel@...r.kernel.org, amit.kucheria@...onical.com,
linux@....linux.org.uk, s.hauer@...gutronix.de,
grant.likely@...retlab.ca, linux-arm-kernel@...ts.infradead.org,
daniel@...aq.de, u.kleine-koenig@...gutronix.de,
xiao-lizhang@...escale.com, valentin.longchamp@...l.ch
Subject: Re: [PATCH 2/2] ARM: imx: Add POWER_KEY to mx51 babbage board
Hi Dinh,
Le 15/10/2010 22:18, Dinh.Nguyen@...escale.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists