From: Nishanth Menon <nm@ti.com>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
viresh.kumar@linaro.org, cpufreq@vger.kernel.org
Subject: Re: [RFC PATCH] regulator: core: allow consumers to request to closes step voltage
Date: Thu, 20 Jun 2013 07:45:42 -0500 [thread overview]
Message-ID: <20130620124542.GA28320@kahuna> (raw)
In-Reply-To: <20130619223828.GK1403@sirena.org.uk>
On 23:38-20130619, Mark Brown wrote:
> On Wed, Jun 19, 2013 at 02:17:54PM -0500, Nishanth Menon wrote:
>
> > Account for step size accuracy when exact voltage requests are send for
> > step based regulators.
>
> If the consumer can tolerate a different voltage why not just request
> the range that can be tolerated? Your problem here is specifying an
> exact voltage.
I think you mean using regulator_get_linear_step
>
> > The specific example I faced was using cpufreq-cpu0 driver with voltages
> > for OPPs for MPU rail and attempting the common definitions against voltages
> > that are non-exact multiples of stepsize of PMIC.
>
> > The alternative would be implement custom set_voltage (as againsta simpler
> > set_voltage_sel and using linear map/list functions) for the regulator which
> > will account for the same.
>
> > Yet another alternative might be to introduce yet another custom function similar
> > to regulator_set_voltage_tol which accounts for this. something like:
> > regulator_set_voltage_floor(regulator, voltage, tol) or something to that effect.
>
> Or as I keep telling you guys the consumer can just do that directly
> using the existing API; the whole point in specifying the voltage as a
> range is to allow the consumer to cope with arbatrary regulators by
> giving a range of voltages that it can accept.
>
> The API is deliberately very conservative in these matters since there
> is a danger of physical damage if things really go wrong in some
> applications, it makes sure that both the drivers and the system
> integration are involved.
I agree. The intent of this series was to start a conversation to see if
we can make it simpler.
Searching for the users of regulator_get_linear_step in 3.10-rc6
shows none.
For a generic driver which needs to handle platforms which
have tolerance, they'd use regulator_set_voltage_tol. But the
implementation would allow for uV - tol to uV + tol as range, which in
the case I mentioned(min voltage =uV) wont work.
If the consumer wants to be aware of linear step regulator, they'd have to do:
step_uV = regulator_get_linear_step(...);
regulator_set_voltage(uV, uV + step_uV);
Then this wont handle tolerance. So the solution seems to be (for the
consumer):
step_uV = regulator_get_linear_step(...);
..
if (tol)
regulator_set_voltage_tol(uV, tol);
else
regulator_set_voltage(uV, uV + step_uV);
(with the required error checks for regulator being a linear regulator
etc..).
At least to me, there is no sane manner to handle "tolerance" and linear step
accuracy for a defined voltage (Should tolerance be rounded off to
step_uV? what about the border cases etc.)
Would you agree?
--
Regards,
Nishanth Menon
PS: Since I just looped in cpufreq list, discussion thread:
http://marc.info/?t=137166954900005&r=1&w=2
WARNING: multiple messages have this Message-ID (diff)
From: Nishanth Menon <nm@ti.com>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
<linux-kernel@vger.kernel.org>, <linux-omap@vger.kernel.org>,
<viresh.kumar@linaro.org>, <cpufreq@vger.kernel.org>
Subject: Re: [RFC PATCH] regulator: core: allow consumers to request to closes step voltage
Date: Thu, 20 Jun 2013 07:45:42 -0500 [thread overview]
Message-ID: <20130620124542.GA28320@kahuna> (raw)
In-Reply-To: <20130619223828.GK1403@sirena.org.uk>
On 23:38-20130619, Mark Brown wrote:
> On Wed, Jun 19, 2013 at 02:17:54PM -0500, Nishanth Menon wrote:
>
> > Account for step size accuracy when exact voltage requests are send for
> > step based regulators.
>
> If the consumer can tolerate a different voltage why not just request
> the range that can be tolerated? Your problem here is specifying an
> exact voltage.
I think you mean using regulator_get_linear_step
>
> > The specific example I faced was using cpufreq-cpu0 driver with voltages
> > for OPPs for MPU rail and attempting the common definitions against voltages
> > that are non-exact multiples of stepsize of PMIC.
>
> > The alternative would be implement custom set_voltage (as againsta simpler
> > set_voltage_sel and using linear map/list functions) for the regulator which
> > will account for the same.
>
> > Yet another alternative might be to introduce yet another custom function similar
> > to regulator_set_voltage_tol which accounts for this. something like:
> > regulator_set_voltage_floor(regulator, voltage, tol) or something to that effect.
>
> Or as I keep telling you guys the consumer can just do that directly
> using the existing API; the whole point in specifying the voltage as a
> range is to allow the consumer to cope with arbatrary regulators by
> giving a range of voltages that it can accept.
>
> The API is deliberately very conservative in these matters since there
> is a danger of physical damage if things really go wrong in some
> applications, it makes sure that both the drivers and the system
> integration are involved.
I agree. The intent of this series was to start a conversation to see if
we can make it simpler.
Searching for the users of regulator_get_linear_step in 3.10-rc6
shows none.
For a generic driver which needs to handle platforms which
have tolerance, they'd use regulator_set_voltage_tol. But the
implementation would allow for uV - tol to uV + tol as range, which in
the case I mentioned(min voltage =uV) wont work.
If the consumer wants to be aware of linear step regulator, they'd have to do:
step_uV = regulator_get_linear_step(...);
regulator_set_voltage(uV, uV + step_uV);
Then this wont handle tolerance. So the solution seems to be (for the
consumer):
step_uV = regulator_get_linear_step(...);
..
if (tol)
regulator_set_voltage_tol(uV, tol);
else
regulator_set_voltage(uV, uV + step_uV);
(with the required error checks for regulator being a linear regulator
etc..).
At least to me, there is no sane manner to handle "tolerance" and linear step
accuracy for a defined voltage (Should tolerance be rounded off to
step_uV? what about the border cases etc.)
Would you agree?
--
Regards,
Nishanth Menon
PS: Since I just looped in cpufreq list, discussion thread:
http://marc.info/?t=137166954900005&r=1&w=2
next prev parent reply other threads:[~2013-06-20 12:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-19 19:17 [RFC PATCH] regulator: core: allow consumers to request to closes step voltage Nishanth Menon
2013-06-19 19:17 ` Nishanth Menon
2013-06-19 22:38 ` Mark Brown
2013-06-20 12:45 ` Nishanth Menon [this message]
2013-06-20 12:45 ` Nishanth Menon
2013-06-20 21:43 ` Nishanth Menon
2013-06-20 21:43 ` Nishanth Menon
2013-06-20 21:43 ` Nishanth Menon
2013-06-21 9:51 ` Mark Brown
2013-06-21 12:43 ` Nishanth Menon
2013-06-21 12:43 ` Nishanth Menon
2013-06-21 14:30 ` 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=20130620124542.GA28320@kahuna \
--to=nm@ti.com \
--cc=broonie@kernel.org \
--cc=cpufreq@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.