On Fri, Jan 16, 2015 at 08:12:28PM +0100, Hans de Goede wrote:
On 16-01-15 13:37, Mark Brown wrote:
It is probably a good idea to use regulator-boot-on and
then test things this way, and if that works use
regulator-boot-on.
No, it's unlikely that boot-on makes sense here - it's there for cases
where we can't read back the hardware state at power on.
Which we cannot here since we've a gpio driven regulator, with the pin
in output mode, so we cannot read it back. Or at least the current kernel
implementation relies on regulator-boot-on rather then reading the
state back from the hardware.
Right, this always seems like a problem with the GPIO API - not being
able to read the state back is a total pain for boot handover, we should
really have a way of reading back the current output state. This is one
of the few cases where boot-on can be useful, though ideally it'd be set
by the bootloader rather than as a static thing since otherwise you have
the opposite problem in the case where the disk isn't being used at the
current time.
While we're discussing this I would also like to advocate to change the
behavior for regulator-boot-on to be the same as always-on when it comes
to regulator_init_complete(), iow regulator-boot-on regulators should
not be touched by regulator_init_complete(). It makes no sense to have
different behavior for build in versus module drivers here.
Like I say boot-on is *only* intended to support bootstrapping, if you
want the regulator to be always on then mark it as always on. If you
want some way of marking the end of userspace init so we can defer
cleanup of unused resources then go do that - it's a change I've
advocated before, it'd help with modular drivers in general.