* [PATCH 2/7] misc: ixp4-beeper: switch to use gpiolib
@ 2013-09-10 12:30 ` Linus Walleij
0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2013-09-10 12:30 UTC (permalink / raw)
To: linux-gpio, Imre Kaloz, Krzysztof Halasa
Cc: Alexandre Courbot, linux-arm-kernel, Linus Walleij,
Arnd Bergmann, Greg Kroah-Hartman
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 <kaloz@openwrt.org>
Cc: Krzysztof Halasa <khc@pm.waw.pl>
Cc: Alexandre Courbot <acourbot@nvidia.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
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(-)
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
index f34beb2..f14afd0 100644
--- a/drivers/input/misc/ixp4xx-beeper.c
+++ b/drivers/input/misc/ixp4xx-beeper.c
@@ -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 <a.zummo@towertech.it>");
@@ -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;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/7] misc: ixp4-beeper: switch to use gpiolib
@ 2013-09-10 12:30 ` Linus Walleij
0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2013-09-10 12:30 UTC (permalink / raw)
To: linux-arm-kernel
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 <kaloz@openwrt.org>
Cc: Krzysztof Halasa <khc@pm.waw.pl>
Cc: Alexandre Courbot <acourbot@nvidia.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
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(-)
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
index f34beb2..f14afd0 100644
--- a/drivers/input/misc/ixp4xx-beeper.c
+++ b/drivers/input/misc/ixp4xx-beeper.c
@@ -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 <a.zummo@towertech.it>");
@@ -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;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/7] misc: ixp4-beeper: switch to use gpiolib
2013-09-10 12:30 ` Linus Walleij
@ 2013-09-10 21:48 ` Arnd Bergmann
-1 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2013-09-10 21:48 UTC (permalink / raw)
To: Linus Walleij
Cc: Greg Kroah-Hartman, linux-gpio, Alexandre Courbot, Imre Kaloz,
linux-arm-kernel, Krzysztof Halasa
On Tuesday 10 September 2013, Linus Walleij wrote:
> 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 <kaloz@openwrt.org>
> Cc: Krzysztof Halasa <khc@pm.waw.pl>
> Cc: Alexandre Courbot <acourbot@nvidia.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> 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 <arnd@arndb.de>
>
> - 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/7] misc: ixp4-beeper: switch to use gpiolib
@ 2013-09-10 21:48 ` Arnd Bergmann
0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2013-09-10 21:48 UTC (permalink / raw)
To: linux-arm-kernel
On Tuesday 10 September 2013, Linus Walleij wrote:
> 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 <kaloz@openwrt.org>
> Cc: Krzysztof Halasa <khc@pm.waw.pl>
> Cc: Alexandre Courbot <acourbot@nvidia.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> 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 <arnd@arndb.de>
>
> - 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/7] misc: ixp4-beeper: switch to use gpiolib
2013-09-10 21:48 ` Arnd Bergmann
@ 2013-09-13 8:21 ` Linus Walleij
-1 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2013-09-13 8:21 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-gpio, Imre Kaloz, Krzysztof Halasa, Alexandre Courbot,
linux-arm-kernel, Greg Kroah-Hartman
On Tue, Sep 10, 2013 at 11:48 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 10 September 2013, Linus Walleij wrote:
>> 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 <arnd@arndb.de>
Thanks!
>> + 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/7] misc: ixp4-beeper: switch to use gpiolib
@ 2013-09-13 8:21 ` Linus Walleij
0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2013-09-13 8:21 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Sep 10, 2013 at 11:48 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 10 September 2013, Linus Walleij wrote:
>> 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 <arnd@arndb.de>
Thanks!
>> + 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/7] misc: ixp4-beeper: switch to use gpiolib
2013-09-10 12:30 ` Linus Walleij
@ 2013-09-26 15:50 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-26 15:50 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-gpio, Imre Kaloz, Krzysztof Halasa, Alexandre Courbot,
linux-arm-kernel, Arnd Bergmann
On Tue, Sep 10, 2013 at 02:30:10PM +0200, Linus Walleij wrote:
> 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 <kaloz@openwrt.org>
> Cc: Krzysztof Halasa <khc@pm.waw.pl>
> Cc: Alexandre Courbot <acourbot@nvidia.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/7] misc: ixp4-beeper: switch to use gpiolib
@ 2013-09-26 15:50 ` Greg Kroah-Hartman
0 siblings, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-26 15:50 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Sep 10, 2013 at 02:30:10PM +0200, Linus Walleij wrote:
> 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 <kaloz@openwrt.org>
> Cc: Krzysztof Halasa <khc@pm.waw.pl>
> Cc: Alexandre Courbot <acourbot@nvidia.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-09-26 15:51 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-10 12:30 [PATCH 2/7] misc: ixp4-beeper: switch to use gpiolib Linus Walleij
2013-09-10 12:30 ` Linus Walleij
2013-09-10 21:48 ` Arnd Bergmann
2013-09-10 21:48 ` Arnd Bergmann
2013-09-13 8:21 ` Linus Walleij
2013-09-13 8:21 ` Linus Walleij
2013-09-26 15:50 ` Greg Kroah-Hartman
2013-09-26 15:50 ` Greg Kroah-Hartman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.