2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-15 08:44:14 +08:00

gpiolib: Add WM8958 support to the WM8994 driver

Several of the GPIOs on the WM8994 are fixed function on the WM8958 so
error out if the user tries to request them with gpiolib.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
This commit is contained in:
Mark Brown 2010-09-01 10:47:16 +01:00
parent 559e0df6b3
commit 4b66672901

View File

@ -35,6 +35,29 @@ static inline struct wm8994_gpio *to_wm8994_gpio(struct gpio_chip *chip)
return container_of(chip, struct wm8994_gpio, gpio_chip); return container_of(chip, struct wm8994_gpio, gpio_chip);
} }
static int wm8994_gpio_request(struct gpio_chip *chip, unsigned offset)
{
struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
struct wm8994 *wm8994 = wm8994_gpio->wm8994;
switch (wm8994->type) {
case WM8958:
switch (offset) {
case 1:
case 2:
case 3:
case 4:
case 6:
return -EINVAL;
}
break;
default:
break;
}
return 0;
}
static int wm8994_gpio_direction_in(struct gpio_chip *chip, unsigned offset) static int wm8994_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
{ {
struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip); struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
@ -136,6 +159,7 @@ static void wm8994_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
static struct gpio_chip template_chip = { static struct gpio_chip template_chip = {
.label = "wm8994", .label = "wm8994",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.request = wm8994_gpio_request,
.direction_input = wm8994_gpio_direction_in, .direction_input = wm8994_gpio_direction_in,
.get = wm8994_gpio_get, .get = wm8994_gpio_get,
.direction_output = wm8994_gpio_direction_out, .direction_output = wm8994_gpio_direction_out,