Re: [PATCH] iio: misc: add a generic regulator driver
From: Bartosz Golaszewski
Date: Sun Dec 11 2016 - 17:23:08 EST
2016-12-10 19:17 GMT+01:00 Jonathan Cameron <jic23@xxxxxxxxxx>:
> On 06/12/16 11:12, Bartosz Golaszewski wrote:
>> I wrote the initial patch quickly and didn't give it much of a
>> thought. Now I realized I completely missed the point and managed to
>> confuse everybody - myself included.
>> 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 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. 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?
> Definitely doesn't fit inside standard scope of IIO - though I can see
> why you were thinking along these lines.
Well, it's industrial INPUT/output right? I guess we can consider
power-cycling input in this case. :)
In our particular use case, the main reason for using IIO is having a
single interface (libiio) instead of introducing a new one just for
that (in the form of random sysfs attributes for example), but I'm
sure such power switches could find application elsewhere too
(measuring temperature, while power-cycling some cooling mechanism is
the first thing that comes to mind).
> Mark Brown, any thoughts?
> Effectively we are are looking at something that (in general form) might
> be the equivalent of controlling a lab bench supply... So regulators
> at the edge of the known world, with no visibility of what lies beyond.
Please consider the two patches I just sent. Instead of regulators,
they add DT bindings for gpio power switches and introduce a simple
iio driver using the gpio consumer API.