All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Axel Lin <axel.lin@ingics.com>
Cc: Sangbeom Kim <sbkim73@samsung.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Sachin Kamat <sachin.kamat@linaro.org>
Subject: Re: [PATCH 2/2] regulator: s2mpa01: Fix accidental enable of buck4 ramp delay
Date: Tue, 06 May 2014 08:25:29 +0200	[thread overview]
Message-ID: <1399357529.5441.4.camel@AMDC1943> (raw)
In-Reply-To: <CAFRkauDO4auf7E4LK4Ms0humK=aRr3496=vEd3FK5jxa3Am-+A@mail.gmail.com>

On pon, 2014-05-05 at 23:27 +0800, Axel Lin wrote:
> 2014-05-05 23:10 GMT+08:00 Krzysztof Kozlowski <k.kozlowski@samsung.com>:
> > S2MPA01 supports enabling/disabling ramp delay only for buck[1234].
> > Other bucks have ramp delay enabled always.
> >
> > However the bit shift for enabling buck4 ramp delay in register is equal
> > to 0. When ramp delay was set for these other bucks (buck[56789] and
> > buck10), the ramp delay for buck4 was also enabled.
> >
> > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > Fixes: f7b1a8dc1c1c ("regulator: s2mpa01: Don't check enable_shift before setting enable ramp rate")
> > ---
> >  drivers/regulator/s2mpa01.c | 15 +++++++++------
> >  1 file changed, 9 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/regulator/s2mpa01.c b/drivers/regulator/s2mpa01.c
> > index f19a30f0fb42..901504880ab6 100644
> > --- a/drivers/regulator/s2mpa01.c
> > +++ b/drivers/regulator/s2mpa01.c
> > @@ -99,7 +99,8 @@ static int s2mpa01_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
> >  {
> >         struct s2mpa01_info *s2mpa01 = rdev_get_drvdata(rdev);
> >         unsigned int ramp_val, ramp_shift, ramp_reg = S2MPA01_REG_RAMP2;
> > -       unsigned int ramp_enable = 1, enable_shift = 0;
> > +       unsigned int ramp_enable = 1;
> > +       int enable_shift = -1;
> Hi Krzysztof,
> This makes the meaning of enable_shift looks confusing.
> I think below change has better readability.
> 
> diff --git a/drivers/regulator/s2mpa01.c b/drivers/regulator/s2mpa01.c
> index f19a30f..eb5ce18 100644
> --- a/drivers/regulator/s2mpa01.c
> +++ b/drivers/regulator/s2mpa01.c
> @@ -192,11 +192,15 @@ static int s2mpa01_set_ramp_delay(struct
> regulator_dev *rdev, int ramp_delay)
>   if (!ramp_enable)
>   goto ramp_disable;
> 
> - ret = regmap_update_bits(rdev->regmap, S2MPA01_REG_RAMP1,
> - 1 << enable_shift, 1 << enable_shift);
> - if (ret) {
> - dev_err(&rdev->dev, "failed to enable ramp rate\n");
> - return ret;
> + /* S2MPA01 supports enabling/disabling ramp delay only for buck[1234] */
> + if (rdev->desc->id >= S2MPA01_BUCK1 &&
> +    rdev->desc->id <= S2MPA01_BUCK4) {
> + ret = regmap_update_bits(rdev->regmap, S2MPA01_REG_RAMP1,
> + 1 << enable_shift, 1 << enable_shift);
> + if (ret) {
> + dev_err(&rdev->dev, "failed to enable ramp rate\n");
> + return ret;
> + }
>   }
> 
>   ramp_val = get_ramp_delay(ramp_delay);

Yes, it looks better for S2MPA01. Thanks for idea, I'll send v2. 

Best regards,
Krzysztof


  reply	other threads:[~2014-05-06  6:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-05 15:10 [PATCH 1/2] regulator: s2mps11: Fix accidental enable of buck6 ramp delay Krzysztof Kozlowski
2014-05-05 15:10 ` [PATCH 2/2] regulator: s2mpa01: Fix accidental enable of buck4 " Krzysztof Kozlowski
2014-05-05 15:27   ` Axel Lin
2014-05-06  6:25     ` Krzysztof Kozlowski [this message]
2014-05-17 13:27   ` Mark Brown
2014-05-17 13:26 ` [PATCH 1/2] regulator: s2mps11: Fix accidental enable of buck6 " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399357529.5441.4.camel@AMDC1943 \
    --to=k.kozlowski@samsung.com \
    --cc=axel.lin@ingics.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sachin.kamat@linaro.org \
    --cc=sbkim73@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.