linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Mauri Sandberg <maukka@ext.kapsi.fi>
Cc: Mauri Sandberg <sandberg@mailfence.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Drew Fustini <drew@beagleboard.org>,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v4 2/2] gpio: gpio-mux-input: add generic gpio input multiplexer
Date: Tue, 1 Jun 2021 12:38:01 +0200	[thread overview]
Message-ID: <CACRpkdYf06W2QDY6EN0OG3RjOnJ+AVE+Wd4M6Z9=B7aZ9rGfwA@mail.gmail.com> (raw)
In-Reply-To: <20210530161333.3996-3-maukka@ext.kapsi.fi>

On Sun, May 30, 2021 at 6:16 PM Mauri Sandberg <maukka@ext.kapsi.fi> wrote:

> Adds support for a generic GPIO multiplexer. To drive the multiplexer a
> mux-controller is needed. The output pin of the multiplexer is a GPIO
> pin.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Mauri Sandberg <maukka@ext.kapsi.fi>
> Tested-by: Drew Fustini <drew@beagleboard.org>
> Reviewed-by: Drew Fustini <drew@beagleboard.org>

The commit message and part of the driver becomes hard to
read and understand because the word pin is overused.
Switch to talk about "gpio lines" rather than pins.

Draw a simple ASCII image like this:

               /|---- Cascaded GPIO line 0
              |M|---- Cascaded GPIO line 1
GPIO line ----+U| .
              |X| .
           \|---- Cascaded GPIO line n

Maybe also as illustration in the driver and in the bindings.
Make things easy to understand.

Explain exactly why only input lines can be multiplexed.

I'm not sure it should be restricted to just input
in theory, but since that is all we can test, restrict it to
input in practice.

> +config GPIO_MUX_INPUT
> +       tristate "General GPIO input multiplexer"

Rename it just GPIO_MUX
  "General GPIO multiplexer"

Then clarify in the help description that it currently can only
handle input lines.

> +       depends on OF_GPIO
> +       select MULTIPLEXER
> +       select MUX_GPIO
> +       help
> +         Say yes here to enable support for generic GPIO input multiplexer.
> +
> +         This driver uses a mux-controller to drive the multiplexer and has a
> +         single output pin for reading the inputs to the mux. The driver can
> +         be used in situations when GPIO pins are used to select what
> +         multiplexer pin should be used for reading input and the output pin
> +         of the multiplexer is connected to a GPIO input pin.

Input output etc, this gets very hard to understand.

Switch terminology from "pin" to "GPIO lines", (or "GPIO rails").

Use the word "routing" as the GPIO line is routed through the
multiplexer. Maybe spell out multiplexer for clarity.

Explain why, for electrical reasons, output lines are harder
to multiplex like this, as the output will not maintain
state. Notice that "using open drain constructions, output
multiplexing may be possible, but it is currently not implemented."

> +static int gpio_mux_input_get_direction(struct gpio_chip *gc,
> +                                       unsigned int offset)
> +{
> +       return GPIO_LINE_DIRECTION_IN;
> +}

Explain why this is a restriction with a comment in the code.
Add comment that in the future we might be able to handle
also output.

> +static int gpio_mux_input_get_value(struct gpio_chip *gc, unsigned int offset)

This looks very nice!

We might have to extend this driver at some point.

Intuitively I'd say it takes some time and then someone
comes along and say "actually we have done this
for output as well, using some open drain and stuff"
but this is a good starting point anyway we need no
big upfront designs.

Yours,
Linus Walleij

  parent reply	other threads:[~2021-06-01 10:38 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25 12:28 [RFC gpio/for-next 0/2] gpio: add generic gpio input multiplexer Mauri Sandberg
2021-03-25 12:28 ` [RFC gpio/for-next 1/2] dt-bindings: gpio-mux-input: add documentation Mauri Sandberg
2021-03-25 12:28 ` [RFC gpio/for-next 2/2] gpio: gpio-mux-input: add generic gpio input multiplexer Mauri Sandberg
2021-03-26  6:59   ` Drew Fustini
2021-03-26 10:32     ` Mauri Sandberg
2021-03-26 10:49       ` Andy Shevchenko
2021-03-29 13:57 ` [RFC v2 0/2] gpio: " Mauri Sandberg
2021-03-29 13:57   ` [RFC v2 1/2] dt-bindings: gpio-mux-input: add documentation Mauri Sandberg
2021-03-29 13:57   ` [RFC v2 2/2] gpio: gpio-mux-input: add generic gpio input multiplexer Mauri Sandberg
2021-05-17 16:58 ` [PATCH v3 0/2] gpio: " Mauri Sandberg
2021-05-17 16:58   ` [PATCH v3 1/2] dt-bindings: gpio-mux-input: add documentation Mauri Sandberg
2021-05-17 16:58   ` [PATCH v3 2/2] gpio: gpio-mux-input: add generic gpio input multiplexer Mauri Sandberg
2021-05-17 22:13   ` [PATCH v3 0/2] gpio: " Drew Fustini
2021-05-28  0:23     ` Linus Walleij
2021-05-28  0:27       ` Drew Fustini
2021-05-24 21:25   ` Drew Fustini
2021-05-24 16:29 ` RESEND PATCH v3 Mauri Sandberg
2021-05-24 16:29   ` [PATCH v3 1/2] dt-bindings: gpio-mux-input: add documentation Mauri Sandberg
2021-05-24 16:29   ` [PATCH v3 2/2] gpio: gpio-mux-input: add generic gpio input multiplexer Mauri Sandberg
2021-05-24 21:29   ` RESEND PATCH v3 Drew Fustini
2021-05-30 16:13 ` [PATCH v4 0/2] gpio: add generic gpio input multiplexer Mauri Sandberg
2021-05-30 16:13   ` [PATCH v4 1/2] dt-bindings: gpio-mux-input: add documentation Mauri Sandberg
2021-06-01 10:10     ` Linus Walleij
2021-06-01 10:44     ` Linus Walleij
2021-06-02  9:31       ` Mauri Sandberg
2021-06-02 10:35         ` Linus Walleij
2021-06-02 11:21           ` Mauri Sandberg
2021-06-04  7:51             ` Linus Walleij
2021-06-01 13:32     ` Rob Herring
2021-06-02 11:36       ` Mauri Sandberg
2021-05-30 16:13   ` [PATCH v4 2/2] gpio: gpio-mux-input: add generic gpio input multiplexer Mauri Sandberg
2021-05-30 18:09     ` Andy Shevchenko
2021-05-30 19:02       ` Mauri Sandberg
2021-05-30 19:38         ` Andy Shevchenko
2021-05-31 10:19           ` Mauri Sandberg
2021-06-01 10:38     ` Linus Walleij [this message]
2021-06-21 17:20 ` [PATCH v5 0/2] gpio: add generic gpio cascade Mauri Sandberg
2021-06-21 17:20   ` [PATCH v5 1/2] dt-bindings: gpio-cascade: add documentation Mauri Sandberg
2021-06-24 18:30     ` Rob Herring
2021-06-21 17:20   ` [PATCH v5 2/2] gpio: gpio-cascade: add generic GPIO cascade Mauri Sandberg
2021-06-21 17:43     ` Andy Shevchenko
2021-06-21 18:31       ` Enrico Weigelt, metux IT consult
2021-10-15 12:56       ` Mauri Sandberg
2021-10-15 17:20         ` Andy Shevchenko
2021-10-19 12:57 ` [PATCH v6 0/2] " Mauri Sandberg
2021-10-19 12:57   ` [PATCH v6 1/2] dt-bindings: gpio-cascade: add documentation Mauri Sandberg
2021-10-19 12:57   ` [PATCH v6 2/2] gpio: gpio-cascade: add generic GPIO cascade Mauri Sandberg
2021-10-19 13:12     ` Andy Shevchenko
2021-10-19 20:08 ` [PATCH v7 0/2] " Mauri Sandberg
2021-10-19 20:08   ` [PATCH v7 1/2] dt-bindings: gpio-cascade: add documentation Mauri Sandberg
2021-10-24 22:18     ` Linus Walleij
2021-10-19 20:08   ` [PATCH v7 2/2] gpio: gpio-cascade: add generic GPIO cascade Mauri Sandberg
2021-10-24 22:17     ` Linus Walleij
2021-10-25  9:29     ` Andy Shevchenko
2021-10-26 19:15 ` [PATCH v8 0/2] " Mauri Sandberg
2021-10-26 19:15   ` [PATCH v8 1/2] dt-bindings: gpio-cascade: add documentation Mauri Sandberg
2021-10-26 19:15   ` [PATCH v8 2/2] gpio: gpio-cascade: add generic GPIO cascade Mauri Sandberg
2022-02-05 21:59 ` [RESEND v8 0/2] " Mauri Sandberg
2022-02-05 21:59   ` [RESEND v8 1/2] dt-bindings: gpio-cascade: add documentation Mauri Sandberg
2022-02-05 21:59   ` [RESEND v8 2/2] gpio: gpio-cascade: add generic GPIO cascade Mauri Sandberg

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='CACRpkdYf06W2QDY6EN0OG3RjOnJ+AVE+Wd4M6Z9=B7aZ9rGfwA@mail.gmail.com' \
    --to=linus.walleij@linaro.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=devicetree@vger.kernel.org \
    --cc=drew@beagleboard.org \
    --cc=geert+renesas@glider.be \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=maukka@ext.kapsi.fi \
    --cc=robh+dt@kernel.org \
    --cc=sandberg@mailfence.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;
as well as URLs for NNTP newsgroup(s).