Skip to content

Commit

Permalink
gpio: sa1100: use sa11x0_gpio_set_wake()
Browse files Browse the repository at this point in the history
Use sa11x0_gpio_set_wake() to set the PWER register, as provided by
Dmitry some time back.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Russell King authored and Linus Walleij committed Mar 24, 2017
1 parent 7477e13 commit 9dd4819
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions drivers/gpio/gpio-sa1100.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/module.h>
#include <linux/io.h>
#include <linux/syscore_ops.h>
#include <soc/sa1100/pwer.h>
#include <mach/hardware.h>
#include <mach/irqs.h>

Expand Down Expand Up @@ -73,6 +74,7 @@ static struct gpio_chip sa1100_gpio_chip = {
static int GPIO_IRQ_rising_edge;
static int GPIO_IRQ_falling_edge;
static int GPIO_IRQ_mask;
static int GPIO_IRQ_wake;

static int sa1100_gpio_type(struct irq_data *d, unsigned int type)
{
Expand Down Expand Up @@ -131,11 +133,14 @@ static void sa1100_gpio_unmask(struct irq_data *d)

static int sa1100_gpio_wake(struct irq_data *d, unsigned int on)
{
if (on)
PWER |= BIT(d->hwirq);
else
PWER &= ~BIT(d->hwirq);
return 0;
int ret = sa11x0_gpio_set_wake(d->hwirq, on);
if (!ret) {
if (on)
GPIO_IRQ_wake |= BIT(d->hwirq);
else
GPIO_IRQ_wake &= ~BIT(d->hwirq);
}
return ret;
}

/*
Expand Down Expand Up @@ -201,8 +206,8 @@ static int sa1100_gpio_suspend(void)
/*
* Set the appropriate edges for wakeup.
*/
GRER = PWER & GPIO_IRQ_rising_edge;
GFER = PWER & GPIO_IRQ_falling_edge;
GRER = GPIO_IRQ_wake & GPIO_IRQ_rising_edge;
GFER = GPIO_IRQ_wake & GPIO_IRQ_falling_edge;

/*
* Clear any pending GPIO interrupts.
Expand Down

0 comments on commit 9dd4819

Please sign in to comment.