aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/misc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 01:50:46 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 01:50:46 -0500
commitc2d33069915d1f9b3b1dcc2199af11d4e072b037 (patch)
tree2664fd3c41c2f3223cfbb64793c2ddb8e9087ded /drivers/input/misc
parent8a5dc585d50015af9c079ae2d182dc4c1cd22914 (diff)
parent993571273275bfecb5161806796eb368db234106 (diff)
Merge tag 'gpio-v3.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO changes from Linus Walleij: "Here is the bulk of GPIO changes for the v3.13 development cycle. I've got ACKs for the things that affect other subsystems (or it's my own subsystem, like pinctrl). Most of that pertain to an attempt from my side to consolidate and get rid of custom GPIO implementations in the ARM tree. I will continue doing this. The main change this time is the new GPIO descriptor API, background for this can be found in Corbet's summary from this january in LWN: http://lwn.net/Articles/533632/ Summary: - Merged the GPIO descriptor API from Alexandre Courbot. This is a first step toward trying to get rid of the global GPIO numberspace for the future. - Add an API so that driver can flag that a certain GPIO line is being used by a irqchip backend for generating IRQs, so that we can enforce checks, like not allowing users to switch that line to an output at runtime, since this makes no sense. Implemented corresponding calls in a few select drivers. - ACPI GPIO cleanups, refactorings and switch to using the descriptor-based interface. - Support for the TPS80036 Palmas GPIO variant. - A new driver for the Broadcom Kona GPIO SoC IP block. - Device tree support for the PCF857x driver. - A set of ARM GPIO refactorings with the goal of getting rid of a bunch of custom GPIO implementations from the arch/arm/* tree: * Move the IOP GPIO driver to the GPIO subsystem and fix all users to use the gpiolib API for accessing GPIOs. Delete the old custom GPIO implementation. * Delete the unused custom PXA GPIO implemention. * Convert all users of the IXP4 custom GPIO implementation to use gpiolib and delete the custom implementation. * Delete the custom Gemini GPIO implementation, also completely unused. - Various cleanups and renamings" * tag 'gpio-v3.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (85 commits) gpio: gpio-mxs: Remove unneeded dt checks gpio: pl061: don't depend on CONFIG_ARM gpio: bcm-kona: add missing .owner to struct gpio_chip gpiolib: provide a declaration of seq_file in gpio/driver.h gpiolib: include gpio/consumer.h in of_gpio.h for desc_to_gpio() gpio: provide stubs for devres gpio functions gpiolib: devres: add missing headers gpiolib: make GPIO_DEVRES depend on GPIOLIB gpiolib: devres: fix devm_gpiod_get_index() gpiolib / ACPI: document the GPIO descriptor based interface gpiolib / ACPI: allow passing GPIOF_ACTIVE_LOW for GpioInt resources gpiolib / ACPI: add ACPI support for gpiod_get_index() gpiolib / ACPI: convert to gpiod interfaces gpiolib: add gpiod_get() and gpiod_put() functions gpiolib: port of_ functions to use gpiod gpiolib: export descriptor-based GPIO interface Fixup "MAINTAINERS: GPIO-INTEL-MID: add maintainer" gpio: bcm281xx: Don't print addresses of GPIO area in probe() gpio: tegra: use new gpio_lock_as_irq() API gpio: rcar: Include linux/of.h header ...
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}