* [PATCH 1/4] tools: gpio: Small updates for output format @ 2016-02-23 7:54 Markus Pargmann 2016-02-23 7:54 ` [PATCH 2/4] tools: gpio: Add necessary include paths Markus Pargmann ` (3 more replies) 0 siblings, 4 replies; 18+ messages in thread From: Markus Pargmann @ 2016-02-23 7:54 UTC (permalink / raw) To: Linus Walleij Cc: linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree, Markus Pargmann Use %2d for the GPIO line number. This should align the results horziontally for most gpio chips. The GPIO label uses quotes for real values. For GPIO names this is currently missing. The patch adds the missing quote. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> --- tools/gpio/lsgpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/gpio/lsgpio.c b/tools/gpio/lsgpio.c index 5535ce81f8f7..6af118cc7efb 100644 --- a/tools/gpio/lsgpio.c +++ b/tools/gpio/lsgpio.c @@ -111,9 +111,9 @@ int list_device(const char *device_name) perror("Failed to issue LINEINFO IOCTL\n"); goto exit_close_error; } - fprintf(stdout, "\tline %d:", linfo.line_offset); + fprintf(stdout, "\tline %2d:", linfo.line_offset); if (linfo.name[0]) - fprintf(stdout, " %s", linfo.name); + fprintf(stdout, " \"%s\"", linfo.name); else fprintf(stdout, " unnamed"); if (linfo.label[0]) -- 2.7.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/4] tools: gpio: Add necessary include paths 2016-02-23 7:54 [PATCH 1/4] tools: gpio: Small updates for output format Markus Pargmann @ 2016-02-23 7:54 ` Markus Pargmann 2016-02-23 13:26 ` Linus Walleij 2016-02-23 7:54 ` [PATCH 3/4] gpio: dt-bindings: Declare gpio-hog optional for GPIO subnodes Markus Pargmann ` (2 subsequent siblings) 3 siblings, 1 reply; 18+ messages in thread From: Markus Pargmann @ 2016-02-23 7:54 UTC (permalink / raw) To: Linus Walleij Cc: linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree, Markus Pargmann Add include paths to the Makefile so that linux/gpio.h can be found even on systems without this header. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> --- tools/gpio/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/gpio/Makefile b/tools/gpio/Makefile index 4d198d5c4203..3f5b3f427b9c 100644 --- a/tools/gpio/Makefile +++ b/tools/gpio/Makefile @@ -1,5 +1,5 @@ CC = $(CROSS_COMPILE)gcc -CFLAGS += -Wall -g -D_GNU_SOURCE +CFLAGS += -Wall -g -D_GNU_SOURCE -I ../include -I ../../include/uapi all: lsgpio -- 2.7.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 2/4] tools: gpio: Add necessary include paths 2016-02-23 7:54 ` [PATCH 2/4] tools: gpio: Add necessary include paths Markus Pargmann @ 2016-02-23 13:26 ` Linus Walleij 2016-02-24 6:39 ` Markus Pargmann 0 siblings, 1 reply; 18+ messages in thread From: Linus Walleij @ 2016-02-23 13:26 UTC (permalink / raw) To: Markus Pargmann Cc: linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree On Tue, Feb 23, 2016 at 8:54 AM, Markus Pargmann <mpa@pengutronix.de> wrote: > Add include paths to the Makefile so that linux/gpio.h can be found even > on systems without this header. > > Signed-off-by: Markus Pargmann <mpa@pengutronix.de> (...) > -CFLAGS += -Wall -g -D_GNU_SOURCE > +CFLAGS += -Wall -g -D_GNU_SOURCE -I ../include -I ../../include/uapi This is probably not how userspace compilation is supposed to work. The way I understand it, userspace programs from tools/* should be compiled like this: make headers_install ARCH=foo INSTALL_HDR_PATH=<bar> cd tools/gpio make CFLAGS="$CFLAGS -I<bar>" The reason being that UAPI files can differ after install depending on arch. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/4] tools: gpio: Add necessary include paths 2016-02-23 13:26 ` Linus Walleij @ 2016-02-24 6:39 ` Markus Pargmann 0 siblings, 0 replies; 18+ messages in thread From: Markus Pargmann @ 2016-02-24 6:39 UTC (permalink / raw) To: Linus Walleij Cc: linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree [-- Attachment #1: Type: text/plain, Size: 1184 bytes --] On Tuesday, February 23, 2016 02:26:09 PM Linus Walleij wrote: > On Tue, Feb 23, 2016 at 8:54 AM, Markus Pargmann <mpa@pengutronix.de> wrote: > > > Add include paths to the Makefile so that linux/gpio.h can be found even > > on systems without this header. > > > > Signed-off-by: Markus Pargmann <mpa@pengutronix.de> > (...) > > -CFLAGS += -Wall -g -D_GNU_SOURCE > > +CFLAGS += -Wall -g -D_GNU_SOURCE -I ../include -I ../../include/uapi > > This is probably not how userspace compilation is supposed > to work. The way I understand it, userspace programs from tools/* > should be compiled like this: > > make headers_install ARCH=foo INSTALL_HDR_PATH=<bar> > cd tools/gpio > make CFLAGS="$CFLAGS -I<bar>" > > The reason being that UAPI files can differ after install depending > on arch. I see, thanks for explaining. Best Regards, Markus -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 3/4] gpio: dt-bindings: Declare gpio-hog optional for GPIO subnodes 2016-02-23 7:54 [PATCH 1/4] tools: gpio: Small updates for output format Markus Pargmann 2016-02-23 7:54 ` [PATCH 2/4] tools: gpio: Add necessary include paths Markus Pargmann @ 2016-02-23 7:54 ` Markus Pargmann 2016-02-23 13:37 ` Linus Walleij 2016-02-23 23:25 ` Rob Herring 2016-02-23 7:54 ` [PATCH 4/4] gpio: Add parsing of DT GPIO line-names Markus Pargmann 2016-02-23 13:21 ` [PATCH 1/4] tools: gpio: Small updates for output format Linus Walleij 3 siblings, 2 replies; 18+ messages in thread From: Markus Pargmann @ 2016-02-23 7:54 UTC (permalink / raw) To: Linus Walleij Cc: linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree, Markus Pargmann Reuse the GPIO hogging DT bindings for more generic specifications of the GPIO. Therefore gpio-hog is declared optional. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> --- Documentation/devicetree/bindings/gpio/gpio.txt | 28 ++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt index 069cdf6f9dac..820898e0649c 100644 --- a/Documentation/devicetree/bindings/gpio/gpio.txt +++ b/Documentation/devicetree/bindings/gpio/gpio.txt @@ -155,13 +155,25 @@ gpio-controller@00000000 { ngpios = <18>; } -The GPIO chip may contain GPIO hog definitions. GPIO hogging is a mechanism -providing automatic GPIO request and configuration as part of the -gpio-controller's driver probe function. +The GPIO chip may contain subnodes describing specific GPIOs of this +controller. These GPIO nodes can be used to define GPIO hogging or define GPIO +names. +GPIO hogging is a mechanism providing automatic GPIO request and configuration +as part of the gpio-controller's driver probe function. -Each GPIO hog definition is represented as a child node of the GPIO controller. +Each GPIO node consists of the following properties: Required properties: +- gpios: Store the GPIO information (id, flags, ...). Shall contain the + number of cells specified in its parent node (GPIO controller + node). + +Optional properties: +- line-name: The GPIO name. If not present the node name is used. - gpio-hog: A property specifying that this child node represent a GPIO hog. + +For GPIO hogging which is specified by the "gpio-hog" property the following +additional properties are required. +Required properties for GPIO hogging: - gpios: Store the GPIO information (id, flags, ...). Shall contain the number of cells specified in its parent node (GPIO controller node). @@ -175,9 +187,6 @@ configuration. - output-high A property specifying to set the GPIO direction as output with the value high. -Optional properties: -- line-name: The GPIO label name. If not present the node name is used. - Example of two SOC GPIO banks defined as gpio-controller nodes: qe_pio_a: gpio-controller@1400 { @@ -192,6 +201,11 @@ Example of two SOC GPIO banks defined as gpio-controller nodes: output-low; line-name = "foo-bar-gpio"; }; + + line_c { + gpios = <7 0>; + line-name = "SCHEMATIC_LINE_NAME"; + }; }; qe_pio_e: gpio-controller@1460 { -- 2.7.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] gpio: dt-bindings: Declare gpio-hog optional for GPIO subnodes 2016-02-23 7:54 ` [PATCH 3/4] gpio: dt-bindings: Declare gpio-hog optional for GPIO subnodes Markus Pargmann @ 2016-02-23 13:37 ` Linus Walleij 2016-02-23 23:25 ` Rob Herring 1 sibling, 0 replies; 18+ messages in thread From: Linus Walleij @ 2016-02-23 13:37 UTC (permalink / raw) To: Markus Pargmann Cc: linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree On Tue, Feb 23, 2016 at 8:54 AM, Markus Pargmann <mpa@pengutronix.de> wrote: > Reuse the GPIO hogging DT bindings for more generic specifications of > the GPIO. Therefore gpio-hog is declared optional. > > Signed-off-by: Markus Pargmann <mpa@pengutronix.de> I like this binding for names since it reuse what we already have, but will allow some time for others to comment. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] gpio: dt-bindings: Declare gpio-hog optional for GPIO subnodes 2016-02-23 7:54 ` [PATCH 3/4] gpio: dt-bindings: Declare gpio-hog optional for GPIO subnodes Markus Pargmann 2016-02-23 13:37 ` Linus Walleij @ 2016-02-23 23:25 ` Rob Herring 2016-02-24 7:01 ` Markus Pargmann 2016-03-09 3:53 ` Linus Walleij 1 sibling, 2 replies; 18+ messages in thread From: Rob Herring @ 2016-02-23 23:25 UTC (permalink / raw) To: Markus Pargmann Cc: Linus Walleij, linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree On Tue, Feb 23, 2016 at 08:54:48AM +0100, Markus Pargmann wrote: > Reuse the GPIO hogging DT bindings for more generic specifications of > the GPIO. Therefore gpio-hog is declared optional. Before extending this binding further, we need to consider other cases that have been discussed recently such as gpio switch binding and whether it should fit in with this. My biggest issue with this binding is whether the DT changes because today we don't have a driver for some GPIO line and tomorrow we do. That said, some specific comments below: > Signed-off-by: Markus Pargmann <mpa@pengutronix.de> > --- > Documentation/devicetree/bindings/gpio/gpio.txt | 28 ++++++++++++++++++------- > 1 file changed, 21 insertions(+), 7 deletions(-) > > diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt > index 069cdf6f9dac..820898e0649c 100644 > --- a/Documentation/devicetree/bindings/gpio/gpio.txt > +++ b/Documentation/devicetree/bindings/gpio/gpio.txt > @@ -155,13 +155,25 @@ gpio-controller@00000000 { > ngpios = <18>; > } > > -The GPIO chip may contain GPIO hog definitions. GPIO hogging is a mechanism > -providing automatic GPIO request and configuration as part of the > -gpio-controller's driver probe function. > +The GPIO chip may contain subnodes describing specific GPIOs of this > +controller. These GPIO nodes can be used to define GPIO hogging or define GPIO > +names. > +GPIO hogging is a mechanism providing automatic GPIO request and configuration > +as part of the gpio-controller's driver probe function. Linux driver details don't belong in binding descriptions. > -Each GPIO hog definition is represented as a child node of the GPIO controller. > +Each GPIO node consists of the following properties: > Required properties: > +- gpios: Store the GPIO information (id, flags, ...). Shall contain the > + number of cells specified in its parent node (GPIO controller > + node). > + > +Optional properties: > +- line-name: The GPIO name. If not present the node name is used. I'd like to deprecate line-name in favor of the standard property for user visible names "label". > - gpio-hog: A property specifying that this child node represent a GPIO hog. > + > +For GPIO hogging which is specified by the "gpio-hog" property the following > +additional properties are required. > +Required properties for GPIO hogging: > - gpios: Store the GPIO information (id, flags, ...). Shall contain the This doesn't make sense. gpios is always required and already listed above. > number of cells specified in its parent node (GPIO controller > node). > @@ -175,9 +187,6 @@ configuration. > - output-high A property specifying to set the GPIO direction as output with > the value high. > > -Optional properties: > -- line-name: The GPIO label name. If not present the node name is used. > - > Example of two SOC GPIO banks defined as gpio-controller nodes: > > qe_pio_a: gpio-controller@1400 { > @@ -192,6 +201,11 @@ Example of two SOC GPIO banks defined as gpio-controller nodes: > output-low; > line-name = "foo-bar-gpio"; > }; > + > + line_c { > + gpios = <7 0>; > + line-name = "SCHEMATIC_LINE_NAME"; > + }; > }; > > qe_pio_e: gpio-controller@1460 { > -- > 2.7.0 > > -- > To unsubscribe from this list: send the line "unsubscribe devicetree" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] gpio: dt-bindings: Declare gpio-hog optional for GPIO subnodes 2016-02-23 23:25 ` Rob Herring @ 2016-02-24 7:01 ` Markus Pargmann 2016-03-02 15:41 ` Rob Herring 2016-03-09 3:53 ` Linus Walleij 1 sibling, 1 reply; 18+ messages in thread From: Markus Pargmann @ 2016-02-24 7:01 UTC (permalink / raw) To: Rob Herring Cc: Linus Walleij, linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree [-- Attachment #1: Type: text/plain, Size: 4114 bytes --] Hi, On Tuesday, February 23, 2016 05:25:34 PM Rob Herring wrote: > On Tue, Feb 23, 2016 at 08:54:48AM +0100, Markus Pargmann wrote: > > Reuse the GPIO hogging DT bindings for more generic specifications of > > the GPIO. Therefore gpio-hog is declared optional. > > Before extending this binding further, we need to consider other cases > that have been discussed recently such as gpio switch binding and > whether it should fit in with this. I tried to discuss my ideas and issues with the gpio-switch bindings already some time ago, unfortunately the discussion didn't proceed: http://thread.gmane.org/gmane.linux.kernel/2100574 > > My biggest issue with this binding is whether the DT changes because > today we don't have a driver for some GPIO line and tomorrow we do. This patch is just about defining that we can give GPIO lines names. In the best case this name refers to the line name on the schematic. In the worst case it is some arbitrary name. In both cases it should not influence any driver that is trying to use this GPIO. gpio-hogging indeed could cause problems for future drivers as these GPIOs are not available for any drivers. But gpio-hogging is already defined for quite some time in the DT bindings. Also I would assume that for most new drivers new DT bindings are created so that it already requires a DT update together with a kernel update. > > That said, some specific comments below: > > > Signed-off-by: Markus Pargmann <mpa@pengutronix.de> > > --- > > Documentation/devicetree/bindings/gpio/gpio.txt | 28 ++++++++++++++++++------- > > 1 file changed, 21 insertions(+), 7 deletions(-) > > > > diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt > > index 069cdf6f9dac..820898e0649c 100644 > > --- a/Documentation/devicetree/bindings/gpio/gpio.txt > > +++ b/Documentation/devicetree/bindings/gpio/gpio.txt > > @@ -155,13 +155,25 @@ gpio-controller@00000000 { > > ngpios = <18>; > > } > > > > -The GPIO chip may contain GPIO hog definitions. GPIO hogging is a mechanism > > -providing automatic GPIO request and configuration as part of the > > -gpio-controller's driver probe function. > > +The GPIO chip may contain subnodes describing specific GPIOs of this > > +controller. These GPIO nodes can be used to define GPIO hogging or define GPIO > > +names. > > +GPIO hogging is a mechanism providing automatic GPIO request and configuration > > +as part of the gpio-controller's driver probe function. > > Linux driver details don't belong in binding descriptions. This last sentence was only moved a bit. So perhaps this should be changed in a separate patch. > > > -Each GPIO hog definition is represented as a child node of the GPIO controller. > > +Each GPIO node consists of the following properties: > > Required properties: > > +- gpios: Store the GPIO information (id, flags, ...). Shall contain the > > + number of cells specified in its parent node (GPIO controller > > + node). > > + > > +Optional properties: > > +- line-name: The GPIO name. If not present the node name is used. > > I'd like to deprecate line-name in favor of the standard property > for user visible names "label". > > > - gpio-hog: A property specifying that this child node represent a GPIO hog. > > + > > +For GPIO hogging which is specified by the "gpio-hog" property the following > > +additional properties are required. > > +Required properties for GPIO hogging: > > - gpios: Store the GPIO information (id, flags, ...). Shall contain the > > This doesn't make sense. gpios is always required and already listed > above. Thanks, will remove it. Best Regards, Markus Pargmann -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] gpio: dt-bindings: Declare gpio-hog optional for GPIO subnodes 2016-02-24 7:01 ` Markus Pargmann @ 2016-03-02 15:41 ` Rob Herring 2016-03-09 4:07 ` Linus Walleij 0 siblings, 1 reply; 18+ messages in thread From: Rob Herring @ 2016-03-02 15:41 UTC (permalink / raw) To: Markus Pargmann Cc: Linus Walleij, linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree On Wed, Feb 24, 2016 at 08:01:47AM +0100, Markus Pargmann wrote: > Hi, > > On Tuesday, February 23, 2016 05:25:34 PM Rob Herring wrote: > > On Tue, Feb 23, 2016 at 08:54:48AM +0100, Markus Pargmann wrote: > > > Reuse the GPIO hogging DT bindings for more generic specifications of > > > the GPIO. Therefore gpio-hog is declared optional. > > > > Before extending this binding further, we need to consider other cases > > that have been discussed recently such as gpio switch binding and > > whether it should fit in with this. > > I tried to discuss my ideas and issues with the gpio-switch bindings > already some time ago, unfortunately the discussion didn't proceed: > http://thread.gmane.org/gmane.linux.kernel/2100574 We need to revive that. I do plan to discuss this with Linus F2F next week. > > My biggest issue with this binding is whether the DT changes because > > today we don't have a driver for some GPIO line and tomorrow we do. > > This patch is just about defining that we can give GPIO lines names. In > the best case this name refers to the line name on the schematic. In the > worst case it is some arbitrary name. In both cases it should not > influence any driver that is trying to use this GPIO. No issues with adding this information. The question is just how should all this fit together (line names, simple functions (e.g. switches), and initialization). The overall structure needs to extendable. As Linus said, we need a proposal that addresses all these issues. > gpio-hogging indeed could cause problems for future drivers as these > GPIOs are not available for any drivers. But gpio-hogging is already > defined for quite some time in the DT bindings. That doesn't mean we can't decide some bindings were a bad idea and move towards something new. > Also I would assume that for most new drivers new DT bindings are > created so that it already requires a DT update together with a kernel > update. Frequently that may be right. However, I think having a temporary binding only encourages to not fully define their h/w. Think of the case where you have a single DTB and support multiple OSs (or different versions). The DTB would have to work with both as one OS may require gpio-hogs and the other may require a specific driver. That should be possible to do. Requiring removing the gpio-hog to add a specific binding is a problem. AIUI, a hog will prevent any other user in the kernel. I think that is backwards in that a hog should only provide some default configuration/use. Rob ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] gpio: dt-bindings: Declare gpio-hog optional for GPIO subnodes 2016-03-02 15:41 ` Rob Herring @ 2016-03-09 4:07 ` Linus Walleij 0 siblings, 0 replies; 18+ messages in thread From: Linus Walleij @ 2016-03-09 4:07 UTC (permalink / raw) To: Rob Herring Cc: Markus Pargmann, linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree On Wed, Mar 2, 2016 at 10:41 PM, Rob Herring <robh@kernel.org> wrote: > Requiring removing the gpio-hog to add a specific > binding is a problem. AIUI, a hog will prevent any other user in the > kernel. I think that is backwards in that a hog should only provide some > default configuration/use. I think there is some misunderstanding here. - HOGS are done to hook a line up in a way so that it is *used* for something, such as biasing a MMC CD line in this example from arch/arm/boot/dts/ste-nomadik-s8815.dts: gpio3: gpio@101e7000 { /* This hog will bias the MMC/SD card detect line */ mmcsd-gpio { gpio-hog; gpios = <16 0x0>; output-low; line-name = "card detect bias"; }; }; So it's not like this line is "unused" or something. - For the case when we want to just set up some default values in some registers for a GPIO line and just leave it for whatever consumer may turn up (whether a driver or e.g. userspace), we have had proposals for setting up initial values from the DT, using essentially the hog syntax but with another bool than "gpio-hog" obviously, "gpio-initval" or just leaving it blank was suggested in the former thread. (See switch discussion.) So my view is if we want just initial configuration of lines, then handle that separately, do not try to change the semantic meaning of the hogs to be something else, let hogs be hogs. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] gpio: dt-bindings: Declare gpio-hog optional for GPIO subnodes 2016-02-23 23:25 ` Rob Herring 2016-02-24 7:01 ` Markus Pargmann @ 2016-03-09 3:53 ` Linus Walleij 2016-03-09 4:27 ` Rob Herring 1 sibling, 1 reply; 18+ messages in thread From: Linus Walleij @ 2016-03-09 3:53 UTC (permalink / raw) To: Rob Herring Cc: Markus Pargmann, linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree On Wed, Feb 24, 2016 at 6:25 AM, Rob Herring <robh@kernel.org> wrote: > On Tue, Feb 23, 2016 at 08:54:48AM +0100, Markus Pargmann wrote: >> +Optional properties: >> +- line-name: The GPIO name. If not present the node name is used. > > I'd like to deprecate line-name in favor of the standard property > for user visible names "label". This causes some unfortunate confusion wrt internal linux naming. GPIO lines have two "names" - The "name" is what the line (pin) is named on the chip, or the name of the rail going out on the board, from the chip, so it is a producer name. - Then the GPIO consumers set a second name, called "label" (confusingly) so we can see in e.g. debugfs and now also the userspace ABI who is using it. I named these "name" and "consumer" in the userspace ABI, I think I should take a round and rename it from "label" to "consumer" also inside the kernel to avoid confusion with this, because "label" in DT is going to be converted to "name" in the GPIOlib and then it also has something named "label" and that is another thing, argh! Yours, Linus Walleij ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] gpio: dt-bindings: Declare gpio-hog optional for GPIO subnodes 2016-03-09 3:53 ` Linus Walleij @ 2016-03-09 4:27 ` Rob Herring 2016-03-09 5:56 ` Linus Walleij 0 siblings, 1 reply; 18+ messages in thread From: Rob Herring @ 2016-03-09 4:27 UTC (permalink / raw) To: Linus Walleij Cc: Markus Pargmann, linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree On Tue, Mar 8, 2016 at 9:53 PM, Linus Walleij <linus.walleij@linaro.org> wrote: > On Wed, Feb 24, 2016 at 6:25 AM, Rob Herring <robh@kernel.org> wrote: >> On Tue, Feb 23, 2016 at 08:54:48AM +0100, Markus Pargmann wrote: > >>> +Optional properties: >>> +- line-name: The GPIO name. If not present the node name is used. >> >> I'd like to deprecate line-name in favor of the standard property >> for user visible names "label". > > This causes some unfortunate confusion wrt internal linux naming. Yes. > GPIO lines have two "names" > > - The "name" is what the line (pin) is named > on the chip, or the name of the rail going out on the board, from the chip, > so it is a producer name. Who/what uses this? > - Then the GPIO consumers set a second name, called "label" > (confusingly) so we can see in e.g. debugfs and now also the userspace > ABI who is using it. > > I named these "name" and "consumer" in the userspace ABI, I think > I should take a round and rename it from "label" to "consumer" > also inside the kernel to avoid confusion with this, because "label" > in DT is going to be converted to "name" in the GPIOlib and > then it also has something named "label" and that is another thing, > argh! There is still confusion because DT label should be the consumer side, not the SoC pin name. Then of course you could have 3 levels of names needed if you have SoC pin, board connector pin, and mezzanine consumer. Rob ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] gpio: dt-bindings: Declare gpio-hog optional for GPIO subnodes 2016-03-09 4:27 ` Rob Herring @ 2016-03-09 5:56 ` Linus Walleij 0 siblings, 0 replies; 18+ messages in thread From: Linus Walleij @ 2016-03-09 5:56 UTC (permalink / raw) To: Rob Herring Cc: Markus Pargmann, linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree On Wed, Mar 9, 2016 at 11:27 AM, Rob Herring <robh@kernel.org> wrote: > On Tue, Mar 8, 2016 at 9:53 PM, Linus Walleij <linus.walleij@linaro.org> wrote: >> - The "name" is what the line (pin) is named >> on the chip, or the name of the rail going out on the board, from the chip, >> so it is a producer name. > > Who/what uses this? The names[] in struct gpio_chip has been used for years to name the lines of the GPIO chips. The requirement coming from the community for userspace GPIO is about being able to name the lines on the producer side. One example is 96boards that want to consistently name lines on a header from the producer side across a set of boards, no matter what SoC is used. In their case the actual consumer is some one-off peripheral driven from userspace, so there (I expect) userspace will set up the label/consumer name eventually, if any. >> I named these "name" and "consumer" in the userspace ABI, I think >> I should take a round and rename it from "label" to "consumer" >> also inside the kernel to avoid confusion with this, because "label" >> in DT is going to be converted to "name" in the GPIOlib and >> then it also has something named "label" and that is another thing, >> argh! > > There is still confusion because DT label should be the consumer side, > not the SoC pin name. Oh I see what you mean. That is actually how it works with the hogs, it is setting the consumer side of things through gpiod_get(). > Then of course you could have 3 levels of names needed if you have SoC > pin, board connector pin, and mezzanine consumer. I don't think the distinction between pin and board connector is needed, if it is then the connector should have its own DT node and I suspect that would be overkill. I am atleast optimistically assuming that "name" will cover pin/rail/header name - whatever makes most sense - for a GPIO line producer. Linus Walleij ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 4/4] gpio: Add parsing of DT GPIO line-names 2016-02-23 7:54 [PATCH 1/4] tools: gpio: Small updates for output format Markus Pargmann 2016-02-23 7:54 ` [PATCH 2/4] tools: gpio: Add necessary include paths Markus Pargmann 2016-02-23 7:54 ` [PATCH 3/4] gpio: dt-bindings: Declare gpio-hog optional for GPIO subnodes Markus Pargmann @ 2016-02-23 7:54 ` Markus Pargmann 2016-02-23 13:36 ` Linus Walleij 2016-03-15 8:41 ` Linus Walleij 2016-02-23 13:21 ` [PATCH 1/4] tools: gpio: Small updates for output format Linus Walleij 3 siblings, 2 replies; 18+ messages in thread From: Markus Pargmann @ 2016-02-23 7:54 UTC (permalink / raw) To: Linus Walleij Cc: linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree, Markus Pargmann This patch reuses the DT bindings that are already in place for the gpio-hogging mechanism. These bindings define line-name properties for GPIOs inside the gpio-chip device node. of_parse_own_gpio() now sets the gpio descriptor name using the newly introduced gpiod_set_name(). It checks for name collisions within a GPIO chip to avoid GPIOs with the same name that are exported over the same GPIO character device. The GPIO flags that describe the GPIO state are not required anymore in general but are checked if the gpio-hog property was found. This can be used to use the line names from the schematic. Example of lsgpio on a modified i.MX6s Riotboard: GPIO chip: gpiochip0, "209c000.gpio", 32 GPIO lines line 0: unnamed unlabeled line 1: unnamed unlabeled line 2: SD2_WP "wp" [kernel output open-drain] line 3: GPIO_3_CLK unlabeled line 4: SD2_CD "cd" [kernel output open-drain] ... The modified DT: &gpio1 { sd2_wp { gpios = <2 0>; line-name = "SD2_WP"; }; gpio_3_clk { gpios = <3 0>; line-name = "GPIO_3_CLK"; }; sd2_cd { gpios = <4 0>; line-name = "SD2_CD"; }; }; Signed-off-by: Markus Pargmann <mpa@pengutronix.de> --- drivers/gpio/gpiolib-of.c | 37 +++++++++++++++++++--------------- drivers/gpio/gpiolib.c | 51 +++++++++++++++++++++++++++++++++++++++-------- drivers/gpio/gpiolib.h | 5 +++-- 3 files changed, 67 insertions(+), 26 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 42a4bb7cf49a..e206b305ae56 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -121,7 +121,6 @@ EXPORT_SYMBOL(of_get_named_gpio_flags); /** * of_parse_own_gpio() - Get a GPIO hog descriptor, names and flags for GPIO API * @np: device node to get GPIO from - * @name: GPIO line name * @lflags: gpio_lookup_flags - returned from of_find_gpio() or * of_parse_own_gpio() * @dflags: gpiod_flags - optional GPIO initialization flags @@ -130,7 +129,6 @@ EXPORT_SYMBOL(of_get_named_gpio_flags); * value on the error condition. */ static struct gpio_desc *of_parse_own_gpio(struct device_node *np, - const char **name, enum gpio_lookup_flags *lflags, enum gpiod_flags *dflags) { @@ -141,6 +139,7 @@ static struct gpio_desc *of_parse_own_gpio(struct device_node *np, }; u32 tmp; int i, ret; + const char *name = NULL; chip_np = np->parent; if (!chip_np) @@ -183,14 +182,15 @@ static struct gpio_desc *of_parse_own_gpio(struct device_node *np, *dflags |= GPIOD_OUT_LOW; else if (of_property_read_bool(np, "output-high")) *dflags |= GPIOD_OUT_HIGH; - else { - pr_warn("GPIO line %d (%s): no hogging state specified, bailing out\n", - desc_to_gpio(gg_data.out_gpio), np->name); - return ERR_PTR(-EINVAL); - } - if (name && of_property_read_string(np, "line-name", name)) - *name = np->name; + if (of_property_read_string(np, "line-name", &name)) + name = np->name; + ret = gpiod_set_name(gg_data.out_gpio, name); + if (ret) { + pr_err("Failed setting GPIO line name %s for GPIO %d.\n", name, + desc_to_gpio(gg_data.out_gpio)); + return ERR_PTR(ret); + } return gg_data.out_gpio; } @@ -206,20 +206,25 @@ static void of_gpiochip_scan_gpios(struct gpio_chip *chip) { struct gpio_desc *desc = NULL; struct device_node *np; - const char *name; enum gpio_lookup_flags lflags; enum gpiod_flags dflags; for_each_child_of_node(chip->of_node, np) { - if (!of_property_read_bool(np, "gpio-hog")) - continue; - - desc = of_parse_own_gpio(np, &name, &lflags, &dflags); + desc = of_parse_own_gpio(np, &lflags, &dflags); if (IS_ERR(desc)) continue; - if (gpiod_hog(desc, name, lflags, dflags)) - continue; + if (of_property_read_bool(np, "gpio-hog")) { + if (!dflags) { + pr_warn("GPIO line %d (%s): no hogging state specified, bailing out\n", + desc_to_gpio(desc), + desc->name); + continue; + } + printk("%s:%d %s lflags %x dflags %x\n", __FILE__, __LINE__, __func__, lflags, dflags); + if (gpiod_hog(desc, lflags, dflags)) + continue; + } } } diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 3580c0de9d5a..0750e6b2868a 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -770,6 +770,42 @@ static struct gpio_chip *find_chip_by_name(const char *name) return gpiochip_find((void *)name, gpiochip_match_name); } +static struct gpio_desc *gpiodev_find_gpiod_by_name(struct gpio_device *gdev, + const char *name) +{ + int i; + + for (i = 0; i != gdev->ngpio; ++i) { + struct gpio_desc *desc = &gdev->descs[i]; + + if (desc->name && !strcmp(desc->name, name)) + return desc; + } + + return NULL; +} + +/** + * gpid_set_name() - sets the name of a gpio descriptor + * @desc: the gpio descriptor + * @name: the name pointer that is assigned. It is internally not copied. + * + * This function sets a new name for the GPIO. It checks for collisions with + * other GPIOs with the same name within the gpio chip. It returns 0 on success + * or -EEXIST if the name is already used within the GPIO chip. + */ +int gpiod_set_name(struct gpio_desc *desc, const char *name) +{ + struct gpio_desc *coll = gpiodev_find_gpiod_by_name(desc->gdev, name); + + if (coll) + return -EEXIST; + + desc->name = name; + + return 0; +} + #ifdef CONFIG_GPIOLIB_IRQCHIP /* @@ -2600,13 +2636,12 @@ EXPORT_SYMBOL_GPL(gpiod_get_index_optional); /** * gpiod_hog - Hog the specified GPIO desc given the provided flags * @desc: gpio whose value will be assigned - * @name: gpio line name * @lflags: gpio_lookup_flags - returned from of_find_gpio() or * of_get_gpio_hog() * @dflags: gpiod_flags - optional GPIO initialization flags */ -int gpiod_hog(struct gpio_desc *desc, const char *name, - unsigned long lflags, enum gpiod_flags dflags) +int gpiod_hog(struct gpio_desc *desc, unsigned long lflags, + enum gpiod_flags dflags) { struct gpio_chip *chip; struct gpio_desc *local_desc; @@ -2618,17 +2653,17 @@ int gpiod_hog(struct gpio_desc *desc, const char *name, gpiod_parse_flags(desc, lflags); - local_desc = gpiochip_request_own_desc(chip, hwnum, name); + local_desc = gpiochip_request_own_desc(chip, hwnum, desc->name); if (IS_ERR(local_desc)) { pr_err("requesting hog GPIO %s (chip %s, offset %d) failed\n", - name, chip->label, hwnum); + desc->name, chip->label, hwnum); return PTR_ERR(local_desc); } - status = gpiod_configure_flags(desc, name, dflags); + status = gpiod_configure_flags(desc, desc->name, dflags); if (status < 0) { pr_err("setup of hog GPIO %s (chip %s, offset %d) failed\n", - name, chip->label, hwnum); + desc->name, chip->label, hwnum); gpiochip_free_own_desc(desc); return status; } @@ -2637,7 +2672,7 @@ int gpiod_hog(struct gpio_desc *desc, const char *name, set_bit(FLAG_IS_HOGGED, &desc->flags); pr_info("GPIO line %d (%s) hogged as %s%s\n", - desc_to_gpio(desc), name, + desc_to_gpio(desc), desc->name, (dflags&GPIOD_FLAGS_BIT_DIR_OUT) ? "output" : "input", (dflags&GPIOD_FLAGS_BIT_DIR_OUT) ? (dflags&GPIOD_FLAGS_BIT_DIR_VAL) ? "/high" : "/low":""); diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index e30e5fdb1214..2d8372f4251e 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -167,8 +167,9 @@ struct gpio_desc { int gpiod_request(struct gpio_desc *desc, const char *label); void gpiod_free(struct gpio_desc *desc); -int gpiod_hog(struct gpio_desc *desc, const char *name, - unsigned long lflags, enum gpiod_flags dflags); +int gpiod_hog(struct gpio_desc *desc, unsigned long lflags, + enum gpiod_flags dflags); +int gpiod_set_name(struct gpio_desc *desc, const char *name); /* * Return the GPIO number of the passed descriptor relative to its chip -- 2.7.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 4/4] gpio: Add parsing of DT GPIO line-names 2016-02-23 7:54 ` [PATCH 4/4] gpio: Add parsing of DT GPIO line-names Markus Pargmann @ 2016-02-23 13:36 ` Linus Walleij 2016-02-24 7:03 ` Markus Pargmann 2016-03-15 8:41 ` Linus Walleij 1 sibling, 1 reply; 18+ messages in thread From: Linus Walleij @ 2016-02-23 13:36 UTC (permalink / raw) To: Markus Pargmann Cc: linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree On Tue, Feb 23, 2016 at 8:54 AM, Markus Pargmann <mpa@pengutronix.de> wrote: > This patch reuses the DT bindings that are already in place for the > gpio-hogging mechanism. These bindings define line-name properties for > GPIOs inside the gpio-chip device node. > > of_parse_own_gpio() now sets the gpio descriptor name using the newly > introduced gpiod_set_name(). It checks for name collisions within a GPIO > chip to avoid GPIOs with the same name that are exported over the same > GPIO character device. > > The GPIO flags that describe the GPIO state are not required anymore in > general but are checked if the gpio-hog property was found. > > This can be used to use the line names from the schematic. Example of lsgpio on > a modified i.MX6s Riotboard: > > GPIO chip: gpiochip0, "209c000.gpio", 32 GPIO lines > line 0: unnamed unlabeled > line 1: unnamed unlabeled > line 2: SD2_WP "wp" [kernel output open-drain] > line 3: GPIO_3_CLK unlabeled > line 4: SD2_CD "cd" [kernel output open-drain] > ... > > The modified DT: > &gpio1 { > sd2_wp { > gpios = <2 0>; > line-name = "SD2_WP"; > }; > > gpio_3_clk { > gpios = <3 0>; > line-name = "GPIO_3_CLK"; > }; > > sd2_cd { > gpios = <4 0>; > line-name = "SD2_CD"; > }; > }; > > Signed-off-by: Markus Pargmann <mpa@pengutronix.de> NICE! And this is what I want too. We need to remove some rough edges: > +static struct gpio_desc *gpiodev_find_gpiod_by_name(struct gpio_device *gdev, > + const char *name) > +{ > + int i; > + > + for (i = 0; i != gdev->ngpio; ++i) { > + struct gpio_desc *desc = &gdev->descs[i]; > + > + if (desc->name && !strcmp(desc->name, name)) > + return desc; > + } > + > + return NULL; > +} We already have gpio_name_to_desc() which does something similar but across all chips. Can we break out one gpiodev_name_to_desc() like yours, and refactor gpio_name_to_desc() to just call that for each chip? > +/** > + * gpid_set_name() - sets the name of a gpio descriptor Missing "o" in gpid_ > + * @desc: the gpio descriptor > + * @name: the name pointer that is assigned. It is internally not copied. > + * > + * This function sets a new name for the GPIO. It checks for collisions with > + * other GPIOs with the same name within the gpio chip. It returns 0 on success > + * or -EEXIST if the name is already used within the GPIO chip. > + */ > +int gpiod_set_name(struct gpio_desc *desc, const char *name) > +{ > + struct gpio_desc *coll = gpiodev_find_gpiod_by_name(desc->gdev, name); > + > + if (coll) > + return -EEXIST; > + > + desc->name = name; > + > + return 0; > +} Otherwise I'm OK with this. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 4/4] gpio: Add parsing of DT GPIO line-names 2016-02-23 13:36 ` Linus Walleij @ 2016-02-24 7:03 ` Markus Pargmann 0 siblings, 0 replies; 18+ messages in thread From: Markus Pargmann @ 2016-02-24 7:03 UTC (permalink / raw) To: Linus Walleij Cc: linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree [-- Attachment #1: Type: text/plain, Size: 3857 bytes --] On Tuesday, February 23, 2016 02:36:42 PM Linus Walleij wrote: > On Tue, Feb 23, 2016 at 8:54 AM, Markus Pargmann <mpa@pengutronix.de> wrote: > > > This patch reuses the DT bindings that are already in place for the > > gpio-hogging mechanism. These bindings define line-name properties for > > GPIOs inside the gpio-chip device node. > > > > of_parse_own_gpio() now sets the gpio descriptor name using the newly > > introduced gpiod_set_name(). It checks for name collisions within a GPIO > > chip to avoid GPIOs with the same name that are exported over the same > > GPIO character device. > > > > The GPIO flags that describe the GPIO state are not required anymore in > > general but are checked if the gpio-hog property was found. > > > > This can be used to use the line names from the schematic. Example of lsgpio on > > a modified i.MX6s Riotboard: > > > > GPIO chip: gpiochip0, "209c000.gpio", 32 GPIO lines > > line 0: unnamed unlabeled > > line 1: unnamed unlabeled > > line 2: SD2_WP "wp" [kernel output open-drain] > > line 3: GPIO_3_CLK unlabeled > > line 4: SD2_CD "cd" [kernel output open-drain] > > ... > > > > The modified DT: > > &gpio1 { > > sd2_wp { > > gpios = <2 0>; > > line-name = "SD2_WP"; > > }; > > > > gpio_3_clk { > > gpios = <3 0>; > > line-name = "GPIO_3_CLK"; > > }; > > > > sd2_cd { > > gpios = <4 0>; > > line-name = "SD2_CD"; > > }; > > }; > > > > Signed-off-by: Markus Pargmann <mpa@pengutronix.de> > > NICE! And this is what I want too. > > We need to remove some rough edges: > > > +static struct gpio_desc *gpiodev_find_gpiod_by_name(struct gpio_device *gdev, > > + const char *name) > > +{ > > + int i; > > + > > + for (i = 0; i != gdev->ngpio; ++i) { > > + struct gpio_desc *desc = &gdev->descs[i]; > > + > > + if (desc->name && !strcmp(desc->name, name)) > > + return desc; > > + } > > + > > + return NULL; > > +} > > We already have gpio_name_to_desc() which does something > similar but across all chips. > > Can we break out one gpiodev_name_to_desc() like > yours, and refactor gpio_name_to_desc() to just call > that for each chip? Yes, that sounds good. Thanks, Markus > > > +/** > > + * gpid_set_name() - sets the name of a gpio descriptor > > Missing "o" in gpid_ > > > + * @desc: the gpio descriptor > > + * @name: the name pointer that is assigned. It is internally not copied. > > + * > > + * This function sets a new name for the GPIO. It checks for collisions with > > + * other GPIOs with the same name within the gpio chip. It returns 0 on success > > + * or -EEXIST if the name is already used within the GPIO chip. > > + */ > > +int gpiod_set_name(struct gpio_desc *desc, const char *name) > > +{ > > + struct gpio_desc *coll = gpiodev_find_gpiod_by_name(desc->gdev, name); > > + > > + if (coll) > > + return -EEXIST; > > + > > + desc->name = name; > > + > > + return 0; > > +} > > Otherwise I'm OK with this. > > Yours, > Linus Walleij > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 4/4] gpio: Add parsing of DT GPIO line-names 2016-02-23 7:54 ` [PATCH 4/4] gpio: Add parsing of DT GPIO line-names Markus Pargmann 2016-02-23 13:36 ` Linus Walleij @ 2016-03-15 8:41 ` Linus Walleij 1 sibling, 0 replies; 18+ messages in thread From: Linus Walleij @ 2016-03-15 8:41 UTC (permalink / raw) To: Markus Pargmann, Rob Herring, Grant Likely Cc: linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, devicetree On Tue, Feb 23, 2016 at 8:54 AM, Markus Pargmann <mpa@pengutronix.de> wrote: > This patch reuses the DT bindings that are already in place for the > gpio-hogging mechanism. These bindings define line-name properties for > GPIOs inside the gpio-chip device node. > > of_parse_own_gpio() now sets the gpio descriptor name using the newly > introduced gpiod_set_name(). It checks for name collisions within a GPIO > chip to avoid GPIOs with the same name that are exported over the same > GPIO character device. > > The GPIO flags that describe the GPIO state are not required anymore in > general but are checked if the gpio-hog property was found. > > This can be used to use the line names from the schematic. Example of lsgpio on > a modified i.MX6s Riotboard: > > GPIO chip: gpiochip0, "209c000.gpio", 32 GPIO lines > line 0: unnamed unlabeled > line 1: unnamed unlabeled > line 2: SD2_WP "wp" [kernel output open-drain] > line 3: GPIO_3_CLK unlabeled > line 4: SD2_CD "cd" [kernel output open-drain] > ... > > The modified DT: > &gpio1 { > sd2_wp { > gpios = <2 0>; > line-name = "SD2_WP"; > }; > > gpio_3_clk { > gpios = <3 0>; > line-name = "GPIO_3_CLK"; > }; > > sd2_cd { > gpios = <4 0>; > line-name = "SD2_CD"; > }; > }; > > Signed-off-by: Markus Pargmann <mpa@pengutronix.de> I discussed the method for naming the GPIO lines with Rob Herring, Grant Likely and Arnd Bergmann in person last week. Rob strongly prefers that we just assign the names to the indices using an array, like is done in the clock framework so we don't deviate from their pattern for clock-output-names: Documentation/devicetree/bindings/clock/clock-bindings.txt In our case I proposed that it be named gpio-line-names, so: gpio-line-names = "foo", "bar", "baz" ... ; It needs to be named gpio-line-names, since they are bidirectional so gpio-output-names would not work, also gpio-names = ... would be ambigous. So I suggest gpio-line-names. Further, there is a problem that I did not realize with reusing the hog names: the name specified in there is for the consumer side: so it will result in gpiod_get("name") and name the consumer side (label) of the GPIO. It is confusing if the same scheme is used to name the producer side: so let's leave hogs to be hogs: they are a kind of consumer nothing else. We also discussed initial values/set up. This is another issue and we didn't reach a conclusion on that. Anyways: we need a line naming patch, are you interested in hacking it up (keep DT bindings and code changed in the same file) or should I do it? Yours, Linus Walleij ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/4] tools: gpio: Small updates for output format 2016-02-23 7:54 [PATCH 1/4] tools: gpio: Small updates for output format Markus Pargmann ` (2 preceding siblings ...) 2016-02-23 7:54 ` [PATCH 4/4] gpio: Add parsing of DT GPIO line-names Markus Pargmann @ 2016-02-23 13:21 ` Linus Walleij 3 siblings, 0 replies; 18+ messages in thread From: Linus Walleij @ 2016-02-23 13:21 UTC (permalink / raw) To: Markus Pargmann Cc: linux-gpio, Alexandre Courbot, Johan Hovold, Michael Welling, Bamvor Jian Zhang, Grant Likely, devicetree On Tue, Feb 23, 2016 at 8:54 AM, Markus Pargmann <mpa@pengutronix.de> wrote: > Use %2d for the GPIO line number. This should align the results > horziontally for most gpio chips. > > The GPIO label uses quotes for real values. For GPIO names this is > currently missing. The patch adds the missing quote. > > Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Patch applied. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2016-03-15 8:41 UTC | newest] Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-02-23 7:54 [PATCH 1/4] tools: gpio: Small updates for output format Markus Pargmann 2016-02-23 7:54 ` [PATCH 2/4] tools: gpio: Add necessary include paths Markus Pargmann 2016-02-23 13:26 ` Linus Walleij 2016-02-24 6:39 ` Markus Pargmann 2016-02-23 7:54 ` [PATCH 3/4] gpio: dt-bindings: Declare gpio-hog optional for GPIO subnodes Markus Pargmann 2016-02-23 13:37 ` Linus Walleij 2016-02-23 23:25 ` Rob Herring 2016-02-24 7:01 ` Markus Pargmann 2016-03-02 15:41 ` Rob Herring 2016-03-09 4:07 ` Linus Walleij 2016-03-09 3:53 ` Linus Walleij 2016-03-09 4:27 ` Rob Herring 2016-03-09 5:56 ` Linus Walleij 2016-02-23 7:54 ` [PATCH 4/4] gpio: Add parsing of DT GPIO line-names Markus Pargmann 2016-02-23 13:36 ` Linus Walleij 2016-02-24 7:03 ` Markus Pargmann 2016-03-15 8:41 ` Linus Walleij 2016-02-23 13:21 ` [PATCH 1/4] tools: gpio: Small updates for output format 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).