Switch to libgpiod and disable CONFIG_GPIO_SYSFS

Bug #1918583 reported by Dmitrii Shcherbakov
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Confirmed
Undecided
Unassigned
Kinetic
Confirmed
Undecided
Unassigned
linux-raspi (Ubuntu)
Fix Released
Undecided
Unassigned
Kinetic
Fix Released
Undecided
Unassigned

Bug Description

Ubuntu kernels are built with CONFIG_GPIO_SYSFS=y after https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1342153

debian.master/config/config.common.ubuntu: CONFIG_GPIO_SYSFS=y

However, this interface got deprecated for removal:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a0910d72afc69b25703f7be9bf7d13f18937a478
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fe95046e960b4b76e73dc1486955d93f47276134
"This marks the (optional) sysfs GPIO ABI as obsolete and schedules it for removal in 2020."

https://www.kernel.org/doc/Documentation/gpio/sysfs.txt
"THIS ABI IS DEPRECATED, THE ABI DOCUMENTATION HAS BEEN MOVED TO Documentation/ABI/obsolete/sysfs-gpio AND NEW USERSPACE CONSUMERS
ARE SUPPOSED TO USE THE CHARACTER DEVICE ABI. THIS OLD SYSFS ABI WILL
NOT BE DEVELOPED (NO NEW FEATURES), IT WILL JUST BE MAINTAINED."

libgpiod and the use of a character file-based interface is a replacement to the sysfs interface:

https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/

Those two interfaces cannot be used interchangeably and working via libgpiod is not possible when the sysfs interface is used:

sudo gpioget gpiochip0 12
gpioget: error reading GPIO values: Device or resource busy

sudo gpioinfo | grep 12
 line 12: "GPIO12" "sysfs" input active-high [used]

It would be good to switch to a newer interface since the old one does not get new features and there is no way to switch to libgpiod besides recompiling the kernel with "CONFIG_GPIO_SYSFS=n"

Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:

apport-collect 1918583

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Changed in linux (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Dave Jones (waveform) wrote :

This post: https://waldorf.waveform.org.uk/2021/the-pins-they-are-a-changin.html should explain things rather more completely than I can here but the TL;DR version is: it would be nice to disable sysfs but there's *way* too much stuff that would break right now if we did (mostly Python GPIO interfaces, but given Python is the "blessed" language for much of the Pi Foundation's output, that's a lot of important stuff to break!).

My hope is that with the addition of lgpio (a "full-featured" library also based on the gpiochip device) in hirsute we should be in a reasonable position to disable that for the LTS next year (maybe impish?). But right now there's too much that'll break.

Revision history for this message
Dave Jones (waveform) wrote :

Now that jammy's out (which still includes CONFIG_GPIO_SYSFS), let's at least consider this for kinetic. I would suggest it would sensible to at least try this in an interim release prior to the next LTS. There will undoubtedly be things that break, but it's probably better to be aware of how much breakage potential there is around this (and what it would take to encourage users over to libgpiod, or if that's practical in all cases).

I'll add linux-raspi to the target list as that's probably the kernel flavour that this will impact most and target to kinetic.

tags: added: rls-kk-incoming
Juerg Haefliger (juergh)
tags: added: kern-3230
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (122.2 KiB)

This bug was fixed in the package linux-raspi - 5.19.0-1002.6

---------------
linux-raspi (5.19.0-1002.6) kinetic; urgency=medium

  * kinetic/linux-raspi: 5.19.0-1002.6 -proposed tracker (LP: #1991077)

  * VM fails to boot in ScalingStack (LP: #1990995)
    - [Packaging] raspi: Include virtio drivers in linux-modules

  * Packaging resync (LP: #1786013)
    - debian/dkms-versions -- update from kernel-versions (main/master)

  * kinetic/linux-raspi: Update to upstream raspberrypi rpi-5.19.y (2022-09-14)
    (LP: #1989958)
    - Revert "ext4: make mb_optimize_scan performance mount option work with
      extents"
    - dtoverlays: Add nohdmi options to vc4-kms-v3d overlays
    - configs: Enable IIO software trigger modules
    - configs: Enable IP_VS_IPV6 (for loadbalancing)
    - configs: Enable CEPH_FS=m
    - overlays: Make more overlays runtime-capable
    - overlays: Mark more overlays as Pi4-specific
    - configs: Add CONFIG_MT7921U=m
    - overlays:Adds HiFiBerry AMP3
    - rpi-simple-soundcard: adds definitions for the HiFiBerry AMP3 card
    - media: bcm2835-unicam: Correctly handle FS + FE ISR condtion
    - bcm2708-dmaengine: Use platform_get_irq
    - media: i2c: imx290: Add compatible strings for IMX327 and IMX462
    - dtoverlays: Add overlays for Sony IMX327 and IMX462 image sensors
    - defconfigs: Add VIDEO_MUX to all defconfigs
    - dtoverlays: Reshuffle image sensor overlays to allow use with muxes
    - bcm2835-v4l2-codec: support H.264 5.0 and 5.1 levels
    - configs: Add support for Cilium on 2711 64-bit
    - overlays: gpio-fan: Add hyst (hysteresis) param
    - overlays: gpio-fan: Document the hyst parameter
    - sound: soc: bcm: Added Sound card driver for Dacberry400 Audio card for
      Raspberry Pi 400
    - overlays: Add dacberry400
    - configs: Enable DACBERRY400
    - overlays: merus-amp: Set GPIO 8 as input np
    - rpi-simple-soundcard: limits sample rate of Merus Amp board
    - drm/vc4: Add async update support for cursor planes
    - media: video-mux: Read CSI2 config from FW, and pass to receiver
    - defconfigs: Add CONFIG_MUX_GPIO.
    - media: i2c: arducam-pivariety: Add custom controls
    - configs: Add LAN7430 driver on BCM2711
    - [Config] raspi: updateconfigs after update to rpi-5.19.y (2022-08-31)
    - overlays: Add a pull (up/down) parameter to pps-gpio
    - drm/vc4: Configure the HVS COB allocations
    - drm/vc4: Set AXI panic modes for the HVS
    - drm/vc4: SCALER_DISPBKGND_AUTOHS is only valid on HVS4
    - drm/vc4: Correct interrupt masking bit assignment for HVS5
    - media: bcm2835-unicam: Fix for possible dummy buffer overrun
    - ASoC:ma120x0p: Extend the volume range to -144dB (mute)
    - media: i2c: imx290: Updating VBLANK should update exposure in all states
    - Revert "media: i2c: imx290: Explicitly set v&h blank on mode change"
    - media: i2c: imx290: Drop incorrect comment about pixelrate
    - media: i2c: imx290: Do not reset exposure time from set_fmt
    - overlays: Add the Raspberry Pi sound cards
    - overlays: Rename unofficial "rpi-" overlays
    - drm/mipi-dsi: Detach devices when removing the host
    - drm/crtc: Introduce drmm_crtc_init_with_planes
...

Changed in linux-raspi (Ubuntu Kinetic):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.