linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauri Sandberg <sandberg@mailfence.com>
To: Linux GPIO <linux-gpio@vger.kernel.org>
Subject: RFC for a GPIO input muxer
Date: Tue, 16 Mar 2021 20:19:48 +0100 (CET)	[thread overview]
Message-ID: <545111184.50061.1615922388276@ichabod.co-bxl> (raw)

I am writing to you to ask for comments on the preferred way of implementing a 4-way GPIO multiplexer in the most generic way. The situation is that there is a dual 4-way multiplexer on my device and its select pins a controlled with GPIOs. The output pins of the multiplexer are connected to two other GPIOs. The datasheet of the multiplexer is here: https://assets.nexperia.com/documents/data-sheet/74HC_HCT153.pdf

This is what I have been contemplating on but I am not aware if the same could be achieved with existing pinctrl or gpio driver or combination of those. 

The 'key-mux1' below implements a gpio-controller that drives the multiplexer and provides gpios for reading device key presses. At the moment it has to be polled as interrupts are not being generated by the key presses. I tried looking around but software interrupts did not give me any hits.

I have omitted 'key-mux2' from this for clarity.

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

	mux-gpios = <&gpio 9 GPIO_ACTIVE_HIGH>,		/* s0 */
		    <&gpio 11 GPIO_ACTIVE_HIGH>;	/* s1 */
};

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

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

	// GPIOs used by this node, mux pin
	pin-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;	/* 1y */
};

keys {
	compatible = "gpio-keys-polled";
	poll-interval = <20>;

	aoss {
		label = "aoss";
		linux,code = <KEY_WPS_BUTTON>;
		gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
		debounce-interval = <60>;
	};
}

Sincerely,
Mauri

             reply	other threads:[~2021-03-16 19:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16 19:19 Mauri Sandberg [this message]
     [not found] ` <CAHp75VdhX1iC_JKyDigFrwzn7mUvvk0PGC-fgVUvJtYS+Dz6Hw@mail.gmail.com>
2021-03-17 12:30   ` RFC for a GPIO input muxer Andy Shevchenko
2021-03-22  6:19     ` Drew Fustini
2021-03-22 17:09       ` Mauri Sandberg
2021-03-23  2:42         ` Drew Fustini

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=545111184.50061.1615922388276@ichabod.co-bxl \
    --to=sandberg@mailfence.com \
    --cc=linux-gpio@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 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).