RE: [PATCH v2] power: regulator: tps65219: Fix LDO selector boundaries

Maarten Brock <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <GV2PR05MB119417EEE35B83CD0DFA0BA9983D42@GV2PR05MB11941.eurprd05.prod.outlook.com>
Hello Kumara,

Thanks. I understand now. The values are used for interpolation.

Maybe you can replace 'map' with 'saturate' in your commit log ?
And add 'for interpolation' after:
'Use the correct selector boundary values of 0x38, 0x0c, and 0x36.'

Kind regards,
Maarten Brock

From: Kumara Bhimeswararao <[email protected]>
Sent: Saturday 1 August 2026 8:57
To: Maarten Brock <[email protected]>
Cc: Jaehoon Chung <[email protected]>; Peng Fan <[email protected]>; [email protected]; Tom Rini <[email protected]>; Neil Armstrong <[email protected]>
Subject: Re: [PATCH v2] power: regulator: tps65219: Fix LDO selector boundaries

Hi Maarten,

Thanks for the review.

These macros are used as the saturation boundaries in
tps65219_ldo_val2volt(), which uses:

if (val >= reg_max)
return max;
else if (val <= reg_base)
return base;

Therefore, they represent the first or last selector in the saturated
range rather than the numerically highest or lowest selector value.

According to Table 7-2 of the TPS65219 datasheet:

- LDO1/LDO2: selectors 0x38-0x3f all map to 3.4 V, so reg_max is 0x38.
- LDO3/LDO4: selectors 0x00-0x0c all map to 1.2 V, so reg_base is 0x0c.
- LDO3/LDO4: selectors 0x36-0x3f all map to 3.3 V, so reg_max is 0x36.

Using 0x3f or 0x00 here would not correctly cover the entire saturated
ranges with the current >= and <= comparisons.

Does that clarify the reasoning behind these boundary values?

Kind regards,
Kumara Bhimeswarao Matsa

On Fri, Jul 31, 2026 at 7:51 PM Maarten Brock <[email protected]<mailto:[email protected]>> wrote:
> From: U-Boot <[email protected]<mailto:[email protected]>> On Behalf Of Kumara Bhimeswararao Matsa
>
> According to the TPS65219 datasheet, selectors 0x38 through 0x3f
> map to 3.4 V for LDO1 and LDO2.
>
> For LDO3 and LDO4, selectors 0x00 through 0x0c map to 1.2 V,
> while selectors 0x36 through 0x3f map to 3.3 V.
>
> The driver currently uses 0x56, 0x12, and 0x54 as selector boundary
> values. These values do not match the selector boundaries defined by
> the datasheet.
>
> Use the correct selector boundary values of 0x38, 0x0c, and 0x36.
>
>  #define TPS65219_LDO12_VOLT_MIN               600000
>  #define TPS65219_LDO12_VOLT_MAX              3400000
>  #define TPS65219_LDO12_VOLT_REG_MIN  0
> -#define TPS65219_LDO12_VOLT_REG_MAX  0x56
> +#define TPS65219_LDO12_VOLT_REG_MAX  0x38

If the maximum for 3.4V is 0x3f then why do you use 0x38 here?

>  #define TPS65219_LDO34_VOLT_MIN              1200000
>  #define TPS65219_LDO34_VOLT_MAX              3300000
> -#define TPS65219_LDO34_VOLT_REG_MIN  0x12
> -#define TPS65219_LDO34_VOLT_REG_MAX  0x54
> +#define TPS65219_LDO34_VOLT_REG_MIN  0x0c

If the minimum for 1.2V is 0x00 then why do you use 0x0c here?

> +#define TPS65219_LDO34_VOLT_REG_MAX  0x36

If the maximum for 3.3V is 0x3f then why do you use 0x36 here?

Kind regards,
Maarten Brock
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.