From: Stephen Warren <swarren@wwwdotorg.org>
To: Alexandre Courbot <gnurou@gmail.com>,
David Cohen <david.a.cohen@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] gpio: add set_active_low() function to gpio_chip
Date: Thu, 19 Mar 2015 09:33:12 -0600 [thread overview]
Message-ID: <550AEC38.8080709@wwwdotorg.org> (raw)
In-Reply-To: <CAAVeFuKT1OPhM8LMQ5z9WejZEeYgqSzwcmCOw6V7E7Y0c=8btA@mail.gmail.com>
On 03/18/2015 08:07 PM, Alexandre Courbot wrote:
> On Thu, Mar 19, 2015 at 5:16 AM, David Cohen
> <david.a.cohen@linux.intel.com> wrote:
>> Some gpio controllers are capable of programming its pins' active-low
>> state. Let's add this new gpio_chip function for such cases and use it
>> in gpiolib.
>>
>> When set_active_low() is implemented, we no longer need to do soft flips
>> on values from non-raw get functions.
>>
>> Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
>> ---
>>
>> Hi,
>>
>> This is a RFC, not meant for integration (yet).
>>
>> We have a GPIO controller that is capable of inverting the GPIO logical value
>> on hardware using a register (and GPIO voltage level if configured for output):
>> - If GPIO pin is configured for input, only the logical value is affected: the
>> GPIO level stays the same but the read values are inverted (it affects even
>> interrupt event triggers).
>> - If GPIO pin is configured for output, the GPIO level is also inverted.
>>
>> Is it acceptable to expose this functionality via new gpio chip operation
>> set_active_low()?
>
> At first I thought "why not", but then I couldn't help but ask "why?"
>
> Handling the active low state in software is basically free and
> requires no extra support. What is the benefit of handling it in
> hardware that would counterbalance the complexity this adds to the
> GPIO framework?
>
> Also, wouldn't that require us to reverse this active-low logic in the
> *_raw functions for them to work as expected?
What happens when some generic driver starts to make use of this new API
because it's convenient? Then that API has to work everywhere, including
on chips that don't support this feature in HW. Then, we're back to
emulating it in SW on those platforms. Given how trivial it is to
emulate, shouldn't we emulate it everywhere, so that the code paths are
identical everywhere?
next prev parent reply other threads:[~2015-03-19 15:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-18 20:16 [RFC] gpio: add set_active_low() function to gpio_chip David Cohen
2015-03-19 2:07 ` Alexandre Courbot
2015-03-19 15:33 ` Stephen Warren [this message]
2015-03-27 8:45 ` Linus Walleij
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=550AEC38.8080709@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=david.a.cohen@linux.intel.com \
--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.