linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: <linus.walleij@linaro.org>, <bgolaszewski@baylibre.com>,
	<robh+dt@kernel.org>
Cc: <linux-gpio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<m.szyprowski@samsung.com>, <broonie@kernel.org>,
	<mripard@kernel.org>, <p.zabel@pengutronix.de>,
	<devicetree@vger.kernel.org>
Subject: [RFC 0/2] gpiolib: Initial, basic support for shared GPIO lines
Date: Wed, 20 Nov 2019 15:34:07 +0200	[thread overview]
Message-ID: <20191120133409.9217-1-peter.ujfalusi@ti.com> (raw)

Hi,

The initial support can replace all use of GPIOD_FLAGS_BIT_NONEXCLUSIVE if the
shared GPIO is configured to follow pass through 'strategy' for the shared GPIO
pin.

I have only implemented DT support.

With the shared gpio support one can choose between three different strategy for
managing the shared gpio:
refcounted low: Keep the line low as long as there is at least one low
		request is registered
refcounted high: Keep the line high as long as there is at least one high
		request is registered
pass through: all requests are allowed to go through without refcounting.

Few shortcomings as of now:
- can not handle different GPIO_ACTIVE_ on the user side, both the root GPIO
  (which is shared) and clients must have the same GPIO_ACTIVE_ mode.
  We are using common gpio_desc.
  Like with GPIOD_FLAGS_BIT_NONEXCLUSIVE
- refcounting counts _all_ 1/0 requests coming from the users of the shared
  GPIO. This could cause issues if clients are using the gpiod API in unbalanced
  way.
  We would need to have separate tracking for each of the clients and agregate
  the level they are asking for at any moment. Basically a new gpio-chip on top
  of the real gpio pin can solve this.

Regards,
Peter
---
Peter Ujfalusi (2):
  dt-bindings: gpio: Document shared GPIO line usage
  gpiolib: Support for (output only) shared GPIO line

 .../devicetree/bindings/gpio/gpio.txt         |  66 +++++++++
 drivers/gpio/gpiolib-of.c                     |  28 +++-
 drivers/gpio/gpiolib.c                        | 132 ++++++++++++++++--
 drivers/gpio/gpiolib.h                        |  10 ++
 4 files changed, 223 insertions(+), 13 deletions(-)

-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


             reply	other threads:[~2019-11-20 13:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-20 13:34 Peter Ujfalusi [this message]
2019-11-20 13:34 ` [RFC 1/2] dt-bindings: gpio: Document shared GPIO line usage Peter Ujfalusi
2019-11-22 12:10   ` Linus Walleij
2019-11-22 13:36     ` Peter Ujfalusi
2019-11-28 10:06       ` Linus Walleij
2019-12-02 21:31         ` Peter Ujfalusi
2019-12-11  0:06           ` Linus Walleij
2019-12-03 23:51         ` Rob Herring
2019-12-10 23:54           ` Linus Walleij
2019-11-20 13:34 ` [RFC 2/2] gpiolib: Support for (output only) shared GPIO line Peter Ujfalusi
2019-11-22 12:22   ` Linus Walleij
2019-11-22 15:14     ` Peter Ujfalusi
2019-11-20 13:49 ` [RFC 0/2] gpiolib: Initial, basic support for shared GPIO lines Peter Ujfalusi

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=20191120133409.9217-1-peter.ujfalusi@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mripard@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@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).