devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Wahren <stefan.wahren@i2se.com>
To: Mark Brown <broonie@kernel.org>
Cc: fabio.estevam@freescale.com, mark.rutland@arm.com, marex@denx.de,
	pawel.moll@arm.com, ijc+devicetree@hellion.org.uk,
	dbaryshkov@gmail.com, viresh.kumar@linaro.org,
	linux-pm@vger.kernel.org, rjw@rjwysocki.net, lgirdwood@gmail.com,
	sre@kernel.org, devicetree@vger.kernel.org, robh+dt@kernel.org,
	kernel@pengutronix.de, galak@codeaurora.org,
	sebastien.szymanski@armadeus.com, shawn.guo@linaro.org,
	dwmw2@infradead.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 4/7] regulator: add mxs regulator driver
Date: Mon, 23 Mar 2015 18:45:41 +0100 (CET)	[thread overview]
Message-ID: <1459171144.549216.1427132741792.JavaMail.open-xchange@oxbaltgw02.schlund.de> (raw)
In-Reply-To: <20150322161425.GC6643@sirena.org.uk>

Hi Mark,

>
> > + if (ldo->get_power_source)
> > + power_source = ldo->get_power_source(reg);
> > +
> > + switch (power_source) {
> > + case HW_POWER_LINREG_DCDC_OFF:
> > + case HW_POWER_LINREG_DCDC_READY:
> > + case HW_POWER_EXTERNAL_SOURCE_5V:
> > + usleep_range(1000, 2000);
> > + return 0;
> > + }
>
> I'd expect the switch to be in the if here?

yes, that's possible too.

>
> > +
> > + usleep_range(15, 20);
> > + start = jiffies;
> > + while (1) {
> > + if (readl(ldo->status_addr) & BM_POWER_STS_DC_OK)
> > + return 0;
> > +
> > + if (time_after(jiffies, start + msecs_to_jiffies(20)))
> > + break;
> > +
> > + schedule();
> > + }
>
> So, this isn't actually quite a busy wait because we do a schedule()
> rather than a cpu_relax() but still it could devolve into that - 20ms
> seems a long time to burn doing that. If we're expecting this to finish
> very quickly can we do an initial busy wait then fall back to something
> with an actual sleep or soemthing?

We will need to keep the initial usleep_range(). So do you think of the
following:

1. usleep_range
2. busy_wait for BM_POWER_STS_DC_OK
3. msleep (for the timeout case)

Stefan

  reply	other threads:[~2015-03-23 17:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-22  0:29 [PATCH 0/7] power: enable cpufreq-dt support for i.MX23/i.MX28 Stefan Wahren
2015-03-22  0:29 ` [PATCH 1/7] DT: add binding for mxs power subsystem Stefan Wahren
2015-03-22  0:29 ` [PATCH 2/7] power: mxs_power: add driver " Stefan Wahren
2015-03-22 10:40   ` Sebastian Reichel
     [not found] ` <1426984203-9133-1-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>
2015-03-22  0:29   ` [PATCH 3/7] DT: add binding for MXS regulator Stefan Wahren
2015-03-22  0:30 ` [PATCH 4/7] regulator: add mxs regulator driver Stefan Wahren
2015-03-22 16:14   ` Mark Brown
2015-03-23 17:45     ` Stefan Wahren [this message]
2015-03-23 18:39       ` Mark Brown
2015-03-22  0:30 ` [PATCH 5/7] ARM: dts: enable regulator support for i.MX23/i.MX28 Stefan Wahren
2015-03-23  6:07   ` Sascha Hauer
2015-03-23 17:54     ` Stefan Wahren
2015-03-23 18:37       ` Mark Brown
     [not found]         ` <20150323183740.GI14954-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-03-24  6:45           ` Stefan Wahren
2015-03-24 17:01             ` Mark Brown
2015-03-24  6:12       ` Sascha Hauer
2015-03-22  0:30 ` [PATCH 6/7] ARM: mxs: register cpufreq-dt in pm init Stefan Wahren
2015-03-22  0:30 ` [PATCH 7/7] ARM: dts: add OPPs for i.MX23/i.MX28 Stefan Wahren
2015-03-24 20:45   ` Juergen Borleis
     [not found]     ` <201503242145.26370.juergen-vozXLyro3r7AVMDmWPUVSw@public.gmane.org>
2015-03-25 20:20       ` Stefan Wahren

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=1459171144.549216.1427132741792.JavaMail.open-xchange@oxbaltgw02.schlund.de \
    --to=stefan.wahren@i2se.com \
    --cc=broonie@kernel.org \
    --cc=dbaryshkov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=fabio.estevam@freescale.com \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=kernel@pengutronix.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=rjw@rjwysocki.net \
    --cc=robh+dt@kernel.org \
    --cc=sebastien.szymanski@armadeus.com \
    --cc=shawn.guo@linaro.org \
    --cc=sre@kernel.org \
    --cc=viresh.kumar@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;
as well as URLs for NNTP newsgroup(s).