Skip to contentSkip to conversation

gpio: sim: allow to mark simulated lines as invalid

PATCH Applied Bartosz Golaszewski 1 participant 3 messages Jun 30, 2025 – Jul 9, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: sim: allow to mark simulated lines as invalid

From: Bartosz Golaszewski <[email protected]>

Add a new line-level, boolean property to the gpio-sim configfs interface called 'valid'. It's set by default and the user can unset it to make the line be included in the standard gpio-reserved-ranges property when the chip is registered with GPIO core. This allows users to specify which lines should not be available for requesting as GPIOs.

---
 Documentation/admin-guide/gpio/gpio-sim.rst |  7 +-
 drivers/gpio/gpio-sim.c                     | 83 ++++++++++++++++++++-
 2 files changed, 86 insertions(+), 4 deletions(-)
Documentation/admin-guide/gpio/gpio-sim.rst +5 -2
index 35d49ccd49e0..f5135a14ef2e 100644
@@ -50,8 +50,11 @@ the number of lines exposed by this bank.
 
 **Attribute:** ``/config/gpio-sim/gpio-device/gpio-bankX/lineY/name``
 
-This group represents a single line at the offset Y. The 'name' attribute
-allows to set the line name as represented by the 'gpio-line-names' property.
+**Attribute:** ``/config/gpio-sim/gpio-device/gpio-bankX/lineY/valid``
+
+This group represents a single line at the offset Y. The ``valid`` attribute
+indicates whether the line can be used as GPIO. The ``name`` attribute allows
+to set the line name as represented by the 'gpio-line-names' property.
 
 **Item:** ``/config/gpio-sim/gpio-device/gpio-bankX/lineY/hog``
 
drivers/gpio/gpio-sim.c +81 -2

129 lines not on this page · raw message

Signature · 1 line
2.48.1
#1 lore raw
Quoted 11 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Add a new line-level, boolean property to the gpio-sim configfs interface called 'valid'. It's set by default and the user can unset it to make the line be included in the standard gpio-reserved-ranges property when the chip is registered with GPIO core. This allows users to specify which lines should not be available for requesting as GPIOs.

---

If there are no objections, I'll pick it up by the end of this week, I'd like to add some tests to libgpiod that verify the valid_mask functionality but need this first in the kernel.

Bart

author Applied
#2 lore raw
In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Quoted 8 lines · Bartosz Golaszewski

Add a new line-level, boolean property to the gpio-sim configfs interface called 'valid'. It's set by default and the user can unset it to make the line be included in the standard gpio-reserved-ranges property when the chip is registered with GPIO core. This allows users to specify which lines should not be available for requesting as GPIOs.

[...]

Applied, thanks!

[1/1] gpio: sim: allow to mark simulated lines as invalid

      https://git.kernel.org/brgl/linux/c/0cf6d425d39cfc1b676fbf9dea36ecd68eeb27ee

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>