From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory Clement <gregory.clement@bootlin.com>,
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ARM: mvebu: switch to using gpiod API in pm-board code
Date: Tue, 15 Nov 2022 17:40:35 -0800 [thread overview]
Message-ID: <Y3Q/k0hoPcnQhS8L@google.com> (raw)
In-Reply-To: <Y3Q4hVn3GEOm4nMq@lunn.ch>
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
next prev parent reply other threads:[~2022-11-16 1:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 23:12 [PATCH] ARM: mvebu: switch to using gpiod API in pm-board code Dmitry Torokhov
2022-11-16 1:10 ` Andrew Lunn
2022-11-16 1:40 ` Dmitry Torokhov [this message]
2022-11-16 2:03 ` Andrew Lunn
2022-11-16 2:03 ` Andrew Lunn
2022-11-28 0:13 ` Gregory CLEMENT
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=Y3Q/k0hoPcnQhS8L@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=andrew@lunn.ch \
--cc=gregory.clement@bootlin.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sebastian.hesselbarth@gmail.com \
/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