All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Robert Nelson <robertcnelson@gmail.com>
Cc: Paolo Pisati <paolo.pisati@canonical.com>,
	linux-omap <linux-omap@vger.kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] regulator: core: if voltage scaling fails, restore original voltage values
Date: Wed, 12 Dec 2012 21:00:21 +0200	[thread overview]
Message-ID: <20121212190021.GA29854@arwen.pp.htv.fi> (raw)
In-Reply-To: <CAOCHtYhgQQX5560+bOHJGJ3EWqrE2JtdUfDNzk_R2Pgkw6c9+w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2231 bytes --]

Hi,

On Wed, Dec 12, 2012 at 12:13:35PM -0600, Robert Nelson wrote:
> On Wed, Dec 12, 2012 at 5:45 AM, Paolo Pisati
> <paolo.pisati@canonical.com> wrote:
> > Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
> > ---
> >  drivers/regulator/core.c |   16 ++++++++++++++--
> >  1 file changed, 14 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> > index e872c8b..c347fd0 100644
> > --- a/drivers/regulator/core.c
> > +++ b/drivers/regulator/core.c
> > @@ -2250,6 +2250,7 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
> >  {
> >         struct regulator_dev *rdev = regulator->rdev;
> >         int ret = 0;
> > +       int old_min_uV, old_max_uV;
> >
> >         mutex_lock(&rdev->mutex);
> >
> > @@ -2271,18 +2272,29 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
> >         ret = regulator_check_voltage(rdev, &min_uV, &max_uV);
> >         if (ret < 0)
> >                 goto out;
> > +
> > +       /* restore original values in case of error */
> > +       old_min_uV = regulator->min_uV;
> > +       old_max_uV = regulator->max_uV;
> >         regulator->min_uV = min_uV;
> >         regulator->max_uV = max_uV;
> >
> >         ret = regulator_check_consumers(rdev, &min_uV, &max_uV);
> >         if (ret < 0)
> > -               goto out;
> > +               goto out2;
> >
> >         ret = _regulator_do_set_voltage(rdev, min_uV, max_uV);
> > -
> > +       if (ret < 0)
> > +               goto out2;
> > +
> >  out:
> >         mutex_unlock(&rdev->mutex);
> >         return ret;
> > +out2:
> > +       regulator->min_uV = old_min_uV;
> > +       regulator->max_uV = old_max_uV;
> > +       mutex_unlock(&rdev->mutex);
> > +       return ret;
> >  }
> >  EXPORT_SYMBOL_GPL(regulator_set_voltage);
> >
> > --
> > 1.7.10.4
> 
> Nice! This fixes the 800Mhz lockup on bootup after a software reset we
> were seeing on the Beagle xM's with v3.7.x/v3.6.x...
> 
> Tested-by: Robert Nelson <robertcnelson@gmail.com>

if this fixes a boot lockup with older kernel, I believe this deserves a
Cc: stable@vger.kernel.org.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Felipe Balbi <balbi@ti.com>
To: Robert Nelson <robertcnelson@gmail.com>
Cc: Paolo Pisati <paolo.pisati@canonical.com>,
	linux-omap <linux-omap@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] regulator: core: if voltage scaling fails, restore original voltage values
Date: Wed, 12 Dec 2012 21:00:21 +0200	[thread overview]
Message-ID: <20121212190021.GA29854@arwen.pp.htv.fi> (raw)
In-Reply-To: <CAOCHtYhgQQX5560+bOHJGJ3EWqrE2JtdUfDNzk_R2Pgkw6c9+w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2231 bytes --]

Hi,

On Wed, Dec 12, 2012 at 12:13:35PM -0600, Robert Nelson wrote:
> On Wed, Dec 12, 2012 at 5:45 AM, Paolo Pisati
> <paolo.pisati@canonical.com> wrote:
> > Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
> > ---
> >  drivers/regulator/core.c |   16 ++++++++++++++--
> >  1 file changed, 14 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> > index e872c8b..c347fd0 100644
> > --- a/drivers/regulator/core.c
> > +++ b/drivers/regulator/core.c
> > @@ -2250,6 +2250,7 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
> >  {
> >         struct regulator_dev *rdev = regulator->rdev;
> >         int ret = 0;
> > +       int old_min_uV, old_max_uV;
> >
> >         mutex_lock(&rdev->mutex);
> >
> > @@ -2271,18 +2272,29 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
> >         ret = regulator_check_voltage(rdev, &min_uV, &max_uV);
> >         if (ret < 0)
> >                 goto out;
> > +
> > +       /* restore original values in case of error */
> > +       old_min_uV = regulator->min_uV;
> > +       old_max_uV = regulator->max_uV;
> >         regulator->min_uV = min_uV;
> >         regulator->max_uV = max_uV;
> >
> >         ret = regulator_check_consumers(rdev, &min_uV, &max_uV);
> >         if (ret < 0)
> > -               goto out;
> > +               goto out2;
> >
> >         ret = _regulator_do_set_voltage(rdev, min_uV, max_uV);
> > -
> > +       if (ret < 0)
> > +               goto out2;
> > +
> >  out:
> >         mutex_unlock(&rdev->mutex);
> >         return ret;
> > +out2:
> > +       regulator->min_uV = old_min_uV;
> > +       regulator->max_uV = old_max_uV;
> > +       mutex_unlock(&rdev->mutex);
> > +       return ret;
> >  }
> >  EXPORT_SYMBOL_GPL(regulator_set_voltage);
> >
> > --
> > 1.7.10.4
> 
> Nice! This fixes the 800Mhz lockup on bootup after a software reset we
> were seeing on the Beagle xM's with v3.7.x/v3.6.x...
> 
> Tested-by: Robert Nelson <robertcnelson@gmail.com>

if this fixes a boot lockup with older kernel, I believe this deserves a
Cc: stable@vger.kernel.org.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2012-12-12 19:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12 11:45 [PATCH] regulator: core: if voltage scaling fails, restore original Paolo Pisati
2012-12-12 11:45 ` [PATCH] regulator: core: if voltage scaling fails, restore original voltage values Paolo Pisati
2012-12-12 18:13   ` Robert Nelson
2012-12-12 19:00     ` Felipe Balbi [this message]
2012-12-12 19:00       ` Felipe Balbi
2012-12-13  5:06 ` [PATCH] regulator: core: if voltage scaling fails, restore original Paul Walmsley
2012-12-13  5:08   ` Paul Walmsley
2012-12-13  5:15 ` Mark Brown
2012-12-13  8:58   ` Paolo Pisati
  -- strict thread matches above, loose matches on Subject: below --
2012-12-13  9:12 [PATCH] [resend] regulator: core: if voltage scaling fails, restore original values Paolo Pisati
2012-12-13  9:13 ` [PATCH] regulator: core: if voltage scaling fails, restore original voltage values Paolo Pisati
2012-12-13  9:47   ` Felipe Balbi
2012-12-13  9:47     ` Felipe Balbi
2012-12-14 15:39     ` Paolo Pisati
2012-12-14 15:40       ` Felipe Balbi
2012-12-14 15:40         ` Felipe Balbi
2012-12-15 14:15         ` Mark Brown
2012-12-15 14:57           ` Felipe Balbi
2012-12-15 14:57             ` Felipe Balbi
2012-12-17 14:15             ` Mark Brown
2012-12-17 15:18               ` Felipe Balbi
2012-12-17 15:18                 ` Felipe Balbi
2012-12-17 15:45                 ` Mark Brown
2012-12-15 14:53   ` 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=20121212190021.GA29854@arwen.pp.htv.fi \
    --to=balbi@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=paolo.pisati@canonical.com \
    --cc=robertcnelson@gmail.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.