All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <lrg@slimlogic.co.uk>
To: michael.hennerich@analog.com
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Jonathan Cameron <jic23@cam.ac.uk>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"device-drivers-devel@blackfin.uclinux.org"
	<device-drivers-devel@blackfin.uclinux.org>
Subject: Re: voltage and current regulator framework: specifying negative voltages
Date: Wed, 13 Apr 2011 14:43:21 +0100	[thread overview]
Message-ID: <1302702201.3600.81.camel@odin> (raw)
In-Reply-To: <4DA59580.4010707@analog.com>

On Wed, 2011-04-13 at 14:22 +0200, Michael Hennerich wrote:
> On 04/12/2011 05:21 PM, Mark Brown wrote:
> > On Tue, Apr 12, 2011 at 12:08:22PM +0100, Hennerich, Michael wrote:
> >
> > Please fix your mail client to word wrap at less than 80 columns - see
> > Documentation/email-clients.txt for suggestions.  I've reflowed your
> > text for legibility.
> >
> >   
> >> I wonder why the voltage and current regulator framework doesn't
> >> support negative voltages.  We like to use the framework to specify
> >> bipolar reference voltages used with converters.  However in various
> >> places negative voltages are treated as error codes, thus causing the
> >> regulator to exit on probe.
> >>     
> > Basically just a lack of demand - there are few negative supplies in
> > the mobile systems that were looked at, and most of those are like the
> > charge pumps found in audio CODECs and not really visible as regulators
> > that could be used with other devices.
> >   
> 
> Hi Mark,
> 
> Contrast control for LC Displays typically use negative voltages, too
> I agree that demand for this on typical mobile devices is low, however
> we like
> to use the regulator framework in the IIO subsystem where negative voltages
> are quite common.
> >   
> >> As a workaround someone could say we specify positive and negative
> >> supply by label with absolute values and add the negative sign in the
> >> consumer driver.  However that doesn't work well, since the bipolar
> >> 'negative' supply may also occasionally be positive.
> >>     
> > That'd probably work.  Or update the API to allow negative voltages to
> > be returned more easily; off the top of my head the only real issue is
> > get_voltage() and so on.  It'd not be great for usability, though.
> >   
> Updating the core to allow negative and zero voltages, is not  straight
> forward.
> There are more issues with constrain checking and I currently can't
> oversee all side

The voltage constraints are just treated as numbers so negative
constraints for bipolar regulators should be fine here. I don't
anticipate lots of rework here. 

There is also some core logic that selects the lowest voltage within a
range of valid voltages (to save power) when consumers set a voltage.
This would need changed a little to support negative voltages since the
lowest voltage will be the _highest_ negative voltage. 

> effects. I think we need to introduce a new constrains flag
> (maybe add to valid_modes_mask?), indicating a bipolar regulator.
> This flag is then used to keep the current implementation untouched for
> unipolar positive
> regulators.
> 
> Thoughts?
>  

My preference is to keep it simple and the API consistent with unipolar
regulators.

One of the problem areas will be regulator_get_voltage() since it
returns negative errors. It may be desirable to deprecate this API call
in favour of a new call that we pass in an int for the voltage (e.g.
get_voltage(reg, &voltage)).

Lets also hear what Mark's thoughts too.

Regards

Liam

  reply	other threads:[~2011-04-13 13:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-12 11:08 voltage and current regulator framework: specifying negative voltages Hennerich, Michael
2011-04-12 15:21 ` Mark Brown
2011-04-13 12:22   ` Michael Hennerich
2011-04-13 13:43     ` Liam Girdwood [this message]
2011-04-13 17:24       ` Mark Brown
2011-04-14 10:44         ` Michael Hennerich
2011-04-14 14:02           ` 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=1302702201.3600.81.camel@odin \
    --to=lrg@slimlogic.co.uk \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=device-drivers-devel@blackfin.uclinux.org \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@vger.kernel.org \
    --cc=michael.hennerich@analog.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 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.