Skip to contentSkip to conversation

power: regulator: tps65219: Fix LDO3 and LDO4 selector boundaries

PATCH Superseded Kumara Bhimeswararao Matsa 2 participants 7 messages Jul 31 – Aug 6

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: regulator: tps65219: Fix LDO3 and LDO4 selector boundaries

According to the TPS65219 datasheet, selectors 0x00 through 0x0c map to 1.2 V, while selectors 0x36 through 0x3f map to 3.3 V.

The driver currently uses 0x12 and 0x54 as the selector boundaries for LDO3 and LDO4. These values do not match the selector ranges defined by the datasheet.

Use the correct selector boundary values of 0x0c and 0x36.

Fixes Fixes: b5cfa0c7ca4f ("power: add driver for the TPS65219 PMIC")
---
 include/power/tps65219.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/power/tps65219.h +2 -2
index e8780af2d81..4feea081f61 100644
@@ -50,7 +50,7 @@
 #define TPS65219_LDO12_VOLT_REG_MAX	0x56
 #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
+#define TPS65219_LDO34_VOLT_REG_MAX	0x36
 
 #endif /* TPS65219_H */

base-commit: 100e12ea78c73071b9710f08b32fd4590019266f

Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/1 power: regulator: tps65219: Fix LDO selector boundaries

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.

Fixes b5cfa0c7ca4f ("power: add driver for the TPS65219 PMIC")

---
Changes in v2:
- Fix the LDO1/LDO2 selector boundary in addition to LDO3/LDO4.
- Update the subject and commit message to cover all LDO selector boundaries.

 include/power/tps65219.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/power/tps65219.h +3 -3
index e8780af2d81..c3114f26e1d 100644
@@ -47,10 +47,10 @@
 #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
 #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
+#define TPS65219_LDO34_VOLT_REG_MAX	0x36
 
 #endif /* TPS65219_H */

base-commit: 100e12ea78c73071b9710f08b32fd4590019266f

Signature · 1 line
2.43.0
#2 lore raw

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

Quoted 17 lines

From: U-Boot <[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

include/power/tps65219.h line 50

Quoted 2 lines
include/power/tps65219.h +1 -1
-#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?

include/power/tps65219.h line 53

Quoted 5 lines

#define TPS65219_LDO34_VOLT_MIN 1200000
#define TPS65219_LDO34_VOLT_MAX 3300000

include/power/tps65219.h +1 -2
-#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?

Quoted 1 line

+#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

#3 lore raw

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

Quoted 39 lines · Maarten Brock
Quoted 1 line

From: U-Boot <[email protected]> On Behalf Of

Kumara Bhimeswararao Matsa

Quoted 16 lines

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

include/power/tps65219.h line 50

Quoted 2 lines
include/power/tps65219.h +1 -1
-#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?

include/power/tps65219.h line 53

Quoted 5 lines

#define TPS65219_LDO34_VOLT_MIN 1200000
#define TPS65219_LDO34_VOLT_MAX 3300000

include/power/tps65219.h +1 -2
-#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?

Quoted 1 line

+#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

#4 lore raw

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

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

Quoted 17 lines · On Fri, Jul 31, 2026 at 7:51 PM Maarten Brock…

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

include/power/tps65219.h line 50

Quoted 2 lines
include/power/tps65219.h +1 -1
-#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?

include/power/tps65219.h line 53

Quoted 5 lines

#define TPS65219_LDO34_VOLT_MIN 1200000
#define TPS65219_LDO34_VOLT_MAX 3300000

include/power/tps65219.h +1 -2
-#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?

Quoted 1 line

+#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

#5 lore raw

PATCH v3 1/1 power: regulator: tps65219: Fix LDO selector boundaries

In reply to Kumara Bhimeswararao Matsa

According to the TPS65219 datasheet, selectors 0x38 through 0x3f saturate at 3.4 V for LDO1 and LDO2.

For LDO3 and LDO4, selectors 0x00 through 0x0c saturate at 1.2 V, while selectors 0x36 through 0x3f saturate at 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 for interpolation.

Fixes b5cfa0c7ca4f ("power: add driver for the TPS65219 PMIC")
---
 include/power/tps65219.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/power/tps65219.h +3 -3
index e8780af2d81..c3114f26e1d 100644
@@ -47,10 +47,10 @@
 #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
 #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
+#define TPS65219_LDO34_VOLT_REG_MAX	0x36
 
 #endif /* TPS65219_H */

base-commit: 100e12ea78c73071b9710f08b32fd4590019266f

Signature · 1 line
2.43.0
Acked-by on v3 1/1
#6 lore raw

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

Quoted 33 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Kumara Bhimeswararao Matsa
Sent: Thursday 6 August 2026 2:58
To: Jaehoon Chung <[email protected]>; Peng Fan <[email protected]>; [email protected]
Cc: Tom Rini <[email protected]>; Neil Armstrong <[email protected]>; Kumara Bhimeswararao Matsa <[email protected]>
Subject: [PATCH v3] power: regulator: tps65219: Fix LDO selector boundaries

According to the TPS65219 datasheet, selectors 0x38 through 0x3f saturate at 3.4 V for LDO1 and LDO2.

For LDO3 and LDO4, selectors 0x00 through 0x0c saturate at 1.2 V, while selectors 0x36 through 0x3f saturate at 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 for interpolation.

Fixes b5cfa0c7ca4f ("power: add driver for the TPS65219 PMIC")
---
 include/power/tps65219.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/power/tps65219.h +0 -0
index e8780af2d81..c3114f26e1d 100644
@@ -47,10 +47,10 @@
 #define TPS65219_LDO12_VOLT_MIN		 600000

include/power/tps65219.h line 54

Quoted 10 lines
include/power/tps65219.h +3 -3
 #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
 #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
+#define TPS65219_LDO34_VOLT_REG_MAX	0x36

I only now see that the values were correct if interpreted as decimal despite the 0x prefix. LGTM

Quoted 6 lines
include/power/tps65219.h +0 -0
 #endif /* TPS65219_H */
 

base-commit: 100e12ea78c73071b9710f08b32fd4590019266f --
2.43.0