Re: [PATCH] regulator: core: Fix enable GPIO reference counting

From: Doug Anderson
Date: Wed Mar 04 2015 - 12:13:59 EST


Mark,

On Wed, Mar 4, 2015 at 3:27 AM, Mark Brown <broonie@xxxxxxxxxx> wrote:
> On Tue, Mar 03, 2015 at 03:21:21PM -0800, Doug Anderson wrote:
>
>> It looks as if "ena_gpio_state" is not quite what I thought it was and
>> I think is not actually consistent in the regulator framework itself.
>> In _regulator_do_enable() and _regulator_do_disable() is clear that
>> ena_gpio_state is 1 when an "rdev" is enabled and 0 when the "rdev" is
>> disabled. That was my assumption. It's also clear in
>> _regulator_is_enabled().
>
>> ...but then I looked in regulator_register(). There you can see that
>> ena_gpio_state could be set to 1 if you've got an active low GPIO that
>> is disabled at boot. That totally throws my logic for a loop. Also
>> with my patch the reference counting will be all messed up for active
>> high / boot on regulators. :(
>
> Isn't that just a bug in the registration code? I'd not be entirely
> surprised if that were the case.

Yes, I'm pretty sure that's the case too and that's what I've assumed
in V2 of the patch that I sent up yesterday. In my testing is caused
no problems, but of course my testing of my previous version also
showed no problems on my particular boards until I found the right
place to put printouts to show that the internal state was a bit
confused...

-Doug
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/