All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martyn Welch <martyn.welch@collabora.co.uk>
To: Rob Herring <robh@kernel.org>, Linus Walleij <linus.walleij@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Russell King <linux@arm.linux.org.uk>,
	Kukjin Kim <kgene@kernel.org>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,
	Olof Johansson <olof@lixom.net>
Subject: Re: [PATCH 1/3] Device tree binding documentation for gpio-switch
Date: Mon, 07 Dec 2015 21:10:55 +0000	[thread overview]
Message-ID: <5665F5DF.50002@collabora.co.uk> (raw)
In-Reply-To: <20151207173702.GA17659@rob-hp-laptop>



On 07/12/15 17:37, Rob Herring wrote:
> +Linus W
>
> On Fri, Dec 04, 2015 at 05:31:13PM +0000, Martyn Welch wrote:
>> This patch adds documentation for the gpio-switch binding. This binding
>> provides a mechanism to bind named links to gpio, with the primary
>> purpose of enabling standardised access to switches that might be standard
>> across a group of devices but implemented differently on each device.
>
> This is good and what I suggested, but it now makes me wonder if switch
> is generic enough. This boils down to needing to expose single gpio
> lines to userspace with a defined function/use. IIRC, there's been some
> discussion about this before along with improving the userspace
> interface for GPIO in general. So I'd like to get Linus' thoughts on
> this.
>

No problem. Rename gpio-signal?

>
>> Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
>> ---
>>   .../devicetree/bindings/misc/gpio-switch.txt       | 47 ++++++++++++++++++++++
>>   1 file changed, 47 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/misc/gpio-switch.txt
>>
>> diff --git a/Documentation/devicetree/bindings/misc/gpio-switch.txt b/Documentation/devicetree/bindings/misc/gpio-switch.txt
>> new file mode 100644
>> index 0000000..13528bd
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/misc/gpio-switch.txt
>> @@ -0,0 +1,47 @@
>> +Device-Tree bindings for gpio attached switches.
>> +
>> +This provides a mechanism to provide a named link to specified gpios. This can
>> +be useful in instances such as when theres a need to monitor a switch, which is
>> +common across a family of devices, but attached to different gpios and even
>> +implemented in different ways on differnet devices.
>> +
>> +Required properties:
>> +	- compatible = "gpio-switch";
>> +
>> +Each signal is represented as a sub-node of "gpio-switch". The naming of
>> +sub-nodes is arbitrary.
>> +
>> +Required sub-node properties:
>> +
>> +	- label: Name to be given to gpio switch.
>> +	- gpios: OF device-tree gpio specification.
>> +
>> +Optional sub-node properties:
>> +
>> +	- read-only: Boolean flag to mark the gpio as read-only, i.e. the line
>> +	  should not be driven by the host.
>
> In terms a a switch use, allowing driving it would be an override of the
> switch. Is that the idea here?
>

Yeah - since it had become a lot more generic and a lot of 
switches/signals would probably be implemented with a pull-up resistor 
of something like that, it seemed to make sense to allow them to be 
driven as well.

>> +
>> +Example nodes:
>> +
>> +        gpio-switch {
>> +                compatible = "gpio-switch";
>
> Both from a binding and driver perspective, there is no point in
> grouping these. Each node can simply have this compatible string.
>

True. I did it this way as this is how gpio-keys is implemented. OK, 
that has one optional parameter (autorepeat) for the block and this has 
none. Though I can also see that these probably have less in common than 
the individual lines used in gpio-keys.

>> +
>> +                write-protect {
>> +                        label = "write-protect";
>> +                        gpios = <&gpx3 0 GPIO_ACTIVE_LOW>;
>> +                        read-only;
>> +                };
>> +
>> +                developer-switch {
>> +                        label = "developer-switch";
>> +                        gpios = <&gpx1 3 GPIO_ACTIVE_HIGH>;
>> +                        read-only;
>> +                };
>> +
>> +                recovery-switch {
>> +                        label = "recovery-switch";
>> +                        gpios = <&gpx0 7 GPIO_ACTIVE_LOW>;
>> +                        read-only;
>> +                };
>> +        };
>> +
>> --
>> 2.1.4
>>

WARNING: multiple messages have this Message-ID (diff)
From: martyn.welch@collabora.co.uk (Martyn Welch)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] Device tree binding documentation for gpio-switch
Date: Mon, 07 Dec 2015 21:10:55 +0000	[thread overview]
Message-ID: <5665F5DF.50002@collabora.co.uk> (raw)
In-Reply-To: <20151207173702.GA17659@rob-hp-laptop>



On 07/12/15 17:37, Rob Herring wrote:
> +Linus W
>
> On Fri, Dec 04, 2015 at 05:31:13PM +0000, Martyn Welch wrote:
>> This patch adds documentation for the gpio-switch binding. This binding
>> provides a mechanism to bind named links to gpio, with the primary
>> purpose of enabling standardised access to switches that might be standard
>> across a group of devices but implemented differently on each device.
>
> This is good and what I suggested, but it now makes me wonder if switch
> is generic enough. This boils down to needing to expose single gpio
> lines to userspace with a defined function/use. IIRC, there's been some
> discussion about this before along with improving the userspace
> interface for GPIO in general. So I'd like to get Linus' thoughts on
> this.
>

No problem. Rename gpio-signal?

>
>> Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
>> ---
>>   .../devicetree/bindings/misc/gpio-switch.txt       | 47 ++++++++++++++++++++++
>>   1 file changed, 47 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/misc/gpio-switch.txt
>>
>> diff --git a/Documentation/devicetree/bindings/misc/gpio-switch.txt b/Documentation/devicetree/bindings/misc/gpio-switch.txt
>> new file mode 100644
>> index 0000000..13528bd
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/misc/gpio-switch.txt
>> @@ -0,0 +1,47 @@
>> +Device-Tree bindings for gpio attached switches.
>> +
>> +This provides a mechanism to provide a named link to specified gpios. This can
>> +be useful in instances such as when theres a need to monitor a switch, which is
>> +common across a family of devices, but attached to different gpios and even
>> +implemented in different ways on differnet devices.
>> +
>> +Required properties:
>> +	- compatible = "gpio-switch";
>> +
>> +Each signal is represented as a sub-node of "gpio-switch". The naming of
>> +sub-nodes is arbitrary.
>> +
>> +Required sub-node properties:
>> +
>> +	- label: Name to be given to gpio switch.
>> +	- gpios: OF device-tree gpio specification.
>> +
>> +Optional sub-node properties:
>> +
>> +	- read-only: Boolean flag to mark the gpio as read-only, i.e. the line
>> +	  should not be driven by the host.
>
> In terms a a switch use, allowing driving it would be an override of the
> switch. Is that the idea here?
>

Yeah - since it had become a lot more generic and a lot of 
switches/signals would probably be implemented with a pull-up resistor 
of something like that, it seemed to make sense to allow them to be 
driven as well.

>> +
>> +Example nodes:
>> +
>> +        gpio-switch {
>> +                compatible = "gpio-switch";
>
> Both from a binding and driver perspective, there is no point in
> grouping these. Each node can simply have this compatible string.
>

True. I did it this way as this is how gpio-keys is implemented. OK, 
that has one optional parameter (autorepeat) for the block and this has 
none. Though I can also see that these probably have less in common than 
the individual lines used in gpio-keys.

>> +
>> +                write-protect {
>> +                        label = "write-protect";
>> +                        gpios = <&gpx3 0 GPIO_ACTIVE_LOW>;
>> +                        read-only;
>> +                };
>> +
>> +                developer-switch {
>> +                        label = "developer-switch";
>> +                        gpios = <&gpx1 3 GPIO_ACTIVE_HIGH>;
>> +                        read-only;
>> +                };
>> +
>> +                recovery-switch {
>> +                        label = "recovery-switch";
>> +                        gpios = <&gpx0 7 GPIO_ACTIVE_LOW>;
>> +                        read-only;
>> +                };
>> +        };
>> +
>> --
>> 2.1.4
>>

  reply	other threads:[~2015-12-07 21:11 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-04 17:31 Add support for monitoring gpio switches Martyn Welch
2015-12-04 17:31 ` Martyn Welch
2015-12-04 17:31 ` Martyn Welch
2015-12-04 17:31 ` [PATCH 1/3] Device tree binding documentation for gpio-switch Martyn Welch
2015-12-04 17:31   ` Martyn Welch
2015-12-07 17:37   ` Rob Herring
2015-12-07 17:37     ` Rob Herring
2015-12-07 21:10     ` Martyn Welch [this message]
2015-12-07 21:10       ` Martyn Welch
2015-12-11 12:39   ` Linus Walleij
2015-12-11 12:39     ` Linus Walleij
2015-12-11 12:39     ` Linus Walleij
2015-12-11 14:06     ` Rob Herring
2015-12-11 14:06       ` Rob Herring
2015-12-11 14:06       ` Rob Herring
2015-12-14 14:28       ` Linus Walleij
2015-12-14 14:28         ` Linus Walleij
2015-12-14 14:28         ` Linus Walleij
2015-12-14 15:45         ` Rob Herring
2015-12-14 15:45           ` Rob Herring
2015-12-14 15:45           ` Rob Herring
2015-12-15  9:09           ` Markus Pargmann
2015-12-15  9:09             ` Markus Pargmann
2016-03-02 16:03             ` Rob Herring
2016-03-02 16:03               ` Rob Herring
2016-03-02 16:03               ` Rob Herring
2016-03-07  8:26               ` Markus Pargmann
2016-03-07  8:26                 ` Markus Pargmann
2016-03-07  8:26                 ` Markus Pargmann
2015-12-04 17:31 ` [PATCH 2/3] Add support for monitoring gpio switches Martyn Welch
2015-12-04 17:31   ` Martyn Welch
2015-12-04 17:31   ` Martyn Welch
2015-12-04 18:14   ` [PATCH] fix noderef.cocci warnings kbuild test robot
2015-12-04 18:14     ` kbuild test robot
2015-12-04 18:14     ` kbuild test robot
2015-12-04 18:14   ` [PATCH 2/3] Add support for monitoring gpio switches kbuild test robot
2015-12-04 18:14     ` kbuild test robot
2015-12-04 18:14     ` kbuild test robot
2015-12-04 18:57   ` Greg Kroah-Hartman
2015-12-04 18:57     ` Greg Kroah-Hartman
2015-12-05 10:42     ` Martyn Welch
2015-12-05 10:42       ` Martyn Welch
2015-12-11  9:08   ` Linus Walleij
2015-12-11  9:08     ` Linus Walleij
2015-12-11  9:08     ` Linus Walleij
2015-12-16 10:11     ` Martyn Welch
2015-12-16 10:11       ` Martyn Welch
2015-12-16 10:11       ` Martyn Welch
2015-12-22  9:25       ` Linus Walleij
2015-12-22  9:25         ` Linus Walleij
2015-12-22  9:25         ` Linus Walleij
2015-12-04 17:31 ` [PATCH 3/3] ARM: dts: Addition of binding for gpio switches on peach-pi Martyn Welch
2015-12-04 17:31   ` Martyn Welch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5665F5DF.50002@collabora.co.uk \
    --to=martyn.welch@collabora.co.uk \
    --cc=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=k.kozlowski@samsung.com \
    --cc=kgene@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=olof@lixom.net \
    --cc=pawel.moll@arm.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.