mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 08:19:28 +00:00
[ARM] Orion: provide GPIO method for enabling hardware assisted blinking
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>
This commit is contained in:
parent
01af72e4e3
commit
b11e9e020c
2 changed files with 20 additions and 0 deletions
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue