diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2007-11-29 09:19:56 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-01-26 10:03:46 -0500 |
commit | b11e9e020c8c6cdd7e7cc6d5178cce2ad0ac0784 (patch) | |
tree | 2d419ec2b46f9df5a83f7a6d7cbfde87433341f2 /arch/arm/mach-orion/gpio.c | |
parent | 01af72e4e36fba66cd7cfc2a628efee866c346d1 (diff) |
[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>
Diffstat (limited to 'arch/arm/mach-orion/gpio.c')
-rw-r--r-- | arch/arm/mach-orion/gpio.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm/mach-orion/gpio.c b/arch/arm/mach-orion/gpio.c index af8553ccd230..0418f5b1ebe7 100644 --- a/arch/arm/mach-orion/gpio.c +++ b/arch/arm/mach-orion/gpio.c | |||
@@ -76,6 +76,7 @@ int gpio_direction_output(unsigned pin, int value) | |||
76 | gpio_label[pin] = "?"; | 76 | gpio_label[pin] = "?"; |
77 | 77 | ||
78 | mask = 1 << pin; | 78 | mask = 1 << pin; |
79 | orion_clrbits(GPIO_BLINK_EN, mask); | ||
79 | if (value) | 80 | if (value) |
80 | orion_setbits(GPIO_OUT, mask); | 81 | orion_setbits(GPIO_OUT, mask); |
81 | else | 82 | else |
@@ -107,6 +108,7 @@ void gpio_set_value(unsigned pin, int value) | |||
107 | 108 | ||
108 | spin_lock_irqsave(&gpio_lock, flags); | 109 | spin_lock_irqsave(&gpio_lock, flags); |
109 | 110 | ||
111 | orion_clrbits(GPIO_BLINK_EN, mask); | ||
110 | if (value) | 112 | if (value) |
111 | orion_setbits(GPIO_OUT, mask); | 113 | orion_setbits(GPIO_OUT, mask); |
112 | else | 114 | else |
@@ -116,6 +118,23 @@ void gpio_set_value(unsigned pin, int value) | |||
116 | } | 118 | } |
117 | EXPORT_SYMBOL(gpio_set_value); | 119 | EXPORT_SYMBOL(gpio_set_value); |
118 | 120 | ||
121 | void orion_gpio_set_blink(unsigned pin, int blink) | ||
122 | { | ||
123 | unsigned long flags; | ||
124 | int mask = 1 << pin; | ||
125 | |||
126 | spin_lock_irqsave(&gpio_lock, flags); | ||
127 | |||
128 | orion_clrbits(GPIO_OUT, mask); | ||
129 | if (blink) | ||
130 | orion_setbits(GPIO_BLINK_EN, mask); | ||
131 | else | ||
132 | orion_clrbits(GPIO_BLINK_EN, mask); | ||
133 | |||
134 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
135 | } | ||
136 | EXPORT_SYMBOL(orion_gpio_set_blink); | ||
137 | |||
119 | int gpio_request(unsigned pin, const char *label) | 138 | int gpio_request(unsigned pin, const char *label) |
120 | { | 139 | { |
121 | int ret = 0; | 140 | int ret = 0; |