From: Mark Brown <broonie@kernel.org>
To: Chris Zhong <zyw@rock-chips.com>
Cc: heiko@sntech.de, dianders@chromium.org,
linux-rockchip@lists.infradead.org,
Liam Girdwood <lgirdwood@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] regulator: rk808: add dvs support
Date: Mon, 29 Dec 2014 17:25:55 +0000 [thread overview]
Message-ID: <20141229172555.GE17800@sirena.org.uk> (raw)
In-Reply-To: <1418612879-16094-3-git-send-email-zyw@rock-chips.com>
[-- Attachment #1: Type: text/plain, Size: 1893 bytes --]
On Mon, Dec 15, 2014 at 11:07:58AM +0800, Chris Zhong wrote:
> + sel <<= ffs(rdev->desc->vsel_mask) - 1;
> + sel |= old_sel & ~rdev->desc->vsel_mask;
> +
> + ret = regmap_write(rdev->regmap, reg, sel);
> + if (ret)
> + return ret;
> +
> + gpiod_set_value(gpio, !gpio_level);
So, this seems a bit odd. What we appear to be doing here is
alternating between the two different voltage setting registers which is
all well and good but makes me wonder why we're bothering - it's a bit
more work than just sticking with one. We do get...
> + /*
> + * dvsok pin would be pull down when dvs1/2 pin changed, and
> + * it would be pull up once the voltage regulate complete.
> + * No need to wait dvsok signal when voltage falling.
> + */
...this but unless the voltage typically ramps much faster than spec
it's never clear to me that we're actually winning by polling the pin
instead of just dead reckoning the time, it's more work for the CPU to
poll the GPIO than to sleep after all.
One thing we can do with hardware like this is to program in a voltage
we're likely to want to switch to quickly and then use the GPIO to get
there. That can be a bit hard to arrange with the regulator API as it
currently stands since we don't exactly have an interface for it.
We can just check to see what the two values are current set to before
switching and skip the register write if it's the same (making things
faster since we're typically avoiding an I2C or SPI transaction by doing
that) but that's a bit meh. We can also try to do things like keep the
top voltage from the voltage ranges we're being given programmed which
for DVS typically ends up doing a reasonable job since governors often
like to jump straight to top speed when things get busy so that's one of
the common cases where we most want to change voltages as quickly as
possible.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2014-12-29 17:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-15 3:07 [PATCH v3 0/2] add the dvs support for rk808 Chris Zhong
2014-12-15 3:07 ` [PATCH v3 1/2] mfd: dt-bindings: add the description about dvs gpio " Chris Zhong
2014-12-15 3:07 ` [PATCH v3 2/2] regulator: rk808: add dvs support Chris Zhong
2014-12-29 17:25 ` Mark Brown [this message]
2014-12-30 3:07 ` Chris Zhong
2014-12-30 17:04 ` Mark Brown
2014-12-31 2:21 ` Chris Zhong
2015-01-02 18:41 ` Doug Anderson
2015-01-06 12:12 ` 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=20141229172555.GE17800@sirena.org.uk \
--to=broonie@kernel.org \
--cc=dianders@chromium.org \
--cc=heiko@sntech.de \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=zyw@rock-chips.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
all inboxes | Powered by JetHome®