lkml.org 
[lkml]   [2012]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Regulator supplies when using Device Tree
On 3/28/2012 3:09 AM, Mark Brown wrote:
> On Tue, Mar 27, 2012 at 06:38:30PM -0700, Michael Bohan wrote:
>> the answer is that we should invent another binding to portray the
>> name of the supply the driver should be checking against. But then
>> it would seem silly to have two bindings that pertain to supply
>> names.
>
> Absolutely not, that would be broken. The whole point here is that
> supplies of all kinds are always requested with the name the chip uses
> for the supply.

Let's consider an example with two regulators:

regulator@0 {
compatible = "ldo_driver";
foo-supply = <&smps1>;
};
regulator@1 {
compatible = "ldo_driver";
};
How do we write a single regulator driver that supports both of these
regulator devices?

Within the regulator driver, we currently have to do an
of_get_property(of_node, "foo-supply", NULL) to determine whether the
device has a supply, and thus whether we should assign
rdesc->supply_name to "foo" or not when calling regulator_register(). Is
there a better way to do this? If we don't do this check for the case
where a device does not have a supply specified in the Device Tree, then
regulator_register() will fail.

Before Device Tree, regulators could get their supply names directly
from the board file like so:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=Documentation/power/regulator/machine.txt;h=ce63af0a8e35ecab32e2f326d13a9a2b33b62909;hb=refs/heads/master#l67

Thus the regulator driver was never concerned about the specifics of a
supply name. And if the supply name was not specified, then the
regulator_register() would happily succeed without any checks in the
driver.

Thanks,
Mike

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


\
 
 \ /
  Last update: 2012-03-28 21:21    [from the cache]
©2003-2011 Jasper Spaans