public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Igor Grinberg <grinberg@compulab.co.il>
To: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: linux-kernel@vger.kernel.org, Liam Girdwood <lrg@slimlogic.co.uk>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	kyungmin.park@samsung.com, myungjoo.ham@gmail.com
Subject: Re: [PATCH v2] Regulator: add suspend-finish API for regulator core.
Date: Wed, 09 Mar 2011 10:03:43 +0200	[thread overview]
Message-ID: <4D77345F.8040706@compulab.co.il> (raw)
In-Reply-To: <1299638225-29162-1-git-send-email-myungjoo.ham@samsung.com>

Hi,


just a minor comment issue...


On 03/09/11 04:37, MyungJoo Ham wrote:

> The regulator core had suspend-prepare that turns off the regulators
> when entering a system-wide suspend. However, it did not have
> suspend-finish that pairs with suspend-prepare and the regulator core
> has assumed that the regulator devices and their drivers support
> autonomous recover at resume.
>
> This patch adds regulator_suspend_finish that pairs with the
> previously-existed regulator_suspend_prepare. The function
> regulator_suspend_finish turns on the regulators that have always_on set
> or positive use_count so that we can reset the regulator states
> appropriately at resume.
>
> In regulator_suspend_finish, if has_full_constraints, it disables
> unnecessary regulators.
>
> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/regulator/core.c          |   40 +++++++++++++++++++++++++++++++++++++
>  include/linux/regulator/machine.h |    1 +
>  2 files changed, 41 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 9fa2095..4d34cc0 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -2653,6 +2653,46 @@ out:
>  EXPORT_SYMBOL_GPL(regulator_suspend_prepare);
>  
>  /**
> + * regulator_suspend_prepare - resume regulators from system wide suspend

s/prepare/finish/

> + *
> + * Turn on regulators that might be turned off by regulator_suspend_prepare.
> + */
> +int regulator_suspend_finish(void)
> +{
> +	struct regulator_dev *rdev;
> +	int ret = 0, error;
> +
> +	mutex_lock(&regulator_list_mutex);
> +	list_for_each_entry(rdev, &regulator_list, list) {
> +		struct regulator_ops *ops = rdev->desc->ops;
> +
> +		mutex_lock(&rdev->mutex);
> +		if ((rdev->use_count > 0  || rdev->constraints->always_on) &&
> +				ops->enable) {
> +			error = ops->enable(rdev);
> +			if (error)
> +				ret = error;
> +		} else {
> +			if (!has_full_constraints)
> +				goto unlock;
> +			if (!ops->disable)
> +				goto unlock;
> +			if (ops->is_enabled && !ops->is_enabled(rdev))
> +				goto unlock;
> +
> +			error = ops->disable(rdev);
> +			if (error)
> +				ret = error;
> +		}
> +unlock:
> +		mutex_unlock(&rdev->mutex);
> +	}
> +	mutex_unlock(&regulator_list_mutex);
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(regulator_suspend_finish);
> +
> +/**
>   * regulator_has_full_constraints - the system has fully specified constraints
>   *
>   * Calling this function will cause the regulator API to disable all
> diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
> index 761c745..c4c4fc4 100644
> --- a/include/linux/regulator/machine.h
> +++ b/include/linux/regulator/machine.h
> @@ -186,6 +186,7 @@ struct regulator_init_data {
>  };
>  
>  int regulator_suspend_prepare(suspend_state_t state);
> +int regulator_suspend_finish(void);
>  
>  #ifdef CONFIG_REGULATOR
>  void regulator_has_full_constraints(void);

-- 
Regards,
Igor.


      reply	other threads:[~2011-03-09  8:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-08  2:03 [PATCH] Regulator: add suspend-finish API for regulator core MyungJoo Ham
2011-03-08 13:38 ` Mark Brown
2011-03-09  2:35   ` MyungJoo Ham
2011-03-09  2:37   ` [PATCH v2] " MyungJoo Ham
2011-03-09  8:03     ` Igor Grinberg [this message]

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=4D77345F.8040706@compulab.co.il \
    --to=grinberg@compulab.co.il \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=myungjoo.ham@gmail.com \
    --cc=myungjoo.ham@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox