Request and free the GPIO line used for the beeper properly.
Then use the gpiolib API to flip the output of the GPIO pin
instead of relying on hacks to poke the register bits.
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 <redacted>
---
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 | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
On Tuesday 10 September 2013, Linus Walleij wrote:
Request and free the GPIO line used for the beeper properly.
Then use the gpiolib API to flip the output of the GPIO pin
instead of relying on hacks to poke the register bits.
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 <redacted>
---
Arnd/Greg: seeking your ACK to take this through the GPIO tree
as part of the attempt at cleaning out custom GPIO implementations.
From: Alex Courbot <acourbot@nvidia.com> Date: 2013-09-11 01:58:05
On 09/10/2013 09:30 PM, Linus Walleij wrote:
quoted hunk
Request and free the GPIO line used for the beeper properly.
Then use the gpiolib API to flip the output of the GPIO pin
instead of relying on hacks to poke the register bits.
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 <redacted>
---
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 | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
@@ -76,11 +76,13 @@ static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsignedstaticirqreturn_tixp4xx_spkr_interrupt(intirq,void*dev_id){+unsignedintpin=(unsignedint)dev_id;+/* clear interrupt */*IXP4XX_OSST=IXP4XX_OSST_TIMER_2_PEND;/* flip the beeper output */-*IXP4XX_GPIO_GPOUTR^=(1<<(unsignedint)dev_id);+gpio_set_value(pin,~gpio_get_value(pin));
Don't you want
gpio_set_value(pin, !gpio_get_value(pin));
instead? From the deleted line I suppose you guess to invert the GPIO
value, but using ~ will invert all the bits of the integer returned by
gpio_get_value(), meaning that if it returns 1 you will end up calling
gpio_set_value(-2). In practice your gpio is very unlikely to ever be
set to 0.
Don't you want
gpio_set_value(pin, !gpio_get_value(pin));
instead? From the deleted line I suppose you guess to invert the GPIO value,
but using ~ will invert all the bits of the integer returned by
gpio_get_value(), meaning that if it returns 1 you will end up calling
gpio_set_value(-2). In practice your gpio is very unlikely to ever be set to
0.
Just wondering, is there a reason for not using the devm_gpio functions
here?
I didn't want to change the style of the whole driver, but I can make
a separate patch switching the whole driver to use managed
resources at some later point.
Yours,
Linus Walleij
On Tue, Sep 10, 2013 at 02:30:26PM +0200, Linus Walleij wrote:
Request and free the GPIO line used for the beeper properly.
Then use the gpiolib API to flip the output of the GPIO pin
instead of relying on hacks to poke the register bits.
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 <redacted>
---
Arnd/Greg: seeking your ACK to take this through the GPIO tree
as part of the attempt at cleaning out custom GPIO implementations.