Skip to content

Commit

Permalink
[ARM] Orion: provide GPIO method for enabling hardware assisted blinking
Browse files Browse the repository at this point in the history
This is a pre-requisite for implementing proper hardware accelerated
GPIO LED flashing, and since we want proper locking, it's sensible to provide
the orion specific orion_gpio_set_blink() implementation within
mach-orion/gpio.c. The functions orion_gpio_set_blink() and gpio_set_value()
implicitly turn off each others state.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Acked-by: Tzachi Perelstein <tzachi@marvell.com>
Acked-by: Nicolas Pitre <nico@marvell.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Herbert Valerio Riedel authored and Russell King committed Jan 26, 2008
1 parent 01af72e commit b11e9e0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions arch/arm/mach-orion/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ int gpio_direction_output(unsigned pin, int value)
gpio_label[pin] = "?";

mask = 1 << pin;
orion_clrbits(GPIO_BLINK_EN, mask);
if (value)
orion_setbits(GPIO_OUT, mask);
else
Expand Down Expand Up @@ -107,6 +108,7 @@ void gpio_set_value(unsigned pin, int value)

spin_lock_irqsave(&gpio_lock, flags);

orion_clrbits(GPIO_BLINK_EN, mask);
if (value)
orion_setbits(GPIO_OUT, mask);
else
Expand All @@ -116,6 +118,23 @@ void gpio_set_value(unsigned pin, int value)
}
EXPORT_SYMBOL(gpio_set_value);

void orion_gpio_set_blink(unsigned pin, int blink)
{
unsigned long flags;
int mask = 1 << pin;

spin_lock_irqsave(&gpio_lock, flags);

orion_clrbits(GPIO_OUT, mask);
if (blink)
orion_setbits(GPIO_BLINK_EN, mask);
else
orion_clrbits(GPIO_BLINK_EN, mask);

spin_unlock_irqrestore(&gpio_lock, flags);
}
EXPORT_SYMBOL(orion_gpio_set_blink);

int gpio_request(unsigned pin, const char *label)
{
int ret = 0;
Expand Down
1 change: 1 addition & 0 deletions include/asm-arm/arch-orion/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ extern int gpio_direction_input(unsigned pin);
extern int gpio_direction_output(unsigned pin, int value);
extern int gpio_get_value(unsigned pin);
extern void gpio_set_value(unsigned pin, int value);
extern void orion_gpio_set_blink(unsigned pin, int blink);
extern void gpio_display(void); /* debug */

static inline int gpio_to_irq(int pin)
Expand Down

0 comments on commit b11e9e0

Please sign in to comment.