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]> wrote: > > 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 > > -#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 > >
