linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Collins <collinsd@codeaurora.org>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Liam Girdwood <lrg@slimlogic.co.uk>
Cc: linux-arm-msm@vger.kernel.org, Anirudh Ghayal <aghayal@codeaurora.org>
Subject: regulator_set_voltage and regulator_set_optimum_mode usage question
Date: Fri, 13 May 2011 09:27:03 -0700	[thread overview]
Message-ID: <4DCD5BD7.60803@codeaurora.org> (raw)

Hi Mark and Liam,

I was wondering what the best way is to handle a situation in which a
consumer driver wishes to be as generic as possible by calling a sequence
like this for any regulator that is uses:

vreg = regulator_get(dev, "foo_vdd");
regulator_set_voltage(vreg, 1000000, 2000000);
regulator_set_optimum_mode(vreg, 50000);
regulator_enable(vreg);

The problem that arises is that the "regulator" it is supplied by may in
fact be a voltage switch.  The driver for this switch is set up so that
only enable, disable, and is_enabled callbacks are specified.  This has
the effect of making all regulator_set_voltage and
regulator_set_optimum_mode calls return an error.

Is there a mechanism in the regulator framework that will allow a consumer
to determine if these APIs are available for a given regulator?

I considered changing the switch drivers to provide dummy voltage and mode
callbacks.  The voltage range would then be any positive integer
(including 0).  However, this results in a problem if one consumer calls
only regulator_enable and then a second consumer calls
regulator_set_voltage with some range, perhaps [1000000, 2000000],
followed by regulator_enable.  regulator_check_consumers will fail inside
of regulator_set_voltage for the second consumer because the implicit [0,
0] request of the first consumer does not overlap [1000000, 2000000].

What are your thoughts on this situation?

Thanks,
David Collins

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

             reply	other threads:[~2011-05-13 16:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-13 16:27 David Collins [this message]
2011-05-14 21:52 ` regulator_set_voltage and regulator_set_optimum_mode usage question 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=4DCD5BD7.60803@codeaurora.org \
    --to=collinsd@codeaurora.org \
    --cc=aghayal@codeaurora.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    /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).