[U-Boot] [PATCH 2/5] power: regulator use node name when no regulator-name

Przemyslaw Marczak p.marczak at samsung.com
Mon Aug 3 17:00:50 CEST 2015


Hello,

On 08/03/2015 02:23 AM, Peng Fan wrote:
> Hi Simon,
>
> On Sun, Aug 02, 2015 at 04:31:06PM -0600, Simon Glass wrote:
>> Hi Peng,
>>
>> On 28 July 2015 at 08:48, Peng Fan <Peng.Fan at freescale.com> wrote:
>>> If there is no property named 'regulator-name' for regulators,
>>> choose node name instead, but not directly return failure value.
>>>
>>> Signed-off-by: Peng Fan <Peng.Fan at freescale.com>
>>> Cc: Przemyslaw Marczak <p.marczak at samsung.com>
>>> Cc: Simon Glass <sjg at chromium.org>
>>> ---
>>>   drivers/power/regulator/regulator-uclass.c | 4 +++-
>>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c
>>> index 12e141b..d4f06d5 100644
>>> --- a/drivers/power/regulator/regulator-uclass.c
>>> +++ b/drivers/power/regulator/regulator-uclass.c
>>> @@ -256,7 +256,9 @@ static int regulator_post_bind(struct udevice *dev)
>>>          if (!uc_pdata->name) {
>>>                  debug("%s: dev: %s has no property 'regulator-name'\n",
>>>                        __func__, dev->name);
>>> -               return -EINVAL;
>>> +               uc_pdata->name = fdt_get_name(blob, offset, NULL);
>>> +               if (!uc_pdata->name)
>>> +                       return -EINVAL;
>>>          }
>>>
>>>          if (regulator_name_is_unique(dev, uc_pdata->name))
>>> --
>>> 1.8.4
>>>
>>>
>>
>> What is this for please? Can you point me to the device tree binding
>> that needs this? I suspect it is fine, but I would like to understand
>> the purpose.
>
> The regulator device tree is as following:
>
>         regulators {
> 	   	sw1a_reg: sw1a {
> 	   		regulator-min-microvolt = <700000>;
> 	   		regulator-max-microvolt = <1475000>;
> 	   		regulator-boot-on;
> 	   		regulator-always-on;
> 	   		regulator-ramp-delay = <6250>;
> 	   	};
> 	   		
> 	   		/* use sw1c_reg to align with pfuze100/pfuze200 */
> 	   	sw1c_reg: sw1b {
> 	   		regulator-min-microvolt = <700000>;
> 	   		regulator-max-microvolt = <1475000>;
> 	   		regulator-boot-on;
> 	   		regulator-always-on;
> 	   		regulator-ramp-delay = <6250>;
> 	   	};
>
> There is no regulator-name property. From the current regulator framework,
> if there is no regulator-name property, it will return -EINVAL. So,
> I did this patch to use node name, if there is no regulator-name property.
>
> Regards,
> Peng.
>

There are few boards in the kernel without the "regulator-name" 
properties in device tree files, so this is right solution.

Please also update the comments in those files:
- include/power/regulator.h
- doc/device-tree-bindings/regulator/regulator.txt

Best regards,
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com


More information about the U-Boot mailing list