mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-kernel@vger.kernel.org, Liam Girdwood <lgirdwood@gmail.com>,
	Shawn Guo <shawn.guo@linaro.org>,
	Anson Huang <b20788@freescale.com>,
	kernel@pengutronix.de
Subject: Re: [PATCH 1/2] regulator: anatop: Add power gating support to digital LDOs
Date: Mon, 10 Feb 2014 13:15:57 +0000	[thread overview]
Message-ID: <20140210131557.GB1757@sirena.org.uk> (raw)
In-Reply-To: <1391697813-20091-1-git-send-email-p.zabel@pengutronix.de>

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

On Thu, Feb 06, 2014 at 03:43:32PM +0100, Philipp Zabel wrote:
> The ARM, PU, and SOC LDOs in the i.MX6 PMU can completely gate
> their power output. Since power gating is configured by writing
> zero to the voltage target bitfield,, store a copy of the
> voltage selector to be restored when reenabling the regulator.

This is mostly good but...

>  static int anatop_regmap_set_voltage_sel(struct regulator_dev *reg,
>  					unsigned selector)
>  {
>  	struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
> +	int ret;
>  
>  	if (!anatop_reg->control_reg)
>  		return -ENOTSUPP;
>  
> -	return regulator_set_voltage_sel_regmap(reg, selector);
> +	ret = regulator_set_voltage_sel_regmap(reg, selector);
> +	if (!ret)
> +		anatop_reg->sel = selector;
> +	return ret;
>  }

...I don't understand this.  If the regulator is disabled won't this
cause it to be reenabled since we just write the stored selector in to
do that?  What I'd expect to see happening is the data being written to
the cache always and only written to the hardware if it's enabled.

> +static int anatop_regmap_disable(struct regulator_dev *reg)
> +{
> +	struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
> +
> +	if (!anatop_is_core_reg(anatop_reg))
> +		return -ENOTSUPP;
> +
> +	return regulator_set_voltage_sel_regmap(reg, LDO_POWER_GATE);
> +}

It's starting to seem like it's worth having separate ops for the core
regulator rather than all these conditionals.

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

  parent reply	other threads:[~2014-02-10 13:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06 14:43 Philipp Zabel
2014-02-06 14:43 ` [PATCH 2/2] regulator: anatop: Add bypass " Philipp Zabel
2014-02-10  7:15 ` [PATCH 1/2] regulator: anatop: Add power gating " Shawn Guo
2014-02-10 13:15 ` Mark Brown [this message]
2014-02-10 13:27   ` Philipp Zabel
2014-02-10 13:32     ` 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=20140210131557.GB1757@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=b20788@freescale.com \
    --cc=kernel@pengutronix.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=shawn.guo@linaro.org \
    /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

all inboxes | Powered by JetHome®