All of lore.kernel.org
 help / color / mirror / Atom feed
From: Drew Fustini <drew@beagleboard.org>
To: Mauri Sandberg <sandberg@mailfence.com>
Cc: andy.shevchenko@gmail.com, bgolaszewski@baylibre.com,
	geert+renesas@glider.be, linus.walleij@linaro.org,
	linux-gpio@vger.kernel.org
Subject: Re: [PATCH v3 0/2] gpio: add generic gpio input multiplexer
Date: Mon, 24 May 2021 14:25:38 -0700	[thread overview]
Message-ID: <20210524212538.GA3756746@x1> (raw)
In-Reply-To: <20210517165847.206316-1-sandberg@mailfence.com>

On Mon, May 17, 2021 at 07:58:45PM +0300, Mauri Sandberg wrote:
> Hello all!
> 
> This patch set is closely related to another thread at [4], which I abandoned
> against better judgement and created this one.
> 
> Here I am sending revised versions of the patches. It builds on v2 and adopts 
> managed device resources as suggested by Andy on the thread mentioned
> above [5].
> 
> I have tested the functionality on a NXP 74HC153 dual 4-way muxer. Drew, did
> you find the time to have a go with this [6] and if so, did it work as expected?
> 
> Thanks,
> Mauri
> 
> [4] https://www.spinics.net/lists/linux-gpio/msg58573.html
> [5] https://www.spinics.net/lists/linux-gpio/msg60160.html
> [6] https://www.spinics.net/lists/linux-gpio/msg60159.html
> 
> 
> Mauri Sandberg (2):
>   dt-bindings: gpio-mux-input: add documentation
>   gpio: gpio-mux-input: add generic gpio input multiplexer
> 
>  .../bindings/gpio/gpio-mux-input.yaml         |  75 +++++++++++
>  drivers/gpio/Kconfig                          |  16 +++
>  drivers/gpio/Makefile                         |   1 +
>  drivers/gpio/gpio-mux-input.c                 | 124 ++++++++++++++++++
>  4 files changed, 216 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/gpio/gpio-mux-input.yaml
>  create mode 100644 drivers/gpio/gpio-mux-input.c
> 
> 
> base-commit: 6453b9532b5f77d19837b159c4d074f0af9f141b
> -- 
> 2.25.1

Tested-by: Drew Fustini <drew@beagleboard.org>
Reviewed-by: Drew Fustini <drew@beagleboard.org>

I have wired up the TI CD74HC153E to a BeagleBone Black:

  S0: P8_7
  S1: P8_8

  1Y: P8_10
  2Y: P8_9

I added this to arch/arm/boot/dts/am335x-boneblack.dts

  mux: mux-controller {
          compatible = "gpio-mux";
          #mux-control-cells = <0>;

          mux-gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>, /* S0: P8_7 */
                      <&gpio2 3 GPIO_ACTIVE_HIGH>  /* S1: P8_8 */;
  };

  gpio8: key-mux1 {
          compatible = "gpio-mux-input";
          mux-controls = <&mux>;

          gpio-controller;
          #gpio-cells = <2>;

          // GPIOs used by this node, mux pin
          pin-gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>; /* 2Y: P8_9 */
  };

  gpio9: key-mux2 {
          compatible = "gpio-mux-input";
          mux-controls = <&mux>;

          gpio-controller;
          #gpio-cells = <2>;

          // GPIOs used by this node, mux pin
          pin-gpios = <&gpio2 4 GPIO_ACTIVE_HIGH>; /* 1Y: P8_10 */
  };


The two new gpiochips appear:

  root@beaglebone:~# gpiodetect
  gpiochip0 [gpio-0-31] (32 lines)
  gpiochip1 [gpio-32-63] (32 lines)
  gpiochip2 [gpio-64-95] (32 lines)
  gpiochip3 [gpio-96-127] (32 lines)
  gpiochip4 [key-mux1] (4 lines)
  gpiochip5 [key-mux2] (4 lines)
  
The mux pins and input pins are connected to lines on gpiochip1:

  debian@beaglebone:~$ gpioinfo 1
  gpiochip1 - 32 lines:
	  line   0:     "P9_15B"       unused   input  active-high
	  line   1:      "P8_18"       unused   input  active-high
	  line   2:       "P8_7"        "mux"  output  active-high [used]
	  line   3:       "P8_8"        "mux"  output  active-high [used]
	  line   4:      "P8_10"        "pin"   input  active-high [used]
	  line   5:       "P8_9"        "pin"   input  active-high [used]
  <snip>
  

Test with all inputs connected to 3.3V (1I0:1I3 and 2I0:2I3)

  debian@beaglebone:~$ gpioget 4 0
  1
  debian@beaglebone:~$ gpioget 4 1
  1
  debian@beaglebone:~$ gpioget 4 2
  1
  debian@beaglebone:~$ gpioget 4 3
  1
  debian@beaglebone:~$ gpioget 5 0
  1
  debian@beaglebone:~$ gpioget 5 1
  1
  debian@beaglebone:~$ gpioget 5 2
  1
  debian@beaglebone:~$ gpioget 5 3
  1

Connect 1I0 to GND

  debian@beaglebone:~$ gpioget 4 0
  0

Connect 1I0 to 3V3

  debian@beaglebone:~$ gpioget 4 0
  1

I tried this with all the rest and got the same succesfull results.

thanks,
drew

  parent reply	other threads:[~2021-05-24 21:25 UTC|newest]

Thread overview: 62+ 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-25 23:08   ` kernel test robot
2021-03-25 23:08   ` [PATCH] gpio: gpio-mux-input: fix platform_no_drv_owner.cocci warnings kernel test robot
2021-03-26  6:59   ` [RFC gpio/for-next 2/2] gpio: gpio-mux-input: add generic gpio input multiplexer 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 [this message]
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
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=20210524212538.GA3756746@x1 \
    --to=drew@beagleboard.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=geert+renesas@glider.be \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.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 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.