From mboxrd@z Thu Jan 1 00:00:00 1970 From: Przemyslaw Marczak Date: Mon, 03 Aug 2015 17:00:50 +0200 Subject: [U-Boot] [PATCH 2/5] power: regulator use node name when no regulator-name In-Reply-To: <20150803002334.GA1452@shlinux2> References: <1438094935-18213-1-git-send-email-Peng.Fan@freescale.com> <1438094935-18213-3-git-send-email-Peng.Fan@freescale.com> <20150803002334.GA1452@shlinux2> Message-ID: <55BF8222.2000904@samsung.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 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 >>> Cc: Przemyslaw Marczak >>> Cc: Simon Glass >>> --- >>> 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