summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-08-14 21:59:55 -0700
committerLinus Walleij <linus.walleij@linaro.org>2017-08-23 09:16:35 +0200
commit3946d18765be0b0fe278bea4f87a54cf13858019 (patch)
tree4709f78ae2fb3857c7efaf8ef39c7008b667d724 /drivers/gpio
parent33f5dc84680878fb077bd4bcab587e4a5ce228f7 (diff)
downloadlinux-3946d18765be0b0fe278bea4f87a54cf13858019.tar.bz2
gpio: add gpio_add_lookup_tables() to add several tables at once
When converting legacy board to use gpiod API() there might be several lookup tables in board file, let's provide a way to register them all at once. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 18bba1748a35..e452768f316d 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -3011,6 +3011,23 @@ void gpiod_set_raw_array_value_cansleep(unsigned int array_size,
EXPORT_SYMBOL_GPL(gpiod_set_raw_array_value_cansleep);
/**
+ * gpiod_add_lookup_tables() - register GPIO device consumers
+ * @tables: list of tables of consumers to register
+ * @n: number of tables in the list
+ */
+void gpiod_add_lookup_tables(struct gpiod_lookup_table **tables, size_t n)
+{
+ unsigned int i;
+
+ mutex_lock(&gpio_lookup_lock);
+
+ for (i = 0; i < n; i++)
+ list_add_tail(&tables[i]->list, &gpio_lookup_list);
+
+ mutex_unlock(&gpio_lookup_lock);
+}
+
+/**
* gpiod_set_array_value_cansleep() - assign values to an array of GPIOs
* @array_size: number of elements in the descriptor / value arrays
* @desc_array: array of GPIO descriptors whose values will be assigned