diff mbox series

[v2,14/17] mfd: adp5585: support getting vdd regulator

Message ID 20250415-dev-adp5589-fw-v2-14-3a799c3ed812@analog.com
State New
Headers show
Series mfd: adp5585: support keymap events and drop legacy Input driver | expand

Commit Message

Nuno Sá via B4 Relay April 15, 2025, 2:49 p.m. UTC
From: Nuno Sá <nuno.sa@analog.com>

Make sure we get and enable the VDD supply (if available).

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
---
 drivers/mfd/adp5585.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Laurent Pinchart April 21, 2025, 10:09 p.m. UTC | #1
Hi Nuno,

On Mon, Apr 21, 2025 at 01:38:47PM +0100, Nuno Sá wrote:
> On Mon, 2025-04-21 at 12:48 +0300, Laurent Pinchart wrote:
> > On Tue, Apr 15, 2025 at 03:49:30PM +0100, Nuno Sá via B4 Relay wrote:
> > > From: Nuno Sá <nuno.sa@analog.com>
> > > 
> > > Make sure we get and enable the VDD supply (if available).
> > 
> > Can the regulator be enabled only when needed ?
> > 
> 
> Hmm, I guess we could do that for the case where only the PWM device is
> "enabled". That said, I don't think the extra complexity for that really pays
> off...

Or when no GPIO is requested, or when the input device for the keypad is
not open ? Then can be handled with power optimization for OSC_EN on top
of this series.

> > > Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> > > ---
> > >  drivers/mfd/adp5585.c | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/drivers/mfd/adp5585.c b/drivers/mfd/adp5585.c
> > > index
> > > c1d51d50dca6c9367d4a1b98a4f8bbec12dbf90b..667cc5bd0745f64eec60837ec3c00057af
> > > 0cddeb 100644
> > > --- a/drivers/mfd/adp5585.c
> > > +++ b/drivers/mfd/adp5585.c
> > > @@ -18,6 +18,7 @@
> > >  #include <linux/mod_devicetable.h>
> > >  #include <linux/module.h>
> > >  #include <linux/regmap.h>
> > > +#include <linux/regulator/consumer.h>
> > >  #include <linux/types.h>
> > >  
> > >  static const struct mfd_cell adp5585_devs[] = {
> > > @@ -849,6 +850,10 @@ static int adp5585_i2c_probe(struct i2c_client *i2c)
> > >  	adp5585->dev = &i2c->dev;
> > >  	adp5585->irq = i2c->irq;
> > >  
> > > +	ret = devm_regulator_get_enable(&i2c->dev, "vdd");
> > > +	if (ret)
> > > +		return ret;
> > > +
> > >  	adp5585->regmap = devm_regmap_init_i2c(i2c, info->regmap_config);
> > >  	if (IS_ERR(adp5585->regmap))
> > >  		return dev_err_probe(&i2c->dev, PTR_ERR(adp5585->regmap),
diff mbox series

Patch

diff --git a/drivers/mfd/adp5585.c b/drivers/mfd/adp5585.c
index c1d51d50dca6c9367d4a1b98a4f8bbec12dbf90b..667cc5bd0745f64eec60837ec3c00057af0cddeb 100644
--- a/drivers/mfd/adp5585.c
+++ b/drivers/mfd/adp5585.c
@@ -18,6 +18,7 @@ 
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
 #include <linux/types.h>
 
 static const struct mfd_cell adp5585_devs[] = {
@@ -849,6 +850,10 @@  static int adp5585_i2c_probe(struct i2c_client *i2c)
 	adp5585->dev = &i2c->dev;
 	adp5585->irq = i2c->irq;
 
+	ret = devm_regulator_get_enable(&i2c->dev, "vdd");
+	if (ret)
+		return ret;
+
 	adp5585->regmap = devm_regmap_init_i2c(i2c, info->regmap_config);
 	if (IS_ERR(adp5585->regmap))
 		return dev_err_probe(&i2c->dev, PTR_ERR(adp5585->regmap),