Re: Replacing global GPIO numbers in sysfs with hardware offsets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 21, 2025 at 8:41 PM Marek Vasut <marex@xxxxxxx> wrote:

> I would very much like to avoid having to enable debugfs on production
> systems to access GPIOs in early userspace (e.g. initramfs).

I didn't understand that. It was because Bartosz used the word "play":

>> The gist of it is: some people need to play with GPIOs very early, for
>> example in an initramfs

So I took that word literal: explore, play around. Not develop
products.

> This was so
> far possible via the sysfs API without tools, currently it is becoming
> not easily possible. A sysfs API "v2" which makes that possible would be
> very much appreciated.

I understand, I'm fine with sysfs if it needs to be a "support forever"
ABI, as long as it's:

- Using the per-chip HW numberspace

- Doesn't need any echo NN > export to see the lines in
  sysfs.

Let's just show them all and introduce an ABI for grabbing one
line at a time and shake it.

/sys/bus/gpio/gpiochip0
/sys/bus/gpio/gpiochip0/gpio0
/sys/bus/gpio/gpiochip0/gpio0/userspace
/sys/bus/gpio/gpiochip0/gpio0/value
/sys/bus/gpio/gpiochip0/gpio1
/sys/bus/gpio/gpiochip0/gpio1/userspace
/sys/bus/gpio/gpiochip0/gpio1/value

Take a GPIO, shake it, give it back to the kernel:
echo 1 > /sys/bus/gpio/gpiochip0/gpio1/userspace
echo 0 > /sys/bus/gpio/gpiochip0/gpio1/value
sleep 1
echo 1 > /sys/bus/gpio/gpiochip0/gpio1/value
echo 0 > /sys/bus/gpio/gpiochip0/gpio1/userspace

 I think at this point all that is needed is a patch set.

Yours,
Linus Walleij





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux