From: Przemyslaw Marczak <p.marczak@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 3/5] regulator: fixed: honour optionality of enable gpio
Date: Thu, 15 Sep 2016 10:15:55 +0200 [thread overview]
Message-ID: <57DA58BB.10908@samsung.com> (raw)
In-Reply-To: <1473924445-14456-4-git-send-email-marcel.ziswiler@toradex.com>
Hello Marcel,
On 09/15/2016 09:27 AM, Marcel Ziswiler wrote:
> According to the binding documentation the fixed regulator enable GPIO
> is optional. However so far registration thereof failed if no enable
> GPIO was specified. Fix this by making it entirely optional whether an
> enable GPIO is used.
>
> Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
>
> ---
>
> Changes in v3:
> - Introduce new patch to honour optionality of fixed regulator enable
> GPIO.
>
> Changes in v2: None
>
> drivers/power/regulator/fixed.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c
> index 37b8400..c68da70 100644
> --- a/drivers/power/regulator/fixed.c
> +++ b/drivers/power/regulator/fixed.c
> @@ -37,11 +37,12 @@ static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
> /* Set type to fixed */
> uc_pdata->type = REGULATOR_TYPE_FIXED;
>
> - /* Get fixed regulator gpio desc */
> + /* Get fixed regulator optional enable GPIO desc */
> gpio = &dev_pdata->gpio;
> ret = gpio_request_by_name(dev, "gpio", 0, gpio, GPIOD_IS_OUT);
> if (ret)
> - debug("Fixed regulator gpio - not found! Error: %d", ret);
> + debug("Fixed reg optional enable GPIO - not found! Error: %d",
> + ret);
The "reg" is usually threated as a "register", so full word is better here.
>
> /* Get optional ramp up delay */
> dev_pdata->startup_delay_us = fdtdec_get_uint(gd->fdt_blob,
> @@ -87,8 +88,9 @@ static bool fixed_regulator_get_enable(struct udevice *dev)
> {
> struct fixed_regulator_platdata *dev_pdata = dev_get_platdata(dev);
>
> + /* Enable GPIO is optional */
> if (!dev_pdata->gpio.dev)
> - return false;
> + return true;
That is good fix :)
>
> return dm_gpio_get_value(&dev_pdata->gpio);
> }
> @@ -98,8 +100,9 @@ static int fixed_regulator_set_enable(struct udevice *dev, bool enable)
> struct fixed_regulator_platdata *dev_pdata = dev_get_platdata(dev);
> int ret;
>
> + /* Enable GPIO is optional */
> if (!dev_pdata->gpio.dev)
> - return -ENOSYS;
> + return 0;
>
> ret = dm_gpio_set_value(&dev_pdata->gpio, enable);
> if (ret) {
I don't think, that returning the 0 (success) is a good idea.
We should return some error value, because this is checked
by the regulator's command code.
User can be informed about what was happened - instead of getting
command succeed - but without any results behind the command.
Maybe the -ENOSYS is not the best here. What about -EPERM?
We could assume, that such operation is not permitted for this device.
Best regards,
--
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
next prev parent reply other threads:[~2016-09-15 8:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-15 7:27 [U-Boot] [PATCH v3 0/5] various fixes mainly for colibri_t20 Marcel Ziswiler
2016-09-15 7:27 ` [U-Boot] [PATCH v3 1/5] tegra: usb gadget: fix ci udc operation if not hostpc capable Marcel Ziswiler
2016-09-15 7:27 ` [U-Boot] [PATCH v3 2/5] simple panel: fix spelling of debug message Marcel Ziswiler
2016-09-15 7:27 ` [U-Boot] [PATCH v3 3/5] regulator: fixed: honour optionality of enable gpio Marcel Ziswiler
2016-09-15 8:15 ` Przemyslaw Marczak [this message]
2016-09-15 9:30 ` John Keeping
2016-09-15 18:58 ` Stephen Warren
2016-09-15 7:27 ` [U-Boot] [PATCH v3 4/5] colibri_t20: fix display configuration Marcel Ziswiler
2016-09-15 18:59 ` Stephen Warren
2016-09-15 7:27 ` [U-Boot] [PATCH v3 5/5] colibri_t20: fix usb operation and controller order Marcel Ziswiler
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=57DA58BB.10908@samsung.com \
--to=p.marczak@samsung.com \
--cc=u-boot@lists.denx.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox