lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20101018074233.GF28242@pengutronix.de>
Date:	Mon, 18 Oct 2010 09:42:33 +0200
From:	Sascha Hauer <s.hauer@...gutronix.de>
To:	Dinh.Nguyen@...escale.com
Cc:	linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux@....linux.org.uk, u.kleine-koenig@...gutronix.de,
	valentin.longchamp@...l.ch, daniel@...aq.de,
	grant.likely@...retlab.ca, amit.kucheria@...onical.com,
	xiao-lizhang@...escale.com
Subject: Re: [PATCH 1/2] ARM: imx: Add wake functionality to GPIO

Hi,

On Fri, Oct 15, 2010 at 03:18:27PM -0500, Dinh.Nguyen@...escale.com wrote:
> From: Dinh Nguyen <Dinh.Nguyen@...escale.com>
> 
> Add function definition for irq_chip.set_wake to enable GPIO to
> wake-up the system.
> 
> Signed-off-by: Dinh Nguyen <Dinh.Nguyen@...escale.com>
> ---
>  arch/arm/plat-mxc/gpio.c              |   35 +++++++++++++++++++++++++++++++++
>  arch/arm/plat-mxc/include/mach/gpio.h |    3 ++
>  2 files changed, 38 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
> index 57ec4a8..7647ba3 100644
> --- a/arch/arm/plat-mxc/gpio.c
> +++ b/arch/arm/plat-mxc/gpio.c
> @@ -20,9 +20,11 @@
>   */
>  
>  #include <linux/init.h>
> +#include <linux/interrupt.h>
>  #include <linux/io.h>
>  #include <linux/irq.h>
>  #include <linux/gpio.h>
> +#include <mach/gpio.h>
>  #include <mach/hardware.h>
>  #include <asm-generic/bug.h>
>  
> @@ -201,11 +203,44 @@ static void mx2_gpio_irq_handler(u32 irq, struct irq_desc *desc)
>  	}
>  }
>  
> +/*
> + * Set interrupt number "irq" in the GPIO as a wake-up source.
> + * While system is running, all registered GPIO interrupts need to have
> + * wake-up enabled. When system is suspended, only selected GPIO interrupts
> + * need to have wake-up enabled.
> + * @param  irq          interrupt source number
> + * @param  enable       enable as wake-up if equal to non-zero
> + * @return       This function returns 0 on success.
> + */
> +static int gpio_set_wake_irq(u32 irq, u32 enable)
> +{
> +	u32 gpio = irq_to_gpio(irq);
> +	u32 gpio_idx = gpio & 0x1F;
> +	struct mxc_gpio_port *port = &mxc_gpio_ports[gpio / 32];
> +
> +	if (enable) {
> +		port->suspend_wakeup |= (1 << gpio_idx);
> +		if (port->irq_high && (gpio_idx >= 16))
> +			enable_irq_wake(port->irq_high);
> +		else
> +			enable_irq_wake(port->irq);
> +	} else {
> +		port->suspend_wakeup &= ~(1 << gpio_idx);
> +		if (port->irq_high && (gpio_idx >= 16))
> +			disable_irq_wake(port->irq_high);
> +		else
> +			disable_irq_wake(port->irq);
> +	}
> +
> +	return 0;
> +}
> +
>  static struct irq_chip gpio_irq_chip = {
>  	.ack = gpio_ack_irq,
>  	.mask = gpio_mask_irq,
>  	.unmask = gpio_unmask_irq,
>  	.set_type = gpio_set_irq_type,
> +	.set_wake = gpio_set_wake_irq,
>  };
>  
>  static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset,
> diff --git a/arch/arm/plat-mxc/include/mach/gpio.h b/arch/arm/plat-mxc/include/mach/gpio.h
> index af33b74..dba3768 100644
> --- a/arch/arm/plat-mxc/include/mach/gpio.h
> +++ b/arch/arm/plat-mxc/include/mach/gpio.h
> @@ -39,6 +39,9 @@ struct mxc_gpio_port {
>  	struct gpio_chip chip;
>  	u32 both_edges;
>  	spinlock_t lock;
> +	u32 suspend_wakeup;

This variable seems unused.

> +	u32 saved_wakeup;
> +
>  };

Please remove that empty line.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ