Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1540083 > unrolled thread

[PATCH 0/2] iio: GPIO power switch support

Started byBartosz Golaszewski <bgolaszewski@baylibre.com>
First post2016-12-11 23:30 +0100
Last post2016-12-28 14:00 +0100
Articles 10 — 6 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] iio: GPIO power switch support Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-12-11 23:30 +0100
    [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-12-11 23:30 +0100
      Re: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven  power switches Rob Herring <robh@kernel.org> - 2016-12-13 20:30 +0100
        Re: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-12-14 18:00 +0100
          Re: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-12-15 12:00 +0100
          Re: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches Rob Herring <robh@kernel.org> - 2016-12-15 16:10 +0100
            Re: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches Geert Uytterhoeven <geert@linux-m68k.org> - 2016-12-23 10:10 +0100
              Re: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power  switches Lars-Peter Clausen <lars@metafoo.de> - 2016-12-23 12:50 +0100
                Re: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power  switches Jonathan Cameron <jic23@kernel.org> - 2016-12-30 16:10 +0100
      Re: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches Linus Walleij <linus.walleij@linaro.org> - 2016-12-28 14:00 +0100

#1540083 — [PATCH 0/2] iio: GPIO power switch support

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-12-11 23:30 +0100
Subject[PATCH 0/2] iio: GPIO power switch support
Message-ID<sNkN3-4IE-7@gated-at.bofh.it>
This series is aimed at improving the support for baylibre-acme[1]
power measurement capes. 

We would like to add support for power-cycling of devices measured
using TI INA226 ADCs. An example use case would be measuring the power
consumption of a development board during boot and power-cycling it
remotely using a GPIO power switch.

The first patch proposes to add a new DT binding for describing simple
power switches.

The second adds a simple IIO driver exposing a single attribute.

The motivation for using the IIO framework is the fact that we already
use it for reading the data from the ADC and that power-cycling the
measured devices is an integral part of our use case. Users would find
it convenient to be able to use libiio as the single interface.

[1] http://baylibre.com/acme/

Bartosz Golaszewski (2):
  devicetree: power: add bindings for GPIO-driven power switches
  iio: misc: add support for GPIO power switches

 .../bindings/power/gpio-power-switch.txt           |  25 ++++
 drivers/iio/Kconfig                                |   1 +
 drivers/iio/Makefile                               |   1 +
 drivers/iio/misc/Kconfig                           |  17 +++
 drivers/iio/misc/Makefile                          |   6 +
 drivers/iio/misc/gpio-power-switch.c               | 127 +++++++++++++++++++++
 6 files changed, 177 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/gpio-power-switch.txt
 create mode 100644 drivers/iio/misc/Kconfig
 create mode 100644 drivers/iio/misc/Makefile
 create mode 100644 drivers/iio/misc/gpio-power-switch.c

-- 
2.9.3

[toc] | [next] | [standalone]


#1540084 — [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-12-11 23:30 +0100
Subject[PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches
Message-ID<sNkN4-4IE-21@gated-at.bofh.it>
In reply to#1540083
Some boards are equipped with simple, GPIO-driven power load switches.
An example of such ICs is the TI tps229* series.

Add device tree bindings allowing to describe them.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 .../bindings/power/gpio-power-switch.txt           | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/gpio-power-switch.txt

diff --git a/Documentation/devicetree/bindings/power/gpio-power-switch.txt b/Documentation/devicetree/bindings/power/gpio-power-switch.txt
new file mode 100644
index 0000000..21420ed
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/gpio-power-switch.txt
@@ -0,0 +1,25 @@
+GPIO Power Switch
+-----------------
+
+This is the device tree binding for simple, GPIO-driven power load switches
+that do not have any control signals.
+
+Required properties:
+
+- compatible:           must be "gpio-power-switch"
+- power-gpios:          phandle for the GPIO driving the power load switch
+
+Optional properties:
+
+- power-switch-name:    the name of the power switch
+- power-switch-on:      the power switch GPIO is driven high by default
+
+Example
+-------
+
+acme_probe0_power_switch: gpio_power_switch@0 {
+	compatible = "gpio-power-switch";
+	power-switch-name = "acme_probe0_switch";
+	power-gpios = <&pca9535 1 GPIO_ACTIVE_HIGH>;
+	power-switch-on;
+};
-- 
2.9.3

[toc] | [prev] | [next] | [standalone]


#1541413 — Re: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches

FromRob Herring <robh@kernel.org>
Date2016-12-13 20:30 +0100
SubjectRe: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches
Message-ID<sO0VX-55N-7@gated-at.bofh.it>
In reply to#1540084
On Sun, Dec 11, 2016 at 11:21:44PM +0100, Bartosz Golaszewski wrote:
> Some boards are equipped with simple, GPIO-driven power load switches.
> An example of such ICs is the TI tps229* series.

How is this different than a GPIO regulator? The input and output 
voltages just happen to be the same. I could be convinced this is 
different enough to have a different compatible, but it somewhat seems 
you want to use this for IIO, so you are creating a different binding 
for that usecase.

Rob

[toc] | [prev] | [next] | [standalone]


#1542048 — Re: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-12-14 18:00 +0100
SubjectRe: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches
Message-ID<sOl4w-mI-25@gated-at.bofh.it>
In reply to#1541413
2016-12-13 20:27 GMT+01:00 Rob Herring <robh@kernel.org>:
> On Sun, Dec 11, 2016 at 11:21:44PM +0100, Bartosz Golaszewski wrote:
>> Some boards are equipped with simple, GPIO-driven power load switches.
>> An example of such ICs is the TI tps229* series.
>
> How is this different than a GPIO regulator? The input and output
> voltages just happen to be the same. I could be convinced this is
> different enough to have a different compatible, but it somewhat seems
> you want to use this for IIO, so you are creating a different binding
> for that usecase.
>

It's more of a fixed regulator I suppose. Do you mean adding a new
compatible to the fixed-regulator binding (e.g. "gpio-power-switch" or
"simple-power-switch") and then providing an iio driver for toggling
the switch?

Thanks,
Bartosz

[toc] | [prev] | [next] | [standalone]


#1542632 — Re: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-12-15 12:00 +0100
SubjectRe: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches
Message-ID<sOBVv-4Kn-9@gated-at.bofh.it>
In reply to#1542048
2016-12-14 18:36 GMT+01:00 Jonathan Cameron <jic23@jic23.retrosnub.co.uk>:
>
>
> On 14 December 2016 16:58:21 GMT+00:00, Bartosz Golaszewski
> <bgolaszewski@baylibre.com> wrote:
>>2016-12-13 20:27 GMT+01:00 Rob Herring <robh@kernel.org>:
>>> On Sun, Dec 11, 2016 at 11:21:44PM +0100, Bartosz Golaszewski wrote:
>>>> Some boards are equipped with simple, GPIO-driven power load
>>switches.
>>>> An example of such ICs is the TI tps229* series.
>>>
>>> How is this different than a GPIO regulator? The input and output
>>> voltages just happen to be the same. I could be convinced this is
>>> different enough to have a different compatible, but it somewhat
>>seems
>>> you want to use this for IIO, so you are creating a different binding
>>> for that usecase.
>>>
>>
>>It's more of a fixed regulator I suppose. Do you mean adding a new
>>compatible to the fixed-regulator binding (e.g. "gpio-power-switch" or
>>"simple-power-switch") and then providing an iio driver for toggling
>>the switch?
>
> I am rather torn on whether the IIO interface makes any sense beyond that of
> convenience.
>

The question is: will the iio maintainers be ok with adding support
for interfaces different than iio (I guess so since Lars already
mentioned wanting to support the GPIO chardev)? If so, I'm ok with not
using the iio framework in the kernel.

> A bridge to a regulator in general might make sense to cover the case of a
> reg effectively
> acting as a DAC at the edge of the known hardware.
>
> Lars' point about perhaps adding support for the new gpio userspace stuff to
> libiio would in
> this case also be rather papering over the issue.
> There is known hardware there so we should describe it!
>
> I think we should be considering this as the general case of the Linux
> controlled power supply.
> How do we want to represent that?
> Ultimately does a general regulator userspace interface make sense?
>
> Classic case of people cutting our hardware in half and making boundaries
> beyond which lie dragons.
>
> I would love to see the general case covered.
>

It seems as if this is already covered by the userspace-consumer
regulator driver, but it doesn't speak device tree yet. I guess we
could reuse it by merging the proposed gpio-power-switch binding and
extending it to parse DT.

Best regards,
Bartosz Golaszewski

[toc] | [prev] | [next] | [standalone]


#1542804 — Re: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches

FromRob Herring <robh@kernel.org>
Date2016-12-15 16:10 +0100
SubjectRe: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches
Message-ID<sOFPs-7kP-35@gated-at.bofh.it>
In reply to#1542048
On Wed, Dec 14, 2016 at 10:58 AM, Bartosz Golaszewski
<bgolaszewski@baylibre.com> wrote:
> 2016-12-13 20:27 GMT+01:00 Rob Herring <robh@kernel.org>:
>> On Sun, Dec 11, 2016 at 11:21:44PM +0100, Bartosz Golaszewski wrote:
>>> Some boards are equipped with simple, GPIO-driven power load switches.
>>> An example of such ICs is the TI tps229* series.
>>
>> How is this different than a GPIO regulator? The input and output
>> voltages just happen to be the same. I could be convinced this is
>> different enough to have a different compatible, but it somewhat seems
>> you want to use this for IIO, so you are creating a different binding
>> for that usecase.
>>
>
> It's more of a fixed regulator I suppose. Do you mean adding a new
> compatible to the fixed-regulator binding (e.g. "gpio-power-switch" or
> "simple-power-switch") and then providing an iio driver for toggling
> the switch?

Yes, at least the first part. I view the switch as just a more
specific subtype of a fixed-regulator. Whether an IIO driver is a
separate discussion which is happening.

Rob

P.S. I really don't like compatibles with "simple".

[toc] | [prev] | [next] | [standalone]


#1546783 — Re: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches

FromGeert Uytterhoeven <geert@linux-m68k.org>
Date2016-12-23 10:10 +0100
SubjectRe: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches
Message-ID<sRu1r-4VR-25@gated-at.bofh.it>
In reply to#1542804
On Thu, Dec 15, 2016 at 4:05 PM, Rob Herring <robh@kernel.org> wrote:
> On Wed, Dec 14, 2016 at 10:58 AM, Bartosz Golaszewski
> <bgolaszewski@baylibre.com> wrote:
>> 2016-12-13 20:27 GMT+01:00 Rob Herring <robh@kernel.org>:
>>> On Sun, Dec 11, 2016 at 11:21:44PM +0100, Bartosz Golaszewski wrote:
>>>> Some boards are equipped with simple, GPIO-driven power load switches.
>>>> An example of such ICs is the TI tps229* series.
>>>
>>> How is this different than a GPIO regulator? The input and output
>>> voltages just happen to be the same. I could be convinced this is
>>> different enough to have a different compatible, but it somewhat seems
>>> you want to use this for IIO, so you are creating a different binding
>>> for that usecase.
>>
>> It's more of a fixed regulator I suppose. Do you mean adding a new
>> compatible to the fixed-regulator binding (e.g. "gpio-power-switch" or
>> "simple-power-switch") and then providing an iio driver for toggling
>> the switch?
>
> Yes, at least the first part. I view the switch as just a more
> specific subtype of a fixed-regulator. Whether an IIO driver is a
> separate discussion which is happening.

The switch could also be an opto-isolator (for which I could use gpio-leds,
too, although also without libiio control ;-) or a relay.

While I agree a switch is a degenerate regulator, modelling it as a regulator
feels a bit weird to me. Switches could be extended to e.g. double throw
relays, or H-bridges using 4 GPIOs.

BTW, I'm not an IIO expert, but from my limited knowledge, it looks like "O"
support in IIO is limited to DACs?

P.S. My motiviation is using libiio to control my board farm, which has a bank
     of opto-isolators in addition to BayLibre's ACME.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

[toc] | [prev] | [next] | [standalone]


#1546834 — Re: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches

FromLars-Peter Clausen <lars@metafoo.de>
Date2016-12-23 12:50 +0100
SubjectRe: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches
Message-ID<sRwwh-6lS-3@gated-at.bofh.it>
In reply to#1546783
On 12/23/2016 10:07 AM, Geert Uytterhoeven wrote:
> BTW, I'm not an IIO expert, but from my limited knowledge, it looks like "O"
> support in IIO is limited to DACs?

Depends on what you categorize as DACs. There are also
potentiometer/rheostat drivers. They are kind of like DACs but the unit you
control are ohm, rather than current or voltage.

[toc] | [prev] | [next] | [standalone]


#1548641 — Re: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches

FromJonathan Cameron <jic23@kernel.org>
Date2016-12-30 16:10 +0100
SubjectRe: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches
Message-ID<sU6YG-5Yf-19@gated-at.bofh.it>
In reply to#1546834
On 23/12/16 11:40, Lars-Peter Clausen wrote:
> On 12/23/2016 10:07 AM, Geert Uytterhoeven wrote:
>> BTW, I'm not an IIO expert, but from my limited knowledge, it looks like "O"
>> support in IIO is limited to DACs?
> 
> Depends on what you categorize as DACs. There are also
> potentiometer/rheostat drivers. They are kind of like DACs but the unit you
> control are ohm, rather than current or voltage.
Though they are still in staging there are also things like function generators.

I've been mulling doing a driver for the st-powerstep01 parts as well which
is a smart stepper motor controller.  At that level we'd need to start describing
the connected stepper motors in DT :) Whole chunk of API to define to do that
though - might well take longer than writing the driver.

So in practice yeah - dac like things, but then on the input side they are almost
all really ADCs with some funny analog stuff on the front end ;)

Arguably switches are 1 bit DACs ;)

The distinction here is whether 'what is passing through' the device is knowable.
So regulators and your power switch are well described.  A relay less so unless
we know what load it is switching...

+ it's IIO.  We are open to almost anything as long as we aren't stepping on
any toes!

Jonathan

> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[toc] | [prev] | [next] | [standalone]


#1547944 — Re: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches

FromLinus Walleij <linus.walleij@linaro.org>
Date2016-12-28 14:00 +0100
SubjectRe: [PATCH 1/2] devicetree: power: add bindings for GPIO-driven power switches
Message-ID<sTlZL-8ke-1@gated-at.bofh.it>
In reply to#1540084
On Sun, Dec 11, 2016 at 11:21 PM, Bartosz Golaszewski
<bgolaszewski@baylibre.com> wrote:

> Some boards are equipped with simple, GPIO-driven power load switches.
> An example of such ICs is the TI tps229* series.
>
> Add device tree bindings allowing to describe them.
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
(...)
>  .../bindings/power/gpio-power-switch.txt           | 25 ++++++++++++++++++++++

Scrap this and use:
Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt

Yours,
Linus Walleij

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web