lkml.org 
[lkml]   [2010]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: The use_count problem of regulator
On Wed, Jan 20, 2010 at 03:30:24PM +0900, Joonyoung Shim wrote:

> In the regulator framework, if the regulator is enabled for example by
> boot_on constraint, when regulator_get is called at the driver probe
> function, the use_count of struct regulator_dev is zero. But if
> regulator_has_full_constraints() is used, even though above the
> regulator is using, it is disabled by regulator_init_complete() because
> the use_count is zero.

This is expected behaviour if the regulator is not marked as always_on.
The idea is that the regulators will have been claimed and enabled by a
regulator consumer during the init process, and if it hasn't then it's
not in active use at the current time and may therefore be powered off.

> Of course, we can use regulator_get_exclusive instead of regulator_get,
> but if the regulator can be shared, i think this will be a problem.

If the consumer is using the regulator then it should enable the
regulator without reference to the existing state of the regulator.
This is required to support sharing of supplies - if another consumer
enabled the regulator then it may later decide to turn it off when it's
done with it, which would have the same effect as you're seeing from the
full constraints code.

A consumer using regulator_get() should in general never need to check
if the regulator is enabled except possibly during startup in order to
gracefully handle the handover of the initial hardware state. Normally
they should call enable() when they start using the device and disable()
when they stop.


\
 
 \ /
  Last update: 2010-01-20 11:37    [W:0.105 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site