RE: [PATCH 1/5] regulator: da9062: fix suspend_enable/disable preparation

2019-09-24 Thread Adam Thomson
On 23 September 2019 23:03, Marco Felsch wrote:

> Hi Adam,
> 
> On 19-09-23 16:03, Adam Thomson wrote:
> > On 17 September 2019 13:43, Marco Felsch wrote:
> >
> > > Currently the suspend reg_field maps to the pmic voltage selection bits
> > > and is used during suspend_enabe/disable() and during get_mode(). This
> > > seems to be wrong for both use cases.
> > >
> > > Use case one (suspend_enabe/disable):
> > > Those callbacks are used to mark a regulator device as enabled/disabled
> > > during suspend. Marking the regulator enabled during suspend is done by
> > > the LDOx_CONF/BUCKx_CONF bit within the LDOx_CONT/BUCKx_CONT
> > > registers.
> > > Setting this bit tells the DA9062 PMIC state machine to keep the
> > > regulator on in POWERDOWN mode and switch to suspend voltage.
> > >
> > > Use case two (get_mode):
> > > The get_mode callback is used to retrieve the active mode state. Since
> > > the regulator-setting-A is used for the active state and
> > > regulator-setting-B for the suspend state there is no need to check
> > > which regulator setting is active.
> > >
> >
> > So I believe you're correct with the above statements. The driver, rather 
> > than
> > enabling/disabling a regulator in system suspend, will instead put the 
> > regulator
> > to a low power state, which is definitely not the desired outcome. Thanks 
> > for
> > rectifying this.
> >
> > Reviewed-by: Adam Thomson 
> 
> Thanks a lot for reviewing the patch :) Can you also have a look on the
> other patches within this series?

Yes, I will take a look at those next. :)

> 
> Regards,
>   Marco
> 
> > > Fixes: 4068e5182ada ("regulator: da9062: DA9062 regulator driver")
> > > Signed-off-by: Marco Felsch 
> > > ---
> > >  drivers/regulator/da9062-regulator.c | 118 +++
> > >  1 file changed, 47 insertions(+), 71 deletions(-)
> > >
> > > diff --git a/drivers/regulator/da9062-regulator.c 
> > > b/drivers/regulator/da9062-
> > > regulator.c
> > > index 2ffc64622451..9b2ca472f70c 100644
> > > --- a/drivers/regulator/da9062-regulator.c
> > > +++ b/drivers/regulator/da9062-regulator.c
> > > @@ -136,7 +136,6 @@ static int da9062_buck_set_mode(struct
> regulator_dev
> > > *rdev, unsigned mode)
> > >  static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
> > >  {
> > >   struct da9062_regulator *regl = rdev_get_drvdata(rdev);
> > > - struct regmap_field *field;
> > >   unsigned int val, mode = 0;
> > >   int ret;
> > >
> > > @@ -158,18 +157,7 @@ static unsigned da9062_buck_get_mode(struct
> > > regulator_dev *rdev)
> > >   return REGULATOR_MODE_NORMAL;
> > >   }
> > >
> > > - /* Detect current regulator state */
> > > - ret = regmap_field_read(regl->suspend, &val);
> > > - if (ret < 0)
> > > - return 0;
> > > -
> > > - /* Read regulator mode from proper register, depending on state */
> > > - if (val)
> > > - field = regl->suspend_sleep;
> > > - else
> > > - field = regl->sleep;
> > > -
> > > - ret = regmap_field_read(field, &val);
> > > + ret = regmap_field_read(regl->sleep, &val);
> > >   if (ret < 0)
> > >   return 0;
> > >
> > > @@ -208,21 +196,9 @@ static int da9062_ldo_set_mode(struct regulator_dev
> > > *rdev, unsigned mode)
> > >  static unsigned da9062_ldo_get_mode(struct regulator_dev *rdev)
> > >  {
> > >   struct da9062_regulator *regl = rdev_get_drvdata(rdev);
> > > - struct regmap_field *field;
> > >   int ret, val;
> > >
> > > - /* Detect current regulator state */
> > > - ret = regmap_field_read(regl->suspend, &val);
> > > - if (ret < 0)
> > > - return 0;
> > > -
> > > - /* Read regulator mode from proper register, depending on state */
> > > - if (val)
> > > - field = regl->suspend_sleep;
> > > - else
> > > - field = regl->sleep;
> > > -
> > > - ret = regmap_field_read(field, &val);
> > > + ret = regmap_field_read(regl->sleep, &val);
> > >   if (ret < 0)
> > >   return 0;
> > >
> > > @@ -408,10 +384,10 @@ static const struct da9062_regulator_info
> > > local_da9061_regulator_info[] = {
> > >   __builtin_ffs((int)DA9062AA_BUCK1_MODE_MASK) - 1,
> > >   sizeof(unsigned int) * 8 -
> > >   __builtin_clz((DA9062AA_BUCK1_MODE_MASK)) - 1),
> > > - .suspend = REG_FIELD(DA9062AA_DVC_1,
> > > - __builtin_ffs((int)DA9062AA_VBUCK1_SEL_MASK) - 1,
> > > + .suspend = REG_FIELD(DA9062AA_BUCK1_CONT,
> > > + __builtin_ffs((int)DA9062AA_BUCK1_CONF_MASK) - 1,
> > >   sizeof(unsigned int) * 8 -
> > > - __builtin_clz((DA9062AA_VBUCK1_SEL_MASK)) - 1),
> > > + __builtin_clz(DA9062AA_BUCK1_CONF_MASK) - 1),
> > >   },
> > >   {
> > >   .desc.id = DA9061_ID_BUCK2,
> > > @@ -444,10 +420,10 @@ static const struct da9062_regulator_info
> > > local_da9061_regulator_info[] = {
> > >   __builtin_ffs((int)DA9062AA_BUCK3_MODE_MASK) - 1,
> > >   sizeof(unsigned int) * 8 -
> > >

Re: [PATCH 1/5] regulator: da9062: fix suspend_enable/disable preparation

2019-09-23 Thread Marco Felsch
Hi Adam,

On 19-09-23 16:03, Adam Thomson wrote:
> On 17 September 2019 13:43, Marco Felsch wrote:
> 
> > Currently the suspend reg_field maps to the pmic voltage selection bits
> > and is used during suspend_enabe/disable() and during get_mode(). This
> > seems to be wrong for both use cases.
> >
> > Use case one (suspend_enabe/disable):
> > Those callbacks are used to mark a regulator device as enabled/disabled
> > during suspend. Marking the regulator enabled during suspend is done by
> > the LDOx_CONF/BUCKx_CONF bit within the LDOx_CONT/BUCKx_CONT
> > registers.
> > Setting this bit tells the DA9062 PMIC state machine to keep the
> > regulator on in POWERDOWN mode and switch to suspend voltage.
> >
> > Use case two (get_mode):
> > The get_mode callback is used to retrieve the active mode state. Since
> > the regulator-setting-A is used for the active state and
> > regulator-setting-B for the suspend state there is no need to check
> > which regulator setting is active.
> >
> 
> So I believe you're correct with the above statements. The driver, rather than
> enabling/disabling a regulator in system suspend, will instead put the 
> regulator
> to a low power state, which is definitely not the desired outcome. Thanks for
> rectifying this.
> 
> Reviewed-by: Adam Thomson 

Thanks a lot for reviewing the patch :) Can you also have a look on the
other patches within this series?

Regards,
  Marco

> > Fixes: 4068e5182ada ("regulator: da9062: DA9062 regulator driver")
> > Signed-off-by: Marco Felsch 
> > ---
> >  drivers/regulator/da9062-regulator.c | 118 +++
> >  1 file changed, 47 insertions(+), 71 deletions(-)
> >
> > diff --git a/drivers/regulator/da9062-regulator.c 
> > b/drivers/regulator/da9062-
> > regulator.c
> > index 2ffc64622451..9b2ca472f70c 100644
> > --- a/drivers/regulator/da9062-regulator.c
> > +++ b/drivers/regulator/da9062-regulator.c
> > @@ -136,7 +136,6 @@ static int da9062_buck_set_mode(struct regulator_dev
> > *rdev, unsigned mode)
> >  static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
> >  {
> > struct da9062_regulator *regl = rdev_get_drvdata(rdev);
> > -   struct regmap_field *field;
> > unsigned int val, mode = 0;
> > int ret;
> >
> > @@ -158,18 +157,7 @@ static unsigned da9062_buck_get_mode(struct
> > regulator_dev *rdev)
> > return REGULATOR_MODE_NORMAL;
> > }
> >
> > -   /* Detect current regulator state */
> > -   ret = regmap_field_read(regl->suspend, &val);
> > -   if (ret < 0)
> > -   return 0;
> > -
> > -   /* Read regulator mode from proper register, depending on state */
> > -   if (val)
> > -   field = regl->suspend_sleep;
> > -   else
> > -   field = regl->sleep;
> > -
> > -   ret = regmap_field_read(field, &val);
> > +   ret = regmap_field_read(regl->sleep, &val);
> > if (ret < 0)
> > return 0;
> >
> > @@ -208,21 +196,9 @@ static int da9062_ldo_set_mode(struct regulator_dev
> > *rdev, unsigned mode)
> >  static unsigned da9062_ldo_get_mode(struct regulator_dev *rdev)
> >  {
> > struct da9062_regulator *regl = rdev_get_drvdata(rdev);
> > -   struct regmap_field *field;
> > int ret, val;
> >
> > -   /* Detect current regulator state */
> > -   ret = regmap_field_read(regl->suspend, &val);
> > -   if (ret < 0)
> > -   return 0;
> > -
> > -   /* Read regulator mode from proper register, depending on state */
> > -   if (val)
> > -   field = regl->suspend_sleep;
> > -   else
> > -   field = regl->sleep;
> > -
> > -   ret = regmap_field_read(field, &val);
> > +   ret = regmap_field_read(regl->sleep, &val);
> > if (ret < 0)
> > return 0;
> >
> > @@ -408,10 +384,10 @@ static const struct da9062_regulator_info
> > local_da9061_regulator_info[] = {
> > __builtin_ffs((int)DA9062AA_BUCK1_MODE_MASK) - 1,
> > sizeof(unsigned int) * 8 -
> > __builtin_clz((DA9062AA_BUCK1_MODE_MASK)) - 1),
> > -   .suspend = REG_FIELD(DA9062AA_DVC_1,
> > -   __builtin_ffs((int)DA9062AA_VBUCK1_SEL_MASK) - 1,
> > +   .suspend = REG_FIELD(DA9062AA_BUCK1_CONT,
> > +   __builtin_ffs((int)DA9062AA_BUCK1_CONF_MASK) - 1,
> > sizeof(unsigned int) * 8 -
> > -   __builtin_clz((DA9062AA_VBUCK1_SEL_MASK)) - 1),
> > +   __builtin_clz(DA9062AA_BUCK1_CONF_MASK) - 1),
> > },
> > {
> > .desc.id = DA9061_ID_BUCK2,
> > @@ -444,10 +420,10 @@ static const struct da9062_regulator_info
> > local_da9061_regulator_info[] = {
> > __builtin_ffs((int)DA9062AA_BUCK3_MODE_MASK) - 1,
> > sizeof(unsigned int) * 8 -
> > __builtin_clz((DA9062AA_BUCK3_MODE_MASK)) - 1),
> > -   .suspend = REG_FIELD(DA9062AA_DVC_1,
> > -   __builtin_ffs((int)DA9062AA_VBUCK3_SEL_MASK) - 1,
> > +   .suspend = REG_FIELD(DA9062AA_BUCK3_CONT,

RE: [PATCH 1/5] regulator: da9062: fix suspend_enable/disable preparation

2019-09-23 Thread Adam Thomson
On 17 September 2019 13:43, Marco Felsch wrote:

> Currently the suspend reg_field maps to the pmic voltage selection bits
> and is used during suspend_enabe/disable() and during get_mode(). This
> seems to be wrong for both use cases.
>
> Use case one (suspend_enabe/disable):
> Those callbacks are used to mark a regulator device as enabled/disabled
> during suspend. Marking the regulator enabled during suspend is done by
> the LDOx_CONF/BUCKx_CONF bit within the LDOx_CONT/BUCKx_CONT
> registers.
> Setting this bit tells the DA9062 PMIC state machine to keep the
> regulator on in POWERDOWN mode and switch to suspend voltage.
>
> Use case two (get_mode):
> The get_mode callback is used to retrieve the active mode state. Since
> the regulator-setting-A is used for the active state and
> regulator-setting-B for the suspend state there is no need to check
> which regulator setting is active.
>

So I believe you're correct with the above statements. The driver, rather than
enabling/disabling a regulator in system suspend, will instead put the regulator
to a low power state, which is definitely not the desired outcome. Thanks for
rectifying this.

Reviewed-by: Adam Thomson 

> Fixes: 4068e5182ada ("regulator: da9062: DA9062 regulator driver")
> Signed-off-by: Marco Felsch 
> ---
>  drivers/regulator/da9062-regulator.c | 118 +++
>  1 file changed, 47 insertions(+), 71 deletions(-)
>
> diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-
> regulator.c
> index 2ffc64622451..9b2ca472f70c 100644
> --- a/drivers/regulator/da9062-regulator.c
> +++ b/drivers/regulator/da9062-regulator.c
> @@ -136,7 +136,6 @@ static int da9062_buck_set_mode(struct regulator_dev
> *rdev, unsigned mode)
>  static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
>  {
>   struct da9062_regulator *regl = rdev_get_drvdata(rdev);
> - struct regmap_field *field;
>   unsigned int val, mode = 0;
>   int ret;
>
> @@ -158,18 +157,7 @@ static unsigned da9062_buck_get_mode(struct
> regulator_dev *rdev)
>   return REGULATOR_MODE_NORMAL;
>   }
>
> - /* Detect current regulator state */
> - ret = regmap_field_read(regl->suspend, &val);
> - if (ret < 0)
> - return 0;
> -
> - /* Read regulator mode from proper register, depending on state */
> - if (val)
> - field = regl->suspend_sleep;
> - else
> - field = regl->sleep;
> -
> - ret = regmap_field_read(field, &val);
> + ret = regmap_field_read(regl->sleep, &val);
>   if (ret < 0)
>   return 0;
>
> @@ -208,21 +196,9 @@ static int da9062_ldo_set_mode(struct regulator_dev
> *rdev, unsigned mode)
>  static unsigned da9062_ldo_get_mode(struct regulator_dev *rdev)
>  {
>   struct da9062_regulator *regl = rdev_get_drvdata(rdev);
> - struct regmap_field *field;
>   int ret, val;
>
> - /* Detect current regulator state */
> - ret = regmap_field_read(regl->suspend, &val);
> - if (ret < 0)
> - return 0;
> -
> - /* Read regulator mode from proper register, depending on state */
> - if (val)
> - field = regl->suspend_sleep;
> - else
> - field = regl->sleep;
> -
> - ret = regmap_field_read(field, &val);
> + ret = regmap_field_read(regl->sleep, &val);
>   if (ret < 0)
>   return 0;
>
> @@ -408,10 +384,10 @@ static const struct da9062_regulator_info
> local_da9061_regulator_info[] = {
>   __builtin_ffs((int)DA9062AA_BUCK1_MODE_MASK) - 1,
>   sizeof(unsigned int) * 8 -
>   __builtin_clz((DA9062AA_BUCK1_MODE_MASK)) - 1),
> - .suspend = REG_FIELD(DA9062AA_DVC_1,
> - __builtin_ffs((int)DA9062AA_VBUCK1_SEL_MASK) - 1,
> + .suspend = REG_FIELD(DA9062AA_BUCK1_CONT,
> + __builtin_ffs((int)DA9062AA_BUCK1_CONF_MASK) - 1,
>   sizeof(unsigned int) * 8 -
> - __builtin_clz((DA9062AA_VBUCK1_SEL_MASK)) - 1),
> + __builtin_clz(DA9062AA_BUCK1_CONF_MASK) - 1),
>   },
>   {
>   .desc.id = DA9061_ID_BUCK2,
> @@ -444,10 +420,10 @@ static const struct da9062_regulator_info
> local_da9061_regulator_info[] = {
>   __builtin_ffs((int)DA9062AA_BUCK3_MODE_MASK) - 1,
>   sizeof(unsigned int) * 8 -
>   __builtin_clz((DA9062AA_BUCK3_MODE_MASK)) - 1),
> - .suspend = REG_FIELD(DA9062AA_DVC_1,
> - __builtin_ffs((int)DA9062AA_VBUCK3_SEL_MASK) - 1,
> + .suspend = REG_FIELD(DA9062AA_BUCK3_CONT,
> + __builtin_ffs((int)DA9062AA_BUCK3_CONF_MASK) - 1,
>   sizeof(unsigned int) * 8 -
> - __builtin_clz((DA9062AA_VBUCK3_SEL_MASK)) - 1),
> + __builtin_clz(DA9062AA_BUCK3_CONF_MASK) - 1),
>   },
>   {
>   

Re: [PATCH 1/5] regulator: da9062: fix suspend_enable/disable preparation

2019-09-18 Thread Marco Felsch
Hi Adam,

On 19-09-18 12:41, Adam Thomson wrote:
> On 17 September 2019 13:43, Marco Felsch wrote:
> 
> > Currently the suspend reg_field maps to the pmic voltage selection bits
> > and is used during suspend_enabe/disable() and during get_mode(). This
> > seems to be wrong for both use cases.
> 
> Hi Marco,
> 
> I'd be very surprised if what was in place was wrong as I know Stephen tested
> this driver thoroughly over its lifetime. Regardless, I'll need some time to 
> review
> your proposed updates to make sure this aligns with our expectation of 
> operation.

Thanks for the upcoming review.

Regards,
  Marco


> > 
> > Use case one (suspend_enabe/disable):
> > Those callbacks are used to mark a regulator device as enabled/disabled
> > during suspend. Marking the regulator enabled during suspend is done by
> > the LDOx_CONF/BUCKx_CONF bit within the LDOx_CONT/BUCKx_CONT
> > registers.
> > Setting this bit tells the DA9062 PMIC state machine to keep the
> > regulator on in POWERDOWN mode and switch to suspend voltage.
> > 
> > Use case two (get_mode):
> > The get_mode callback is used to retrieve the active mode state. Since
> > the regulator-setting-A is used for the active state and
> > regulator-setting-B for the suspend state there is no need to check
> > which regulator setting is active.
> > 
> > Fixes: 4068e5182ada ("regulator: da9062: DA9062 regulator driver")
> > Signed-off-by: Marco Felsch 
> > ---
> >  drivers/regulator/da9062-regulator.c | 118 +++
> >  1 file changed, 47 insertions(+), 71 deletions(-)
> > 
> > diff --git a/drivers/regulator/da9062-regulator.c 
> > b/drivers/regulator/da9062-
> > regulator.c
> > index 2ffc64622451..9b2ca472f70c 100644
> > --- a/drivers/regulator/da9062-regulator.c
> > +++ b/drivers/regulator/da9062-regulator.c
> > @@ -136,7 +136,6 @@ static int da9062_buck_set_mode(struct regulator_dev
> > *rdev, unsigned mode)
> >  static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
> >  {
> > struct da9062_regulator *regl = rdev_get_drvdata(rdev);
> > -   struct regmap_field *field;
> > unsigned int val, mode = 0;
> > int ret;
> > 
> > @@ -158,18 +157,7 @@ static unsigned da9062_buck_get_mode(struct
> > regulator_dev *rdev)
> > return REGULATOR_MODE_NORMAL;
> > }
> > 
> > -   /* Detect current regulator state */
> > -   ret = regmap_field_read(regl->suspend, &val);
> > -   if (ret < 0)
> > -   return 0;
> > -
> > -   /* Read regulator mode from proper register, depending on state */
> > -   if (val)
> > -   field = regl->suspend_sleep;
> > -   else
> > -   field = regl->sleep;
> > -
> > -   ret = regmap_field_read(field, &val);
> > +   ret = regmap_field_read(regl->sleep, &val);
> > if (ret < 0)
> > return 0;
> > 
> > @@ -208,21 +196,9 @@ static int da9062_ldo_set_mode(struct regulator_dev
> > *rdev, unsigned mode)
> >  static unsigned da9062_ldo_get_mode(struct regulator_dev *rdev)
> >  {
> > struct da9062_regulator *regl = rdev_get_drvdata(rdev);
> > -   struct regmap_field *field;
> > int ret, val;
> > 
> > -   /* Detect current regulator state */
> > -   ret = regmap_field_read(regl->suspend, &val);
> > -   if (ret < 0)
> > -   return 0;
> > -
> > -   /* Read regulator mode from proper register, depending on state */
> > -   if (val)
> > -   field = regl->suspend_sleep;
> > -   else
> > -   field = regl->sleep;
> > -
> > -   ret = regmap_field_read(field, &val);
> > +   ret = regmap_field_read(regl->sleep, &val);
> > if (ret < 0)
> > return 0;
> > 
> > @@ -408,10 +384,10 @@ static const struct da9062_regulator_info
> > local_da9061_regulator_info[] = {
> > __builtin_ffs((int)DA9062AA_BUCK1_MODE_MASK) - 1,
> > sizeof(unsigned int) * 8 -
> > __builtin_clz((DA9062AA_BUCK1_MODE_MASK)) - 1),
> > -   .suspend = REG_FIELD(DA9062AA_DVC_1,
> > -   __builtin_ffs((int)DA9062AA_VBUCK1_SEL_MASK) - 1,
> > +   .suspend = REG_FIELD(DA9062AA_BUCK1_CONT,
> > +   __builtin_ffs((int)DA9062AA_BUCK1_CONF_MASK) - 1,
> > sizeof(unsigned int) * 8 -
> > -   __builtin_clz((DA9062AA_VBUCK1_SEL_MASK)) - 1),
> > +   __builtin_clz(DA9062AA_BUCK1_CONF_MASK) - 1),
> > },
> > {
> > .desc.id = DA9061_ID_BUCK2,
> > @@ -444,10 +420,10 @@ static const struct da9062_regulator_info
> > local_da9061_regulator_info[] = {
> > __builtin_ffs((int)DA9062AA_BUCK3_MODE_MASK) - 1,
> > sizeof(unsigned int) * 8 -
> > __builtin_clz((DA9062AA_BUCK3_MODE_MASK)) - 1),
> > -   .suspend = REG_FIELD(DA9062AA_DVC_1,
> > -   __builtin_ffs((int)DA9062AA_VBUCK3_SEL_MASK) - 1,
> > +   .suspend = REG_FIELD(DA9062AA_BUCK3_CONT,
> > +   __builtin_ffs((int)DA9062AA_BUCK3_CONF_MASK) - 1,
> >  

RE: [PATCH 1/5] regulator: da9062: fix suspend_enable/disable preparation

2019-09-18 Thread Adam Thomson
On 17 September 2019 13:43, Marco Felsch wrote:

> Currently the suspend reg_field maps to the pmic voltage selection bits
> and is used during suspend_enabe/disable() and during get_mode(). This
> seems to be wrong for both use cases.

Hi Marco,

I'd be very surprised if what was in place was wrong as I know Stephen tested
this driver thoroughly over its lifetime. Regardless, I'll need some time to 
review
your proposed updates to make sure this aligns with our expectation of 
operation.

> 
> Use case one (suspend_enabe/disable):
> Those callbacks are used to mark a regulator device as enabled/disabled
> during suspend. Marking the regulator enabled during suspend is done by
> the LDOx_CONF/BUCKx_CONF bit within the LDOx_CONT/BUCKx_CONT
> registers.
> Setting this bit tells the DA9062 PMIC state machine to keep the
> regulator on in POWERDOWN mode and switch to suspend voltage.
> 
> Use case two (get_mode):
> The get_mode callback is used to retrieve the active mode state. Since
> the regulator-setting-A is used for the active state and
> regulator-setting-B for the suspend state there is no need to check
> which regulator setting is active.
> 
> Fixes: 4068e5182ada ("regulator: da9062: DA9062 regulator driver")
> Signed-off-by: Marco Felsch 
> ---
>  drivers/regulator/da9062-regulator.c | 118 +++
>  1 file changed, 47 insertions(+), 71 deletions(-)
> 
> diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-
> regulator.c
> index 2ffc64622451..9b2ca472f70c 100644
> --- a/drivers/regulator/da9062-regulator.c
> +++ b/drivers/regulator/da9062-regulator.c
> @@ -136,7 +136,6 @@ static int da9062_buck_set_mode(struct regulator_dev
> *rdev, unsigned mode)
>  static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
>  {
>   struct da9062_regulator *regl = rdev_get_drvdata(rdev);
> - struct regmap_field *field;
>   unsigned int val, mode = 0;
>   int ret;
> 
> @@ -158,18 +157,7 @@ static unsigned da9062_buck_get_mode(struct
> regulator_dev *rdev)
>   return REGULATOR_MODE_NORMAL;
>   }
> 
> - /* Detect current regulator state */
> - ret = regmap_field_read(regl->suspend, &val);
> - if (ret < 0)
> - return 0;
> -
> - /* Read regulator mode from proper register, depending on state */
> - if (val)
> - field = regl->suspend_sleep;
> - else
> - field = regl->sleep;
> -
> - ret = regmap_field_read(field, &val);
> + ret = regmap_field_read(regl->sleep, &val);
>   if (ret < 0)
>   return 0;
> 
> @@ -208,21 +196,9 @@ static int da9062_ldo_set_mode(struct regulator_dev
> *rdev, unsigned mode)
>  static unsigned da9062_ldo_get_mode(struct regulator_dev *rdev)
>  {
>   struct da9062_regulator *regl = rdev_get_drvdata(rdev);
> - struct regmap_field *field;
>   int ret, val;
> 
> - /* Detect current regulator state */
> - ret = regmap_field_read(regl->suspend, &val);
> - if (ret < 0)
> - return 0;
> -
> - /* Read regulator mode from proper register, depending on state */
> - if (val)
> - field = regl->suspend_sleep;
> - else
> - field = regl->sleep;
> -
> - ret = regmap_field_read(field, &val);
> + ret = regmap_field_read(regl->sleep, &val);
>   if (ret < 0)
>   return 0;
> 
> @@ -408,10 +384,10 @@ static const struct da9062_regulator_info
> local_da9061_regulator_info[] = {
>   __builtin_ffs((int)DA9062AA_BUCK1_MODE_MASK) - 1,
>   sizeof(unsigned int) * 8 -
>   __builtin_clz((DA9062AA_BUCK1_MODE_MASK)) - 1),
> - .suspend = REG_FIELD(DA9062AA_DVC_1,
> - __builtin_ffs((int)DA9062AA_VBUCK1_SEL_MASK) - 1,
> + .suspend = REG_FIELD(DA9062AA_BUCK1_CONT,
> + __builtin_ffs((int)DA9062AA_BUCK1_CONF_MASK) - 1,
>   sizeof(unsigned int) * 8 -
> - __builtin_clz((DA9062AA_VBUCK1_SEL_MASK)) - 1),
> + __builtin_clz(DA9062AA_BUCK1_CONF_MASK) - 1),
>   },
>   {
>   .desc.id = DA9061_ID_BUCK2,
> @@ -444,10 +420,10 @@ static const struct da9062_regulator_info
> local_da9061_regulator_info[] = {
>   __builtin_ffs((int)DA9062AA_BUCK3_MODE_MASK) - 1,
>   sizeof(unsigned int) * 8 -
>   __builtin_clz((DA9062AA_BUCK3_MODE_MASK)) - 1),
> - .suspend = REG_FIELD(DA9062AA_DVC_1,
> - __builtin_ffs((int)DA9062AA_VBUCK3_SEL_MASK) - 1,
> + .suspend = REG_FIELD(DA9062AA_BUCK3_CONT,
> + __builtin_ffs((int)DA9062AA_BUCK3_CONF_MASK) - 1,
>   sizeof(unsigned int) * 8 -
> - __builtin_clz((DA9062AA_VBUCK3_SEL_MASK)) - 1),
> + __builtin_clz(DA9062AA_BUCK3_CONF_MASK) - 1),
>   },
>   {
>   .desc.id = DA9061