All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about regulator API
@ 2016-12-14 14:52 Harald Geyer
  2016-12-14 18:14 ` Mark Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Harald Geyer @ 2016-12-14 14:52 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: linux-kernel

Hi all!

I have a quite complex situation with regulator consumers, which I'm not
sure how to handle best.

Suppose there is some quirky HW that after some random time crashes - i.e.
it doesn't respond to requests anymore at all. The driver can detect this
situation and the only way to fix it is to disable the supply for 2 seconds,
then enable it again. Also after enabling the power supply the driver needs
to wait 2 seconds before talking to the HW.

Now the complicated part: The HW is some kind of sensor which often is
used in an array of identical devices. To make the wiring simpler all
these devices are attatched to the same supply (and maybe the same bus),
however they are read independently and thus also are independent devices
from the kernel POV.

Thus the following constraints should be met:
* When user space asks the driver to read a device, it needs to "claim"
  the supply and ensure that it has been up for at least 2 seconds
  before proceeding to read the HW. The supply would be "locked" enabled.
  (I think this is standard regulator API.)
* When HW failure is detected, the driver needs to tell the supply to
  turn off for at least 2 seconds, wait for all other devices to release
  the supply so it can actually be turned off, then wait for the off period,
  then start over again.
  (This is easy only with getting the supply exclusively.)
* It should be possible to read multiple devices quickly when everything
  is okay and working. (Having 6 2-second delays accumulate would be quite
  annoying.)
  (This won't work with exclusive supply usage.)
* Optionally: If all devices are idle the supply would be enabled if short
  response time is desired, but disabled if power saving is desired.

Can this somehow be solved with the existing API?
If not, do you think it would be reasonable/possible to extend the API
to cover situations like the one described above?

Any help or hints are appreciated.

TIA,
Harald

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-12-19 11:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-14 14:52 Question about regulator API Harald Geyer
2016-12-14 18:14 ` Mark Brown
2016-12-16 13:41   ` Harald Geyer
2016-12-16 16:53     ` Mark Brown
2016-12-16 22:00       ` Harald Geyer
2016-12-19 11:09         ` Mark Brown

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.