All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Kent Gibson <warthog618@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: [libgpiod][PATCH 4/6] treewide: make drive settings an enum
Date: Mon, 11 Jan 2021 15:48:38 +0100	[thread overview]
Message-ID: <CAMRc=Mcr-8Cts29bTREvZa-BAjKTDdxXLGQqA4ZLam0APV13Kg@mail.gmail.com> (raw)
In-Reply-To: <20210111143951.GB1036910@sol>

On Mon, Jan 11, 2021 at 3:39 PM Kent Gibson <warthog618@gmail.com> wrote:
>
> On Mon, Jan 11, 2021 at 02:34:24PM +0100, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > Open-source and open-drain drive settings are mutually exclusive just like
> > the bias settings. Make them into an enum so that becomes clear.
> >
> > Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > ---
> >  bindings/cxx/gpiod.hpp                 | 24 +++++----
> >  bindings/cxx/line.cpp                  | 18 +++----
> >  bindings/cxx/tests/tests-line.cpp      | 45 ++++++----------
> >  bindings/python/gpiodmodule.c          | 73 ++++++++++++++------------
> >  bindings/python/tests/gpiod_py_test.py | 18 +++----
> >  include/gpiod.h                        | 26 +++++----
> >  lib/core.c                             | 12 ++---
> >  tests/tests-line.c                     | 36 ++++++-------
> >  tools/gpioinfo.c                       | 14 ++++-
> >  9 files changed, 134 insertions(+), 132 deletions(-)
> >
> > diff --git a/bindings/cxx/gpiod.hpp b/bindings/cxx/gpiod.hpp
> > index fb675fc..f9c341d 100644
> > --- a/bindings/cxx/gpiod.hpp
> > +++ b/bindings/cxx/gpiod.hpp
> > @@ -332,16 +332,10 @@ public:
> >       GPIOD_API bool is_used(void) const;
> >
> >       /**
> > -      * @brief Check if this line represents an open-drain GPIO.
> > -      * @return True if the line is an open-drain GPIO, false otherwise.
> > +      * @brief Get current drive setting of this line.
> > +      * @return Current drive setting.
> >        */
> > -     GPIOD_API bool is_open_drain(void) const;
> > -
> > -     /**
> > -      * @brief Check if this line represents an open-source GPIO.
> > -      * @return True if the line is an open-source GPIO, false otherwise.
> > -      */
> > -     GPIOD_API bool is_open_source(void) const;
> > +     GPIOD_API int drive(void) const;
> >
> >       /**
> >        * @brief Request this line.
> > @@ -482,6 +476,18 @@ public:
> >               /**< Line's direction setting is output. */
> >       };
> >
> > +     /**
> > +      * @brief Possible drive settings.
> > +      */
> > +     enum : int {
> > +             DRIVE_NONE = 1,
> > +             /**< Drive setting is unknown. */
>
> Unlike bias, the drive setting is never unknown - if zero the pin is
> assumed push-pull.
>
> And to me DRIVE_NONE implies a high impedance state.
>

Indeed, I'll change it to DRIVE_PUSH_PULL then.

Bart

  reply	other threads:[~2021-01-11 14:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-11 13:34 [libgpiod][PATCH 0/6] treewide: remove more cruft and Bartosz Golaszewski
2021-01-11 13:34 ` [libgpiod][PATCH 1/6] treewide: remove helpers for opening chips by name & number Bartosz Golaszewski
2021-01-11 13:34 ` [libgpiod][PATCH 2/6] treewide: simplify the active-low line property Bartosz Golaszewski
2021-01-11 13:34 ` [libgpiod][PATCH 3/6] treewide: rename BIAS_AS_IS to BIAS_NONE Bartosz Golaszewski
2021-01-11 14:31   ` Kent Gibson
2021-01-11 13:34 ` [libgpiod][PATCH 4/6] treewide: make drive settings an enum Bartosz Golaszewski
2021-01-11 14:39   ` Kent Gibson
2021-01-11 14:48     ` Bartosz Golaszewski [this message]
2021-01-11 13:34 ` [libgpiod][PATCH 5/6] bindings: cxx: line: reorder bias mapping entries Bartosz Golaszewski
2021-01-11 13:34 ` [libgpiod][PATCH 6/6] core: add the kernel uapi header to the repository Bartosz Golaszewski
2021-01-11 13:46   ` Andy Shevchenko
2021-01-11 14:06     ` Bartosz Golaszewski
2021-01-11 14:46       ` Andy Shevchenko
2021-01-11 15:15         ` Bartosz Golaszewski
2021-01-25  5:55           ` Kent Gibson
2021-01-25 10:54             ` Andy Shevchenko
2021-01-26 15:07             ` Bartosz Golaszewski
2021-01-26 17:11               ` Greg Kroah-Hartman
2021-01-26 19:08                 ` Bartosz Golaszewski
2021-01-27 11:43                   ` Greg Kroah-Hartman
2021-01-28  3:26                     ` Kent Gibson
2021-01-28  7:51                       ` Greg Kroah-Hartman

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='CAMRc=Mcr-8Cts29bTREvZa-BAjKTDdxXLGQqA4ZLam0APV13Kg@mail.gmail.com' \
    --to=brgl@bgdev.pl \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=warthog618@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 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.