aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/misc
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2013-12-10 01:22:40 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2013-12-10 01:22:40 -0500
commit5d43889c07bb38694742936aa70d1187c012e198 (patch)
tree73809dddae39ae3b746396e9779142dbd1973f33 /drivers/input/misc
parent95f75e91588afecfb0090988393653d21f5d1f91 (diff)
parent374b105797c3d4f29c685f3be535c35f5689b30e (diff)
Merge tag 'v3.13-rc3' into for-linus
Merging with the mainline to sync up on changes to serio core.
Diffstat (limited to 'drivers/input/misc')
-rw-r--r--drivers/input/misc/ixp4xx-beeper.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
index f34beb228d36..17ccba88d636 100644
--- a/drivers/input/misc/ixp4xx-beeper.c
+++ b/drivers/input/misc/ixp4xx-beeper.c
@@ -20,6 +20,7 @@
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/gpio.h>
23#include <mach/hardware.h> 24#include <mach/hardware.h>
24 25
25MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); 26MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
@@ -35,15 +36,12 @@ static void ixp4xx_spkr_control(unsigned int pin, unsigned int count)
35 36
36 spin_lock_irqsave(&beep_lock, flags); 37 spin_lock_irqsave(&beep_lock, flags);
37 38
38 if (count) { 39 if (count) {
39 gpio_line_config(pin, IXP4XX_GPIO_OUT); 40 gpio_direction_output(pin, 0);
40 gpio_line_set(pin, IXP4XX_GPIO_LOW);
41
42 *IXP4XX_OSRT2 = (count & ~IXP4XX_OST_RELOAD_MASK) | IXP4XX_OST_ENABLE; 41 *IXP4XX_OSRT2 = (count & ~IXP4XX_OST_RELOAD_MASK) | IXP4XX_OST_ENABLE;
43 } else { 42 } else {
44 gpio_line_config(pin, IXP4XX_GPIO_IN); 43 gpio_direction_output(pin, 1);
45 gpio_line_set(pin, IXP4XX_GPIO_HIGH); 44 gpio_direction_input(pin);
46
47 *IXP4XX_OSRT2 = 0; 45 *IXP4XX_OSRT2 = 0;
48 } 46 }
49 47
@@ -78,11 +76,13 @@ static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned
78 76
79static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id) 77static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id)
80{ 78{
79 unsigned int pin = (unsigned int) dev_id;
80
81 /* clear interrupt */ 81 /* clear interrupt */
82 *IXP4XX_OSST = IXP4XX_OSST_TIMER_2_PEND; 82 *IXP4XX_OSST = IXP4XX_OSST_TIMER_2_PEND;
83 83
84 /* flip the beeper output */ 84 /* flip the beeper output */
85 *IXP4XX_GPIO_GPOUTR ^= (1 << (unsigned int) dev_id); 85 gpio_set_value(pin, !gpio_get_value(pin));
86 86
87 return IRQ_HANDLED; 87 return IRQ_HANDLED;
88} 88}
@@ -110,11 +110,15 @@ static int ixp4xx_spkr_probe(struct platform_device *dev)
110 input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE); 110 input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
111 input_dev->event = ixp4xx_spkr_event; 111 input_dev->event = ixp4xx_spkr_event;
112 112
113 err = gpio_request(dev->id, "ixp4-beeper");
114 if (err)
115 goto err_free_device;
116
113 err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt, 117 err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt,
114 IRQF_NO_SUSPEND, "ixp4xx-beeper", 118 IRQF_NO_SUSPEND, "ixp4xx-beeper",
115 (void *) dev->id); 119 (void *) dev->id);
116 if (err) 120 if (err)
117 goto err_free_device; 121 goto err_free_gpio;
118 122
119 err = input_register_device(input_dev); 123 err = input_register_device(input_dev);
120 if (err) 124 if (err)
@@ -126,6 +130,8 @@ static int ixp4xx_spkr_probe(struct platform_device *dev)
126 130
127 err_free_irq: 131 err_free_irq:
128 free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id); 132 free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id);
133 err_free_gpio:
134 gpio_free(dev->id);
129 err_free_device: 135 err_free_device:
130 input_free_device(input_dev); 136 input_free_device(input_dev);
131 137
@@ -144,6 +150,7 @@ static int ixp4xx_spkr_remove(struct platform_device *dev)
144 ixp4xx_spkr_control(pin, 0); 150 ixp4xx_spkr_control(pin, 0);
145 151
146 free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id); 152 free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id);
153 gpio_free(dev->id);
147 154
148 return 0; 155 return 0;
149} 156}