lkml.org 
[lkml]   [2022]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ARM: mvebu: switch to using gpiod API in pm-board code
On Wed, Nov 16, 2022 at 02:10:29AM +0100, Andrew Lunn wrote:
> > - ret = gpio_direction_output(pic_gpios[i], 0);
> > - if (ret < 0) {
> > - gpio_free(pic_gpios[i]);
> > + pic_gpios[i] = fwnode_gpiod_get_index(of_fwnode_handle(np),
> > + "ctrl", i, GPIOD_OUT_HIGH,
> > + name);
>
> The old code passes value=0 to gpio_direction_output(). For
> fwnode_gpiod_get_index() you pass GPIOD_OUT_HIGH. Is this correct?

Yes, gpiod API works on logical states, whereas old gpio API used signal
levels. In arch/arm/boot/dts/armada-xp-gp.dts ctrl-gpios are described
as "active low":

cpus {
pm_pic {
ctrl-gpios = <&gpio0 16 GPIO_ACTIVE_LOW>,
<&gpio0 17 GPIO_ACTIVE_LOW>,
<&gpio0 18 GPIO_ACTIVE_LOW>;
};
};

so gpiolib will translate GPIOD_OUT_HIGH to 0 when setting final state
of the pin.

There are discussions to rename GPIOD_OUT_HIGH and friends to something
like active/inactive for better clarity, but that has not happened yet.

Thanks.

--
Dmitry

\
 
 \ /
  Last update: 2022-11-16 02:41    [W:0.048 / U:0.612 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site