misc: ixp4-beeper: switch to use gpiolib
Subsystems (2)
PATCH 2/7 misc: ixp4-beeper: switch to use gpiolib
The platform using this beeper has support for gpiolib, so there is no point to use the custom gpio_line* API. A strange ambiguity where a line was first set as input and then driven high was solved by first driving the line high as output and then switch it to input.
---
Arnd/Greg: seeking your ACK to take this through the GPIO tree as part of the attempt at cleaning out custom GPIO implementations.
--- drivers/input/misc/ixp4xx-beeper.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/input/misc/ixp4xx-beeper.c +5 -7
@@ -20,6 +20,7 @@#include <linux/delay.h> #include <linux/platform_device.h> #include <linux/interrupt.h> +#include <linux/gpio.h> #include <mach/hardware.h> MODULE_AUTHOR ("Alessandro Zummo <[email protected]>" );
@@ -35,15 +36,12 @@ static void ixp4xx_spkr_control(unsigned int pin, unsigned int count)spin_lock_irqsave (&beep_lock, flags); -if (count) { -gpio_line_config (pin,IXP4XX_GPIO_OUT ); -gpio_line_set (pin,IXP4XX_GPIO_LOW ); - +if (count) { +gpio_direction_output (pin,0 ); *IXP4XX_OSRT2 = (count & ~IXP4XX_OST_RELOAD_MASK ) |IXP4XX_OST_ENABLE ; }else { -gpio_line_config (pin,IXP4XX_GPIO_IN ); -gpio_line_set (pin,IXP4XX_GPIO_HIGH ); - +gpio_direction_output (pin,1 ); +gpio_direction_input (pin); *IXP4XX_OSRT2 =0 ; }
Signature · 1 line
1.8.3.1
PATCH 2/7 misc: ixp4-beeper: switch to use gpiolib
Quoted 12 lines · Linus Walleij
The platform using this beeper has support for gpiolib, so there is no point to use the custom gpio_line* API. A strange ambiguity where a line was first set as input and then driven high was solved by first driving the line high as output and then switch it to input.
Cc Imre Kaloz <[email protected]>Cc Krzysztof Halasa <[email protected]>Cc Alexandre Courbot <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Linus Walleij <[email protected]>
Quoted 3 lines
---
Arnd/Greg: seeking your ACK to take this through the GPIO tree as part of the attempt at cleaning out custom GPIO implementations.
drivers/input/misc/ixp4xx-beeper.c static void ixp4xx_spkr_control(unsigned int pin, unsigned int count) · line 42
Quoted 9 lines
drivers/input/misc/ixp4xx-beeper.c +2
-4-if (count) { -gpio_line_config (pin,IXP4XX_GPIO_OUT ); -gpio_line_set (pin,IXP4XX_GPIO_LOW ); - +if (count) { +gpio_direction_output (pin,0 ); *IXP4XX_OSRT2 = (count & ~IXP4XX_OST_RELOAD_MASK ) |IXP4XX_OST_ENABLE ; }else {
Too bad we can't just clean up all the open-coded mmio accesses as well. It shouldn't be hard, but some platforms are full of them, and there is definitely some regression potential.
Arnd
PATCH 2/7 misc: ixp4-beeper: switch to use gpiolib
Quoted 6 lines · Arnd Bergmann
Quoted 2 lines · Linus Walleij
Arnd/Greg: seeking your ACK to take this through the GPIO tree as part of the attempt at cleaning out custom GPIO implementations.
Acked-by Arnd Bergmann <[email protected]>
Thanks!
Quoted 8 lines
drivers/input/misc/ixp4xx-beeper.c static void ixp4xx_spkr_control(unsigned int pin, unsigned int count) · line 42
Quoted 4 lines
drivers/input/misc/ixp4xx-beeper.c +2
-0+if (count) { +gpio_direction_output (pin,0 ); *IXP4XX_OSRT2 = (count & ~IXP4XX_OST_RELOAD_MASK ) |IXP4XX_OST_ENABLE ; }else {Too bad we can't just clean up all the open-coded mmio accesses as well. It shouldn't be hard, but some platforms are full of them, and there is definitely some regression potential.
Yeah :-/
I'm poking the IXP4 people a bit, it seems to have a large hobbyist following due to all the NSLU2 hackers out there so lets see if someone picks up the challenge to go and clean up this stuff.
Yours,
Linus Walleij
PATCH 2/7 misc: ixp4-beeper: switch to use gpiolib
In reply to Linus WalleijQuoted 12 lines · Linus Walleij
The platform using this beeper has support for gpiolib, so there is no point to use the custom gpio_line* API. A strange ambiguity where a line was first set as input and then driven high was solved by first driving the line high as output and then switch it to input.
Cc Imre Kaloz <[email protected]>Cc Krzysztof Halasa <[email protected]>Cc Alexandre Courbot <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Linus Walleij <[email protected]>
Quoted 3 lines
---
Arnd/Greg: seeking your ACK to take this through the GPIO tree as part of the attempt at cleaning out custom GPIO implementations.