netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/11] Add support for software nodes to gpiolib
@ 2019-09-11  7:52 Dmitry Torokhov
  2019-09-11  7:52 ` [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index() Dmitry Torokhov
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2019-09-11  7:52 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Andy Shevchenko, Mika Westerberg, linux-kernel, linux-gpio,
	Andrew Lunn, Andrzej Hajda, Bartosz Golaszewski, Daniel Vetter,
	David Airlie, David S. Miller, Florian Fainelli, Heiner Kallweit,
	Jernej Skrabec, Jonas Karlman, Laurent Pinchart, Neil Armstrong,
	Russell King, dri-devel, linux-acpi, netdev

This series attempts to add support for software nodes to gpiolib, using
software node references that were introduced recently. This allows us
to convert more drivers to the generic device properties and drop
support for custom platform data:

static const struct software_node gpio_bank_b_node = {
|-------.name = "B",
};

static const struct property_entry simone_key_enter_props[] = {
|-------PROPERTY_ENTRY_U32("linux,code", KEY_ENTER),
|-------PROPERTY_ENTRY_STRING("label", "enter"),
|-------PROPERTY_ENTRY_REF("gpios", &gpio_bank_b_node, 123, GPIO_ACTIVE_LOW),
|-------{ }
};

If we agree in principle, I would like to have the very first 3 patches
in an immutable branch off maybe -rc8 so that it can be pulled into
individual subsystems so that patches switching various drivers to
fwnode_gpiod_get_index() could be applied.

Thanks,
Dmitry

Dmitry Torokhov (11):
  gpiolib: of: add a fallback for wlf,reset GPIO name
  gpiolib: introduce devm_fwnode_gpiod_get_index()
  gpiolib: introduce fwnode_gpiod_get_index()
  net: phylink: switch to using fwnode_gpiod_get_index()
  net: mdio: switch to using fwnode_gpiod_get_index()
  drm/bridge: ti-tfp410: switch to using fwnode_gpiod_get_index()
  gpliolib: make fwnode_get_named_gpiod() static
  gpiolib: of: tease apart of_find_gpio()
  gpiolib: of: tease apart acpi_find_gpio()
  gpiolib: consolidate fwnode GPIO lookups
  gpiolib: add support for software nodes

 drivers/gpio/Makefile              |   1 +
 drivers/gpio/gpiolib-acpi.c        | 153 ++++++++++++++----------
 drivers/gpio/gpiolib-acpi.h        |  21 ++--
 drivers/gpio/gpiolib-devres.c      |  33 ++----
 drivers/gpio/gpiolib-of.c          | 159 ++++++++++++++-----------
 drivers/gpio/gpiolib-of.h          |  26 ++--
 drivers/gpio/gpiolib-swnode.c      |  92 +++++++++++++++
 drivers/gpio/gpiolib-swnode.h      |  13 ++
 drivers/gpio/gpiolib.c             | 184 ++++++++++++++++-------------
 drivers/gpu/drm/bridge/ti-tfp410.c |   4 +-
 drivers/net/phy/mdio_bus.c         |   4 +-
 drivers/net/phy/phylink.c          |   4 +-
 include/linux/gpio/consumer.h      |  53 ++++++---
 13 files changed, 471 insertions(+), 276 deletions(-)
 create mode 100644 drivers/gpio/gpiolib-swnode.c
 create mode 100644 drivers/gpio/gpiolib-swnode.h

-- 
2.23.0.162.g0b9fbb3734-goog


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

* [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
  2019-09-11  7:52 [PATCH 00/11] Add support for software nodes to gpiolib Dmitry Torokhov
@ 2019-09-11  7:52 ` Dmitry Torokhov
  2019-09-11  9:25   ` Andy Shevchenko
  2019-09-11  7:52 ` [PATCH 05/11] net: mdio: " Dmitry Torokhov
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 19+ messages in thread
From: Dmitry Torokhov @ 2019-09-11  7:52 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Andy Shevchenko, Mika Westerberg, linux-kernel, linux-gpio,
	Andrew Lunn, David S. Miller, Florian Fainelli, Heiner Kallweit,
	Russell King, netdev

Instead of fwnode_get_named_gpiod() that I plan to hide away, let's use
the new fwnode_gpiod_get_index() that mimics gpiod_get_index(), bit
works with arbitrary firmware node.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---

 drivers/net/phy/phylink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index a45c5de96ab1..14b608991445 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -168,8 +168,8 @@ static int phylink_parse_fixedlink(struct phylink *pl,
 			pl->link_config.pause |= MLO_PAUSE_ASYM;
 
 		if (ret == 0) {
-			desc = fwnode_get_named_gpiod(fixed_node, "link-gpios",
-						      0, GPIOD_IN, "?");
+			desc = fwnode_gpiod_get_index(fixed_node, "link", 0,
+						      GPIOD_IN, "?");
 
 			if (!IS_ERR(desc))
 				pl->link_gpio = desc;
-- 
2.23.0.162.g0b9fbb3734-goog


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

* [PATCH 05/11] net: mdio: switch to using fwnode_gpiod_get_index()
  2019-09-11  7:52 [PATCH 00/11] Add support for software nodes to gpiolib Dmitry Torokhov
  2019-09-11  7:52 ` [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index() Dmitry Torokhov
@ 2019-09-11  7:52 ` Dmitry Torokhov
  2019-09-11 17:13 ` [PATCH 00/11] Add support for software nodes to gpiolib Andy Shevchenko
  2019-09-12  9:55 ` Linus Walleij
  3 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2019-09-11  7:52 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Andy Shevchenko, Mika Westerberg, linux-kernel, linux-gpio,
	Andrew Lunn, David S. Miller, Florian Fainelli, Heiner Kallweit,
	netdev

Instead of fwnode_get_named_gpiod() that I plan to hide away, let's use
the new fwnode_gpiod_get_index() that mimics gpiod_get_index(), bit
works with arbitrary firmware node.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---

 drivers/net/phy/mdio_bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index ce940871331e..9ca51d678123 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -46,8 +46,8 @@ static int mdiobus_register_gpiod(struct mdio_device *mdiodev)
 
 	/* Deassert the optional reset signal */
 	if (mdiodev->dev.of_node)
-		gpiod = fwnode_get_named_gpiod(&mdiodev->dev.of_node->fwnode,
-					       "reset-gpios", 0, GPIOD_OUT_LOW,
+		gpiod = fwnode_gpiod_get_index(&mdiodev->dev.of_node->fwnode,
+					       "reset", 0, GPIOD_OUT_LOW,
 					       "PHY reset");
 	if (IS_ERR(gpiod)) {
 		if (PTR_ERR(gpiod) == -ENOENT || PTR_ERR(gpiod) == -ENOSYS)
-- 
2.23.0.162.g0b9fbb3734-goog


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

* Re: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
  2019-09-11  7:52 ` [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index() Dmitry Torokhov
@ 2019-09-11  9:25   ` Andy Shevchenko
  2019-09-11  9:39     ` Russell King - ARM Linux admin
  0 siblings, 1 reply; 19+ messages in thread
From: Andy Shevchenko @ 2019-09-11  9:25 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Linus Walleij, Mika Westerberg, linux-kernel, linux-gpio,
	Andrew Lunn, David S. Miller, Florian Fainelli, Heiner Kallweit,
	Russell King, netdev

On Wed, Sep 11, 2019 at 12:52:08AM -0700, Dmitry Torokhov wrote:
> Instead of fwnode_get_named_gpiod() that I plan to hide away, let's use
> the new fwnode_gpiod_get_index() that mimics gpiod_get_index(), bit
> works with arbitrary firmware node.

I'm wondering if it's possible to step forward and replace
fwnode_get_gpiod_index by gpiod_get() / gpiod_get_index() here and
in other cases in this series.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
  2019-09-11  9:25   ` Andy Shevchenko
@ 2019-09-11  9:39     ` Russell King - ARM Linux admin
  2019-09-11  9:46       ` Andy Shevchenko
  0 siblings, 1 reply; 19+ messages in thread
From: Russell King - ARM Linux admin @ 2019-09-11  9:39 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Dmitry Torokhov, Linus Walleij, Mika Westerberg, linux-kernel,
	linux-gpio, Andrew Lunn, David S. Miller, Florian Fainelli,
	Heiner Kallweit, netdev

On Wed, Sep 11, 2019 at 12:25:14PM +0300, Andy Shevchenko wrote:
> On Wed, Sep 11, 2019 at 12:52:08AM -0700, Dmitry Torokhov wrote:
> > Instead of fwnode_get_named_gpiod() that I plan to hide away, let's use
> > the new fwnode_gpiod_get_index() that mimics gpiod_get_index(), bit
> > works with arbitrary firmware node.
> 
> I'm wondering if it's possible to step forward and replace
> fwnode_get_gpiod_index by gpiod_get() / gpiod_get_index() here and
> in other cases in this series.

No, those require a struct device, but we have none.  There are network
drivers where there is a struct device for the network complex, but only
DT nodes for the individual network interfaces.  So no, gpiod_* really
doesn't work.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

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

* Re: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
  2019-09-11  9:39     ` Russell King - ARM Linux admin
@ 2019-09-11  9:46       ` Andy Shevchenko
  2019-09-11  9:49         ` Russell King - ARM Linux admin
  2019-09-11  9:51         ` Dmitry Torokhov
  0 siblings, 2 replies; 19+ messages in thread
From: Andy Shevchenko @ 2019-09-11  9:46 UTC (permalink / raw)
  To: Russell King - ARM Linux admin
  Cc: Dmitry Torokhov, Linus Walleij, Mika Westerberg, linux-kernel,
	linux-gpio, Andrew Lunn, David S. Miller, Florian Fainelli,
	Heiner Kallweit, netdev

On Wed, Sep 11, 2019 at 10:39:14AM +0100, Russell King - ARM Linux admin wrote:
> On Wed, Sep 11, 2019 at 12:25:14PM +0300, Andy Shevchenko wrote:
> > On Wed, Sep 11, 2019 at 12:52:08AM -0700, Dmitry Torokhov wrote:
> > > Instead of fwnode_get_named_gpiod() that I plan to hide away, let's use
> > > the new fwnode_gpiod_get_index() that mimics gpiod_get_index(), bit
> > > works with arbitrary firmware node.
> > 
> > I'm wondering if it's possible to step forward and replace
> > fwnode_get_gpiod_index by gpiod_get() / gpiod_get_index() here and
> > in other cases in this series.
> 
> No, those require a struct device, but we have none.  There are network
> drivers where there is a struct device for the network complex, but only
> DT nodes for the individual network interfaces.  So no, gpiod_* really
> doesn't work.

In the following patch the node is derived from struct device. So, I believe
some cases can be handled differently.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
  2019-09-11  9:46       ` Andy Shevchenko
@ 2019-09-11  9:49         ` Russell King - ARM Linux admin
  2019-09-11  9:55           ` Dmitry Torokhov
  2019-09-11  9:51         ` Dmitry Torokhov
  1 sibling, 1 reply; 19+ messages in thread
From: Russell King - ARM Linux admin @ 2019-09-11  9:49 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Dmitry Torokhov, Linus Walleij, Mika Westerberg, linux-kernel,
	linux-gpio, Andrew Lunn, David S. Miller, Florian Fainelli,
	Heiner Kallweit, netdev

On Wed, Sep 11, 2019 at 12:46:19PM +0300, Andy Shevchenko wrote:
> On Wed, Sep 11, 2019 at 10:39:14AM +0100, Russell King - ARM Linux admin wrote:
> > On Wed, Sep 11, 2019 at 12:25:14PM +0300, Andy Shevchenko wrote:
> > > On Wed, Sep 11, 2019 at 12:52:08AM -0700, Dmitry Torokhov wrote:
> > > > Instead of fwnode_get_named_gpiod() that I plan to hide away, let's use
> > > > the new fwnode_gpiod_get_index() that mimics gpiod_get_index(), bit
> > > > works with arbitrary firmware node.
> > > 
> > > I'm wondering if it's possible to step forward and replace
> > > fwnode_get_gpiod_index by gpiod_get() / gpiod_get_index() here and
> > > in other cases in this series.
> > 
> > No, those require a struct device, but we have none.  There are network
> > drivers where there is a struct device for the network complex, but only
> > DT nodes for the individual network interfaces.  So no, gpiod_* really
> > doesn't work.
> 
> In the following patch the node is derived from struct device. So, I believe
> some cases can be handled differently.

phylink is not passed a struct device - it has no knowledge what the
parent device is.

In any case, I do not have "the following patch".

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

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

* Re: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
  2019-09-11  9:46       ` Andy Shevchenko
  2019-09-11  9:49         ` Russell King - ARM Linux admin
@ 2019-09-11  9:51         ` Dmitry Torokhov
  2019-09-12  9:41           ` Linus Walleij
  1 sibling, 1 reply; 19+ messages in thread
From: Dmitry Torokhov @ 2019-09-11  9:51 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Russell King - ARM Linux admin, Linus Walleij, Mika Westerberg,
	linux-kernel, linux-gpio, Andrew Lunn, David S. Miller,
	Florian Fainelli, Heiner Kallweit, netdev

On Wed, Sep 11, 2019 at 12:46:19PM +0300, Andy Shevchenko wrote:
> On Wed, Sep 11, 2019 at 10:39:14AM +0100, Russell King - ARM Linux admin wrote:
> > On Wed, Sep 11, 2019 at 12:25:14PM +0300, Andy Shevchenko wrote:
> > > On Wed, Sep 11, 2019 at 12:52:08AM -0700, Dmitry Torokhov wrote:
> > > > Instead of fwnode_get_named_gpiod() that I plan to hide away, let's use
> > > > the new fwnode_gpiod_get_index() that mimics gpiod_get_index(), bit
> > > > works with arbitrary firmware node.
> > > 
> > > I'm wondering if it's possible to step forward and replace
> > > fwnode_get_gpiod_index by gpiod_get() / gpiod_get_index() here and
> > > in other cases in this series.
> > 
> > No, those require a struct device, but we have none.  There are network
> > drivers where there is a struct device for the network complex, but only
> > DT nodes for the individual network interfaces.  So no, gpiod_* really
> > doesn't work.
> 
> In the following patch the node is derived from struct device. So, I believe
> some cases can be handled differently.

If we are willing to sacrifice the custom label for the GPIO that
fwnode_gpiod_get_index() allows us to set, then there are several
drivers that could actually use gpiod_get() API.

This is up to the dirver's maintainers...

Thanks.

-- 
Dmitry

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

* Re: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
  2019-09-11  9:49         ` Russell King - ARM Linux admin
@ 2019-09-11  9:55           ` Dmitry Torokhov
  2019-09-11 10:10             ` Russell King - ARM Linux admin
  0 siblings, 1 reply; 19+ messages in thread
From: Dmitry Torokhov @ 2019-09-11  9:55 UTC (permalink / raw)
  To: Russell King - ARM Linux admin
  Cc: Andy Shevchenko, Linus Walleij, Mika Westerberg, linux-kernel,
	linux-gpio, Andrew Lunn, David S. Miller, Florian Fainelli,
	Heiner Kallweit, netdev

On Wed, Sep 11, 2019 at 10:49:29AM +0100, Russell King - ARM Linux admin wrote:
> On Wed, Sep 11, 2019 at 12:46:19PM +0300, Andy Shevchenko wrote:
> > On Wed, Sep 11, 2019 at 10:39:14AM +0100, Russell King - ARM Linux admin wrote:
> > > On Wed, Sep 11, 2019 at 12:25:14PM +0300, Andy Shevchenko wrote:
> > > > On Wed, Sep 11, 2019 at 12:52:08AM -0700, Dmitry Torokhov wrote:
> > > > > Instead of fwnode_get_named_gpiod() that I plan to hide away, let's use
> > > > > the new fwnode_gpiod_get_index() that mimics gpiod_get_index(), bit
> > > > > works with arbitrary firmware node.
> e > > 
> > > > I'm wondering if it's possible to step forward and replace
> > > > fwnode_get_gpiod_index by gpiod_get() / gpiod_get_index() here and
> > > > in other cases in this series.
> > > 
> > > No, those require a struct device, but we have none.  There are network
> > > drivers where there is a struct device for the network complex, but only
> > > DT nodes for the individual network interfaces.  So no, gpiod_* really
> > > doesn't work.
> > 
> > In the following patch the node is derived from struct device. So, I believe
> > some cases can be handled differently.
> 
> phylink is not passed a struct device - it has no knowledge what the
> parent device is.
> 
> In any case, I do not have "the following patch".

Andy is talking about this one:

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index ce940871331e..9ca51d678123 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -46,8 +46,8 @@ static int mdiobus_register_gpiod(struct mdio_device *mdiodev)

        /* Deassert the optional reset signal */
        if (mdiodev->dev.of_node)
-               gpiod = fwnode_get_named_gpiod(&mdiodev->dev.of_node->fwnode,
-                                              "reset-gpios", 0,
                                               GPIOD_OUT_LOW,
+               gpiod = fwnode_gpiod_get_index(&mdiodev->dev.of_node->fwnode,
+                                              "reset", 0, GPIOD_OUT_LOW,
                                               "PHY reset");
Here if we do not care about "PHY reset" label, we could use
gpiod_get(&mdiodev->dev, "reset", GPIOD_OUT_LOW).

Thanks.

-- 
Dmitry

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

* Re: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
  2019-09-11  9:55           ` Dmitry Torokhov
@ 2019-09-11 10:10             ` Russell King - ARM Linux admin
  2019-09-11 16:52               ` Andy Shevchenko
  0 siblings, 1 reply; 19+ messages in thread
From: Russell King - ARM Linux admin @ 2019-09-11 10:10 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Andy Shevchenko, Linus Walleij, Mika Westerberg, linux-kernel,
	linux-gpio, Andrew Lunn, David S. Miller, Florian Fainelli,
	Heiner Kallweit, netdev

On Wed, Sep 11, 2019 at 02:55:11AM -0700, Dmitry Torokhov wrote:
> On Wed, Sep 11, 2019 at 10:49:29AM +0100, Russell King - ARM Linux admin wrote:
> > On Wed, Sep 11, 2019 at 12:46:19PM +0300, Andy Shevchenko wrote:
> > > On Wed, Sep 11, 2019 at 10:39:14AM +0100, Russell King - ARM Linux admin wrote:
> > > > On Wed, Sep 11, 2019 at 12:25:14PM +0300, Andy Shevchenko wrote:
> > > > > On Wed, Sep 11, 2019 at 12:52:08AM -0700, Dmitry Torokhov wrote:
> > > > > > Instead of fwnode_get_named_gpiod() that I plan to hide away, let's use
> > > > > > the new fwnode_gpiod_get_index() that mimics gpiod_get_index(), bit
> > > > > > works with arbitrary firmware node.
> > e > > 
> > > > > I'm wondering if it's possible to step forward and replace
> > > > > fwnode_get_gpiod_index by gpiod_get() / gpiod_get_index() here and
> > > > > in other cases in this series.
> > > > 
> > > > No, those require a struct device, but we have none.  There are network
> > > > drivers where there is a struct device for the network complex, but only
> > > > DT nodes for the individual network interfaces.  So no, gpiod_* really
> > > > doesn't work.
> > > 
> > > In the following patch the node is derived from struct device. So, I believe
> > > some cases can be handled differently.
> > 
> > phylink is not passed a struct device - it has no knowledge what the
> > parent device is.
> > 
> > In any case, I do not have "the following patch".
> 
> Andy is talking about this one:
> 
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index ce940871331e..9ca51d678123 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -46,8 +46,8 @@ static int mdiobus_register_gpiod(struct mdio_device *mdiodev)
> 
>         /* Deassert the optional reset signal */
>         if (mdiodev->dev.of_node)
> -               gpiod = fwnode_get_named_gpiod(&mdiodev->dev.of_node->fwnode,
> -                                              "reset-gpios", 0,
>                                                GPIOD_OUT_LOW,
> +               gpiod = fwnode_gpiod_get_index(&mdiodev->dev.of_node->fwnode,
> +                                              "reset", 0, GPIOD_OUT_LOW,
>                                                "PHY reset");
> Here if we do not care about "PHY reset" label, we could use
> gpiod_get(&mdiodev->dev, "reset", GPIOD_OUT_LOW).

Here, you have a struct device, so yes, it's possible.

Referring back to my comment, notice that I said we have none for the
phylink case, so it's not possible there.

I'm not sure why Andy replied the way he did, unless he mis-read my
comment.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

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

* Re: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
  2019-09-11 10:10             ` Russell King - ARM Linux admin
@ 2019-09-11 16:52               ` Andy Shevchenko
  0 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2019-09-11 16:52 UTC (permalink / raw)
  To: Russell King - ARM Linux admin
  Cc: Dmitry Torokhov, Linus Walleij, Mika Westerberg, linux-kernel,
	linux-gpio, Andrew Lunn, David S. Miller, Florian Fainelli,
	Heiner Kallweit, netdev

On Wed, Sep 11, 2019 at 11:10:16AM +0100, Russell King - ARM Linux admin wrote:
> On Wed, Sep 11, 2019 at 02:55:11AM -0700, Dmitry Torokhov wrote:
> > On Wed, Sep 11, 2019 at 10:49:29AM +0100, Russell King - ARM Linux admin wrote:
> > > On Wed, Sep 11, 2019 at 12:46:19PM +0300, Andy Shevchenko wrote:
> > > > On Wed, Sep 11, 2019 at 10:39:14AM +0100, Russell King - ARM Linux admin wrote:
> > > > > On Wed, Sep 11, 2019 at 12:25:14PM +0300, Andy Shevchenko wrote:
> > > > > > On Wed, Sep 11, 2019 at 12:52:08AM -0700, Dmitry Torokhov wrote:
> > > > > > > Instead of fwnode_get_named_gpiod() that I plan to hide away, let's use
> > > > > > > the new fwnode_gpiod_get_index() that mimics gpiod_get_index(), bit
> > > > > > > works with arbitrary firmware node.
> > > e > > 
> > > > > > I'm wondering if it's possible to step forward and replace
> > > > > > fwnode_get_gpiod_index by gpiod_get() / gpiod_get_index() here and
> > > > > > in other cases in this series.
> > > > > 
> > > > > No, those require a struct device, but we have none.  There are network
> > > > > drivers where there is a struct device for the network complex, but only
> > > > > DT nodes for the individual network interfaces.  So no, gpiod_* really
> > > > > doesn't work.
> > > > 
> > > > In the following patch the node is derived from struct device. So, I believe
> > > > some cases can be handled differently.

> Referring back to my comment, notice that I said we have none for the
> phylink case, so it's not possible there.
> 
> I'm not sure why Andy replied the way he did, unless he mis-read my
> comment.

It is a first patch which does the change. Mostly my reply was to Dmitry and
your comment clarifies the case with this patch, thanks!

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 00/11] Add support for software nodes to gpiolib
  2019-09-11  7:52 [PATCH 00/11] Add support for software nodes to gpiolib Dmitry Torokhov
  2019-09-11  7:52 ` [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index() Dmitry Torokhov
  2019-09-11  7:52 ` [PATCH 05/11] net: mdio: " Dmitry Torokhov
@ 2019-09-11 17:13 ` Andy Shevchenko
  2019-09-12  9:55 ` Linus Walleij
  3 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2019-09-11 17:13 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Linus Walleij, Mika Westerberg, linux-kernel, linux-gpio,
	Andrew Lunn, Andrzej Hajda, Bartosz Golaszewski, Daniel Vetter,
	David Airlie, David S. Miller, Florian Fainelli, Heiner Kallweit,
	Jernej Skrabec, Jonas Karlman, Laurent Pinchart, Neil Armstrong,
	Russell King, dri-devel, linux-acpi, netdev

On Wed, Sep 11, 2019 at 12:52:04AM -0700, Dmitry Torokhov wrote:
> This series attempts to add support for software nodes to gpiolib, using
> software node references that were introduced recently. This allows us
> to convert more drivers to the generic device properties and drop
> support for custom platform data:
> 
> static const struct software_node gpio_bank_b_node = {
> |-------.name = "B",
> };
> 
> static const struct property_entry simone_key_enter_props[] = {
> |-------PROPERTY_ENTRY_U32("linux,code", KEY_ENTER),
> |-------PROPERTY_ENTRY_STRING("label", "enter"),
> |-------PROPERTY_ENTRY_REF("gpios", &gpio_bank_b_node, 123, GPIO_ACTIVE_LOW),
> |-------{ }
> };
> 
> If we agree in principle, I would like to have the very first 3 patches
> in an immutable branch off maybe -rc8 so that it can be pulled into
> individual subsystems so that patches switching various drivers to
> fwnode_gpiod_get_index() could be applied.

FWIW,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

for patches 1-8 after addressing minor issues.
I'll review the rest later on.

> 
> Thanks,
> Dmitry
> 
> Dmitry Torokhov (11):
>   gpiolib: of: add a fallback for wlf,reset GPIO name
>   gpiolib: introduce devm_fwnode_gpiod_get_index()
>   gpiolib: introduce fwnode_gpiod_get_index()
>   net: phylink: switch to using fwnode_gpiod_get_index()
>   net: mdio: switch to using fwnode_gpiod_get_index()
>   drm/bridge: ti-tfp410: switch to using fwnode_gpiod_get_index()
>   gpliolib: make fwnode_get_named_gpiod() static
>   gpiolib: of: tease apart of_find_gpio()
>   gpiolib: of: tease apart acpi_find_gpio()
>   gpiolib: consolidate fwnode GPIO lookups
>   gpiolib: add support for software nodes
> 
>  drivers/gpio/Makefile              |   1 +
>  drivers/gpio/gpiolib-acpi.c        | 153 ++++++++++++++----------
>  drivers/gpio/gpiolib-acpi.h        |  21 ++--
>  drivers/gpio/gpiolib-devres.c      |  33 ++----
>  drivers/gpio/gpiolib-of.c          | 159 ++++++++++++++-----------
>  drivers/gpio/gpiolib-of.h          |  26 ++--
>  drivers/gpio/gpiolib-swnode.c      |  92 +++++++++++++++
>  drivers/gpio/gpiolib-swnode.h      |  13 ++
>  drivers/gpio/gpiolib.c             | 184 ++++++++++++++++-------------
>  drivers/gpu/drm/bridge/ti-tfp410.c |   4 +-
>  drivers/net/phy/mdio_bus.c         |   4 +-
>  drivers/net/phy/phylink.c          |   4 +-
>  include/linux/gpio/consumer.h      |  53 ++++++---
>  13 files changed, 471 insertions(+), 276 deletions(-)
>  create mode 100644 drivers/gpio/gpiolib-swnode.c
>  create mode 100644 drivers/gpio/gpiolib-swnode.h
> 
> -- 
> 2.23.0.162.g0b9fbb3734-goog
> 

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
  2019-09-11  9:51         ` Dmitry Torokhov
@ 2019-09-12  9:41           ` Linus Walleij
  2019-09-12 13:44             ` Andy Shevchenko
  0 siblings, 1 reply; 19+ messages in thread
From: Linus Walleij @ 2019-09-12  9:41 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Andy Shevchenko, Russell King - ARM Linux admin, Mika Westerberg,
	linux-kernel, open list:GPIO SUBSYSTEM, Andrew Lunn,
	David S. Miller, Florian Fainelli, Heiner Kallweit, netdev

On Wed, Sep 11, 2019 at 10:51 AM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:

> If we are willing to sacrifice the custom label for the GPIO that
> fwnode_gpiod_get_index() allows us to set, then there are several
> drivers that could actually use gpiod_get() API.

We have:
gpiod_set_consumer_name(gpiod, "name");
to deal with that so no sacrifice is needed.

Yours,
Linus Walleij

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

* Re: [PATCH 00/11] Add support for software nodes to gpiolib
  2019-09-11  7:52 [PATCH 00/11] Add support for software nodes to gpiolib Dmitry Torokhov
                   ` (2 preceding siblings ...)
  2019-09-11 17:13 ` [PATCH 00/11] Add support for software nodes to gpiolib Andy Shevchenko
@ 2019-09-12  9:55 ` Linus Walleij
  2019-09-17  0:22   ` Dmitry Torokhov
  3 siblings, 1 reply; 19+ messages in thread
From: Linus Walleij @ 2019-09-12  9:55 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Andy Shevchenko, Mika Westerberg, linux-kernel,
	open list:GPIO SUBSYSTEM, Andrew Lunn, Andrzej Hajda,
	Bartosz Golaszewski, Daniel Vetter, David Airlie,
	David S. Miller, Florian Fainelli, Heiner Kallweit,
	Jernej Skrabec, Jonas Karlman, Laurent Pinchart, Neil Armstrong,
	Russell King, open list:DRM PANEL DRIVERS,
	ACPI Devel Maling List, netdev

On Wed, Sep 11, 2019 at 8:52 AM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:

> If we agree in principle, I would like to have the very first 3 patches
> in an immutable branch off maybe -rc8 so that it can be pulled into
> individual subsystems so that patches switching various drivers to
> fwnode_gpiod_get_index() could be applied.

I think it seems a bit enthusiastic to have non-GPIO subsystems
pick up these changes this close to the merge window so my plan
is to merge patches 1.2.3 (1 already merged) and then you could
massage the other subsystems in v5.4-rc1.

But if other subsystems say "hey we want do fix this in like 3 days"
then I'm game for an immutable branch as well.

Yours,
Linus Walleij

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

* Re: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
  2019-09-12  9:41           ` Linus Walleij
@ 2019-09-12 13:44             ` Andy Shevchenko
  2019-09-12 13:52               ` Russell King - ARM Linux admin
  0 siblings, 1 reply; 19+ messages in thread
From: Andy Shevchenko @ 2019-09-12 13:44 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Dmitry Torokhov, Russell King - ARM Linux admin, Mika Westerberg,
	linux-kernel, open list:GPIO SUBSYSTEM, Andrew Lunn,
	David S. Miller, Florian Fainelli, Heiner Kallweit, netdev

On Thu, Sep 12, 2019 at 10:41:43AM +0100, Linus Walleij wrote:
> On Wed, Sep 11, 2019 at 10:51 AM Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> 
> > If we are willing to sacrifice the custom label for the GPIO that
> > fwnode_gpiod_get_index() allows us to set, then there are several
> > drivers that could actually use gpiod_get() API.
> 
> We have:
> gpiod_set_consumer_name(gpiod, "name");
> to deal with that so no sacrifice is needed.

Thank for this hint!

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
  2019-09-12 13:44             ` Andy Shevchenko
@ 2019-09-12 13:52               ` Russell King - ARM Linux admin
  0 siblings, 0 replies; 19+ messages in thread
From: Russell King - ARM Linux admin @ 2019-09-12 13:52 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Linus Walleij, Dmitry Torokhov, Mika Westerberg, linux-kernel,
	open list:GPIO SUBSYSTEM, Andrew Lunn, David S. Miller,
	Florian Fainelli, Heiner Kallweit, netdev

On Thu, Sep 12, 2019 at 04:44:29PM +0300, Andy Shevchenko wrote:
> On Thu, Sep 12, 2019 at 10:41:43AM +0100, Linus Walleij wrote:
> > On Wed, Sep 11, 2019 at 10:51 AM Dmitry Torokhov
> > <dmitry.torokhov@gmail.com> wrote:
> > 
> > > If we are willing to sacrifice the custom label for the GPIO that
> > > fwnode_gpiod_get_index() allows us to set, then there are several
> > > drivers that could actually use gpiod_get() API.
> > 
> > We have:
> > gpiod_set_consumer_name(gpiod, "name");
> > to deal with that so no sacrifice is needed.
> 
> Thank for this hint!

Would it be possible to improve your email etiquette, and move this
discussion to a more appropriate subject line, so I don't have to keep
checking these emails, in case you _do_ talk about something relevent
to the original patch that the subject line refers to?

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

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

* Re: [PATCH 00/11] Add support for software nodes to gpiolib
  2019-09-12  9:55 ` Linus Walleij
@ 2019-09-17  0:22   ` Dmitry Torokhov
  2019-09-30 22:44     ` Dmitry Torokhov
  0 siblings, 1 reply; 19+ messages in thread
From: Dmitry Torokhov @ 2019-09-17  0:22 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Andy Shevchenko, Mika Westerberg, linux-kernel,
	open list:GPIO SUBSYSTEM, Andrew Lunn, Andrzej Hajda,
	Bartosz Golaszewski, Daniel Vetter, David Airlie,
	David S. Miller, Florian Fainelli, Heiner Kallweit,
	Jernej Skrabec, Jonas Karlman, Laurent Pinchart, Neil Armstrong,
	Russell King, open list:DRM PANEL DRIVERS,
	ACPI Devel Maling List, netdev

On Thu, Sep 12, 2019 at 10:55:47AM +0100, Linus Walleij wrote:
> On Wed, Sep 11, 2019 at 8:52 AM Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> 
> > If we agree in principle, I would like to have the very first 3 patches
> > in an immutable branch off maybe -rc8 so that it can be pulled into
> > individual subsystems so that patches switching various drivers to
> > fwnode_gpiod_get_index() could be applied.
> 
> I think it seems a bit enthusiastic to have non-GPIO subsystems
> pick up these changes this close to the merge window so my plan
> is to merge patches 1.2.3 (1 already merged) and then you could
> massage the other subsystems in v5.4-rc1.
> 
> But if other subsystems say "hey we want do fix this in like 3 days"
> then I'm game for an immutable branch as well.

No, if it is still has a chance for -rc1 then I'm good. I was thinking
if it does not go into -rc1 I could convince some of them merge a
targeted immutable branch off -rc8 or 5.3 final and then apply patches
relevant to their subsystems so we do not have to wait till 5.6 to land
everything.

Thanks.

-- 
Dmitry

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

* Re: [PATCH 00/11] Add support for software nodes to gpiolib
  2019-09-17  0:22   ` Dmitry Torokhov
@ 2019-09-30 22:44     ` Dmitry Torokhov
  2019-10-04 21:44       ` Linus Walleij
  0 siblings, 1 reply; 19+ messages in thread
From: Dmitry Torokhov @ 2019-09-30 22:44 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Andy Shevchenko, Mika Westerberg, linux-kernel,
	open list:GPIO SUBSYSTEM, Andrew Lunn, Andrzej Hajda,
	Bartosz Golaszewski, Daniel Vetter, David Airlie,
	David S. Miller, Florian Fainelli, Heiner Kallweit,
	Jernej Skrabec, Jonas Karlman, Laurent Pinchart, Neil Armstrong,
	Russell King, open list:DRM PANEL DRIVERS,
	ACPI Devel Maling List, netdev

Hi Linus,

On Mon, Sep 16, 2019 at 05:22:07PM -0700, Dmitry Torokhov wrote:
> On Thu, Sep 12, 2019 at 10:55:47AM +0100, Linus Walleij wrote:
> > On Wed, Sep 11, 2019 at 8:52 AM Dmitry Torokhov
> > <dmitry.torokhov@gmail.com> wrote:
> > 
> > > If we agree in principle, I would like to have the very first 3 patches
> > > in an immutable branch off maybe -rc8 so that it can be pulled into
> > > individual subsystems so that patches switching various drivers to
> > > fwnode_gpiod_get_index() could be applied.
> > 
> > I think it seems a bit enthusiastic to have non-GPIO subsystems
> > pick up these changes this close to the merge window so my plan
> > is to merge patches 1.2.3 (1 already merged) and then you could
> > massage the other subsystems in v5.4-rc1.
> > 
> > But if other subsystems say "hey we want do fix this in like 3 days"
> > then I'm game for an immutable branch as well.
> 
> No, if it is still has a chance for -rc1 then I'm good. I was thinking
> if it does not go into -rc1 I could convince some of them merge a
> targeted immutable branch off -rc8 or 5.3 final and then apply patches
> relevant to their subsystems so we do not have to wait till 5.6 to land
> everything.

So I guess we missed -rc1. Any chance we could get an immutable branch
off -rc1 that you will pull into your main branch and I hopefully can
persuade other maintainers to pull as well so we do not need to drag it
over 2+ merge windows?

Thanks.

-- 
Dmitry

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

* Re: [PATCH 00/11] Add support for software nodes to gpiolib
  2019-09-30 22:44     ` Dmitry Torokhov
@ 2019-10-04 21:44       ` Linus Walleij
  0 siblings, 0 replies; 19+ messages in thread
From: Linus Walleij @ 2019-10-04 21:44 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Andy Shevchenko, Mika Westerberg, linux-kernel,
	open list:GPIO SUBSYSTEM, Andrew Lunn, Andrzej Hajda,
	Bartosz Golaszewski, Daniel Vetter, David Airlie,
	David S. Miller, Florian Fainelli, Heiner Kallweit,
	Jernej Skrabec, Jonas Karlman, Laurent Pinchart, Neil Armstrong,
	Russell King, open list:DRM PANEL DRIVERS,
	ACPI Devel Maling List, netdev

On Tue, Oct 1, 2019 at 12:45 AM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:

> So I guess we missed -rc1. Any chance we could get an immutable branch
> off -rc1 that you will pull into your main branch and I hopefully can
> persuade other maintainers to pull as well so we do not need to drag it
> over 2+ merge windows?

Yes I'm sorry. I was swamped with stabilizing the kernel.
I made an immutable branch and tried to use zeroday for testing
but it timed out so I folded it in for-next anyways after som basic
tests.

Yours,
Linus Walleij

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

end of thread, other threads:[~2019-10-04 21:44 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-11  7:52 [PATCH 00/11] Add support for software nodes to gpiolib Dmitry Torokhov
2019-09-11  7:52 ` [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index() Dmitry Torokhov
2019-09-11  9:25   ` Andy Shevchenko
2019-09-11  9:39     ` Russell King - ARM Linux admin
2019-09-11  9:46       ` Andy Shevchenko
2019-09-11  9:49         ` Russell King - ARM Linux admin
2019-09-11  9:55           ` Dmitry Torokhov
2019-09-11 10:10             ` Russell King - ARM Linux admin
2019-09-11 16:52               ` Andy Shevchenko
2019-09-11  9:51         ` Dmitry Torokhov
2019-09-12  9:41           ` Linus Walleij
2019-09-12 13:44             ` Andy Shevchenko
2019-09-12 13:52               ` Russell King - ARM Linux admin
2019-09-11  7:52 ` [PATCH 05/11] net: mdio: " Dmitry Torokhov
2019-09-11 17:13 ` [PATCH 00/11] Add support for software nodes to gpiolib Andy Shevchenko
2019-09-12  9:55 ` Linus Walleij
2019-09-17  0:22   ` Dmitry Torokhov
2019-09-30 22:44     ` Dmitry Torokhov
2019-10-04 21:44       ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).