Thread (19 messages) 19 messages, 7 authors, 2017-01-09

Re: [PATCH] iio: misc: add a generic regulator driver

From: Bartosz Golaszewski <hidden>
Date: 2016-12-01 12:07:53
Also in: linux-iio, lkml

2016-11-30 11:10 GMT+01:00 Lars-Peter Clausen [off-list ref]:
On 11/29/2016 04:35 PM, Bartosz Golaszewski wrote:
quoted
2016-11-29 16:30 GMT+01:00 Lars-Peter Clausen [off-list ref]:
quoted
On 11/29/2016 04:22 PM, Bartosz Golaszewski wrote:
[...]
quoted
diff --git a/Documentation/devicetree/bindings/iio/misc/iio-regulator.txt b/Documentation/devicetree/bindings/iio/misc/iio-regulator.txt
new file mode 100644
index 0000000..147458f
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/misc/iio-regulator.txt
@@ -0,0 +1,18 @@
+Industrial IO regulator device driver
+-------------------------------------
+
+This document describes the bindings for the iio-regulator - a dummy device
+driver representing a physical regulator within the iio framework.
No bindings for drivers, only for hardware. So this wont work.
What about exporting regulator attributes analogous to the one in this
patch from the iio-core when a *-supply property is specified for a
node?
The problem with exposing direct control to the regulator is that it allows
to modify the hardware state without the drivers knowledge. If you
power-cycle a device all previous configuration that has been written to the
device is reset. The device driver needs to be aware of this otherwise its
assumed state and the actual device state can divert which will result in
undefined behavior. Also access to the device will fail unexpectedly when
the regulator is turned off. So I think generally the driver should
explicitly control the regulator, power-up when needed, power-down when not.

- Lars
I missed the fact that - unlike hwmon - the iio version of the ina2xx
driver is not capable of detecting a bad state and re-initializing
itself. But you're right in general of course.

Still, it made me think: what if we implement the suspend/resume
callbacks in struct device_driver to store/resume the state when
power-cycling? The core iio module would then call the suspend
callback before disabling the regulator. We wouldn't need to duplicate
similar code and DT bindings in every iio driver.

Best regards,
Bartosz Golaszewski
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help