Message ID | 20220628140621.254550-3-heiko.thiery@gmail.com |
---|---|
State | Superseded |
Delegated to: | Stefano Babic |
Headers | show |
Series | pmic: pca9450: Initialization of pmic like done in linux | expand |
On 28/06/2022 11:06, Heiko Thiery wrote: > The regulator driver uses the DVS registers PCA9450_REG_BUCKxOUT_DVS0 > to > set the voltage for the buck regulators 1, 2 and 3. This has no effect > as the > PRESET_EN bit is set by default and therefore the preset values are > used > instead, which are set to 850 mV. > > This is a port of the same change in the Linux kernel: > 98b94b6e38ca0 ("regulator: pca9450: Clear PRESET_EN bit to fix > BUCK1/2/3 voltage setting") > > Cc: Frieder Schrempf <frieder.schrempf@kontron.de> > Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> > --- > drivers/power/pmic/pca9450.c | 6 ++++++ > include/power/pca9450.h | 3 +++ > 2 files changed, 9 insertions(+) > > diff --git a/drivers/power/pmic/pca9450.c > b/drivers/power/pmic/pca9450.c > index fecab0496f..1c59362ab4 100644 > --- a/drivers/power/pmic/pca9450.c > +++ b/drivers/power/pmic/pca9450.c > @@ -94,6 +94,12 @@ static int pca9450_probe(struct udevice *dev) > > priv->regmap = syscon_node_to_regmap(dev_ofnode(dev)); > > + /* Clear PRESET_EN bit in BUCK123_DVS to use DVS registers */ > + if (CONFIG_IS_ENABLED(DM_REGULATOR_PCA9450)) { > + ret = regmap_update_bits(priv->regmap, PCA9450_BUCK123_DVS, > + BUCK123_PRESET_EN, 0); > + } Nit: the braces could be dropped. Reviewed-by: Fabio Estevam <festevam@denx.de>
On 6/28/22 22:02, Fabio Estevam wrote: > On 28/06/2022 11:06, Heiko Thiery wrote: >> The regulator driver uses the DVS registers PCA9450_REG_BUCKxOUT_DVS0 to >> set the voltage for the buck regulators 1, 2 and 3. This has no effect >> as the >> PRESET_EN bit is set by default and therefore the preset values are used >> instead, which are set to 850 mV. >> >> This is a port of the same change in the Linux kernel: >> 98b94b6e38ca0 ("regulator: pca9450: Clear PRESET_EN bit to fix >> BUCK1/2/3 voltage setting") >> >> Cc: Frieder Schrempf <frieder.schrempf@kontron.de> >> Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> >> --- >> drivers/power/pmic/pca9450.c | 6 ++++++ >> include/power/pca9450.h | 3 +++ >> 2 files changed, 9 insertions(+) >> >> diff --git a/drivers/power/pmic/pca9450.c b/drivers/power/pmic/pca9450.c >> index fecab0496f..1c59362ab4 100644 >> --- a/drivers/power/pmic/pca9450.c >> +++ b/drivers/power/pmic/pca9450.c >> @@ -94,6 +94,12 @@ static int pca9450_probe(struct udevice *dev) >> >> priv->regmap = syscon_node_to_regmap(dev_ofnode(dev)); >> >> + /* Clear PRESET_EN bit in BUCK123_DVS to use DVS registers */ >> + if (CONFIG_IS_ENABLED(DM_REGULATOR_PCA9450)) { >> + ret = regmap_update_bits(priv->regmap, PCA9450_BUCK123_DVS, >> + BUCK123_PRESET_EN, 0); >> + } > > Nit: the braces could be dropped. IIRC they were recommended on multi-line code in conditional. I think checkpatch --strict might even warn about them missing.
Am 28.06.22 um 16:06 schrieb Heiko Thiery: > The regulator driver uses the DVS registers PCA9450_REG_BUCKxOUT_DVS0 to > set the voltage for the buck regulators 1, 2 and 3. This has no effect as the > PRESET_EN bit is set by default and therefore the preset values are used > instead, which are set to 850 mV. > > This is a port of the same change in the Linux kernel: > 98b94b6e38ca0 ("regulator: pca9450: Clear PRESET_EN bit to fix BUCK1/2/3 voltage setting") > > Cc: Frieder Schrempf <frieder.schrempf@kontron.de> > Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
diff --git a/drivers/power/pmic/pca9450.c b/drivers/power/pmic/pca9450.c index fecab0496f..1c59362ab4 100644 --- a/drivers/power/pmic/pca9450.c +++ b/drivers/power/pmic/pca9450.c @@ -94,6 +94,12 @@ static int pca9450_probe(struct udevice *dev) priv->regmap = syscon_node_to_regmap(dev_ofnode(dev)); + /* Clear PRESET_EN bit in BUCK123_DVS to use DVS registers */ + if (CONFIG_IS_ENABLED(DM_REGULATOR_PCA9450)) { + ret = regmap_update_bits(priv->regmap, PCA9450_BUCK123_DVS, + BUCK123_PRESET_EN, 0); + } + if (dev_read_bool(dev, "nxp,wdog_b-warm-reset")) reset_ctrl = WDOG_B_CFG_WARM; else diff --git a/include/power/pca9450.h b/include/power/pca9450.h index bf9be7d6bb..60e37c671a 100644 --- a/include/power/pca9450.h +++ b/include/power/pca9450.h @@ -67,6 +67,9 @@ enum { #define PCA9450_LDO34_MASK 0x1f #define PCA9450_LDO5_MASK 0x0f +/* PCA9450_REG_BUCK123_PRESET_EN bit */ +#define BUCK123_PRESET_EN 0x80 + /* PCA9450_REG_RESET_CTRL bits */ #define WDOG_B_CFG_MASK 0xC0 #define WDOG_B_CFG_NONE 0x00
The regulator driver uses the DVS registers PCA9450_REG_BUCKxOUT_DVS0 to set the voltage for the buck regulators 1, 2 and 3. This has no effect as the PRESET_EN bit is set by default and therefore the preset values are used instead, which are set to 850 mV. This is a port of the same change in the Linux kernel: 98b94b6e38ca0 ("regulator: pca9450: Clear PRESET_EN bit to fix BUCK1/2/3 voltage setting") Cc: Frieder Schrempf <frieder.schrempf@kontron.de> Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> --- drivers/power/pmic/pca9450.c | 6 ++++++ include/power/pca9450.h | 3 +++ 2 files changed, 9 insertions(+)