[RFC PATCH v1] regulator: pwm-regulator: Fix continuous get_voltage for disabled PWM
Mark Brown
broonie at kernel.org
Fri Dec 22 03:53:44 PST 2023
On Thu, Dec 21, 2023 at 11:07:41PM +0100, Uwe Kleine-König wrote:
> On Thu, Dec 21, 2023 at 09:45:49PM +0000, Mark Brown wrote:
> > > - voltage = pwm_get_relative_duty_cycle(&pstate, duty_unit);
> > > + if (pstate.enabled)
> > > + voltage = pwm_get_relative_duty_cycle(&pstate, duty_unit);
> > > + else if (max_uV_duty < min_uV_duty)
> > > + voltage = max_uV_duty;
> > > + else
> > > + voltage = min_uV_duty;
> > AFAICT this means that enabling the PWM changes the voltage read back
> > which isn't what we expect (other than a change from 0 to target) and is
> > likely to cause issues. get_voltage() should not change after an
> > enable(), and indeed I'm unclear how this change works? I'd expect a
> > change in the init_state() function, possibly one that programs the PWM
> > to reflect the actual hardware state but I'm not 100% confident on that
> > without digging into the PWM API more.
> What is your question here? Looking at pwm_regulator_set_voltage() I
> think this lacks a
> pstate.enabled = true;
> which might also fix Martin's problem?
That's not really a question, it's a statement - I don't see how the
change works at all and as it stands it introduces a problem with the
behaviour when the regulator is enabled.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20231222/15a56d7b/attachment.sig>
More information about the linux-amlogic
mailing list