public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] power: regulator: fixed: set gpio direction before set value
@ 2016-03-12  5:19 Peng Fan
  2016-03-13  2:51 ` Simon Glass
  0 siblings, 1 reply; 3+ messages in thread
From: Peng Fan @ 2016-03-12  5:19 UTC (permalink / raw)
  To: u-boot

Before set value for a gpio, need to set its direction to
output first.

Signed-off-by: Peng Fan <van.freenix@gmail.com>
Cc: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Simon Glass <sjg@chromium.org>
---
 drivers/power/regulator/fixed.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c
index d053817..1b0d193 100644
--- a/drivers/power/regulator/fixed.c
+++ b/drivers/power/regulator/fixed.c
@@ -95,6 +95,11 @@ static int fixed_regulator_set_enable(struct udevice *dev, bool enable)
 	if (!dev_pdata->gpio.dev)
 		return -ENOSYS;
 
+	ret = dm_gpio_set_dir_flags(&dev_pdata->gpio, GPIOD_IS_OUT);
+	if (ret) {
+		error("Can't set out direction : %s gpio\n", dev->name);
+		return ret;
+	}
 	ret = dm_gpio_set_value(&dev_pdata->gpio, enable);
 	if (ret) {
 		error("Can't set regulator : %s gpio to: %d\n", dev->name,
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] power: regulator: fixed: set gpio direction before set value
  2016-03-12  5:19 [U-Boot] [PATCH] power: regulator: fixed: set gpio direction before set value Peng Fan
@ 2016-03-13  2:51 ` Simon Glass
  2016-03-13  9:19   ` Peng Fan
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Glass @ 2016-03-13  2:51 UTC (permalink / raw)
  To: u-boot

Hi Peng,

On 11 March 2016 at 22:19, Peng Fan <van.freenix@gmail.com> wrote:
> Before set value for a gpio, need to set its direction to
> output first.
>
> Signed-off-by: Peng Fan <van.freenix@gmail.com>
> Cc: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  drivers/power/regulator/fixed.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c
> index d053817..1b0d193 100644
> --- a/drivers/power/regulator/fixed.c
> +++ b/drivers/power/regulator/fixed.c
> @@ -95,6 +95,11 @@ static int fixed_regulator_set_enable(struct udevice *dev, bool enable)
>         if (!dev_pdata->gpio.dev)
>                 return -ENOSYS;
>
> +       ret = dm_gpio_set_dir_flags(&dev_pdata->gpio, GPIOD_IS_OUT);
> +       if (ret) {
> +               error("Can't set out direction : %s gpio\n", dev->name);
> +               return ret;
> +       }
>         ret = dm_gpio_set_value(&dev_pdata->gpio, enable);
>         if (ret) {
>                 error("Can't set regulator : %s gpio to: %d\n", dev->name,
> --
> 2.6.2
>

This should already be done by the GPIOD_IS_OUT flag in
fixed_regulator_ofdata_to_platdata().

BTW I notice that mxc_gpio.c does not have an xlate() method, so
GPIO_ACTIVE_LOW will not be supported.

Regards,
Simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] power: regulator: fixed: set gpio direction before set value
  2016-03-13  2:51 ` Simon Glass
@ 2016-03-13  9:19   ` Peng Fan
  0 siblings, 0 replies; 3+ messages in thread
From: Peng Fan @ 2016-03-13  9:19 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Sat, Mar 12, 2016 at 07:51:51PM -0700, Simon Glass wrote:
>Hi Peng,
>
>On 11 March 2016 at 22:19, Peng Fan <van.freenix@gmail.com> wrote:
>> Before set value for a gpio, need to set its direction to
>> output first.
>>
>> Signed-off-by: Peng Fan <van.freenix@gmail.com>
>> Cc: Przemyslaw Marczak <p.marczak@samsung.com>
>> Cc: Simon Glass <sjg@chromium.org>
>> ---
>>  drivers/power/regulator/fixed.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c
>> index d053817..1b0d193 100644
>> --- a/drivers/power/regulator/fixed.c
>> +++ b/drivers/power/regulator/fixed.c
>> @@ -95,6 +95,11 @@ static int fixed_regulator_set_enable(struct udevice *dev, bool enable)
>>         if (!dev_pdata->gpio.dev)
>>                 return -ENOSYS;
>>
>> +       ret = dm_gpio_set_dir_flags(&dev_pdata->gpio, GPIOD_IS_OUT);
>> +       if (ret) {
>> +               error("Can't set out direction : %s gpio\n", dev->name);
>> +               return ret;
>> +       }
>>         ret = dm_gpio_set_value(&dev_pdata->gpio, enable);
>>         if (ret) {
>>                 error("Can't set regulator : %s gpio to: %d\n", dev->name,
>> --
>> 2.6.2
>>
>
>This should already be done by the GPIOD_IS_OUT flag in
>fixed_regulator_ofdata_to_platdata().

Oh. Thanks for correcting me.

>
>BTW I notice that mxc_gpio.c does not have an xlate() method, so
>GPIO_ACTIVE_LOW will not be supported.

Yeah. I got it and already have patch for it. After do some test,
will send it out for the xlate in mxc_gpio.c

Regards,
Peng.

>
>Regards,
>Simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-13  9:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-12  5:19 [U-Boot] [PATCH] power: regulator: fixed: set gpio direction before set value Peng Fan
2016-03-13  2:51 ` Simon Glass
2016-03-13  9:19   ` Peng Fan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox