Message ID | 1438094935-18213-3-git-send-email-Peng.Fan@freescale.com |
---|---|
State | Superseded |
Delegated to: | Przemyslaw Marczak |
Headers | show |
Hi Peng, On 28 July 2015 at 08:48, Peng Fan <Peng.Fan@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@freescale.com> > Cc: Przemyslaw Marczak <p.marczak@samsung.com> > Cc: Simon Glass <sjg@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. Regards, Simon
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@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@freescale.com> >> Cc: Przemyslaw Marczak <p.marczak@samsung.com> >> Cc: Simon Glass <sjg@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.
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@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@freescale.com> >>> Cc: Przemyslaw Marczak <p.marczak@samsung.com> >>> Cc: Simon Glass <sjg@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,
Hello Przemyslaw, On Mon, Aug 03, 2015 at 05:00:50PM +0200, Przemyslaw Marczak wrote: >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@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@freescale.com> >>>>Cc: Przemyslaw Marczak <p.marczak@samsung.com> >>>>Cc: Simon Glass <sjg@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 Ok. I'll do this, but I prefer to make the documentation update a single patch. Regards, Peng. > >Best regards, >-- >Przemyslaw Marczak >Samsung R&D Institute Poland >Samsung Electronics >p.marczak@samsung.com
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))
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@freescale.com> Cc: Przemyslaw Marczak <p.marczak@samsung.com> Cc: Simon Glass <sjg@chromium.org> --- drivers/power/regulator/regulator-uclass.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)