aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-16 21:55:20 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-16 21:55:20 -0500
commit2dfea3803dcf70983d14ce1dcbb3e97a7459a28b (patch)
tree59bffc7389ff554585f79d7cc06021790dc2b317 /drivers/gpio
parentaed606e3bc1f10753254db308d3fd8c053c41328 (diff)
parent1881b68b8961a86d40c3c5c205e533515a2dc9c6 (diff)
Merge tag 'mfd-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
Pull MFS update from Samuel Ortiz: "This is the MFD patch set for the 3.8 merge window. We have several new drivers, most of the time coming with their sub devices drivers: - Austria Microsystem's AS3711 - Nano River's viperboard - TI's TPS80031, AM335x TS/ADC, - Realtek's MMC/memstick card reader - Nokia's retu We also got some notable cleanups and improvements: - tps6586x got converted to IRQ domains. - tps65910 and tps65090 moved to the regmap IRQ API. - STMPE is now Device Tree aware. - A general twl6040 and twl-core cleanup, with moves to the regmap I/O and IRQ APIs and a conversion to the recently added PWM framework. - sta2x11 gained regmap support. Then the rest is mostly tiny cleanups and fixes, among which we have Mark's wm5xxx and wm8xxx patchset." Far amount of annoying but largely trivial conflicts. Many due to __devinit/exit removal, others due to one or two of the new drivers also having come in through another tree. * tag 'mfd-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (119 commits) mfd: tps6507x: Convert to devm_kzalloc mfd: stmpe: Update DT support for stmpe driver mfd: wm5102: Add readback of DSP status 3 register mfd: arizona: Log if we fail to create the primary IRQ domain mfd: tps80031: MFD_TPS80031 needs to select REGMAP_IRQ mfd: tps80031: Add terminating entry for tps80031_id_table mfd: sta2x11: Fix potential NULL pointer dereference in __sta2x11_mfd_mask() mfd: wm5102: Add tuning for revision B mfd: arizona: Defer patch initialistation until after first device boot mfd: tps65910: Fix wrong ack_base register mfd: tps65910: Remove unused data mfd: stmpe: Get rid of irq_invert_polarity mfd: ab8500-core: Fix invalid free of devm_ allocated data mfd: wm5102: Mark DSP memory regions as volatile mfd: wm5102: Correct default for LDO1_CONTROL_2 mfd: arizona: Register haptics devices mfd: wm8994: Make current device behaviour the default mfd: tps65090: MFD_TPS65090 needs to select REGMAP_IRQ mfd: Fix stmpe.c build when OF is not enabled mfd: jz4740-adc: Use devm_kzalloc ...
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/Kconfig13
-rw-r--r--drivers/gpio/Makefile1
-rw-r--r--drivers/gpio/gpio-da9052.c6
-rw-r--r--drivers/gpio/gpio-tps6586x.c9
-rw-r--r--drivers/gpio/gpio-twl4030.c12
-rw-r--r--drivers/gpio/gpio-viperboard.c517
6 files changed, 551 insertions, 7 deletions
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index bf892bd68c1..8ae1f5b1966 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -683,4 +683,17 @@ config GPIO_MSIC
683 Enable support for GPIO on intel MSIC controllers found in 683 Enable support for GPIO on intel MSIC controllers found in
684 intel MID devices 684 intel MID devices
685 685
686comment "USB GPIO expanders:"
687
688config GPIO_VIPERBOARD
689 tristate "Viperboard GPIO a & b support"
690 depends on MFD_VIPERBOARD && USB
691 help
692 Say yes here to access the GPIO signals of Nano River
693 Technologies Viperboard. There are two GPIO chips on the
694 board: gpioa and gpiob.
695 See viperboard API specification and Nano
696 River Tech's viperboard.h for detailed meaning
697 of the module parameters.
698
686endif 699endif
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 76b34468325..c5aebd008dd 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -76,6 +76,7 @@ obj-$(CONFIG_GPIO_TS5500) += gpio-ts5500.o
76obj-$(CONFIG_GPIO_TWL4030) += gpio-twl4030.o 76obj-$(CONFIG_GPIO_TWL4030) += gpio-twl4030.o
77obj-$(CONFIG_GPIO_TWL6040) += gpio-twl6040.o 77obj-$(CONFIG_GPIO_TWL6040) += gpio-twl6040.o
78obj-$(CONFIG_GPIO_UCB1400) += gpio-ucb1400.o 78obj-$(CONFIG_GPIO_UCB1400) += gpio-ucb1400.o
79obj-$(CONFIG_GPIO_VIPERBOARD) += gpio-viperboard.o
79obj-$(CONFIG_GPIO_VR41XX) += gpio-vr41xx.o 80obj-$(CONFIG_GPIO_VR41XX) += gpio-vr41xx.o
80obj-$(CONFIG_GPIO_VT8500) += gpio-vt8500.o 81obj-$(CONFIG_GPIO_VT8500) += gpio-vt8500.o
81obj-$(CONFIG_GPIO_VX855) += gpio-vx855.o 82obj-$(CONFIG_GPIO_VX855) += gpio-vx855.o
diff --git a/drivers/gpio/gpio-da9052.c b/drivers/gpio/gpio-da9052.c
index a05aacd2777..29b11e9b6a7 100644
--- a/drivers/gpio/gpio-da9052.c
+++ b/drivers/gpio/gpio-da9052.c
@@ -185,7 +185,11 @@ static int da9052_gpio_to_irq(struct gpio_chip *gc, u32 offset)
185 struct da9052_gpio *gpio = to_da9052_gpio(gc); 185 struct da9052_gpio *gpio = to_da9052_gpio(gc);
186 struct da9052 *da9052 = gpio->da9052; 186 struct da9052 *da9052 = gpio->da9052;
187 187
188 return da9052->irq_base + DA9052_IRQ_GPI0 + offset; 188 int irq;
189
190 irq = regmap_irq_get_virq(da9052->irq_data, DA9052_IRQ_GPI0 + offset);
191
192 return irq;
189} 193}
190 194
191static struct gpio_chip reference_gp = { 195static struct gpio_chip reference_gp = {
diff --git a/drivers/gpio/gpio-tps6586x.c b/drivers/gpio/gpio-tps6586x.c
index c1b82da5650..29e8e750bd4 100644
--- a/drivers/gpio/gpio-tps6586x.c
+++ b/drivers/gpio/gpio-tps6586x.c
@@ -80,6 +80,14 @@ static int tps6586x_gpio_output(struct gpio_chip *gc, unsigned offset,
80 val, mask); 80 val, mask);
81} 81}
82 82
83static int tps6586x_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
84{
85 struct tps6586x_gpio *tps6586x_gpio = to_tps6586x_gpio(gc);
86
87 return tps6586x_irq_get_virq(tps6586x_gpio->parent,
88 TPS6586X_INT_PLDO_0 + offset);
89}
90
83static int tps6586x_gpio_probe(struct platform_device *pdev) 91static int tps6586x_gpio_probe(struct platform_device *pdev)
84{ 92{
85 struct tps6586x_platform_data *pdata; 93 struct tps6586x_platform_data *pdata;
@@ -106,6 +114,7 @@ static int tps6586x_gpio_probe(struct platform_device *pdev)
106 tps6586x_gpio->gpio_chip.direction_output = tps6586x_gpio_output; 114 tps6586x_gpio->gpio_chip.direction_output = tps6586x_gpio_output;
107 tps6586x_gpio->gpio_chip.set = tps6586x_gpio_set; 115 tps6586x_gpio->gpio_chip.set = tps6586x_gpio_set;
108 tps6586x_gpio->gpio_chip.get = tps6586x_gpio_get; 116 tps6586x_gpio->gpio_chip.get = tps6586x_gpio_get;
117 tps6586x_gpio->gpio_chip.to_irq = tps6586x_gpio_to_irq;
109 118
110#ifdef CONFIG_OF_GPIO 119#ifdef CONFIG_OF_GPIO
111 tps6586x_gpio->gpio_chip.of_node = pdev->dev.parent->of_node; 120 tps6586x_gpio->gpio_chip.of_node = pdev->dev.parent->of_node;
diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
index 00329f2fc05..9572aa137e6 100644
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@ -355,13 +355,13 @@ static struct gpio_chip twl_gpiochip = {
355 355
356static int gpio_twl4030_pulls(u32 ups, u32 downs) 356static int gpio_twl4030_pulls(u32 ups, u32 downs)
357{ 357{
358 u8 message[6]; 358 u8 message[5];
359 unsigned i, gpio_bit; 359 unsigned i, gpio_bit;
360 360
361 /* For most pins, a pulldown was enabled by default. 361 /* For most pins, a pulldown was enabled by default.
362 * We should have data that's specific to this board. 362 * We should have data that's specific to this board.
363 */ 363 */
364 for (gpio_bit = 1, i = 1; i < 6; i++) { 364 for (gpio_bit = 1, i = 0; i < 5; i++) {
365 u8 bit_mask; 365 u8 bit_mask;
366 unsigned j; 366 unsigned j;
367 367
@@ -380,16 +380,16 @@ static int gpio_twl4030_pulls(u32 ups, u32 downs)
380 380
381static int gpio_twl4030_debounce(u32 debounce, u8 mmc_cd) 381static int gpio_twl4030_debounce(u32 debounce, u8 mmc_cd)
382{ 382{
383 u8 message[4]; 383 u8 message[3];
384 384
385 /* 30 msec of debouncing is always used for MMC card detect, 385 /* 30 msec of debouncing is always used for MMC card detect,
386 * and is optional for everything else. 386 * and is optional for everything else.
387 */ 387 */
388 message[1] = (debounce & 0xff) | (mmc_cd & 0x03); 388 message[0] = (debounce & 0xff) | (mmc_cd & 0x03);
389 debounce >>= 8; 389 debounce >>= 8;
390 message[2] = (debounce & 0xff); 390 message[1] = (debounce & 0xff);
391 debounce >>= 8; 391 debounce >>= 8;
392 message[3] = (debounce & 0x03); 392 message[2] = (debounce & 0x03);
393 393
394 return twl_i2c_write(TWL4030_MODULE_GPIO, message, 394 return twl_i2c_write(TWL4030_MODULE_GPIO, message,
395 REG_GPIO_DEBEN1, 3); 395 REG_GPIO_DEBEN1, 3);
diff --git a/drivers/gpio/gpio-viperboard.c b/drivers/gpio/gpio-viperboard.c
new file mode 100644
index 00000000000..13772996cf2
--- /dev/null
+++ b/drivers/gpio/gpio-viperboard.c
@@ -0,0 +1,517 @@
1/*
2 * Nano River Technologies viperboard GPIO lib driver
3 *
4 * (C) 2012 by Lemonage GmbH
5 * Author: Lars Poeschel <poeschel@lemonage.de>
6 * All rights reserved.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#include <linux/kernel.h>
16#include <linux/errno.h>
17#include <linux/module.h>
18#include <linux/slab.h>
19#include <linux/types.h>
20#include <linux/mutex.h>
21#include <linux/platform_device.h>
22
23#include <linux/usb.h>
24#include <linux/gpio.h>
25
26#include <linux/mfd/viperboard.h>
27
28#define VPRBRD_GPIOA_CLK_1MHZ 0
29#define VPRBRD_GPIOA_CLK_100KHZ 1
30#define VPRBRD_GPIOA_CLK_10KHZ 2
31#define VPRBRD_GPIOA_CLK_1KHZ 3
32#define VPRBRD_GPIOA_CLK_100HZ 4
33#define VPRBRD_GPIOA_CLK_10HZ 5
34
35#define VPRBRD_GPIOA_FREQ_DEFAULT 1000
36
37#define VPRBRD_GPIOA_CMD_CONT 0x00
38#define VPRBRD_GPIOA_CMD_PULSE 0x01
39#define VPRBRD_GPIOA_CMD_PWM 0x02
40#define VPRBRD_GPIOA_CMD_SETOUT 0x03
41#define VPRBRD_GPIOA_CMD_SETIN 0x04
42#define VPRBRD_GPIOA_CMD_SETINT 0x05
43#define VPRBRD_GPIOA_CMD_GETIN 0x06
44
45#define VPRBRD_GPIOB_CMD_SETDIR 0x00
46#define VPRBRD_GPIOB_CMD_SETVAL 0x01
47
48struct vprbrd_gpioa_msg {
49 u8 cmd;
50 u8 clk;
51 u8 offset;
52 u8 t1;
53 u8 t2;
54 u8 invert;
55 u8 pwmlevel;
56 u8 outval;
57 u8 risefall;
58 u8 answer;
59 u8 __fill;
60} __packed;
61