Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9c9fc23 authored by Linus Walleij's avatar Linus Walleij
Browse files

input: 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.

Cc: Imre Kaloz <kaloz@openwrt.org>
Cc: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarKrzysztof Halasa <khc@pm.waw.pl>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 8040dd09
Loading
Loading
Loading
Loading
+5 −7
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/interrupt.h>
#include <linux/gpio.h>
#include <mach/hardware.h>
#include <mach/hardware.h>


MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
@@ -36,14 +37,11 @@ static void ixp4xx_spkr_control(unsigned int pin, unsigned int count)
	spin_lock_irqsave(&beep_lock, flags);
	spin_lock_irqsave(&beep_lock, flags);


	if (count) {
	if (count) {
		gpio_line_config(pin, IXP4XX_GPIO_OUT);
		gpio_direction_output(pin, 0);
		gpio_line_set(pin, IXP4XX_GPIO_LOW);

		*IXP4XX_OSRT2 = (count & ~IXP4XX_OST_RELOAD_MASK) | IXP4XX_OST_ENABLE;
		*IXP4XX_OSRT2 = (count & ~IXP4XX_OST_RELOAD_MASK) | IXP4XX_OST_ENABLE;
	} else {
	} else {
		gpio_line_config(pin, IXP4XX_GPIO_IN);
		gpio_direction_output(pin, 1);
		gpio_line_set(pin, IXP4XX_GPIO_HIGH);
		gpio_direction_input(pin);

		*IXP4XX_OSRT2 = 0;
		*IXP4XX_OSRT2 = 0;
	}
	}