All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Unify gpiod_get*() API
@ 2017-01-09 14:02 Andy Shevchenko
  2017-01-09 14:02 ` [PATCH v2 1/3] gpiolib: Switch to for_each_set_bit() Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Andy Shevchenko @ 2017-01-09 14:02 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot, linux-gpio, Mika Westerberg
  Cc: Andy Shevchenko

By some reason fwnode_get_named_gpiod() doesn't take flags as argument and each
caller has to cope with it.

Unify API here. Do couple obvious clean ups beforehand.

Since v1:
- append Mika's tags

Andy Shevchenko (3):
  gpiolib: Switch to for_each_set_bit()
  gpiolib: Update documentation of struct acpi_gpio_info
  gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO

 drivers/gpio/devres.c                     |  9 ++++++--
 drivers/gpio/gpiolib-acpi.c               |  5 ++--
 drivers/gpio/gpiolib.c                    | 38 ++++++++++++++++++-------------
 drivers/gpio/gpiolib.h                    |  3 ++-
 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 +++++++++++-----
 9 files changed, 55 insertions(+), 56 deletions(-)

-- 
2.11.0


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

* [PATCH v2 1/3] gpiolib: Switch to for_each_set_bit()
  2017-01-09 14:02 [PATCH v2 0/3] Unify gpiod_get*() API Andy Shevchenko
@ 2017-01-09 14:02 ` Andy Shevchenko
  2017-01-11 11:11   ` Linus Walleij
  2017-01-09 14:02 ` [PATCH v2 2/3] gpiolib: Update documentation of struct acpi_gpio_info Andy Shevchenko
  2017-01-09 14:02 ` [PATCH v2 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO Andy Shevchenko
  2 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2017-01-09 14:02 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.

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
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] 15+ messages in thread

* [PATCH v2 2/3] gpiolib: Update documentation of struct acpi_gpio_info
  2017-01-09 14:02 [PATCH v2 0/3] Unify gpiod_get*() API Andy Shevchenko
  2017-01-09 14:02 ` [PATCH v2 1/3] gpiolib: Switch to for_each_set_bit() Andy Shevchenko
@ 2017-01-09 14:02 ` Andy Shevchenko
  2017-01-11 11:11   ` Linus Walleij
  2017-01-09 14:02 ` [PATCH v2 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO Andy Shevchenko
  2 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2017-01-09 14:02 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>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.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] 15+ messages in thread

* [PATCH v2 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO
  2017-01-09 14:02 [PATCH v2 0/3] Unify gpiod_get*() API Andy Shevchenko
  2017-01-09 14:02 ` [PATCH v2 1/3] gpiolib: Switch to for_each_set_bit() Andy Shevchenko
  2017-01-09 14:02 ` [PATCH v2 2/3] gpiolib: Update documentation of struct acpi_gpio_info Andy Shevchenko
@ 2017-01-09 14:02 ` Andy Shevchenko
  2017-01-11 12:21   ` Linus Walleij
  2017-01-17 15:05   ` Linus Walleij
  2 siblings, 2 replies; 15+ messages in thread
From: Andy Shevchenko @ 2017-01-09 14:02 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.

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
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] 15+ messages in thread

* Re: [PATCH v2 1/3] gpiolib: Switch to for_each_set_bit()
  2017-01-09 14:02 ` [PATCH v2 1/3] gpiolib: Switch to for_each_set_bit() Andy Shevchenko
@ 2017-01-11 11:11   ` Linus Walleij
  0 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2017-01-11 11:11 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Alexandre Courbot, linux-gpio, Mika Westerberg

On Mon, Jan 9, 2017 at 3:02 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.
>
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

I hope v1 is just as fine. It looks the same.

Yours,
Linus Walleij

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

* Re: [PATCH v2 2/3] gpiolib: Update documentation of struct acpi_gpio_info
  2017-01-09 14:02 ` [PATCH v2 2/3] gpiolib: Update documentation of struct acpi_gpio_info Andy Shevchenko
@ 2017-01-11 11:11   ` Linus Walleij
  2017-01-11 11:42     ` Andy Shevchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Linus Walleij @ 2017-01-11 11:11 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Alexandre Courbot, linux-gpio, Mika Westerberg, Christophe RICARD

On Mon, Jan 9, 2017 at 3:02 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>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

This too seems identical to v1.

Yours,
Linus Walleij

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

* Re: [PATCH v2 2/3] gpiolib: Update documentation of struct acpi_gpio_info
  2017-01-11 11:11   ` Linus Walleij
@ 2017-01-11 11:42     ` Andy Shevchenko
  0 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2017-01-11 11:42 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Alexandre Courbot, linux-gpio, Mika Westerberg, Christophe RICARD

On Wed, 2017-01-11 at 12:11 +0100, Linus Walleij wrote:
> On Mon, Jan 9, 2017 at 3:02 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>
> > Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> This too seems identical to v1.

Yes, and patch 3 after discussion stays same.

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

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

* Re: [PATCH v2 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO
  2017-01-09 14:02 ` [PATCH v2 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO Andy Shevchenko
@ 2017-01-11 12:21   ` Linus Walleij
  2017-01-11 13:35     ` Andy Shevchenko
  2017-01-17 15:05   ` Linus Walleij
  1 sibling, 1 reply; 15+ messages in thread
From: Linus Walleij @ 2017-01-11 12:21 UTC (permalink / raw)
  To: Andy Shevchenko, Alexander Stein
  Cc: Alexandre Courbot, linux-gpio, Mika Westerberg

On Mon, Jan 9, 2017 at 3:02 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> 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.
>
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

This is overall fine. However I have another patch in the works from
Alexander Stein to pass down the label to the core properly, can you look
at this patch too, so we don't have to mess around too much?
http://marc.info/?l=linux-gpio&m=148179211709228&w=2

Which patch should we base on which patch? Or can they be
combined into one?

That patch has been held back awaiting ACKs and already
has an ACK from Jacek so I would merge it first. Could you
rebase this patch on top of Alexander's patch?

Yours,
Linus Walleij

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

* Re: [PATCH v2 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO
  2017-01-11 12:21   ` Linus Walleij
@ 2017-01-11 13:35     ` Andy Shevchenko
  2017-01-11 14:14       ` Andy Shevchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2017-01-11 13:35 UTC (permalink / raw)
  To: Linus Walleij, Alexander Stein
  Cc: Alexandre Courbot, linux-gpio, Mika Westerberg

On Wed, 2017-01-11 at 13:21 +0100, Linus Walleij wrote:
> On Mon, Jan 9, 2017 at 3:02 PM, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> 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.
> > 
> > Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> This is overall fine. However I have another patch in the works from
> Alexander Stein to pass down the label to the core properly, can you
> look
> at this patch too, so we don't have to mess around too much?
> http://marc.info/?l=linux-gpio&m=148179211709228&w=2
> 
> Which patch should we base on which patch? Or can they be
> combined into one?



> That patch has been held back awaiting ACKs and already
> has an ACK from Jacek so I would merge it first. Could you
> rebase this patch on top of Alexander's patch?
> 

At the first glance looks okay to just merge it. 
Means I don't see it might affect functionality of what I'm trying to
do.

So, please, go ahead and thanks for pointing out. I will prepare mine on
top of it.

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

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

* Re: [PATCH v2 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO
  2017-01-11 13:35     ` Andy Shevchenko
@ 2017-01-11 14:14       ` Andy Shevchenko
  2017-01-12  7:27         ` Alexander Stein
  0 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2017-01-11 14:14 UTC (permalink / raw)
  To: Linus Walleij, Alexander Stein
  Cc: Alexandre Courbot, linux-gpio, Mika Westerberg

On Wed, 2017-01-11 at 15:35 +0200, Andy Shevchenko wrote:
> On Wed, 2017-01-11 at 13:21 +0100, Linus Walleij wrote:
> > On Mon, Jan 9, 2017 at 3:02 PM, Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:

> > This is overall fine. However I have another patch in the works from
> > Alexander Stein to pass down the label to the core properly, can you
> > look
> > at this patch too, so we don't have to mess around too much?
> > http://marc.info/?l=linux-gpio&m=148179211709228&w=2
> > 
> > Which patch should we base on which patch? Or can they be
> > combined into one?

> > That patch has been held back awaiting ACKs and already
> > has an ACK from Jacek so I would merge it first. Could you
> > rebase this patch on top of Alexander's patch?
> > 
> 
> At the first glance looks okay to just merge it. 
> Means I don't see it might affect functionality of what I'm trying to
> do.
> 
> So, please, go ahead and thanks for pointing out. I will prepare mine
> on
> top of it.

Alas, it doesn't apply clearly. gpio_keys_polled.c has been changed a
lot from that time. So, would you like to fix it yourself?

Since mine is applied clearly I may do other way around, rebase and fix
that patch on top of mine.
How does it sound?

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

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

* Re: [PATCH v2 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO
  2017-01-11 14:14       ` Andy Shevchenko
@ 2017-01-12  7:27         ` Alexander Stein
  2017-01-12 12:15           ` Andy Shevchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Alexander Stein @ 2017-01-12  7:27 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Linus Walleij, Alexandre Courbot, linux-gpio, Mika Westerberg

On Wednesday 11 January 2017 16:14:57, Andy Shevchenko wrote:
> On Wed, 2017-01-11 at 15:35 +0200, Andy Shevchenko wrote:
> > On Wed, 2017-01-11 at 13:21 +0100, Linus Walleij wrote:
> > > On Mon, Jan 9, 2017 at 3:02 PM, Andy Shevchenko
> > > <andriy.shevchenko@linux.intel.com> wrote:
> > > 
> > > This is overall fine. However I have another patch in the works from
> > > Alexander Stein to pass down the label to the core properly, can you
> > > look
> > > at this patch too, so we don't have to mess around too much?
> > > http://marc.info/?l=linux-gpio&m=148179211709228&w=2
> > > 
> > > Which patch should we base on which patch? Or can they be
> > > combined into one?
> > > 
> > > That patch has been held back awaiting ACKs and already
> > > has an ACK from Jacek so I would merge it first. Could you
> > > rebase this patch on top of Alexander's patch?
> > 
> > At the first glance looks okay to just merge it. 
> > Means I don't see it might affect functionality of what I'm trying to
> > do.
> > 
> > So, please, go ahead and thanks for pointing out. I will prepare mine
> > on
> > top of it.
> 
> Alas, it doesn't apply clearly. gpio_keys_polled.c has been changed a
> lot from that time. So, would you like to fix it yourself?
> 
> Since mine is applied clearly I may do other way around, rebase and fix
> that patch on top of mine.
> How does it sound?

Yeah, I noticed that gpio_keys_polled.c has changed meanwhile, so my patch has 
to be modifed anyway. If your patch is applied somewhere I can rebase my 
change on that and resubmit.

Best regards,
Alexander
-- 
Dipl.-Inf. Alexander Stein
SYS TEC electronic GmbH
alexander.stein@systec-electronic.com

Legal and Commercial Address:
Am Windrad 2
08468 Heinsdorfergrund
Germany

Office: +49 (0) 3765 38600-0
Fax:    +49 (0) 3765 38600-4100
 
Managing Directors:
	Director Technology/CEO: Dipl.-Phys. Siegmar Schmidt;
	Director Commercial Affairs/COO: Dipl. Ing. (FH) Armin von Collrepp
Commercial Registry:
	Amtsgericht Chemnitz, HRB 28082; USt.-Id Nr. DE150534010


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

* Re: [PATCH v2 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO
  2017-01-12  7:27         ` Alexander Stein
@ 2017-01-12 12:15           ` Andy Shevchenko
  2017-01-12 12:51             ` Alexander Stein
  0 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2017-01-12 12:15 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Linus Walleij, Alexandre Courbot, linux-gpio, Mika Westerberg

On Thu, 2017-01-12 at 08:27 +0100, Alexander Stein wrote:
> On Wednesday 11 January 2017 16:14:57, Andy Shevchenko wrote:
> > On Wed, 2017-01-11 at 15:35 +0200, Andy Shevchenko wrote:
> > > On Wed, 2017-01-11 at 13:21 +0100, Linus Walleij wrote:
> > > > On Mon, Jan 9, 2017 at 3:02 PM, Andy Shevchenko
> > > > <andriy.shevchenko@linux.intel.com> wrote:
> > > > 

> > Alas, it doesn't apply clearly. gpio_keys_polled.c has been changed
> > a
> > lot from that time. So, would you like to fix it yourself?
> > 
> > Since mine is applied clearly I may do other way around, rebase and
> > fix
> > that patch on top of mine.
> > How does it sound?
> 
> Yeah, I noticed that gpio_keys_polled.c has changed meanwhile, so my
> patch has 
> to be modifed anyway. If your patch is applied somewhere I can rebase
> my 
> change on that and resubmit.

First of all, how do you feel if Linus applies my change first?

Please, keep me in Cc list for new version if you are going to re-
base/re-send.

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

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

* Re: [PATCH v2 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO
  2017-01-12 12:15           ` Andy Shevchenko
@ 2017-01-12 12:51             ` Alexander Stein
  2017-01-12 14:27               ` Andy Shevchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Alexander Stein @ 2017-01-12 12:51 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Linus Walleij, Alexandre Courbot, linux-gpio, Mika Westerberg

On Thursday 12 January 2017 14:15:12, Andy Shevchenko wrote:
> On Thu, 2017-01-12 at 08:27 +0100, Alexander Stein wrote:
> > On Wednesday 11 January 2017 16:14:57, Andy Shevchenko wrote:
> > > On Wed, 2017-01-11 at 15:35 +0200, Andy Shevchenko wrote:
> > > > On Wed, 2017-01-11 at 13:21 +0100, Linus Walleij wrote:
> > > > > On Mon, Jan 9, 2017 at 3:02 PM, Andy Shevchenko
> > > 
> > > > > <andriy.shevchenko@linux.intel.com> wrote:
> > > Alas, it doesn't apply clearly. gpio_keys_polled.c has been changed
> > > a
> > > lot from that time. So, would you like to fix it yourself?
> > > 
> > > Since mine is applied clearly I may do other way around, rebase and
> > > fix
> > > that patch on top of mine.
> > > How does it sound?
> > 
> > Yeah, I noticed that gpio_keys_polled.c has changed meanwhile, so my
> > patch has 
> > to be modifed anyway. If your patch is applied somewhere I can rebase
> > my 
> > change on that and resubmit.
> 
> First of all, how do you feel if Linus applies my change first?

I don't mind. Just go ahead and point me somewhere I can base on.

> Please, keep me in Cc list for new version if you are going to re-
> base/re-send.

Will do.

Best regards,
Alexander
-- 
Dipl.-Inf. Alexander Stein
SYS TEC electronic GmbH
alexander.stein@systec-electronic.com

Legal and Commercial Address:
Am Windrad 2
08468 Heinsdorfergrund
Germany

Office: +49 (0) 3765 38600-0
Fax:    +49 (0) 3765 38600-4100
 
Managing Directors:
	Director Technology/CEO: Dipl.-Phys. Siegmar Schmidt;
	Director Commercial Affairs/COO: Dipl. Ing. (FH) Armin von Collrepp
Commercial Registry:
	Amtsgericht Chemnitz, HRB 28082; USt.-Id Nr. DE150534010


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

* Re: [PATCH v2 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO
  2017-01-12 12:51             ` Alexander Stein
@ 2017-01-12 14:27               ` Andy Shevchenko
  0 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2017-01-12 14:27 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Linus Walleij, Alexandre Courbot, linux-gpio, Mika Westerberg

On Thu, 2017-01-12 at 13:51 +0100, Alexander Stein wrote:
> On Thursday 12 January 2017 14:15:12, Andy Shevchenko wrote:
> > On Thu, 2017-01-12 at 08:27 +0100, Alexander Stein wrote:
> > > On Wednesday 11 January 2017 16:14:57, Andy Shevchenko wrote:
> > > > On Wed, 2017-01-11 at 15:35 +0200, Andy Shevchenko wrote:
> > > > > On Wed, 2017-01-11 at 13:21 +0100, Linus Walleij wrote:
> > > > > > On Mon, Jan 9, 2017 at 3:02 PM, Andy Shevchenko
> > > > > > <andriy.shevchenko@linux.intel.com> wrote:

> > > > Alas, it doesn't apply clearly. gpio_keys_polled.c has been
> > > > changed
> > > > a
> > > > lot from that time. So, would you like to fix it yourself?
> > > > 
> > > > Since mine is applied clearly I may do other way around, rebase
> > > > and
> > > > fix
> > > > that patch on top of mine.
> > > > How does it sound?

> > > Yeah, I noticed that gpio_keys_polled.c has changed meanwhile, so
> > > my
> > > patch has 
> > > to be modifed anyway. If your patch is applied somewhere I can
> > > rebase
> > > my 
> > > change on that and resubmit.

> > First of all, how do you feel if Linus applies my change first?

> I don't mind. Just go ahead and point me somewhere I can base on.

For now the only my topic/uart/rpm branch [1] on bitbucket contains it.
(It also has many other patches, meaning you need to base your branch on
top of gpio-next + cherry-picked the only one from my branch)

[1] https://bitbucket.org/andy-shev/linux/branch/topic%2Fuart%2frpm

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

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

* Re: [PATCH v2 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO
  2017-01-09 14:02 ` [PATCH v2 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO Andy Shevchenko
  2017-01-11 12:21   ` Linus Walleij
@ 2017-01-17 15:05   ` Linus Walleij
  1 sibling, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2017-01-17 15:05 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Alexandre Courbot, linux-gpio, Mika Westerberg

On Mon, Jan 9, 2017 at 3:02 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> 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.
>
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Patch applied. Will apply Alex' patch on top.

Yours,
Linus Walleij

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

end of thread, other threads:[~2017-01-17 15:13 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-09 14:02 [PATCH v2 0/3] Unify gpiod_get*() API Andy Shevchenko
2017-01-09 14:02 ` [PATCH v2 1/3] gpiolib: Switch to for_each_set_bit() Andy Shevchenko
2017-01-11 11:11   ` Linus Walleij
2017-01-09 14:02 ` [PATCH v2 2/3] gpiolib: Update documentation of struct acpi_gpio_info Andy Shevchenko
2017-01-11 11:11   ` Linus Walleij
2017-01-11 11:42     ` Andy Shevchenko
2017-01-09 14:02 ` [PATCH v2 3/3] gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO Andy Shevchenko
2017-01-11 12:21   ` Linus Walleij
2017-01-11 13:35     ` Andy Shevchenko
2017-01-11 14:14       ` Andy Shevchenko
2017-01-12  7:27         ` Alexander Stein
2017-01-12 12:15           ` Andy Shevchenko
2017-01-12 12:51             ` Alexander Stein
2017-01-12 14:27               ` Andy Shevchenko
2017-01-17 15:05   ` 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.