From: Guenter Roeck <linux@roeck-us.net>
To: Alexandre Courbot <gnurou@gmail.com>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH] gpio: Add support for GPIOF_ACTIVE_LOW to gpio_request_one
Date: Thu, 17 Jul 2014 07:34:11 -0700 [thread overview]
Message-ID: <53C7DEE3.6060107@roeck-us.net> (raw)
In-Reply-To: <CAAVeFuKC19AK8BjM7OBm=FWm0ua5YJXoGRkpOvM1TWkz9yOZ5Q@mail.gmail.com>
On 07/17/2014 12:26 AM, Alexandre Courbot wrote:
> On Thu, Jul 17, 2014 at 3:37 PM, Guenter Roeck <linux@roeck-us.net> wrote:
>> On 07/16/2014 11:09 PM, Alexandre Courbot wrote:
>>>
>>> On Thu, Jul 17, 2014 at 8:11 AM, Guenter Roeck <linux@roeck-us.net> wrote:
>>>>
>>>> The gpio include file and the gpio documentation declare and document
>>>> GPIOF_ACTIVE_LOW as one of the flags to be passed to gpio_request_one
>>>> and related functions. However, the flag is not evaluated or used.
>>>>
>>>> Check the flag in gpio_request_one and set the gpio internal flag
>>>> FLAG_ACTIVE_LOW if it is set.
>>>
>>>
>>> What is the point since the integer GPIO API has no clue of the
>>> active-low status of a GPIO? It is only used by the gpiod and sysfs
>>> interfaces.
>>>
>>
>> One can use gpio_request_one() to export a gpio pin to user space from
>> the kernel. That code path does use the flag, as you point out yourself
>> above.
>
> Ok, in that case I suppose it makes sense.
>
> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
>
>> One could also argue that the integer gpio API _should_ support this as
>> well,
>> but that is a different question.
>
> Probably not going to happen. The integer GPIO interface is deprecated
> and users who need new features should seriously consider switching to
> gpiod.
>
The new API is unfortunately not equivalent to the old one. For example,
if I understand correctly, gpiod_get is expected to be used instead of
gpio_request_one. That may work nicely in a world with full DT or ACPI
support, but doesn't work as well otherwise unless one drops the notion
of using platform specific drivers built as modules (gpiod_add_lookup_table
is not exported, and there is no remove function).
Specifically, I don't see an easy way to convert mdio-gpio to use the new
model, and that driver could really use support for an API which supports
active-low pins. And even if gpiod_add_lookup_table was supported,
converting a driver like this would be a major pain. Sure, it would be
all easy if there would be a gpiod equivalent to gpio_request_one and
gpio_request_array, but that is not the case. This makes converting
drivers from the old to the new model challenging enough that I suspect
that it won't really happen.
Guenter
next prev parent reply other threads:[~2014-07-17 14:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-16 23:11 [PATCH] gpio: Add support for GPIOF_ACTIVE_LOW to gpio_request_one Guenter Roeck
2014-07-17 6:09 ` Alexandre Courbot
2014-07-17 6:37 ` Guenter Roeck
2014-07-17 7:26 ` Alexandre Courbot
2014-07-17 14:34 ` Guenter Roeck [this message]
2014-07-22 4:30 ` Alexandre Courbot
2014-07-22 5:16 ` Guenter Roeck
2014-07-22 6:59 ` Alexandre Courbot
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=53C7DEE3.6060107@roeck-us.net \
--to=linux@roeck-us.net \
--cc=gnurou@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.