The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Linus Walleij <linusw@kernel.org>
To: Alex Elder <elder@riscstar.com>,
	Michael Walle <mwalle@kernel.org>,
	 Bartosz Golaszewski <brgl@kernel.org>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Linus Walleij <linusw@kernel.org>,
	Sashiko <sashiko-bot@kernel.org>
Subject: [PATCH v3 0/2] Support sparse unidirectional GPIO lines.
Date: Mon, 11 May 2026 21:43:42 +0200	[thread overview]
Message-ID: <20260511-regmap-gpio-sparse-fixed-dir-v3-0-1429ec453be7@kernel.org> (raw)

This adds a fixed_direction_mask bitmap to the regmap GPIO
config and state holder. This works the following way:

- If the bitmap is NULL all GPIOs are assumed to be fixed
  direction and that is specified in fixed_direction_output.
  This makes sure old drivers keep working as before.

- If the fixed_direction_mask bitmap is present (!= NULL)
  the lines set to 1 in the bitmask are fixed direction,
  all other lines can change their direction dynamically.

To be used in a forthcoming submission.

As a consequence, be more elaborate when handling direction
setting (patch 2).

Signed-off-by: Linus Walleij <linusw@kernel.org>
---
Changes in v3:
- Rename fixed_direction_sparse to fixed_direction_mask which is more
  to the point.
- Make gpio_regmap_set_direction() fail if the requested direction is
  not the same as the fixed direction.
- Augment gpio_regmap_direction_output() such that it will first check
  if the line is a fixed direction line and only continue if it is
  fixed as output in this case.
- Link to v2: https://patch.msgid.link/20260508-regmap-gpio-sparse-fixed-dir-v2-0-deee84df3027@kernel.org

Changes in v2:
- Make a second patch to exclude setting on unidirectional
  lines.
- Link to v1: https://patch.msgid.link/20260507-regmap-gpio-sparse-fixed-dir-v1-1-a2e5855e2701@kernel.org

---
Linus Walleij (2):
      gpio: regmap: Support sparsed fixed direction
      gpio: regmap: Don't set a fixed direction line

 drivers/gpio/gpio-regmap.c  | 74 ++++++++++++++++++++++++++++++++++++++++++---
 include/linux/gpio/regmap.h |  7 +++++
 2 files changed, 77 insertions(+), 4 deletions(-)
---
base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
change-id: 20260507-regmap-gpio-sparse-fixed-dir-1d5c0d2e2c6f

Best regards,
--  
Linus Walleij <linusw@kernel.org>


             reply	other threads:[~2026-05-11 19:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 19:43 Linus Walleij [this message]
2026-05-11 19:43 ` [PATCH v3 1/2] gpio: regmap: Support sparsed fixed direction Linus Walleij
2026-05-11 21:06   ` Alex Elder
2026-05-11 19:43 ` [PATCH v3 2/2] gpio: regmap: Don't set a fixed direction line Linus Walleij
2026-05-11 21:06   ` Alex Elder

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=20260511-regmap-gpio-sparse-fixed-dir-v3-0-1429ec453be7@kernel.org \
    --to=linusw@kernel.org \
    --cc=brgl@kernel.org \
    --cc=elder@riscstar.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mwalle@kernel.org \
    --cc=sashiko-bot@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