Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1677463 > unrolled thread

Where to update regulator register with initial voltage set by HW

Started byWaldemar Rymarkiewicz <waldemar.rymarkiewicz@gmail.com>
First post2017-06-29 09:20 +0200
Last post2017-06-30 17:30 +0200
Articles 11 — 3 participants

Back to article view | Back to linux.kernel


Contents

  Where to update regulator register with initial voltage set by HW Waldemar Rymarkiewicz <waldemar.rymarkiewicz@gmail.com> - 2017-06-29 09:20 +0200
    Re: Where to update regulator register with initial voltage set by HW Mark Brown <broonie@kernel.org> - 2017-06-30 12:50 +0200
      Re: Where to update regulator register with initial voltage set by HW Waldemar Rymarkiewicz <waldemar.rymarkiewicz@gmail.com> - 2017-06-30 13:40 +0200
        Re: Where to update regulator register with initial voltage set by HW Mark Brown <broonie@kernel.org> - 2017-06-30 14:20 +0200
          RE: Where to update regulator register with initial voltage set by  HW "Bartholomae, Thomas" <t.bartholomae@intel.com> - 2017-06-30 14:30 +0200
            Re: Where to update regulator register with initial voltage set by HW Mark Brown <broonie@kernel.org> - 2017-07-03 17:20 +0200
              Re: Where to update regulator register with initial voltage set by HW Mark Brown <broonie@kernel.org> - 2017-07-03 17:40 +0200
                Re: Where to update regulator register with initial voltage set by HW Waldemar Rymarkiewicz <waldemar.rymarkiewicz@gmail.com> - 2017-07-04 13:00 +0200
                  Re: Where to update regulator register with initial voltage set by HW Mark Brown <broonie@kernel.org> - 2017-07-04 13:30 +0200
              Re: Where to update regulator register with initial voltage set by HW Waldemar Rymarkiewicz <waldemar.rymarkiewicz@gmail.com> - 2017-07-03 17:40 +0200
          Re: Where to update regulator register with initial voltage set by HW Waldemar Rymarkiewicz <waldemar.rymarkiewicz@gmail.com> - 2017-06-30 17:30 +0200

#1677463 — Where to update regulator register with initial voltage set by HW

FromWaldemar Rymarkiewicz <waldemar.rymarkiewicz@gmail.com>
Date2017-06-29 09:20 +0200
SubjectWhere to update regulator register with initial voltage set by HW
Message-ID<tXBU7-4BD-23@gated-at.bofh.it>
Hi,

I do a power regulator driver and  I have faced an issue with an
initial voltage value set  (or rather not set) in regulator register.

Initially, on boot, the voltage is set by HW (sensing resistors). When
OS starts and the reg driver registers regulator with the specific
constraints uV_min and uV_max, regulator core will apply uV_min or
uV_max if current (in regulator register) setting is not in the range.
Normally, by default register holds min(voltage_table) which is
different than the value set by HW (sensing resistors).

So, it results in uV_min set by regulator core which is not expected
as I start my board with max cpu freq which needs relevant voltage
(the power reg supplies CPU)  in order CPU to be stable.

I believe this issue is not specific just to my HW, so wondering where
in the system the actual voltage set by HW is typically also put into
the register, so probing regulator we can read the real value?
bootloader seems to be a good candidate? platform code?

Will appreciate any hints.

Thanks
/Waldek

[toc] | [next] | [standalone]


#1678691

FromMark Brown <broonie@kernel.org>
Date2017-06-30 12:50 +0200
Message-ID<tY1ER-4os-9@gated-at.bofh.it>
In reply to#1677463

[Multipart message — attachments visible in raw view] — view raw

On Thu, Jun 29, 2017 at 09:18:09AM +0200, Waldemar Rymarkiewicz wrote:

> Initially, on boot, the voltage is set by HW (sensing resistors). When
> OS starts and the reg driver registers regulator with the specific
> constraints uV_min and uV_max, regulator core will apply uV_min or
> uV_max if current (in regulator register) setting is not in the range.
> Normally, by default register holds min(voltage_table) which is
> different than the value set by HW (sensing resistors).

You shoudn't be specfiying a default value for the register, clearly
there is none as it is determined dynamically by the hardware when the
system boots.

[toc] | [prev] | [next] | [standalone]


#1678721

FromWaldemar Rymarkiewicz <waldemar.rymarkiewicz@gmail.com>
Date2017-06-30 13:40 +0200
Message-ID<tY2rh-4Tg-23@gated-at.bofh.it>
In reply to#1678691
On 30 June 2017 at 12:41, Mark Brown <broonie@kernel.org> wrote:
> On Thu, Jun 29, 2017 at 09:18:09AM +0200, Waldemar Rymarkiewicz wrote:
>
>> Initially, on boot, the voltage is set by HW (sensing resistors). When
>> OS starts and the reg driver registers regulator with the specific
>> constraints uV_min and uV_max, regulator core will apply uV_min or
>> uV_max if current (in regulator register) setting is not in the range.
>> Normally, by default register holds min(voltage_table) which is
>> different than the value set by HW (sensing resistors).
>
> You shoudn't be specfiying a default value for the register, clearly
> there is none as it is determined dynamically by the hardware when the
> system boots.

Thanks Mark for your feedback.

I am not sure if I understand. Do you mean, a regulator should
determine a voltage and update a register with a right selector when
system boots, so the regulator framework reading reg register knows
actual voltage?

BTW, I work with TPS65273 regulator.

/Waldek

[toc] | [prev] | [next] | [standalone]


#1678757

FromMark Brown <broonie@kernel.org>
Date2017-06-30 14:20 +0200
Message-ID<tY33Y-5nU-13@gated-at.bofh.it>
In reply to#1678721

[Multipart message — attachments visible in raw view] — view raw

On Fri, Jun 30, 2017 at 01:37:32PM +0200, Waldemar Rymarkiewicz wrote:

> I am not sure if I understand. Do you mean, a regulator should
> determine a voltage and update a register with a right selector when
> system boots, so the regulator framework reading reg register knows
> actual voltage?

Just don't provide a default value for the cache, regmap will do a
physical read if there's nothing in the cache for that register and
everything will work transparently.

[toc] | [prev] | [next] | [standalone]


#1678764 — RE: Where to update regulator register with initial voltage set by HW

From"Bartholomae, Thomas" <t.bartholomae@intel.com>
Date2017-06-30 14:30 +0200
SubjectRE: Where to update regulator register with initial voltage set by HW
Message-ID<tY3dE-5r3-3@gated-at.bofh.it>
In reply to#1678757
Hi Mark,

The problem is that our used regulator TPS65273V from TI do not have the possibility to read the current voltage defined by the HW, means by the circuit of the regulator.
In this case the register holding the voltage to be set later by software has a reset value which is normally the min value the regulator can support. This value can be out of the range of the supported rail. Therefore before the regulator gets registered this register needs to be set with a 'good' value.
I assume the only practicable solution will be that we initialize this voltage register in the boot code where we also set the CPU frequency.
BR Thomas

-----Original Message-----
From: Mark Brown [mailto:broonie@kernel.org] 
Sent: Friday, June 30, 2017 14:15
To: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@gmail.com>
Cc: linux-kernel@vger.kernel.org; Liam Girdwood <lgirdwood@gmail.com>; Bartholomae, Thomas <t.bartholomae@intel.com>
Subject: Re: Where to update regulator register with initial voltage set by HW

On Fri, Jun 30, 2017 at 01:37:32PM +0200, Waldemar Rymarkiewicz wrote:

> I am not sure if I understand. Do you mean, a regulator should 
> determine a voltage and update a register with a right selector when 
> system boots, so the regulator framework reading reg register knows 
> actual voltage?

Just don't provide a default value for the cache, regmap will do a physical read if there's nothing in the cache for that register and everything will work transparently.

[toc] | [prev] | [next] | [standalone]


#1680438

FromMark Brown <broonie@kernel.org>
Date2017-07-03 17:20 +0200
Message-ID<tZbiP-3ib-49@gated-at.bofh.it>
In reply to#1678764

[Multipart message — attachments visible in raw view] — view raw

On Fri, Jun 30, 2017 at 12:26:52PM +0000, Bartholomae, Thomas wrote:
> Hi Mark,

Please don't top post, reply in line with needed context.  This allows
readers to readily follow the flow of conversation and understand what
you are talking about and also helps ensure that everything in the
discussion is being addressed.

Please fix your mail client to word wrap within paragraphs at something
substantially less than 80 columns.  Doing this makes your messages much
easier to read and reply to.

> The problem is that our used regulator TPS65273V from TI do not have
> the possibility to read the current voltage defined by the HW, means
> by the circuit of the regulator.  In this case the register holding
> the voltage to be set later by software has a reset value which is
> normally the min value the regulator can support. This value can be
> out of the range of the supported rail. Therefore before the regulator
> gets registered this register needs to be set with a 'good' value.  I
> assume the only practicable solution will be that we initialize this
> voltage register in the boot code where we also set the CPU frequency.

You probably need platform data to tell the kernelw hat teh startup
value is.

[toc] | [prev] | [next] | [standalone]


#1680451

FromMark Brown <broonie@kernel.org>
Date2017-07-03 17:40 +0200
Message-ID<tZbC9-3oO-1@gated-at.bofh.it>
In reply to#1680438

[Multipart message — attachments visible in raw view] — view raw

On Mon, Jul 03, 2017 at 05:33:03PM +0200, Waldemar Rymarkiewicz wrote:

> I've asked also on TI forum if this is typical to the regulator not to
> determine the startup voltage but still waiting for feedback. Anyway,
> if this is the case I guess a driver is a good place to update
> register before we register to the regulator framework.

It's really unusual to have a device that has the voltage changable by
register write at runtime where the current state can't be read back.

[toc] | [prev] | [next] | [standalone]


#1680870

FromWaldemar Rymarkiewicz <waldemar.rymarkiewicz@gmail.com>
Date2017-07-04 13:00 +0200
Message-ID<tZtIJ-7a9-11@gated-at.bofh.it>
In reply to#1680451
Hi Mark,

On 3 July 2017 at 17:36, Mark Brown <broonie@kernel.org> wrote:
> On Mon, Jul 03, 2017 at 05:33:03PM +0200, Waldemar Rymarkiewicz wrote:
>
>> I've asked also on TI forum if this is typical to the regulator not to
>> determine the startup voltage but still waiting for feedback. Anyway,
>> if this is the case I guess a driver is a good place to update
>> register before we register to the regulator framework.
>
> It's really unusual to have a device that has the voltage changable by
> register write at runtime where the current state can't be read back.

or you did not realise that this is initialised by bootloader for example.

After investigating this issue a bit more I've found that this is
rather typical for power regulators not to update a register with
startup voltage set by a feedback resistor divider as it would cost
extra circuit.  So, I assume that most likely a bootloader normally
initializes power regulator in case it's needed eg. if it's supplying
CPU which is DVS-enabled.

Anyway, it's more clear now to me how this should be done.

/Waldek

[toc] | [prev] | [next] | [standalone]


#1680885

FromMark Brown <broonie@kernel.org>
Date2017-07-04 13:30 +0200
Message-ID<tZubL-7zh-3@gated-at.bofh.it>
In reply to#1680870

[Multipart message — attachments visible in raw view] — view raw

On Tue, Jul 04, 2017 at 12:58:04PM +0200, Waldemar Rymarkiewicz wrote:
> On 3 July 2017 at 17:36, Mark Brown <broonie@kernel.org> wrote:
> > On Mon, Jul 03, 2017 at 05:33:03PM +0200, Waldemar Rymarkiewicz wrote:

> >> I've asked also on TI forum if this is typical to the regulator not to
> >> determine the startup voltage but still waiting for feedback. Anyway,
> >> if this is the case I guess a driver is a good place to update
> >> register before we register to the regulator framework.

> > It's really unusual to have a device that has the voltage changable by
> > register write at runtime where the current state can't be read back.

> or you did not realise that this is initialised by bootloader for example.

No, it's just incredibly unusual to have hardware that does this.

> After investigating this issue a bit more I've found that this is
> rather typical for power regulators not to update a register with
> startup voltage set by a feedback resistor divider as it would cost
> extra circuit.  So, I assume that most likely a bootloader normally
> initializes power regulator in case it's needed eg. if it's supplying
> CPU which is DVS-enabled.

The majority of things that have configuration based on bias resistors
just wouldn't have any register based control at all, or wouldn't have
any physical readback (for really old devices that were concerned with
the I2C licensing issues).  I'm pretty surprised to see such a
combination in a current system.

[toc] | [prev] | [next] | [standalone]


#1680456

FromWaldemar Rymarkiewicz <waldemar.rymarkiewicz@gmail.com>
Date2017-07-03 17:40 +0200
Message-ID<tZbC9-3oO-3@gated-at.bofh.it>
In reply to#1680438
On 3 July 2017 at 17:11, Mark Brown <broonie@kernel.org> wrote:
> On Fri, Jun 30, 2017 at 12:26:52PM +0000, Bartholomae, Thomas wrote:
>> Hi Mark,
>
>> The problem is that our used regulator TPS65273V from TI do not have
>> the possibility to read the current voltage defined by the HW, means
>> by the circuit of the regulator.  In this case the register holding
>> the voltage to be set later by software has a reset value which is
>> normally the min value the regulator can support. This value can be
>> out of the range of the supported rail. Therefore before the regulator
>> gets registered this register needs to be set with a 'good' value.  I
>> assume the only practicable solution will be that we initialize this
>> voltage register in the boot code where we also set the CPU frequency.
>
> You probably need platform data to tell the kernelw hat teh startup
> value is.

I've asked also on TI forum if this is typical to the regulator not to
determine the startup voltage but still waiting for feedback. Anyway,
if this is the case I guess a driver is a good place to update
register before we register to the regulator framework.

Thanks Mark for your feedback.

/Waldek

[toc] | [prev] | [next] | [standalone]


#1678907

FromWaldemar Rymarkiewicz <waldemar.rymarkiewicz@gmail.com>
Date2017-06-30 17:30 +0200
Message-ID<tY61Q-7aE-9@gated-at.bofh.it>
In reply to#1678757
On 30 June 2017 at 14:14, Mark Brown <broonie@kernel.org> wrote:
> On Fri, Jun 30, 2017 at 01:37:32PM +0200, Waldemar Rymarkiewicz wrote:
>
>> I am not sure if I understand. Do you mean, a regulator should
>> determine a voltage and update a register with a right selector when
>> system boots, so the regulator framework reading reg register knows
>> actual voltage?
>
> Just don't provide a default value for the cache, regmap will do a
> physical read if there's nothing in the cache for that register and
> everything will work transparently.

Just want to understand well. "Physical read" means to read a register
value? or determine actual value another way? As Thomas mentioned in
previous email TPS65275 does not have a circuit to determine startup
voltage at least I cannot see this in the datasheet.

Data sheet: http://www.ti.com/lit/gpn/tps65273v

/Waldek

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web