diff options
Diffstat (limited to 'drivers/video/fbdev/via')
-rw-r--r-- | drivers/video/fbdev/via/via-core.c | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via-gpio.c | 28 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via-gpio.h | 13 |
3 files changed, 28 insertions, 15 deletions
diff --git a/drivers/video/fbdev/via/via-core.c b/drivers/video/fbdev/via/via-core.c index 2c1803eb196f..908524a74a38 100644 --- a/drivers/video/fbdev/via/via-core.c +++ b/drivers/video/fbdev/via/via-core.c @@ -11,7 +11,7 @@ #include <linux/aperture.h> #include <linux/via-core.h> #include <linux/via_i2c.h> -#include <linux/via-gpio.h> +#include "via-gpio.h" #include "global.h" #include <linux/module.h> diff --git a/drivers/video/fbdev/via/via-gpio.c b/drivers/video/fbdev/via/via-gpio.c index f1b670397c02..2719943c06f4 100644 --- a/drivers/video/fbdev/via/via-gpio.c +++ b/drivers/video/fbdev/via/via-gpio.c @@ -7,10 +7,11 @@ #include <linux/spinlock.h> #include <linux/gpio/driver.h> +#include <linux/gpio/machine.h> #include <linux/platform_device.h> #include <linux/via-core.h> -#include <linux/via-gpio.h> #include <linux/export.h> +#include "via-gpio.h" /* * The ports we know about. Note that the port-25 gpios are not @@ -189,19 +190,14 @@ static struct viafb_pm_hooks viafb_gpio_pm_hooks = { }; #endif /* CONFIG_PM */ -/* - * Look up a specific gpio and return the number it was assigned. - */ -int viafb_gpio_lookup(const char *name) -{ - int i; - - for (i = 0; i < viafb_gpio_config.gpio_chip.ngpio; i++) - if (!strcmp(name, viafb_gpio_config.active_gpios[i]->vg_name)) - return viafb_gpio_config.gpio_chip.base + i; - return -1; -} -EXPORT_SYMBOL_GPL(viafb_gpio_lookup); +static struct gpiod_lookup_table viafb_gpio_table = { + .dev_id = "viafb-camera", + .table = { + GPIO_LOOKUP("via-gpio", 2, "VGPIO2", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("via-gpio", 3, "VGPIO3", GPIO_ACTIVE_HIGH), + { } + }, +}; /* * Platform device stuff. @@ -249,12 +245,16 @@ static int viafb_gpio_probe(struct platform_device *platdev) * Get registered. */ viafb_gpio_config.gpio_chip.base = -1; /* Dynamic */ + viafb_gpio_config.gpio_chip.label = "via-gpio"; ret = gpiochip_add_data(&viafb_gpio_config.gpio_chip, &viafb_gpio_config); if (ret) { printk(KERN_ERR "viafb: failed to add gpios (%d)\n", ret); viafb_gpio_config.gpio_chip.ngpio = 0; } + + gpiod_add_lookup_table(&viafb_gpio_table); + #ifdef CONFIG_PM viafb_pm_register(&viafb_gpio_pm_hooks); #endif diff --git a/drivers/video/fbdev/via/via-gpio.h b/drivers/video/fbdev/via/via-gpio.h new file mode 100644 index 000000000000..2ffedf282f7e --- /dev/null +++ b/drivers/video/fbdev/via/via-gpio.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Support for viafb GPIO ports. + * + * Copyright 2009 Jonathan Corbet <corbet@lwn.net> + */ + +#ifndef __VIA_GPIO_H__ +#define __VIA_GPIO_H__ + +extern int viafb_gpio_init(void); +extern void viafb_gpio_exit(void); +#endif |