[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADiBU383BxOttuoLdF2GjXHasoPMc634wsMr3zLC=v74OBGUmw@mail.gmail.com>
Date: Mon, 13 Jun 2022 09:49:31 +0800
From: ChiYuan Huang <u0084500@...il.com>
To: Mark Brown <broonie@...nel.org>
Cc: Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Lee Jones <lee.jones@...aro.org>, dmitry.torokhov@...il.com,
Liam Girdwood <lgirdwood@...il.com>,
cy_huang <cy_huang@...htek.com>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>, lkml <linux-kernel@...r.kernel.org>,
linux-input@...r.kernel.org
Subject: Re: [PATCH 3/4] regulator: rt5120: Add PMIC regulator support
Mark Brown <broonie@...nel.org> 於 2022年6月10日 週五 下午7:03寫道:
>
> On Thu, Jun 09, 2022 at 02:35:07PM +0800, ChiYuan Huang wrote:
> > Mark Brown <broonie@...nel.org> 於 2022年6月8日 週三 下午6:12寫道:
> > > On Wed, Jun 08, 2022 at 11:15:56AM +0800, ChiYuan Huang wrote:
>
> > > > My excuse. let me explain it.
> > > > buck1 voltage range from 600mV to 1393.75mV.
> > > > buck2~4/ldo/exten is the fixed regulator.
> > > > buck3 and buck4 is fixed by the IC efuse default.
> > > > buck2 and ldo is fixed by the external resistor chosen.
> > > > exten is designed to connected to the external power.
>
> > > > That's why I cannot directly declared it as the static regulator_desc.
>
> > > So buck 2-4 need some dynamic handling then but the rest can be static -
> > > that would be a lot clearer. You could also have a template for the
> > > ones with some dynamic values and just override the few fields that need
> > > it.
>
> > Not just buck2/3, buck2/3/4/ldo/exten all need the dynamic handling.
>
> Why do the others need it?
>
Sometimes, for this kind of general purpose PMIC, it need to provide
the flexibility.
Cause buck2 and ldo can already be fixed by the external resistor,
buck3 and buck4 seems to be fixed by IC default.
So there may be the same part number and use the postfix to be
different like as 5120'A'/5120'B', etc...
And use it to define the voltage for the different IC default for
buck3 and buck4, and exten behavior.
That's due to the different application use the different power on
sequence and default voltages.l
> > > > > Drivers should never override constraints passed in by machine drivers,
> > > > > if there's validation needed let the core do it. The same probably
> > > > > applies to providing a voltage range for a fixed regulator though that's
> > > > > not modifying everything so not such a problem.
>
> > > > Please check the above explanation about each power rails.
>
> > > I'm not sure what you're referencing here?
>
> > Sorry. Let me explain it.
>
> > You mean 'of_parse_cb' must not override constraint.
> > But if the regulator is fixed and dynamic, after
> > 'of_get_regulation_constraint', apply_uV will be true.
> > The is referring to 'fixed.c'
>
> fixed.c is a special case due to legacy issues and being generic, for
> normal fixed voltage regulators in a device where we know what they're
> fixed to they can just have their voltage hard coded in the driver. If
> there's issues with the machine providing invalid or nonsensical
> constraints the driver should just let the core deal with them.
>
> > > > > This is all open coding stuff that's in the core - just provde an
> > > > > of_parse_cb() operation and let the core take care of calling it.
>
> > > > Ditto
>
> > > Or here.
>
> > If I put 'of_parce_cb' to make core handling it, the input parameter
> > 'init_data' is declared as const.
> > I cannot override the 'apply_uV'.
> > Right?
>
> Yes, that's by design.
I have traced the code for 'of_get_regulator_init_data' and
'set_machine_constraints' in regulator register.
If I cannot overwrite apply_uV variable, it will cause the
regulator_register return -EINVAL.
Is the below flow that you suggested?
1. of_parse_cb to check min_uV and max_uV, and fill in the fixed_uV in
regulator_desc
2. provide the duummy set/get voltage to make set_machine_constraints
not return '-EINVAL'.
Powered by blists - more mailing lists