From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
To: Lars-Peter Clausen <lars@metafoo.de>,
Linus Walleij <linus.walleij@linaro.org>
Cc: Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
linux-iio@vger.kernel.org,
linux-devicetree <devicetree@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Kevin Hilman <khilman@baylibre.com>,
Patrick Titiano <ptitiano@baylibre.com>,
Neil Armstrong <narmstrong@baylibre.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH] iio: misc: add a generic regulator driver
Date: Tue, 13 Dec 2016 15:28:22 +0100 [thread overview]
Message-ID: <CAMpxmJVpj57s-m_FS58J+QWvu-MnVmaZP-6ECnYHeRVSCfd-Fw@mail.gmail.com> (raw)
In-Reply-To: <c670d597-46b6-235f-545f-7136a3abff7f@metafoo.de>
2016-12-12 18:15 GMT+01:00 Lars-Peter Clausen <lars@metafoo.de>:
> On 12/06/2016 12:12 PM, Bartosz Golaszewski wrote:
[snip!]
>>
>> So the problem we have is not power-cycling the adc - it's
>> power-cycling the device connected to a probe on which there's an adc.
>> What I was trying to do was adding support for the power-switch on
>> baylibre-acme[1] probes.
>>
>> For example: we have a USB probe on which the VBUS signal goes through
>> a power load switch and than through the adc. The adc (in this case
>> ina226) is always powered on, while the fixed regulator I wanted to
>> enable/disable actually drives the power switch to cut/restore power
>> to the connected USB device i.e. there's no real regulator - just a
>> GPIO driving the power switch.
>>
>> A typical use case is measuring the power consumption of development
>> boards[2]. Rebooting them remotely using acme probes is already done,
>> but we're using the obsolete /sys/class/gpio interface.
>>
>> We're already using libiio to read the measured data from the power
>> monitor, that's why we'd like to use the iio framework for
>> power-cycling the devices as well. My question is: would bridging the
>> regulator framework be the right solution? Should we look for
>> something else? Bridge the GPIO framework instead?
>
> I wouldn't necessaries create bridge, but instead just use the GPIO
> framework directly.
>
> We now have the GPIO chardev interface which meant to be used to support
> application specific logic that control the GPIOs, but where you don't want
> to write a kernel driver.
>
> My idea was to add GPIOs and GPIO chips as high level object inside libiio
> that can be accessed through the same context as the IIO devices. Similar to
> the current IIO API you have a API for gpios that allows to enumerate the
> GPIO devices and their pins as well as modify the pin state.
>
+ Linus
While the new GPIO interface would be very convenient - in our case we
could simply name the lines appropriately in the device tree - I'm not
sure this would be the correct approach.
>From this year's ELCE in Berlin I remember Linus suggested during his
talk that it's always better to write a kernel driver. Also: this way
the relevant GPIO lines would not be reserved for exclusive use by
power switches.
Linus - do you have any thoughts/suggestions on that subject?
Best regards,
Bartosz Golaszewski
next prev parent reply other threads:[~2016-12-13 14:28 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-29 15:22 [PATCH] iio: misc: add a generic regulator driver Bartosz Golaszewski
2016-11-29 15:30 ` Lars-Peter Clausen
2016-11-29 15:35 ` Bartosz Golaszewski
2016-11-30 10:10 ` Lars-Peter Clausen
2016-12-01 12:07 ` Bartosz Golaszewski
2016-12-03 9:11 ` Jonathan Cameron
2016-12-06 11:12 ` Bartosz Golaszewski
2016-12-10 18:17 ` Jonathan Cameron
2016-12-11 22:23 ` Bartosz Golaszewski
2016-12-12 17:15 ` Lars-Peter Clausen
2016-12-13 14:28 ` Bartosz Golaszewski [this message]
2016-12-28 13:00 ` Linus Walleij
2016-12-23 10:00 ` Geert Uytterhoeven
2016-12-23 11:35 ` Lars-Peter Clausen
2016-12-23 12:56 ` Geert Uytterhoeven
2016-12-24 10:43 ` Jonathan Cameron
2017-01-05 12:00 ` Mark Brown
2017-01-09 10:49 ` Linus Walleij
2016-12-28 13:08 ` Linus Walleij
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=CAMpxmJVpj57s-m_FS58J+QWvu-MnVmaZP-6ECnYHeRVSCfd-Fw@mail.gmail.com \
--to=bgolaszewski@baylibre.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=khilman@baylibre.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=narmstrong@baylibre.com \
--cc=pmeerw@pmeerw.net \
--cc=ptitiano@baylibre.com \
--cc=robh+dt@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 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).