mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Mark Brown <broonie@kernel.org>
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 14:27:55 +0100	[thread overview]
Message-ID: <1392038875.6687.17.camel@pizza.hi.pengutronix.de> (raw)
In-Reply-To: <20140210131557.GB1757@sirena.org.uk>

Hi Mark,

Am Montag, den 10.02.2014, 13:15 +0000 schrieb Mark Brown:
> 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.

yes, thanks. I'll fix this. What should happen if the
regulator_set_voltage_sel_regmap fails? Is it ok to still
set the cache in this case?

> > +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.

Will do.

regards
Philipp


  reply	other threads:[~2014-02-10 13:28 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
2014-02-10 13:27   ` Philipp Zabel [this message]
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=1392038875.6687.17.camel@pizza.hi.pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=b20788@freescale.com \
    --cc=broonie@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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®