All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/3] gpiolib: Switch to for_each_set_bit()
@ 2017-01-03 17:01 Andy Shevchenko
  2017-01-03 17:01 ` [PATCH v1 2/3] gpiolib: Update documentation of struct acpi_gpio_info Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Andy Shevchenko @ 2017-01-03 17:01 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot, linux-gpio, Mika Westerberg
  Cc: Andy Shevchenko

The macro for_each_set_bit() effectively looks up to the next set bit in array
of bits.

Instead of open coding that switch to for_each_set_bit() in
gpio_chip_set_multiple().

While here, make gpio_chip_set_multiple() non-destructive against its
parameters. We are safe since all callers, i.e.
gpiod_set_array_value_complex(), handle that already.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index f4c26c7826cd..7f51c9bf5533 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1,3 +1,4 @@
+#include <linux/bitops.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
@@ -2570,18 +2571,11 @@ static void gpio_chip_set_multiple(struct gpio_chip *chip,
 	if (chip->set_multiple) {
 		chip->set_multiple(chip, mask, bits);
 	} else {
-		int i;
-		for (i = 0; i < chip->ngpio; i++) {
-			if (mask[BIT_WORD(i)] == 0) {
-				/* no more set bits in this mask word;
-				 * skip ahead to the next word */
-				i = (BIT_WORD(i) + 1) * BITS_PER_LONG - 1;
-				continue;
-			}
-			/* set outputs if the corresponding mask bit is set */
-			if (__test_and_clear_bit(i, mask))
-				chip->set(chip, i, test_bit(i, bits));
-		}
+		unsigned int i;
+
+		/* set outputs if the corresponding mask bit is set */
+		for_each_set_bit(i, mask, chip->ngpio)
+			chip->set(chip, i, test_bit(i, bits));
 	}
 }
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v1 2/3] gpiolib: Update documentation of struct acpi_gpio_info
  2017-01-03 17:01 [PATCH v1 1/3] gpiolib: Switch to for_each_set_bit() Andy Shevchenko
@ 2017-01-03 17:01 ` Andy Shevchenko
  2017-01-04 12:37   ` Mika Westerberg
  2017-01-11 11:10   ` Linus Walleij
  2017-01-03 17:01 ` [PATCH v1 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO Andy Shevchenko
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 10+ messages in thread
From: Andy Shevchenko @ 2017-01-03 17:01 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot, linux-gpio, Mika Westerberg
  Cc: Andy Shevchenko, Christophe RICARD

It seems the code had been changed, but description left untouched.

Update description of the struct acpi_gpio_info and relative comments
accordingly.

Fixes: commit 52044723cd27 ("ACPI / gpio: Add irq_type when a GPIO is used as an interrupt")
Cc: Christophe RICARD <christophe.ricard@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib-acpi.c | 5 ++---
 drivers/gpio/gpiolib.h      | 3 ++-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index a3faefa44f68..9b37a3692b3f 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -416,9 +416,8 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
 			agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT;
 
 		/*
-		 * ActiveLow is only specified for GpioInt resource. If
-		 * GpioIo is used then the only way to set the flag is
-		 * to use _DSD "gpios" property.
+		 * Polarity and triggering are only specified for GpioInt
+		 * resource.
 		 * Note: we expect here:
 		 * - ACPI_ACTIVE_LOW == GPIO_ACTIVE_LOW
 		 * - ACPI_ACTIVE_HIGH == GPIO_ACTIVE_HIGH
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
index d10eaf520860..2495b7ee1b42 100644
--- a/drivers/gpio/gpiolib.h
+++ b/drivers/gpio/gpiolib.h
@@ -76,7 +76,8 @@ struct gpio_device {
 /**
  * struct acpi_gpio_info - ACPI GPIO specific information
  * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
- * @active_low: in case of @gpioint, the pin is active low
+ * @polarity: interrupt polarity as provided by ACPI
+ * @triggering: triggering type as provided by ACPI
  */
 struct acpi_gpio_info {
 	bool gpioint;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v1 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO
  2017-01-03 17:01 [PATCH v1 1/3] gpiolib: Switch to for_each_set_bit() Andy Shevchenko
  2017-01-03 17:01 ` [PATCH v1 2/3] gpiolib: Update documentation of struct acpi_gpio_info Andy Shevchenko
@ 2017-01-03 17:01 ` Andy Shevchenko
  2017-01-04 12:52   ` Mika Westerberg
  2017-01-04 12:58 ` [PATCH v1 1/3] gpiolib: Switch to for_each_set_bit() Mika Westerberg
  2017-01-11 11:08 ` Linus Walleij
  3 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2017-01-03 17:01 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot, linux-gpio, Mika Westerberg
  Cc: Andy Shevchenko

Make fwnode_get_named_gpiod() consistent with the rest of gpiod_get() like API,
i.e. configure GPIO pin immediately after request.

Besides obvious clean up it will help to configure pins based on firmware
provided resources.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/devres.c                     |  9 +++++++--
 drivers/gpio/gpiolib.c                    | 20 ++++++++++++++++----
 drivers/input/keyboard/gpio_keys.c        |  9 +--------
 drivers/input/keyboard/gpio_keys_polled.c | 11 ++---------
 drivers/leds/leds-gpio.c                  |  2 +-
 drivers/video/fbdev/amba-clcd-nomadik.c   | 15 +++++----------
 include/linux/gpio/consumer.h             | 19 +++++++++++++------
 7 files changed, 45 insertions(+), 40 deletions(-)

diff --git a/drivers/gpio/devres.c b/drivers/gpio/devres.c
index 54da61112752..3da9c39fed04 100644
--- a/drivers/gpio/devres.c
+++ b/drivers/gpio/devres.c
@@ -129,13 +129,18 @@ EXPORT_SYMBOL(devm_gpiod_get_index);
  * @dev:	GPIO consumer
  * @con_id:	function within the GPIO consumer
  * @child:	firmware node (child of @dev)
+ * @flags:	GPIO initialization flags
  *
  * GPIO descriptors returned from this function are automatically disposed on
  * driver detach.
+ *
+ * On successfull request the GPIO pin is configured in accordance with
+ * provided @flags.
  */
 struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
 					    const char *con_id,
-					    struct fwnode_handle *child)
+					    struct fwnode_handle *child,
+					    enum gpiod_flags flags)
 {
 	char prop_name[32]; /* 32 is max size of property name */
 	struct gpio_desc **dr;
@@ -155,7 +160,7 @@ struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
 			snprintf(prop_name, sizeof(prop_name), "%s",
 					    gpio_suffixes[i]);
 
-		desc = fwnode_get_named_gpiod(child, prop_name);
+		desc = fwnode_get_named_gpiod(child, prop_name, flags);
 		if (!IS_ERR(desc) || (PTR_ERR(desc) != -ENOENT))
 			break;
 	}
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 7f51c9bf5533..38e415642e03 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -3303,6 +3303,7 @@ EXPORT_SYMBOL_GPL(gpiod_get_index);
  * fwnode_get_named_gpiod - obtain a GPIO from firmware node
  * @fwnode:	handle of the firmware node
  * @propname:	name of the firmware property representing the GPIO
+ * @dflags:	GPIO initialization flags
  *
  * This function can be used for drivers that get their configuration
  * from firmware.
@@ -3311,12 +3312,17 @@ EXPORT_SYMBOL_GPL(gpiod_get_index);
  * underlying firmware interface and then makes sure that the GPIO
  * descriptor is requested before it is returned to the caller.
  *
+ * On successfull request the GPIO pin is configured in accordance with
+ * provided @dflags.
+ *
  * In case of error an ERR_PTR() is returned.
  */
 struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
-					 const char *propname)
+					 const char *propname,
+					 enum gpiod_flags dflags)
 {
 	struct gpio_desc *desc = ERR_PTR(-ENODEV);
+	unsigned long lflags = 0;
 	bool active_low = false;
 	bool single_ended = false;
 	int ret;
@@ -3349,13 +3355,19 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
 		return ERR_PTR(ret);
 
 	if (active_low)
-		set_bit(FLAG_ACTIVE_LOW, &desc->flags);
+		lflags |= GPIO_ACTIVE_LOW;
 
 	if (single_ended) {
 		if (active_low)
-			set_bit(FLAG_OPEN_DRAIN, &desc->flags);
+			lflags |= GPIO_OPEN_DRAIN;
 		else
-			set_bit(FLAG_OPEN_SOURCE, &desc->flags);
+			lflags |= GPIO_OPEN_SOURCE;
+	}
+
+	ret = gpiod_configure_flags(desc, propname, lflags, dflags);
+	if (ret < 0) {
+		gpiod_put(desc);
+		return ERR_PTR(ret);
 	}
 
 	return desc;
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 582462d0af75..9de4b876100a 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -481,7 +481,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
 	spin_lock_init(&bdata->lock);
 
 	if (child) {
-		bdata->gpiod = devm_get_gpiod_from_child(dev, NULL, child);
+		bdata->gpiod = devm_get_gpiod_from_child(dev, NULL, child, GPIOD_IN);
 		if (IS_ERR(bdata->gpiod)) {
 			error = PTR_ERR(bdata->gpiod);
 			if (error == -ENOENT) {
@@ -496,13 +496,6 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
 						error);
 				return error;
 			}
-		} else {
-			error = gpiod_direction_input(bdata->gpiod);
-			if (error) {
-				dev_err(dev, "Failed to configure GPIO %d as input: %d\n",
-					desc_to_gpio(bdata->gpiod), error);
-				return error;
-			}
 		}
 	} else if (gpio_is_valid(button->gpio)) {
 		/*
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
index bed4f2086158..fd7ab4dad87b 100644
--- a/drivers/input/keyboard/gpio_keys_polled.c
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -304,7 +304,8 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
 			}
 
 			bdata->gpiod = devm_get_gpiod_from_child(dev, NULL,
-								 child);
+								 child,
+								 GPIOD_IN);
 			if (IS_ERR(bdata->gpiod)) {
 				error = PTR_ERR(bdata->gpiod);
 				if (error != -EPROBE_DEFER)
@@ -314,14 +315,6 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
 				fwnode_handle_put(child);
 				return error;
 			}
-
-			error = gpiod_direction_input(bdata->gpiod);
-			if (error) {
-				dev_err(dev, "Failed to configure GPIO %d as input: %d\n",
-					desc_to_gpio(bdata->gpiod), error);
-				fwnode_handle_put(child);
-				return error;
-			}
 		} else if (gpio_is_valid(button->gpio)) {
 			/*
 			 * Legacy GPIO number so request the GPIO here and
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index d400dcaf4d29..00cc671cddcc 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -174,7 +174,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
 		const char *state = NULL;
 		struct device_node *np = to_of_node(child);
 
-		led.gpiod = devm_get_gpiod_from_child(dev, NULL, child);
+		led.gpiod = devm_get_gpiod_from_child(dev, NULL, child, GPIOD_ASIS);
 		if (IS_ERR(led.gpiod)) {
 			fwnode_handle_put(child);
 			return ERR_CAST(led.gpiod);
diff --git a/drivers/video/fbdev/amba-clcd-nomadik.c b/drivers/video/fbdev/amba-clcd-nomadik.c
index 0c06fcaaa6e8..2e800d70b0e5 100644
--- a/drivers/video/fbdev/amba-clcd-nomadik.c
+++ b/drivers/video/fbdev/amba-clcd-nomadik.c
@@ -184,32 +184,27 @@ static void tpg110_init(struct device *dev, struct device_node *np,
 {
 	dev_info(dev, "TPG110 display init\n");
 
-	grestb = devm_get_gpiod_from_child(dev, "grestb", &np->fwnode);
+	/* This asserts the GRESTB signal, putting the display into reset */
+	grestb = devm_get_gpiod_from_child(dev, "grestb", &np->fwnode, GPIOD_OUT_HIGH);
 	if (IS_ERR(grestb)) {
 		dev_err(dev, "no GRESTB GPIO\n");
 		return;
 	}
-	/* This asserts the GRESTB signal, putting the display into reset */
-	gpiod_direction_output(grestb, 1);
-
-	scen = devm_get_gpiod_from_child(dev, "scen", &np->fwnode);
+	scen = devm_get_gpiod_from_child(dev, "scen", &np->fwnode, GPIOD_OUT_LOW);
 	if (IS_ERR(scen)) {
 		dev_err(dev, "no SCEN GPIO\n");
 		return;
 	}
-	gpiod_direction_output(scen, 0);
-	scl = devm_get_gpiod_from_child(dev, "scl", &np->fwnode);
+	scl = devm_get_gpiod_from_child(dev, "scl", &np->fwnode, GPIOD_OUT_LOW);
 	if (IS_ERR(scl)) {
 		dev_err(dev, "no SCL GPIO\n");
 		return;
 	}
-	gpiod_direction_output(scl, 0);
-	sda = devm_get_gpiod_from_child(dev, "sda", &np->fwnode);
+	sda = devm_get_gpiod_from_child(dev, "sda", &np->fwnode, GPIOD_OUT_LOW);
 	if (IS_ERR(sda)) {
 		dev_err(dev, "no SDA GPIO\n");
 		return;
 	}
-	gpiod_direction_output(sda, 0);
 	board->enable = tpg110_enable;
 	board->disable = tpg110_disable;
 }
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index fb0fde686cb1..930d10049d8d 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -135,10 +135,12 @@ int desc_to_gpio(const struct gpio_desc *desc);
 struct fwnode_handle;
 
 struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
-					 const char *propname);
+					 const char *propname,
+					 enum gpiod_flags dflags);
 struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
 					    const char *con_id,
-					    struct fwnode_handle *child);
+					    struct fwnode_handle *child,
+					    enum gpiod_flags flags);
 #else /* CONFIG_GPIOLIB */
 
 static inline int gpiod_count(struct device *dev, const char *con_id)
@@ -411,14 +413,19 @@ static inline int desc_to_gpio(const struct gpio_desc *desc)
 /* Child properties interface */
 struct fwnode_handle;
 
-static inline struct gpio_desc *fwnode_get_named_gpiod(
-	struct fwnode_handle *fwnode, const char *propname)
+static inline
+struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
+					 const char *propname,
+					 enum gpiod_flags dflags)
 {
 	return ERR_PTR(-ENOSYS);
 }
 
-static inline struct gpio_desc *devm_get_gpiod_from_child(
-	struct device *dev, const char *con_id, struct fwnode_handle *child)
+static inline
+struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
+					    const char *con_id,
+					    struct fwnode_handle *child,
+					    enum gpiod_flags flags)
 {
 	return ERR_PTR(-ENOSYS);
 }
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 2/3] gpiolib: Update documentation of struct acpi_gpio_info
  2017-01-03 17:01 ` [PATCH v1 2/3] gpiolib: Update documentation of struct acpi_gpio_info Andy Shevchenko
@ 2017-01-04 12:37   ` Mika Westerberg
  2017-01-11 11:10   ` Linus Walleij
  1 sibling, 0 replies; 10+ messages in thread
From: Mika Westerberg @ 2017-01-04 12:37 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Linus Walleij, Alexandre Courbot, linux-gpio, Christophe RICARD

On Tue, Jan 03, 2017 at 07:01:18PM +0200, Andy Shevchenko wrote:
> It seems the code had been changed, but description left untouched.
> 
> Update description of the struct acpi_gpio_info and relative comments
> accordingly.
> 
> Fixes: commit 52044723cd27 ("ACPI / gpio: Add irq_type when a GPIO is used as an interrupt")
> Cc: Christophe RICARD <christophe.ricard@gmail.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO
  2017-01-03 17:01 ` [PATCH v1 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO Andy Shevchenko
@ 2017-01-04 12:52   ` Mika Westerberg
  2017-01-09 13:49     ` Andy Shevchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Mika Westerberg @ 2017-01-04 12:52 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Linus Walleij, Alexandre Courbot, linux-gpio

On Tue, Jan 03, 2017 at 07:01:19PM +0200, Andy Shevchenko wrote:
> Make fwnode_get_named_gpiod() consistent with the rest of gpiod_get() like API,
> i.e. configure GPIO pin immediately after request.
> 
> Besides obvious clean up it will help to configure pins based on firmware
> provided resources.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/devres.c                     |  9 +++++++--
>  drivers/gpio/gpiolib.c                    | 20 ++++++++++++++++----
>  drivers/input/keyboard/gpio_keys.c        |  9 +--------
>  drivers/input/keyboard/gpio_keys_polled.c | 11 ++---------
>  drivers/leds/leds-gpio.c                  |  2 +-
>  drivers/video/fbdev/amba-clcd-nomadik.c   | 15 +++++----------
>  include/linux/gpio/consumer.h             | 19 +++++++++++++------
>  7 files changed, 45 insertions(+), 40 deletions(-)
> 
> diff --git a/drivers/gpio/devres.c b/drivers/gpio/devres.c
> index 54da61112752..3da9c39fed04 100644
> --- a/drivers/gpio/devres.c
> +++ b/drivers/gpio/devres.c
> @@ -129,13 +129,18 @@ EXPORT_SYMBOL(devm_gpiod_get_index);
>   * @dev:	GPIO consumer
>   * @con_id:	function within the GPIO consumer
>   * @child:	firmware node (child of @dev)
> + * @flags:	GPIO initialization flags

Please call this 'dflags' as it is called elsewhere as well.

Otherwise looks reasonable to me.

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 1/3] gpiolib: Switch to for_each_set_bit()
  2017-01-03 17:01 [PATCH v1 1/3] gpiolib: Switch to for_each_set_bit() Andy Shevchenko
  2017-01-03 17:01 ` [PATCH v1 2/3] gpiolib: Update documentation of struct acpi_gpio_info Andy Shevchenko
  2017-01-03 17:01 ` [PATCH v1 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO Andy Shevchenko
@ 2017-01-04 12:58 ` Mika Westerberg
  2017-01-11 11:08 ` Linus Walleij
  3 siblings, 0 replies; 10+ messages in thread
From: Mika Westerberg @ 2017-01-04 12:58 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Linus Walleij, Alexandre Courbot, linux-gpio

On Tue, Jan 03, 2017 at 07:01:17PM +0200, Andy Shevchenko wrote:
> The macro for_each_set_bit() effectively looks up to the next set bit in array
> of bits.
> 
> Instead of open coding that switch to for_each_set_bit() in
> gpio_chip_set_multiple().
> 
> While here, make gpio_chip_set_multiple() non-destructive against its
> parameters. We are safe since all callers, i.e.
> gpiod_set_array_value_complex(), handle that already.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO
  2017-01-04 12:52   ` Mika Westerberg
@ 2017-01-09 13:49     ` Andy Shevchenko
  2017-01-09 13:59       ` Mika Westerberg
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2017-01-09 13:49 UTC (permalink / raw)
  To: Mika Westerberg; +Cc: Linus Walleij, Alexandre Courbot, linux-gpio

On Wed, 2017-01-04 at 14:52 +0200, Mika Westerberg wrote:
> On Tue, Jan 03, 2017 at 07:01:19PM +0200, Andy Shevchenko wrote:
> > Make fwnode_get_named_gpiod() consistent with the rest of
> > gpiod_get() like API,
> > i.e. configure GPIO pin immediately after request.
> > 
> > Besides obvious clean up it will help to configure pins based on
> > firmware
> > provided resources.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  drivers/gpio/devres.c                     |  9 +++++++--
> >  drivers/gpio/gpiolib.c                    | 20 ++++++++++++++++----
> >  drivers/input/keyboard/gpio_keys.c        |  9 +--------
> >  drivers/input/keyboard/gpio_keys_polled.c | 11 ++---------
> >  drivers/leds/leds-gpio.c                  |  2 +-
> >  drivers/video/fbdev/amba-clcd-nomadik.c   | 15 +++++----------
> >  include/linux/gpio/consumer.h             | 19 +++++++++++++------
> >  7 files changed, 45 insertions(+), 40 deletions(-)
> > 
> > diff --git a/drivers/gpio/devres.c b/drivers/gpio/devres.c
> > index 54da61112752..3da9c39fed04 100644
> > --- a/drivers/gpio/devres.c
> > +++ b/drivers/gpio/devres.c
> > @@ -129,13 +129,18 @@ EXPORT_SYMBOL(devm_gpiod_get_index);
> >   * @dev:	GPIO consumer
> >   * @con_id:	function within the GPIO consumer
> >   * @child:	firmware node (child of @dev)
> > + * @flags:	GPIO initialization flags
> 
> Please call this 'dflags' as it is called elsewhere as well.

Elsewhere in this file it's called 'flags'. I would stick with that
(btw, my internal first version used to have 'dflags').

> 
> Otherwise looks reasonable to me.
> 
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO
  2017-01-09 13:49     ` Andy Shevchenko
@ 2017-01-09 13:59       ` Mika Westerberg
  0 siblings, 0 replies; 10+ messages in thread
From: Mika Westerberg @ 2017-01-09 13:59 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Linus Walleij, Alexandre Courbot, linux-gpio

On Mon, Jan 09, 2017 at 03:49:32PM +0200, Andy Shevchenko wrote:
> > Please call this 'dflags' as it is called elsewhere as well.
> 
> Elsewhere in this file it's called 'flags'. I would stick with that
> (btw, my internal first version used to have 'dflags').

Fair enough :)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 1/3] gpiolib: Switch to for_each_set_bit()
  2017-01-03 17:01 [PATCH v1 1/3] gpiolib: Switch to for_each_set_bit() Andy Shevchenko
                   ` (2 preceding siblings ...)
  2017-01-04 12:58 ` [PATCH v1 1/3] gpiolib: Switch to for_each_set_bit() Mika Westerberg
@ 2017-01-11 11:08 ` Linus Walleij
  3 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2017-01-11 11:08 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Alexandre Courbot, linux-gpio, Mika Westerberg

On Tue, Jan 3, 2017 at 6:01 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> The macro for_each_set_bit() effectively looks up to the next set bit in array
> of bits.
>
> Instead of open coding that switch to for_each_set_bit() in
> gpio_chip_set_multiple().
>
> While here, make gpio_chip_set_multiple() non-destructive against its
> parameters. We are safe since all callers, i.e.
> gpiod_set_array_value_complex(), handle that already.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Irrestible clarification patch, applied with Mika's review tag.
Thanks!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 2/3] gpiolib: Update documentation of struct acpi_gpio_info
  2017-01-03 17:01 ` [PATCH v1 2/3] gpiolib: Update documentation of struct acpi_gpio_info Andy Shevchenko
  2017-01-04 12:37   ` Mika Westerberg
@ 2017-01-11 11:10   ` Linus Walleij
  1 sibling, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2017-01-11 11:10 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Alexandre Courbot, linux-gpio, Mika Westerberg, Christophe RICARD

On Tue, Jan 3, 2017 at 6:01 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> It seems the code had been changed, but description left untouched.
>
> Update description of the struct acpi_gpio_info and relative comments
> accordingly.
>
> Fixes: commit 52044723cd27 ("ACPI / gpio: Add irq_type when a GPIO is used as an interrupt")
> Cc: Christophe RICARD <christophe.ricard@gmail.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Patch applied with Mika's ACK.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-01-11 11:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-03 17:01 [PATCH v1 1/3] gpiolib: Switch to for_each_set_bit() Andy Shevchenko
2017-01-03 17:01 ` [PATCH v1 2/3] gpiolib: Update documentation of struct acpi_gpio_info Andy Shevchenko
2017-01-04 12:37   ` Mika Westerberg
2017-01-11 11:10   ` Linus Walleij
2017-01-03 17:01 ` [PATCH v1 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO Andy Shevchenko
2017-01-04 12:52   ` Mika Westerberg
2017-01-09 13:49     ` Andy Shevchenko
2017-01-09 13:59       ` Mika Westerberg
2017-01-04 12:58 ` [PATCH v1 1/3] gpiolib: Switch to for_each_set_bit() Mika Westerberg
2017-01-11 11:08 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.