Add support for software nodes to gpiolib
Subsystems (10)
cover Add support for software nodes to gpiolib
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
Signature · 1 line
2.23.0.162.g0b9fbb3734-goog
PATCH 1/11 gpiolib: of: add a fallback for wlf,reset GPIO name
The old Arizona binding did not use -gpio or -gpios suffix, so devm_gpiod_get() does not work for it. As it is the one of a few users of devm_gpiod_get_from_of_node() API that I want to remove, I'd rather have a small quirk in the gpiolib OF handler, and switch Arizona driver to devm_gpiod_get().
---
drivers/gpio/gpiolib-of.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/gpio/gpiolib-of.c +16 -0
@@ -438,6 +438,19 @@ static struct gpio_desc *of_find_regulator_gpio(struct device *dev, const char *return desc; } +static struct gpio_desc *of_find_arizona_gpio (struct device *dev, +const char *con_id, +enum of_gpio_flags *of_flags) +{ +if (!IS_ENABLED (CONFIG_MFD_ARIZONA )) +return ERR_PTR (-ENOENT ); + +if (!con_id ||strcmp (con_id,"wlf,reset" )) +return ERR_PTR (-ENOENT ); + +return of_get_named_gpiod_flags (dev->of_node, con_id,0 , of_flags); +} +struct gpio_desc *of_find_gpio (struct device *dev,const char *con_id,unsigned int idx,unsigned long *flags) {
@@ -479,6 +492,9 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, desc =of_find_regulator_gpio (dev, con_id, &of_flags); } +if (IS_ERR (desc) &&PTR_ERR (desc) == -ENOENT ) + desc =of_find_arizona_gpio (dev, con_id, &of_flags); +if (IS_ERR (desc))return desc;
Signature · 1 line
2.23.0.162.g0b9fbb3734-goog
Re: [PATCH 01/11] gpiolib: of: add a fallback for wlf,reset GPIO name
Quoted 7 lines · Dmitry Torokhov
The old Arizona binding did not use -gpio or -gpios suffix, so
devm_gpiod_get()does not work for it. As it is the one of a few users ofdevm_gpiod_get_from_of_node()API that I want to remove, I'd rather have a small quirk in the gpiolib OF handler, and switch Arizona driver todevm_gpiod_get().Signed-off-by Dmitry Torokhov <[email protected]>
Patch applied, good to have this in and it is completely in line with my idea to handle all these quirks inside the gpiolib-of.
Yours,
Linus Walleij
PATCH 2/11 gpiolib: introduce devm_fwnode_gpiod_get_index()
In reply to Dmitry Torokhovdevm_fwnode_get_index_gpiod_from_child() is too long, besides the fwnode in question does not have to be a child of device node. Let's rename it to devm_fwnode_gpiod_get_index() and keep the old name for compatibility for now.
Also let's add a devm_fwnode_gpiod_get() wrapper as majority of the callers need a single GPIO.
---
drivers/gpio/gpiolib-devres.c | 19 ++++++++-------- include/linux/gpio/consumer.h | 41 ++++++++++++++++++++++++++--------- 2 files changed, 40 insertions(+), 20 deletions(-)
drivers/gpio/gpiolib-devres.c +9 -10
@@ -185,12 +185,11 @@ struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev,EXPORT_SYMBOL (devm_gpiod_get_from_of_node);/** -* devm_fwnode_get_index_gpiod_from_child - get a GPIO descriptor from a -* device's child node +* devm_fwnode_gpiod_get_index - get a GPIO descriptor from a given node * @dev: GPIO consumer +* @fwnode: firmware node containing GPIO reference * @con_id: function within the GPIO consumer * @index: index of the GPIO to obtain in the consumer -* @child: firmware node (child of @dev) * @flags: GPIO initialization flags * @label: label to attach to the requested GPIO *
@@ -200,11 +199,11 @@ EXPORT_SYMBOL(devm_gpiod_get_from_of_node);* On successful request the GPIO pin is configured in accordance with * provided @flags. */ -struct gpio_desc *devm_fwnode_get_index_gpiod_from_child (struct device *dev, -const char *con_id,int index, -struct fwnode_handle *child, -enum gpiod_flags flags, -const char *label) +struct gpio_desc *devm_fwnode_gpiod_get_index (struct device *dev, +struct fwnode_handle *fwnode, +const char *con_id,int index, +enum gpiod_flags flags, +const char *label) {char prop_name[32 ];/* 32 is max size of property name */ struct gpio_desc **dr;
@@ -224,7 +223,7 @@ struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev,snprintf (prop_name,sizeof (prop_name),"%s" , gpio_suffixes[i]); - desc =fwnode_get_named_gpiod (child, prop_name, index, flags, + desc =fwnode_get_named_gpiod (fwnode, prop_name, index, flags, label);if (!IS_ERR (desc) || (PTR_ERR (desc) != -ENOENT ))break ;
@@ -239,7 +238,7 @@ struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev,return desc; } -EXPORT_SYMBOL (devm_fwnode_get_index_gpiod_from_child); +EXPORT_SYMBOL (devm_fwnode_gpiod_get_index);/** * devm_gpiod_get_index_optional - Resource-managed gpiod_get_index_optional()
include/linux/gpio/consumer.h +31 -10
67 lines not on this page · raw message
Signature · 1 line
2.23.0.162.g0b9fbb3734-goog
Andy Shevchenko
maintainerRe: [PATCH 02/11] gpiolib: introduce devm_fwnode_gpiod_get_index()
include/linux/gpio/consumer.h struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, · line 554
Quoted 10 lines · Dmitry Torokhov
devm_fwnode_get_index_gpiod_from_child()is too long, besides the fwnode in question does not have to be a child of device node. Let's rename it todevm_fwnode_gpiod_get_index()and keep the old name for compatibility for now.Also let's add a
devm_fwnode_gpiod_get()wrapper as majority of the callers need a single GPIO.include/linux/gpio/consumer.h +2
-0+return devm_fwnode_gpiod_get_index (dev, fwnode, con_id,0 , + flags, label);
At least one parameter can fit previous line, but taking into consideration that moving second one makes it 81 character long, I would do it completely on one line. I don't remember Linus' preferences.
include/linux/gpio/consumer.h struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev, · line 565
Quoted 4 lines
include/linux/gpio/consumer.h +3
-0+} +return devm_fwnode_gpiod_get_index (dev, child, con_id, index, + flags, label);
Ditto.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 02/11] gpiolib: introduce devm_fwnode_gpiod_get_index()
Quoted 9 lines · Andy Shevchenko
Quoted 7 lines · Dmitry Torokhov
devm_fwnode_get_index_gpiod_from_child()is too long, besides the fwnode in question does not have to be a child of device node. Let's rename it todevm_fwnode_gpiod_get_index()and keep the old name for compatibility for now.Also let's add a
devm_fwnode_gpiod_get()wrapper as majority of the callers need a single GPIO.
Quoted 6 lines
include/linux/gpio/consumer.h struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, · line 554
Quoted 2 lines
include/linux/gpio/consumer.h +2
-0+return devm_fwnode_gpiod_get_index (dev, fwnode, con_id,0 , + flags, label);At least one parameter can fit previous line, but taking into consideration that moving second one makes it 81 character long, I would do it completely on one line. I don't remember Linus' preferences.
I don't really have one, I don't mind 80+ chars, I don't mind breaking lines to avoid it.
Yours,
Linus Walleij
Re: [PATCH 02/11] gpiolib: introduce devm_fwnode_gpiod_get_index()
In reply to Dmitry TorokhovQuoted 9 lines · Dmitry Torokhov
devm_fwnode_get_index_gpiod_from_child()is too long, besides the fwnode in question does not have to be a child of device node. Let's rename it todevm_fwnode_gpiod_get_index()and keep the old name for compatibility for now.Also let's add a
devm_fwnode_gpiod_get()wrapper as majority of the callers need a single GPIO.Signed-off-by Dmitry Torokhov <[email protected]>
The patch is good because this is in line with Rusty Russells API manifesto:
7. The obvious use is (probably) the correct one.
6. The name tells you how to use it.
It doesn't apply to my "devel" branch as of now:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/log/?h=devel
If you rebase this and the next patch and send them separately I am willing to apply them already for v5.4 to easy your refactoring work during the v5.5 cycle here, provided we try to fix up the old users ASAP and delete the compatibility fallbacks in the near future.
Yours,
Linus Walleij
Re: [PATCH 02/11] gpiolib: introduce devm_fwnode_gpiod_get_index()
Quoted 19 lines · Linus Walleij
Quoted 9 lines · Dmitry Torokhov
devm_fwnode_get_index_gpiod_from_child()is too long, besides the fwnode in question does not have to be a child of device node. Let's rename it todevm_fwnode_gpiod_get_index()and keep the old name for compatibility for now.Also let's add a
devm_fwnode_gpiod_get()wrapper as majority of the callers need a single GPIO.Signed-off-by Dmitry Torokhov <[email protected]>The patch is good because this is in line with Rusty Russells API manifesto:
7. The obvious use is (probably) the correct one.
6. The name tells you how to use it.
Quoted 7 lines
It doesn't apply to my "devel" branch as of now:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/log/?h=develIf you rebase this and the next patch and send them separately I am willing to apply them already for v5.4 to easy your refactoring work during the v5.5 cycle here, provided we try to fix up the old users ASAP and delete the compatibility fallbacks in the near future.
Done.
Thanks.
Signature · 1 line
Dmitry
PATCH 3/11 gpiolib: introduce fwnode_gpiod_get_index()
In reply to Dmitry TorokhovThis introduces fwnode_gpiod_get_index() that iterates through common gpio suffixes when trying to locate a GPIO within a given firmware node.
We also switch devm_fwnode_gpiod_get_index() to call fwnode_gpiod_get_index() instead of iterating through GPIO suffixes on its own.
---
drivers/gpio/gpiolib-devres.c | 16 +----------- drivers/gpio/gpiolib.c | 48 +++++++++++++++++++++++++++++++++++ include/linux/gpio/consumer.h | 13 ++++++++++ 3 files changed, 62 insertions(+), 15 deletions(-)
drivers/gpio/gpiolib-devres.c +1 -15
@@ -205,29 +205,15 @@ struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev,enum gpiod_flags flags, const char *label) { - char prop_name[32]; /* 32 is max size of property name */ struct gpio_desc **dr;struct gpio_desc *desc; -unsigned int i; dr =devres_alloc (devm_gpiod_release,sizeof (struct gpio_desc *),GFP_KERNEL );if (!dr)return ERR_PTR (-ENOMEM ); -for (i =0 ; i <ARRAY_SIZE (gpio_suffixes); i++) { -if (con_id) -snprintf (prop_name,sizeof (prop_name),"%s-%s" , - con_id, gpio_suffixes[i]); -else -snprintf (prop_name,sizeof (prop_name),"%s" , - gpio_suffixes[i]); - - desc =fwnode_get_named_gpiod (fwnode, prop_name, index, flags, - label); -if (!IS_ERR (desc) || (PTR_ERR (desc) != -ENOENT )) -break ; - } + desc =fwnode_gpiod_get_index (fwnode, con_id, index, flags, label);if (IS_ERR (desc)) {devres_free (dr);return desc;
drivers/gpio/gpiolib.c +48 -0
54 lines not on this page · raw message
include/linux/gpio/consumer.h +13 -0
@@ -176,6 +176,10 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, const char *propname, int index, enum gpiod_flags dflags, const char *label); +struct gpio_desc *fwnode_gpiod_get_index (struct fwnode_handle *fwnode, +const char *con_id,int index, +enum gpiod_flags flags, +const char *label); struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev, struct fwnode_handle *child, const char *con_id, int index,
@@ -531,6 +535,15 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,return ERR_PTR (-ENOSYS ); } +static inline +struct gpio_desc *fwnode_gpiod_get_index (struct fwnode_handle *fwnode, +const char *con_id,int index, +enum gpiod_flags flags, +const char *label) +{ +return ERR_PTR (-ENOSYS ); +} +static inline struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev, struct fwnode_handle *fwnode,
Signature · 1 line
2.23.0.162.g0b9fbb3734-goog
Re: [PATCH 03/11] gpiolib: introduce fwnode_gpiod_get_index()
Quoted 8 lines · Dmitry Torokhov
This introduces
fwnode_gpiod_get_index()that iterates through common gpio suffixes when trying to locate a GPIO within a given firmware node.We also switch
devm_fwnode_gpiod_get_index()to callfwnode_gpiod_get_index()instead of iterating through GPIO suffixes on its own.Signed-off-by Dmitry Torokhov <[email protected]>
So I'd like to merge this as well for v5.4 because I see where you're going with this and it's nice to have these APIs in place for that.
Please rebase this and the other one and resend!
Yours,
Linus Walleij
PATCH 4/11 net: phylink: switch to using fwnode_gpiod_get_index()
In reply to Dmitry TorokhovInstead 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.
---
drivers/net/phy/phylink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/phylink.c +2 -2
@@ -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;
Signature · 1 line
2.23.0.162.g0b9fbb3734-goog
Andy Shevchenko
maintainerRe: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
Quoted 3 lines · Dmitry Torokhov
Instead of
fwnode_get_named_gpiod()that I plan to hide away, let's use the newfwnode_gpiod_get_index()that mimicsgpiod_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.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Russell King - ARM Linux admin
maintainerRe: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
Quoted 8 lines · Andy Shevchenko
Quoted 3 lines · Dmitry Torokhov
Instead of
fwnode_get_named_gpiod()that I plan to hide away, let's use the newfwnode_gpiod_get_index()that mimicsgpiod_get_index(), bit works with arbitrary firmware node.I'm wondering if it's possible to step forward and replace
fwnode_get_gpiod_indexbygpiod_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.
Signature · 3 lines
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
Andy Shevchenko
maintainerRe: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
Quoted 6 lines · Russell King - ARM Linux admin
Quoted 5 lines · Andy Shevchenko
Quoted 3 lines · Dmitry Torokhov
Instead of
fwnode_get_named_gpiod()that I plan to hide away, let's use the newfwnode_gpiod_get_index()that mimicsgpiod_get_index(), bit works with arbitrary firmware node.
Quoted 8 lines
Quoted 3 lines
I'm wondering if it's possible to step forward and replace
fwnode_get_gpiod_indexbygpiod_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.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Russell King - ARM Linux admin
maintainerRe: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
Quoted 11 lines · Andy Shevchenko
Quoted 10 lines · Russell King - ARM Linux admin
Quoted 8 lines · Andy Shevchenko
Quoted 3 lines · Dmitry Torokhov
Instead of
fwnode_get_named_gpiod()that I plan to hide away, let's use the newfwnode_gpiod_get_index()that mimicsgpiod_get_index(), bit works with arbitrary firmware node.I'm wondering if it's possible to step forward and replace
fwnode_get_gpiod_indexbygpiod_get()/gpiod_get_index()here and in other cases in this series.
Quoted 7 lines
Quoted 4 lines
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".
Signature · 3 lines
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
Re: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
Quoted 17 lines · Russell King - ARM Linux admin
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Russell King - ARM Linux admin
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Dmitry Torokhov
Instead of
fwnode_get_named_gpiod()that I plan to hide away, let's use the newfwnode_gpiod_get_index()that mimicsgpiod_get_index(), bit works with arbitrary firmware node.e > >
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
I'm wondering if it's possible to step forward and replace
fwnode_get_gpiod_indexbygpiod_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.
Quoted 7 lines
Quoted 2 lines
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:
drivers/net/phy/mdio_bus.c +2 -2
@@ -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.
Signature · 1 line
Dmitry
Russell King - ARM Linux admin
maintainerRe: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
Quoted 42 lines · Dmitry Torokhov
Quoted 17 lines · Russell King - ARM Linux admin
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Russell King - ARM Linux admin
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Dmitry Torokhov
Instead of
fwnode_get_named_gpiod()that I plan to hide away, let's use the newfwnode_gpiod_get_index()that mimicsgpiod_get_index(), bit works with arbitrary firmware node.e > >
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
I'm wondering if it's possible to step forward and replace
fwnode_get_gpiod_indexbygpiod_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.
Quoted 7 lines
Quoted 2 lines
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:
drivers/net/phy/mdio_bus.c +2
-2@@ -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" );
Quoted 2 lines
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.
Signature · 3 lines
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
Andy Shevchenko
maintainerRe: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
Quoted 19 lines · Russell King - ARM Linux admin
Quoted 18 lines · Dmitry Torokhov
Quoted 17 lines · Russell King - ARM Linux admin
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Russell King - ARM Linux admin
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Dmitry Torokhov
Instead of
fwnode_get_named_gpiod()that I plan to hide away, let's use the newfwnode_gpiod_get_index()that mimicsgpiod_get_index(), bit works with arbitrary firmware node.e > >
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
I'm wondering if it's possible to step forward and replace
fwnode_get_gpiod_indexbygpiod_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.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
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!
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
In reply to Andy ShevchenkoQuoted 11 lines · Andy Shevchenko
Quoted 10 lines · Russell King - ARM Linux admin
Quoted 8 lines · Andy Shevchenko
Quoted 3 lines · Dmitry Torokhov
Instead of
fwnode_get_named_gpiod()that I plan to hide away, let's use the newfwnode_gpiod_get_index()that mimicsgpiod_get_index(), bit works with arbitrary firmware node.I'm wondering if it's possible to step forward and replace
fwnode_get_gpiod_indexbygpiod_get()/gpiod_get_index()here and in other cases in this series.
Quoted 7 lines
Quoted 4 lines
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.
Signature · 1 line
Dmitry
Re: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
Quoted 3 lines · Dmitry Torokhov
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 usegpiod_get()API.
We have:gpiod_set_consumer_name(gpiod, "name");
to deal with that so no sacrifice is needed.
Yours,
Linus Walleij
Andy Shevchenko
maintainerRe: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
Quoted 10 lines · Linus Walleij
Quoted 3 lines · Dmitry Torokhov
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 usegpiod_get()API.We have:
gpiod_set_consumer_name(gpiod, "name");
to deal with that so no sacrifice is needed.
Thank for this hint!
Signature · 2 lines
With Best Regards, Andy Shevchenko
Russell King - ARM Linux admin
maintainerRe: [PATCH 04/11] net: phylink: switch to using fwnode_gpiod_get_index()
Quoted 8 lines · Andy Shevchenko
Quoted 7 lines · Linus Walleij
Quoted 3 lines · Dmitry Torokhov
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 usegpiod_get()API.
Quoted 5 lines
Quoted 3 lines
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.
Signature · 3 lines
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
PATCH 5/11 net: mdio: switch to using fwnode_gpiod_get_index()
In reply to Dmitry TorokhovInstead 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.
---
drivers/net/phy/mdio_bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/mdio_bus.c +2 -2
@@ -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 )
Signature · 1 line
2.23.0.162.g0b9fbb3734-goog
PATCH 6/11 drm/bridge: ti-tfp410: switch to using fwnode_gpiod_get_index()
In reply to Dmitry TorokhovInstead 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.
---
drivers/gpu/drm/bridge/ti-tfp410.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/ti-tfp410.c +2 -2
@@ -284,8 +284,8 @@ static int tfp410_get_connector_properties(struct tfp410 *dvi)else dvi->connector_type =DRM_MODE_CONNECTOR_DVID ; - dvi->hpd =fwnode_get_named_gpiod (&connector_node->fwnode, -"hpd-gpios" ,0 ,GPIOD_IN ,"hpd" ); + dvi->hpd =fwnode_gpiod_get_index (&connector_node->fwnode, +"hpd" ,0 ,GPIOD_IN ,"hpd" );if (IS_ERR (dvi->hpd)) { ret =PTR_ERR (dvi->hpd); dvi->hpd =NULL ;
Signature · 1 line
2.23.0.162.g0b9fbb3734-goog
Re: [PATCH 06/11] drm/bridge: ti-tfp410: switch to using fwnode_gpiod_get_index()
Hi Dmitry,
(CC'ing Heikki as the original author of software nodes support)
Thank you for the patch.
Quoted 2 lines · Dmitry Torokhov
Instead of
fwnode_get_named_gpiod()that I plan to hide away, let's use the newfwnode_gpiod_get_index()that mimicsgpiod_get_index(), bit
s/bit/but/
Quoted 3 lines
works with arbitrary firmware node.
Signed-off-by Dmitry Torokhov <[email protected]>
On a side note, as I'm not very familiar with software nodes, I tried to see how they are to be used, and it seems they are completely undocumented :-( Heikki, is this something that could be fixed ?
Quoted 20 lines
---
drivers/gpu/drm/bridge/ti-tfp410.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/bridge/ti-tfp410.c +2
-2@@ -284,8 +284,8 @@ static int tfp410_get_connector_properties(struct tfp410 *dvi)else dvi->connector_type =DRM_MODE_CONNECTOR_DVID ; - dvi->hpd =fwnode_get_named_gpiod (&connector_node->fwnode, -"hpd-gpios" ,0 ,GPIOD_IN ,"hpd" ); + dvi->hpd =fwnode_gpiod_get_index (&connector_node->fwnode, +"hpd" ,0 ,GPIOD_IN ,"hpd" );if (IS_ERR (dvi->hpd)) { ret =PTR_ERR (dvi->hpd); dvi->hpd =NULL ;
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH 06/11] drm/bridge: ti-tfp410: switch to using fwnode_gpiod_get_index()
Quoted 14 lines · Laurent Pinchart
Hi Dmitry,
(CC'ing Heikki as the original author of software nodes support)
Thank you for the patch.
Quoted 2 lines · Dmitry Torokhov
Instead of
fwnode_get_named_gpiod()that I plan to hide away, let's use the newfwnode_gpiod_get_index()that mimicsgpiod_get_index(), bits/bit/but/
Quoted 2 lines
works with arbitrary firmware node.
Quoted 7 lines
Quoted 1 line
Signed-off-by Dmitry Torokhov <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>On a side note, as I'm not very familiar with software nodes, I tried to see how they are to be used, and it seems they are completely undocumented :-( Heikki, is this something that could be fixed ?
OK. I'll start writing API documentation for it.
thanks,
Signature · 1 line
heikki
Laurent Pinchart
reviewerRe: [PATCH 06/11] drm/bridge: ti-tfp410: switch to using fwnode_gpiod_get_index()
Hi Heikki,
Quoted 17 lines · Heikki Krogerus
Quoted 16 lines · Laurent Pinchart
Hi Dmitry,
(CC'ing Heikki as the original author of software nodes support)
Thank you for the patch.
Quoted 2 lines · Dmitry Torokhov
Instead of
fwnode_get_named_gpiod()that I plan to hide away, let's use the newfwnode_gpiod_get_index()that mimicsgpiod_get_index(), bits/bit/but/
Quoted 3 lines
works with arbitrary firmware node.
Signed-off-by Dmitry Torokhov <[email protected]>
Quoted 7 lines
Quoted 5 lines
Reviewed-by Laurent Pinchart <[email protected]>On a side note, as I'm not very familiar with software nodes, I tried to see how they are to be used, and it seems they are completely undocumented :-( Heikki, is this something that could be fixed ?
OK. I'll start writing API documentation for it.
That's great, thanks ! I'll do my best to review it if you CC me.
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 7/11 gpliolib: make fwnode_get_named_gpiod() static
In reply to Dmitry TorokhovNow that there are no external users of fwnode_get_named_gpiod() we can make it static.
---
drivers/gpio/gpiolib.c | 108 ++++++++++++++-------------------- include/linux/gpio/consumer.h | 13 ---- 2 files changed, 43 insertions(+), 78 deletions(-)
drivers/gpio/gpiolib.c +43 -65
@@ -4314,6 +4314,49 @@ static int platform_gpio_count(struct device *dev, const char *con_id)return count; } +static struct gpio_desc *fwnode_get_named_gpiod (struct fwnode_handle *fwnode, +const char *propname,int index, +enum gpiod_flags dflags, +const char *label) +{ +unsigned long lflags =GPIO_LOOKUP_FLAGS_DEFAULT ; +struct gpio_desc *desc =ERR_PTR (-ENODEV ); +int ret; + +if (!fwnode) +return ERR_PTR (-EINVAL ); + +if (is_of_node (fwnode)) { + desc =gpiod_get_from_of_node (to_of_node (fwnode), + propname, index, + dflags, + label); +return desc; + }else if (is_acpi_node (fwnode)) { +struct acpi_gpio_info info; + + desc =acpi_node_get_gpiod (fwnode, propname, index, &info); +if (IS_ERR (desc)) +return desc; + +acpi_gpio_update_gpiod_flags (&dflags, &info); +acpi_gpio_update_gpiod_lookup_flags (&lflags, &info); + } + +/* Currently only ACPI takes this path */ + ret =gpiod_request (desc, label); +if (ret) +return ERR_PTR (ret); + + ret =gpiod_configure_flags (desc, propname, lflags, dflags); +if (ret <0 ) { +gpiod_put (desc); +return ERR_PTR (ret); + } + +return desc; +} +/** * fwnode_gpiod_get_index - obtain a GPIO from firmware node * @fwnode: handle of the firmware node
@@ -4574,71 +4617,6 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, }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 -* @index: index of the GPIO to obtain for the consumer -* @dflags: GPIO initialization flags -* @label: label to attach to the requested GPIO -* -* This function can be used for drivers that get their configuration -* from opaque firmware. -* -* The function properly finds the corresponding GPIO using whatever is the -* underlying firmware interface and then makes sure that the GPIO -* descriptor is requested before it is returned to the caller. -* -* Returns: -* On successful 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,int index, -enum gpiod_flags dflags, -const char *label) -{ -unsigned long lflags =GPIO_LOOKUP_FLAGS_DEFAULT ; -struct gpio_desc *desc =ERR_PTR (-ENODEV ); -int ret; - -if (!fwnode) -return ERR_PTR (-EINVAL ); - -if (is_of_node (fwnode)) { - desc =gpiod_get_from_of_node (to_of_node (fwnode), - propname, index, - dflags, - label); -return desc; - }else if (is_acpi_node (fwnode)) { -struct acpi_gpio_info info; - - desc =acpi_node_get_gpiod (fwnode, propname, index, &info); -if (IS_ERR (desc)) -return desc; - -acpi_gpio_update_gpiod_flags (&dflags, &info); -acpi_gpio_update_gpiod_lookup_flags (&lflags, &info); - } - -/* Currently only ACPI takes this path */ - ret =gpiod_request (desc, label); -if (ret) -return ERR_PTR (ret); - - ret =gpiod_configure_flags (desc, propname, lflags, dflags); -if (ret <0 ) { -gpiod_put (desc); -return ERR_PTR (ret); - } - -return desc; -} -EXPORT_SYMBOL_GPL (fwnode_get_named_gpiod); -/** * gpiod_get_index_optional - obtain an optional GPIO from a multi-index GPIO * function
include/linux/gpio/consumer.h +0 -13
@@ -172,10 +172,6 @@ int desc_to_gpio(const struct gpio_desc *desc);/* Child properties interface */ struct fwnode_handle ; -struct gpio_desc *fwnode_get_named_gpiod (struct fwnode_handle *fwnode, -const char *propname,int index, -enum gpiod_flags dflags, -const char *label); struct gpio_desc *fwnode_gpiod_get_index(struct fwnode_handle *fwnode, const char *con_id, int index, enum gpiod_flags flags,
@@ -526,15 +522,6 @@ 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,int index, -enum gpiod_flags dflags, -const char *label) -{ -return ERR_PTR (-ENOSYS ); -} -static inline struct gpio_desc *fwnode_gpiod_get_index(struct fwnode_handle *fwnode, const char *con_id, int index,
Signature · 1 line
2.23.0.162.g0b9fbb3734-goog
PATCH 8/11 gpiolib: of: tease apart of_find_gpio()
In reply to Dmitry TorokhovTease apart of_find_gpio() into common function that works on the firmware node, and a fallback handler that works on the device structure, so that we can later use of_find_gpio() in fwnode_gpiod_get_index().
---
drivers/gpio/gpiolib-of.c | 149 +++++++++++++++++++------------------- drivers/gpio/gpiolib-of.h | 26 +++++-- drivers/gpio/gpiolib.c | 7 +- 3 files changed, 99 insertions(+), 83 deletions(-)
drivers/gpio/gpiolib-of.c +75 -74
@@ -276,6 +276,28 @@ int of_get_named_gpio_flags(struct device_node *np, const char *list_name, }EXPORT_SYMBOL (of_get_named_gpio_flags); +static void of_gpio_flags_to_lookup (enum of_gpio_flags of_flags, +unsigned long *flags) +{ +if (of_flags &OF_GPIO_ACTIVE_LOW ) + *flags |=GPIO_ACTIVE_LOW ; + +if (of_flags &OF_GPIO_SINGLE_ENDED ) { +if (of_flags &OF_GPIO_OPEN_DRAIN ) + *flags |=GPIO_OPEN_DRAIN ; +else + *flags |=GPIO_OPEN_SOURCE ; + } + +if (of_flags &OF_GPIO_TRANSITORY ) + *flags |=GPIO_TRANSITORY ; + +if (of_flags &OF_GPIO_PULL_UP ) + *flags |=GPIO_PULL_UP ; +if (of_flags &OF_GPIO_PULL_DOWN ) + *flags |=GPIO_PULL_DOWN ; +} +/** * gpiod_get_from_of_node() - obtain a GPIO from an OF node * @node: handle of the OF node
@@ -298,10 +320,6 @@ struct gpio_desc *gpiod_get_from_of_node(struct device_node *node,unsigned long lflags =GPIO_LOOKUP_FLAGS_DEFAULT ;struct gpio_desc *desc;enum of_gpio_flags flags; -bool active_low = false; -bool single_ended = false; -bool open_drain = false; -bool transitory = false;int ret; desc = of_get_named_gpiod_flags(node, propname,
@@ -311,29 +329,13 @@ struct gpio_desc *gpiod_get_from_of_node(struct device_node *node,return desc; } - active_low = flags &OF_GPIO_ACTIVE_LOW ; - single_ended = flags &OF_GPIO_SINGLE_ENDED ; - open_drain = flags &OF_GPIO_OPEN_DRAIN ; - transitory = flags &OF_GPIO_TRANSITORY ; - ret =gpiod_request (desc, label);if (ret == -EBUSY && (flags &GPIOD_FLAGS_BIT_NONEXCLUSIVE ))return desc;if (ret)return ERR_PTR (ret); -if (active_low) - lflags |=GPIO_ACTIVE_LOW ; - -if (single_ended) { -if (open_drain) - lflags |=GPIO_OPEN_DRAIN ; -else - lflags |=GPIO_OPEN_SOURCE ; - } - -if (transitory) - lflags |=GPIO_TRANSITORY ; +of_gpio_flags_to_lookup (flags, &lflags); ret =gpiod_configure_flags (desc, propname, lflags, dflags);if (ret <0 ) {
@@ -345,6 +347,46 @@ struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, }EXPORT_SYMBOL (gpiod_get_from_of_node); +static struct gpio_desc *of_find_node_gpio (struct device_node *np, +const char *con_id,unsigned int idx, +enum of_gpio_flags *of_flags) +{ +struct gpio_desc *desc; +char prop_name[32 ];/* 32 is max size of property name */ +unsigned int i; + +/* Try GPIO property "foo-gpios" and "foo-gpio" */ +for (i =0 ; i <ARRAY_SIZE (gpio_suffixes); i++) { +if (con_id) +snprintf (prop_name,sizeof (prop_name),"%s-%s" , con_id, + gpio_suffixes[i]); +else +snprintf (prop_name,sizeof (prop_name),"%s" , + gpio_suffixes[i]); + + desc =of_get_named_gpiod_flags (np, prop_name, idx, of_flags); +if (!IS_ERR (desc) ||PTR_ERR (desc) != -ENOENT ) +break ; + } + +return desc; +} + +struct gpio_desc *of_find_gpio (struct fwnode_handle *fwnode, +const char *con_id,unsigned int idx, +unsigned long *flags) +{ +struct device_node *np =to_of_node (fwnode); +struct gpio_desc *desc; +enum of_gpio_flags of_flags; + + desc =of_find_node_gpio (np, con_id, idx, &of_flags); +if (!IS_ERR (desc)) +of_gpio_flags_to_lookup (of_flags, flags); + +return desc; +} +/* * The SPI GPIO bindings happened before we managed to establish that GPIO * properties should be named "foo-gpios" so we have this special kludge for
@@ -383,7 +425,7 @@ static struct gpio_desc *of_find_spi_gpio(struct device *dev, const char *con_idstatic struct gpio_desc *of_find_spi_cs_gpio (struct device *dev,const char *con_id,unsigned int idx, -unsigned long *flags) +enum of_gpio_flags *of_flags) {struct device_node *np = dev->of_node;
@@ -403,7 +445,7 @@ static struct gpio_desc *of_find_spi_cs_gpio(struct device *dev,* uses just "gpios" so translate to that when "cs-gpios" is * requested. */ -return of_find_gpio (dev,NULL , idx, flags); +return of_find_node_gpio (dev->of_node,NULL , idx, of_flags); }/*
@@ -451,41 +493,18 @@ static struct gpio_desc *of_find_arizona_gpio(struct device *dev,return of_get_named_gpiod_flags (dev->of_node, con_id,0 , of_flags); } -struct gpio_desc *of_find_gpio (struct device *dev,const char *con_id, -unsigned int idx,unsigned long *flags) +struct gpio_desc *of_find_gpio_fallback (struct device *dev, +const char *con_id,unsigned int idx, +unsigned long *flags) { -char prop_name[32 ];/* 32 is max size of property name */ -enum of_gpio_flags of_flags;struct gpio_desc *desc; -unsigned int i; - -/* Try GPIO property "foo-gpios" and "foo-gpio" */ -for (i =0 ; i <ARRAY_SIZE (gpio_suffixes); i++) { -if (con_id) -snprintf (prop_name,sizeof (prop_name),"%s-%s" , con_id, - gpio_suffixes[i]); -else -snprintf (prop_name,sizeof (prop_name),"%s" , - gpio_suffixes[i]); - - desc =of_get_named_gpiod_flags (dev->of_node, prop_name, idx, - &of_flags); - -if (!IS_ERR (desc) ||PTR_ERR (desc) != -ENOENT ) -break ; - } +enum of_gpio_flags of_flags; -if (IS_ERR (desc) &&PTR_ERR (desc) == -ENOENT ) { -/* Special handling for SPI GPIOs if used */ - desc =of_find_spi_gpio (dev, con_id, &of_flags); - } +/* Special handling for SPI GPIOs if used */ + desc =of_find_spi_gpio (dev, con_id, &of_flags); -if (IS_ERR (desc) &&PTR_ERR (desc) == -ENOENT ) { -/* This quirk looks up flags and all */ - desc =of_find_spi_cs_gpio (dev, con_id, idx, flags); -if (!IS_ERR (desc)) -return desc; - } +if (IS_ERR (desc) &&PTR_ERR (desc) == -ENOENT ) + desc =of_find_spi_cs_gpio (dev, con_id, idx, &of_flags);if (IS_ERR (desc) &&PTR_ERR (desc) == -ENOENT ) {/* Special handling for regulator GPIOs if used */
@@ -495,26 +514,8 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,if (IS_ERR (desc) &&PTR_ERR (desc) == -ENOENT ) desc =of_find_arizona_gpio (dev, con_id, &of_flags); -if (IS_ERR (desc)) -return desc; - -if (of_flags &OF_GPIO_ACTIVE_LOW ) - *flags |=GPIO_ACTIVE_LOW ; - -if (of_flags &OF_GPIO_SINGLE_ENDED ) { -if (of_flags &OF_GPIO_OPEN_DRAIN ) - *flags |=GPIO_OPEN_DRAIN ; -else - *flags |=GPIO_OPEN_SOURCE ; - } - -if (of_flags &OF_GPIO_TRANSITORY ) - *flags |=GPIO_TRANSITORY ; - -if (of_flags &OF_GPIO_PULL_UP ) - *flags |=GPIO_PULL_UP ; -if (of_flags &OF_GPIO_PULL_DOWN ) - *flags |=GPIO_PULL_DOWN ; +if (!IS_ERR (desc)) +of_gpio_flags_to_lookup (of_flags, flags);return desc; }
drivers/gpio/gpiolib-of.h +18 -8
@@ -3,14 +3,17 @@#ifndef GPIOLIB_OF_H #define GPIOLIB_OF_H +struct fwnode_handle ;struct gpio_chip ;enum of_gpio_flags ;#ifdef CONFIG_OF_GPIO -struct gpio_desc *of_find_gpio (struct device *dev, -const char *con_id, -unsigned int idx, -unsigned long *lookupflags); +struct gpio_desc *of_find_gpio (struct fwnode_handle *fwnode, +const char *con_id,unsigned int idx, +unsigned long *flags); +struct gpio_desc *of_find_gpio_fallback (struct device *dev, +const char *con_id,unsigned int idx, +unsigned long *flags);struct gpio_desc *of_get_named_gpiod_flags (struct device_node *np,const char *list_name,int index,enum of_gpio_flags *flags);int of_gpiochip_add (struct gpio_chip *gc);
@@ -18,10 +21,17 @@ void of_gpiochip_remove(struct gpio_chip *gc);int of_gpio_get_count (struct device *dev,const char *con_id);bool of_gpio_need_valid_mask (const struct gpio_chip *gc);#else -static inline struct gpio_desc *of_find_gpio (struct device *dev, -const char *con_id, -unsigned int idx, -unsigned long *lookupflags) +static inline +struct gpio_desc *of_find_gpio (struct fwnode_handle *fwnode, +const char *con_id,unsigned int idx, +unsigned long *flags) +{ +return ERR_PTR (-ENOENT ); +} +static inline +struct gpio_desc *of_find_gpio_fallback (struct device *dev, +const char *con_id,unsigned int idx, +unsigned long *flags) {return ERR_PTR (-ENOENT ); }
drivers/gpio/gpiolib.c +6 -1
@@ -4562,7 +4562,12 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,/* Using device tree? */ if (IS_ENABLED (CONFIG_OF ) && dev->of_node) {dev_dbg (dev,"using device tree for GPIO lookup\n" ); - desc =of_find_gpio (dev, con_id, idx, &lookupflags); + desc =of_find_gpio (dev_fwnode (dev), + con_id, idx, &lookupflags); +if (desc ==ERR_PTR (-ENOENT )) + desc =of_find_gpio_fallback (dev, con_id, idx, + &lookupflags); + }else if (ACPI_COMPANION (dev)) {dev_dbg (dev,"using ACPI for GPIO lookup\n" ); desc =acpi_find_gpio (dev, con_id, idx, &flags, &lookupflags);
Signature · 1 line
2.23.0.162.g0b9fbb3734-goog
Andy Shevchenko
maintainerRe: [PATCH 08/11] gpiolib: of: tease apart of_find_gpio()
drivers/gpio/gpiolib.c struct gpio_desc *__must_check gpiod_get_index(struct device *dev, · line 4566
Quoted 7 lines · Dmitry Torokhov
Tease apart
of_find_gpio()into common function that works on the firmware node, and a fallback handler that works on the device structure, so that we can later useof_find_gpio()infwnode_gpiod_get_index().drivers/gpio/gpiolib.c +2
-0+ desc =of_find_gpio (dev_fwnode (dev), + con_id, idx, &lookupflags);
Couple of parameters can be placed on previous line.
drivers/gpio/gpiolib.c struct gpio_desc *__must_check gpiod_get_index(struct device *dev, · line 4570
Quoted 5 lines
drivers/gpio/gpiolib.c +4
-0+if (desc ==ERR_PTR (-ENOENT )) + desc =of_find_gpio_fallback (dev, con_id, idx, + &lookupflags); +
Do we need extra blank line?
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 9/11 gpiolib: of: tease apart acpi_find_gpio()
In reply to Dmitry TorokhovTease apart acpi_find_gpio() into common function that works on the firmware node, and a fallback handler that works on the ACPI device structure, so that we can later use acpi_find_gpio() in fwnode_gpiod_get_index().
---
drivers/gpio/gpiolib-acpi.c | 77 +++++++++++++++++++++++++------------ drivers/gpio/gpiolib-acpi.h | 17 +++++++- drivers/gpio/gpiolib.c | 8 +++- 3 files changed, 74 insertions(+), 28 deletions(-)
drivers/gpio/gpiolib-acpi.c +52 -25
@@ -728,29 +728,35 @@ static struct gpio_desc *acpi_get_gpiod_by_index(struct acpi_device *adev,return ret ?ERR_PTR (ret) : lookup.desc; } -static bool acpi_can_fallback_to_crs (struct acpi_device *adev, -const char *con_id) +static int acpi_finalize_gpio_lookup (struct acpi_gpio_info *info, +enum gpiod_flags *dflags, +unsigned long *lookupflags) { -/* Never allow fallback if the device has properties */ -if (acpi_dev_has_props (adev) || adev->driver_gpios) -return false; +if (info->gpioint && + (*dflags ==GPIOD_OUT_LOW || *dflags ==GPIOD_OUT_HIGH )) { +dev_dbg (&info->adev->dev, +"refusing GpioInt() entry when doing GPIOD_OUT_* lookup\n" ); +return -ENOENT ; + } -return con_id ==NULL ; +acpi_gpio_update_gpiod_flags (dflags, info); +acpi_gpio_update_gpiod_lookup_flags (lookupflags, info); + +return 0 ; } -struct gpio_desc *acpi_find_gpio (struct device *dev, -const char *con_id, -unsigned int idx, +struct gpio_desc *acpi_find_gpio (struct fwnode_handle *fwnode, +const char *con_id,unsigned int idx,enum gpiod_flags *dflags,unsigned long *lookupflags) { -struct acpi_device *adev =ACPI_COMPANION (dev);struct acpi_gpio_info info;struct gpio_desc *desc;char propname[32 ];int i; +int error; -/* Try first from _DSD */ +/* Try GPIOs from _DSD */ for (i =0 ; i <ARRAY_SIZE (gpio_suffixes); i++) {if (con_id) { snprintf(propname, sizeof(propname), "%s-%s",
@@ -760,31 +766,52 @@ struct gpio_desc *acpi_find_gpio(struct device *dev, gpio_suffixes[i]); } - desc =acpi_get_gpiod_by_index (adev, propname, idx, &info); + desc =acpi_node_get_gpiod (fwnode, propname, idx, &info);if (!IS_ERR (desc))break ;if (PTR_ERR (desc) == -EPROBE_DEFER )return ERR_CAST (desc); } -/* Then from plain _CRS GPIOs */ -if (IS_ERR (desc)) { -if (!acpi_can_fallback_to_crs (adev, con_id)) -return ERR_PTR (-ENOENT ); - - desc =acpi_get_gpiod_by_index (adev,NULL , idx, &info); -if (IS_ERR (desc)) -return desc; +if (!IS_ERR (desc)) { + error =acpi_finalize_gpio_lookup (&info, dflags, lookupflags); +if (error) +return ERR_PTR (error); } -if (info.gpioint && - (*dflags ==GPIOD_OUT_LOW || *dflags ==GPIOD_OUT_HIGH )) { -dev_dbg (dev,"refusing GpioInt() entry when doing GPIOD_OUT_* lookup\n" ); +return desc; +} + +static bool acpi_can_fallback_to_crs (struct acpi_device *adev, +const char *con_id) +{ +/* Never allow fallback if the device has properties */ +if (acpi_dev_has_props (adev) || adev->driver_gpios) +return false; + +return con_id ==NULL ; +} + +struct gpio_desc *acpi_find_gpio_fallback (struct acpi_device *adev, +const char *con_id,unsigned int idx, +enum gpiod_flags *dflags, +unsigned long *lookupflags) +{ +struct acpi_gpio_info info; +struct gpio_desc *desc; +int error; + +/* Then from plain _CRS GPIOs */ +if (!acpi_can_fallback_to_crs (adev, con_id))return ERR_PTR (-ENOENT ); + + desc =acpi_get_gpiod_by_index (adev,NULL , idx, &info); +if (!IS_ERR (desc)) { + error =acpi_finalize_gpio_lookup (&info, dflags, lookupflags); +if (error) +return ERR_PTR (error); } -acpi_gpio_update_gpiod_flags (dflags, &info); -acpi_gpio_update_gpiod_lookup_flags (lookupflags, &info);return desc; }
drivers/gpio/gpiolib-acpi.h +15 -2
@@ -9,6 +9,7 @@#define GPIOLIB_ACPI_H struct acpi_device ; +struct fwnode_handle ;/** * struct acpi_gpio_info - ACPI GPIO specific information
@@ -42,11 +43,16 @@ int acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags,int acpi_gpio_update_gpiod_lookup_flags (unsigned long *lookupflags,struct acpi_gpio_info *info); -struct gpio_desc *acpi_find_gpio (struct device *dev, +struct gpio_desc *acpi_find_gpio (struct fwnode_handle *fwnode,const char *con_id,unsigned int idx,enum gpiod_flags *dflags,unsigned long *lookupflags); +struct gpio_desc *acpi_find_gpio_fallback (struct acpi_device *adev, +const char *con_id, +unsigned int idx, +enum gpiod_flags *dflags, +unsigned long *lookupflags);struct gpio_desc *acpi_node_get_gpiod (struct fwnode_handle *fwnode,const char *propname,int index,struct acpi_gpio_info *info);
@@ -75,13 +81,20 @@ acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags, }static inline struct gpio_desc * -acpi_find_gpio (struct device *dev,const char *con_id, +acpi_find_gpio (struct firmware_node *fwnode,const char *con_id,unsigned int idx,enum gpiod_flags *dflags,unsigned long *lookupflags) {return ERR_PTR (-ENOENT ); }static inline struct gpio_desc * +acpi_find_gpio_fallback (struct acpi_device *adev,const char *con_id, +unsigned int idx,enum gpiod_flags *dflags, +unsigned long *lookupflags) +{ +return ERR_PTR (-ENOENT ); +} +static inline struct gpio_desc *acpi_node_get_gpiod (struct fwnode_handle *fwnode,const char *propname,int index,struct acpi_gpio_info *info) {
drivers/gpio/gpiolib.c +7 -1
@@ -4570,7 +4570,13 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, }else if (ACPI_COMPANION (dev)) {dev_dbg (dev,"using ACPI for GPIO lookup\n" ); - desc =acpi_find_gpio (dev, con_id, idx, &flags, &lookupflags); + desc =acpi_find_gpio (dev_fwnode (dev), con_id, idx, + &flags, &lookupflags); +if (desc ==ERR_PTR (-ENOENT )) + desc =acpi_find_gpio_fallback ( +ACPI_COMPANION (dev), + con_id, idx, + &flags, &lookupflags); } }
Signature · 1 line
2.23.0.162.g0b9fbb3734-goog
Andy Shevchenko
maintainerRe: [PATCH 09/11] gpiolib: of: tease apart acpi_find_gpio()
Quoted 4 lines · Dmitry Torokhov
Tease apart
acpi_find_gpio()into common function that works on the firmware node, and a fallback handler that works on the ACPI device structure, so that we can later useacpi_find_gpio()infwnode_gpiod_get_index().
Title should start with "gpiolib: acpi:"
I review from this one later on.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 10/11 gpiolib: consolidate fwnode GPIO lookups
In reply to Dmitry TorokhovEnsure that all paths to obtain/look up GPIOD from generic consumer-visible APIs go through the new fwnode_locate_gpiod(), so that we can easily extend the support for new firmware mechanisms.
---
drivers/gpio/gpiolib-acpi.c | 88 +++++++++++++++---------------- drivers/gpio/gpiolib-acpi.h | 10 ---- drivers/gpio/gpiolib.c | 100 ++++++++++++------------------------ 3 files changed, 77 insertions(+), 121 deletions(-)
drivers/gpio/gpiolib-acpi.c +44 -44
@@ -728,6 +728,50 @@ static struct gpio_desc *acpi_get_gpiod_by_index(struct acpi_device *adev,return ret ?ERR_PTR (ret) : lookup.desc; } +/** +* acpi_node_get_gpiod() - get a GPIO descriptor from ACPI resources +* @fwnode: pointer to an ACPI firmware node to get the GPIO information from +* @propname: Property name of the GPIO +* @index: index of GpioIo/GpioInt resource (starting from %0) +* @info: info pointer to fill in (optional) +* +* If @fwnode is an ACPI device object, call acpi_get_gpiod_by_index() for it. +* Otherwise (i.e. it is a data-only non-device object), use the property-based +* GPIO lookup to get to the GPIO resource with the relevant information and use +* that to obtain the GPIO descriptor to return. +* +* If the GPIO cannot be translated or there is an error an ERR_PTR is +* returned. +*/ +static struct gpio_desc *acpi_node_get_gpiod (struct fwnode_handle *fwnode, +const char *propname,int index, +struct acpi_gpio_info *info) +{ +struct acpi_gpio_lookup lookup; +struct acpi_device *adev; +int ret; + + adev =to_acpi_device_node (fwnode); +if (adev) +return acpi_get_gpiod_by_index (adev, propname, index, info); + +if (!is_acpi_data_node (fwnode)) +return ERR_PTR (-ENODEV ); + +if (!propname) +return ERR_PTR (-EINVAL ); + +memset (&lookup,0 ,sizeof (lookup)); + lookup.index = index; + + ret =acpi_gpio_property_lookup (fwnode, propname, index, &lookup); +if (ret) +return ERR_PTR (ret); + + ret =acpi_gpio_resource_lookup (&lookup, info); +return ret ?ERR_PTR (ret) : lookup.desc; +} +static int acpi_finalize_gpio_lookup (struct acpi_gpio_info *info,enum gpiod_flags *dflags,unsigned long *lookupflags)
@@ -815,50 +859,6 @@ struct gpio_desc *acpi_find_gpio_fallback(struct acpi_device *adev,return desc; } -/** -* acpi_node_get_gpiod() - get a GPIO descriptor from ACPI resources -* @fwnode: pointer to an ACPI firmware node to get the GPIO information from -* @propname: Property name of the GPIO -* @index: index of GpioIo/GpioInt resource (starting from %0) -* @info: info pointer to fill in (optional) -* -* If @fwnode is an ACPI device object, call acpi_get_gpiod_by_index() for it. -* Otherwise (i.e. it is a data-only non-device object), use the property-based -* GPIO lookup to get to the GPIO resource with the relevant information and use -* that to obtain the GPIO descriptor to return. -* -* If the GPIO cannot be translated or there is an error an ERR_PTR is -* returned. -*/ -struct gpio_desc *acpi_node_get_gpiod (struct fwnode_handle *fwnode, -const char *propname,int index, -struct acpi_gpio_info *info) -{ -struct acpi_gpio_lookup lookup; -struct acpi_device *adev; -int ret; - - adev =to_acpi_device_node (fwnode); -if (adev) -return acpi_get_gpiod_by_index (adev, propname, index, info); - -if (!is_acpi_data_node (fwnode)) -return ERR_PTR (-ENODEV ); - -if (!propname) -return ERR_PTR (-EINVAL ); - -memset (&lookup,0 ,sizeof (lookup)); - lookup.index = index; - - ret =acpi_gpio_property_lookup (fwnode, propname, index, &lookup); -if (ret) -return ERR_PTR (ret); - - ret =acpi_gpio_resource_lookup (&lookup, info); -return ret ?ERR_PTR (ret) : lookup.desc; -} -/** * acpi_dev_gpio_irq_get() - Find GpioInt and translate it to Linux IRQ number * @adev: pointer to a ACPI device to get IRQ from
drivers/gpio/gpiolib-acpi.h +0 -10
@@ -53,10 +53,6 @@ struct gpio_desc *acpi_find_gpio_fallback(struct acpi_device *adev,unsigned int idx, enum gpiod_flags *dflags, unsigned long *lookupflags); -struct gpio_desc *acpi_node_get_gpiod (struct fwnode_handle *fwnode, -const char *propname,int index, -struct acpi_gpio_info *info); -int acpi_gpio_count (struct device *dev,const char *con_id);#else static inline void acpi_gpiochip_add (struct gpio_chip *chip) { }
@@ -94,12 +90,6 @@ acpi_find_gpio_fallback(struct acpi_device *adev, const char *con_id, {return ERR_PTR (-ENOENT ); } -static inline struct gpio_desc * -acpi_node_get_gpiod (struct fwnode_handle *fwnode,const char *propname, -int index,struct acpi_gpio_info *info) -{ -return ERR_PTR (-ENXIO ); -}static inline int acpi_gpio_count (struct device *dev,const char *con_id) {return -ENODEV ;
drivers/gpio/gpiolib.c +33 -67
126 lines not on this page · raw message
Signature · 1 line
2.23.0.162.g0b9fbb3734-goog
PATCH 11/11 gpiolib: add support for software nodes
In reply to Dmitry TorokhovNow that static device properties understand notion of child nodes and references, let's teach gpiolib to handle them:
- GPIOs are represented as a references to software nodes representing gpiochip
- references must have 2 arguments - GPIO number within the chip and GPIO flags (GPIO_ACTIVE_LOW/GPIO_ACTIVE_HIGH, etc).
- name of the software node representing gpiochip must match label of the gpiochip, as we use it to locate gpiochip structure at runtime.
const struct software_node gpio_bank_b_node = {
.name = "B",
};const struct property_entry simone_key_enter_props[] __initconst = {
PROPERTY_ENTRY_U32("linux,code", KEY_ENTER),
PROPERTY_ENTRY_STRING("label", "enter"),
PROPERTY_ENTRY_REF("gpios", &gpio_bank_b_node, 123, GPIO_ACTIVE_LOW),
{ }
};---
drivers/gpio/Makefile | 1 + drivers/gpio/gpiolib-swnode.c | 92 +++++++++++++++++++++++++++++++++++ drivers/gpio/gpiolib-swnode.h | 13 +++++ drivers/gpio/gpiolib.c | 31 ++++++++++-- 4 files changed, 133 insertions(+), 4 deletions(-) create mode 100644 drivers/gpio/gpiolib-swnode.c create mode 100644 drivers/gpio/gpiolib-swnode.h
drivers/gpio/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_GPIOLIB) += gpiolib.o obj-$(CONFIG_GPIOLIB) += gpiolib-devres.o obj-$(CONFIG_GPIOLIB) += gpiolib-legacy.o obj-$(CONFIG_GPIOLIB) += gpiolib-devprop.o +obj-$(CONFIG_GPIOLIB) += gpiolib-swnode.o obj-$(CONFIG_OF_GPIO) += gpiolib-of.o obj-$(CONFIG_GPIO_SYSFS) += gpiolib-sysfs.o obj-$(CONFIG_GPIO_ACPI) += gpiolib-acpi.o
drivers/gpio/gpiolib-swnode.c new file +92 -0
92 lines not on this page · raw message
drivers/gpio/gpiolib-swnode.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef GPIOLIB_SWNODE_H +#define GPIOLIB_SWNODE_H + +struct fwnode_handle ; + +struct gpio_desc *swnode_find_gpio (struct fwnode_handle *fwnode, +const char *con_id,unsigned int idx, +unsigned long *flags); +int swnode_gpio_count (struct fwnode_handle *fwnode,const char *con_id); + +#endif /* GPIOLIB_SWNODE_H */
drivers/gpio/gpiolib.c +27 -4
@@ -31,6 +31,7 @@#include "gpiolib.h" #include "gpiolib-of.h" #include "gpiolib-acpi.h" +#include "gpiolib-swnode.h" #define CREATE_TRACE_POINTS #include <trace/events/gpio.h>
@@ -4335,6 +4336,16 @@ static struct gpio_desc *fwnode_locate_gpiod(struct fwnode_handle *fwnode, desc =acpi_find_gpio_fallback (ACPI_COMPANION (dev), con_id, idx, flags, lookupflags); + }else if (is_software_node (fwnode)) { +dev_dbg (dev,"using software node for GPIO lookup\n" ); + desc =swnode_find_gpio (fwnode, con_id, idx, lookupflags); + } + +if (IS_ERR (desc) && + !IS_ERR_OR_NULL (fwnode) && +is_software_node (fwnode->secondary)) { + desc =swnode_find_gpio (fwnode->secondary, + con_id, idx, lookupflags); }return desc;
@@ -4397,12 +4408,24 @@ EXPORT_SYMBOL_GPL(fwnode_gpiod_get_index);*/ int gpiod_count (struct device *dev,const char *con_id) { +struct fwnode_handle *fwnode;int count = -ENOENT ; -if (IS_ENABLED (CONFIG_OF ) && dev && dev->of_node) - count =of_gpio_get_count (dev, con_id); -else if (IS_ENABLED (CONFIG_ACPI ) && dev &&ACPI_HANDLE (dev)) - count =acpi_gpio_count (dev, con_id); +if (dev) { + fwnode =dev_fwnode (dev); +if (is_of_node (fwnode)) + count =of_gpio_get_count (dev, con_id); +else if (is_acpi_device_node (fwnode)) + count =acpi_gpio_count (dev, con_id); +else if (is_software_node (fwnode)) + count =swnode_gpio_count (fwnode, con_id); + +if (count <0 && + !IS_ERR_OR_NULL (fwnode) && +is_software_node (fwnode->secondary)) { + count =swnode_gpio_count (fwnode, con_id); + } + }if (count <0 ) count =platform_gpio_count (dev, con_id);
Signature · 1 line
2.23.0.162.g0b9fbb3734-goog
Quoted 14 lines · Dmitry Torokhov
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_nodegpio_bank_b_node= { |-------.name = "B",
};static const struct
property_entrysimone_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), |-------{ }
Quoted 6 lines
};
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,
for patches 1-8 after addressing minor issues.
I'll review the rest later on.
Quoted 37 lines
Thanks,
DmitryDmitry Torokhov (11):
gpiolib: of: add a fallback for wlf,reset GPIO name
gpiolib: introducedevm_fwnode_gpiod_get_index()
gpiolib: introducefwnode_gpiod_get_index()
net: phylink: switch to usingfwnode_gpiod_get_index()
net: mdio: switch to usingfwnode_gpiod_get_index()drm/bridge: ti-tfp410: switch to usingfwnode_gpiod_get_index()
gpliolib: makefwnode_get_named_gpiod()static
gpiolib: of: tease apartof_find_gpio()
gpiolib: of: tease apartacpi_find_gpio()
gpiolib: consolidate fwnode GPIO lookups
gpiolib: add support for software nodesdrivers/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.hSignature · 1 line
2.23.0.162.g0b9fbb3734-goog
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 4 lines · Dmitry Torokhov
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
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · Linus Walleij
Quoted 4 lines · Dmitry Torokhov
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.
Quoted 7 lines
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.
Signature · 1 line
Dmitry
Hi Linus,
Quoted 14 lines · Dmitry Torokhov
Quoted 13 lines · Linus Walleij
Quoted 4 lines · Dmitry Torokhov
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.
Quoted 8 lines
Quoted 2 lines
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.
Signature · 1 line
Dmitry
Quoted 4 lines · Dmitry Torokhov
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