diff options
Diffstat (limited to 'drivers/gpio/wm831x-gpio.c')
-rw-r--r-- | drivers/gpio/wm831x-gpio.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/gpio/wm831x-gpio.c b/drivers/gpio/wm831x-gpio.c index f9c09a54ec7f..b4468b616890 100644 --- a/drivers/gpio/wm831x-gpio.c +++ b/drivers/gpio/wm831x-gpio.c | |||
@@ -22,8 +22,7 @@ | |||
22 | #include <linux/mfd/wm831x/core.h> | 22 | #include <linux/mfd/wm831x/core.h> |
23 | #include <linux/mfd/wm831x/pdata.h> | 23 | #include <linux/mfd/wm831x/pdata.h> |
24 | #include <linux/mfd/wm831x/gpio.h> | 24 | #include <linux/mfd/wm831x/gpio.h> |
25 | 25 | #include <linux/mfd/wm831x/irq.h> | |
26 | #define WM831X_GPIO_MAX 16 | ||
27 | 26 | ||
28 | struct wm831x_gpio { | 27 | struct wm831x_gpio { |
29 | struct wm831x *wm831x; | 28 | struct wm831x *wm831x; |
@@ -80,6 +79,17 @@ static void wm831x_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
80 | value << offset); | 79 | value << offset); |
81 | } | 80 | } |
82 | 81 | ||
82 | static int wm831x_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | ||
83 | { | ||
84 | struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip); | ||
85 | struct wm831x *wm831x = wm831x_gpio->wm831x; | ||
86 | |||
87 | if (!wm831x->irq_base) | ||
88 | return -EINVAL; | ||
89 | |||
90 | return wm831x->irq_base + WM831X_IRQ_GPIO_1 + offset; | ||
91 | } | ||
92 | |||
83 | #ifdef CONFIG_DEBUG_FS | 93 | #ifdef CONFIG_DEBUG_FS |
84 | static void wm831x_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | 94 | static void wm831x_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) |
85 | { | 95 | { |
@@ -175,6 +185,7 @@ static struct gpio_chip template_chip = { | |||
175 | .get = wm831x_gpio_get, | 185 | .get = wm831x_gpio_get, |
176 | .direction_output = wm831x_gpio_direction_out, | 186 | .direction_output = wm831x_gpio_direction_out, |
177 | .set = wm831x_gpio_set, | 187 | .set = wm831x_gpio_set, |
188 | .to_irq = wm831x_gpio_to_irq, | ||
178 | .dbg_show = wm831x_gpio_dbg_show, | 189 | .dbg_show = wm831x_gpio_dbg_show, |
179 | .can_sleep = 1, | 190 | .can_sleep = 1, |
180 | }; | 191 | }; |
@@ -192,7 +203,7 @@ static int __devinit wm831x_gpio_probe(struct platform_device *pdev) | |||
192 | 203 | ||
193 | wm831x_gpio->wm831x = wm831x; | 204 | wm831x_gpio->wm831x = wm831x; |
194 | wm831x_gpio->gpio_chip = template_chip; | 205 | wm831x_gpio->gpio_chip = template_chip; |
195 | wm831x_gpio->gpio_chip.ngpio = WM831X_GPIO_MAX; | 206 | wm831x_gpio->gpio_chip.ngpio = wm831x->num_gpio; |
196 | wm831x_gpio->gpio_chip.dev = &pdev->dev; | 207 | wm831x_gpio->gpio_chip.dev = &pdev->dev; |
197 | if (pdata && pdata->gpio_base) | 208 | if (pdata && pdata->gpio_base) |
198 | wm831x_gpio->gpio_chip.base = pdata->gpio_base; | 209 | wm831x_gpio->gpio_chip.base = pdata->gpio_base; |