GPIO character device v1 API not enabled in kernel

Bug #1953613 reported by Arthur Magill
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
Medium
Unassigned
Jammy
Fix Released
Medium
Unassigned
linux-allwinner-5.17 (Ubuntu)
Invalid
Undecided
Unassigned
Jammy
Fix Released
Undecided
Unassigned
linux-hwe-5.17 (Ubuntu)
Invalid
Undecided
Unassigned
Jammy
Fix Committed
Undecided
Unassigned
linux-starfive-5.17 (Ubuntu)
Invalid
Undecided
Unassigned
Jammy
Fix Released
Undecided
Unassigned

Bug Description

[Impact]

 * The libgpiod2 library and gpiod tools shipped in Jammy don't work.

 * These tools are meant to replace the old sysfs interface and be
   a better and more efficient way to manipulate GPIOs from userspace.
   Unfortunately the latest release is still using v1 of the character
   device kernel API which is not enabled in Ubuntu kernels.

 * This is Kent Gibsons reply on the linux-gpio mailing list:

On Tue, Jul 12, 2022 at 09:48:45AM +0200, Alexandre Ghiti wrote:
> Hi,
>
> Ubuntu kernels do not enable GPIO_CDEV_V1 as it is deprecated, but the
> libgpiod package that we ship is still based on the latest version
> 1.6.3 which does not implement the API v2. So I'd like to update
> libgpiod, do you have any recommendations about what branch/sha1 I
> should use? Do you plan to make a release that implements the API v2?
>

Firstly, libgpiod is Bart's library so he is the authority, but this
is my understanding...

TLDR: You should keep GPIO_CDEV_V1 enabled.

v1 is deprecated from a development perspective, so all new feature
development will occur on v2, and new applications should target v2.
Existing apps targetting v1, be that directly or via libgpiod v1.6.3,
will require GPIO_CDEV_V1 until they migrate to v2.
The mainline kernel will continue to support v1 while userspace
transitions.

libgpiod v2 is in active development, and should reach its first release
shortly.
Note that it is NOT a plugin replacement for v1. It has a different API,
for similar reasons to why we had to switch in the kernel, so apps will
need to be actively migrated.

I wouldn't suggest making any effort to package libgpiod v2 until Bart
makes an official release.

Cheers,
Kent.

[Test Plan]

 * Run gpioinfo on a machine with exposed GPIOs and check that it lists
   the GPIOs and doesn't error with

   gpioinfo: error creating line iterator: Invalid argument

[Where problems could occur]

 * There may be code and scripts that hasn't been tested with a working
   libgpiod2/gpiod tools and uncover latent bugs.

[Other Info]

Original bug text:

The current versions of gpiod, libgpiod-dev and libgpiod2 (1.6.2-1) use version 1 of the GPIO character device API. However, they cannot work because the interface is disabled in the default kernel (tested with 5.13.19). After rebuilding the kernel with the option CONFIG_GPIO_CDEV_V1=y, the gpiod tools work as expected.

Thanks to Marek Szuba, who reported the same bug for Gentoo (https://bugs.gentoo.org/807334), pointing me in the right direction.

What I expect to happen:

$ gpiodetect
gpiochip0 [0-003c] (8 lines)
$ gpioinfo
gpiochip0 - 8 lines:
 line 0: unnamed unused output active-high
 line 1: unnamed unused output active-high
 line 2: unnamed unused output active-high
 line 3: unnamed unused output active-high
 line 4: unnamed unused output active-high
 line 5: unnamed unused output active-high
 line 6: unnamed unused input active-high
 line 7: unnamed unused input active-high
$ gpioget gpiochip0 0
1

What actually happens:

$ gpiodetect
gpiochip0 [0-003c] (8 lines)
$ gpioinfo
gpioinfo: error creating line iterator: Invalid argument
$ gpioget gpiochip0 0
gpioget: error reading GPIO values: Invalid argument

$ cat /proc/version_signature
Ubuntu 5.13.0-22.22-lowlatency 5.13.19

$ apt-cache policy libgpiod2
libgpiod2:
  Installed: 1.6.2-1
  Candidate: 1.6.2-1
  Version table:
 *** 1.6.2-1 500
        500 http://de.archive.ubuntu.com/ubuntu impish/universe amd64 Packages
        100 /var/lib/dpkg/status

I am testing with the onboard PCA9554A on a Fujitsu D3641-S motherboard.

$ lspci | grep -i smb
00:1f.4 SMBus: Intel Corporation Cannon Lake PCH SMBus Controller (rev 10)
$ lspci -s 1f.4 -vvv
00:1f.4 SMBus: Intel Corporation Cannon Lake PCH SMBus Controller (rev 10)
 DeviceName: Onboard - Other
 Subsystem: Fujitsu Technology Solutions Cannon Lake PCH SMBus Controller
 Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
 Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
 Interrupt: pin A routed to IRQ 16
 Region 0: Memory at 6013106000 (64-bit, non-prefetchable) [size=256]
 Region 4: I/O ports at efa0 [size=32]
 Kernel driver in use: i801_smbus
 Kernel modules: i2c_i801
---
ProblemType: Bug
ApportVersion: 2.20.11-0ubuntu71
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: dkfz 4589 F.... pulseaudio
 /dev/snd/controlC1: dkfz 4589 F.... pulseaudio
CasperMD5CheckResult: unknown
CurrentDesktop: ubuntu:GNOME
DistroRelease: Ubuntu 21.10
InstallationDate: Installed on 2018-11-12 (1122 days ago)
InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
Lsusb:
 Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
 Bus 001 Device 003: ID 7392:a812 Edimax Technology Co., Ltd Edimax AC600 USB
 Bus 001 Device 002: ID 256f:c650 3Dconnexion CadMouse
 Bus 001 Device 004: ID 046d:c336 Logitech, Inc. Gaming Keyboard G213
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
NonfreeKernelModules: nvidia_modeset nvidia
Package: linux (not installed)
ProcFB: 0 i915drmfb
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.13.19 root=UUID=75550043-7044-41bf-a01e-bf41b267f7d0 ro
ProcVersionSignature: Ubuntu 5.13.0-22.22-lowlatency 5.13.19
RelatedPackageVersions:
 linux-restricted-modules-5.13.19 N/A
 linux-backports-modules-5.13.19 N/A
 linux-firmware 1.201.1
RfKill:
 0: phy0: Wireless LAN
  Soft blocked: no
  Hard blocked: no
Tags: impish
Uname: Linux 5.13.19 x86_64
UpgradeStatus: Upgraded to impish on 2021-10-19 (49 days ago)
UserGroups: sudo
WifiSyslog:

_MarkForUpload: True
dmi.bios.date: 02/18/2021
dmi.bios.release: 1.12
dmi.bios.vendor: FUJITSU // American Megatrends Inc.
dmi.bios.version: V5.0.0.13 R1.12.0 for D3641-S1x
dmi.board.name: D3641-S1
dmi.board.vendor: FUJITSU
dmi.board.version: S26361-D3641-S1
dmi.chassis.type: 3
dmi.chassis.vendor: FUJITSU
dmi.modalias: dmi:bvnFUJITSU//AmericanMegatrendsInc.:bvrV5.0.0.13R1.12.0forD3641-S1x:bd02/18/2021:br1.12:svnFUJITSU:pn:pvr:rvnFUJITSU:rnD3641-S1:rvrS26361-D3641-S1:cvnFUJITSU:ct3:cvr:sku:
dmi.product.family: ESPRIMO-FTS
dmi.sys.vendor: FUJITSU

CVE References

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 1953613

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
Revision history for this message
Arthur Magill (arthurmagill) wrote : AlsaInfo.txt

apport information

tags: added: apport-collected impish
description: updated
Revision history for this message
Arthur Magill (arthurmagill) wrote : CRDA.txt

apport information

Revision history for this message
Arthur Magill (arthurmagill) wrote : CurrentDmesg.txt

apport information

Revision history for this message
Arthur Magill (arthurmagill) wrote : IwConfig.txt

apport information

Revision history for this message
Arthur Magill (arthurmagill) wrote : Lspci.txt

apport information

Revision history for this message
Arthur Magill (arthurmagill) wrote : Lspci-vt.txt

apport information

Revision history for this message
Arthur Magill (arthurmagill) wrote : Lsusb-t.txt

apport information

Revision history for this message
Arthur Magill (arthurmagill) wrote : Lsusb-v.txt

apport information

Revision history for this message
Arthur Magill (arthurmagill) wrote : PaInfo.txt

apport information

Revision history for this message
Arthur Magill (arthurmagill) wrote : ProcCpuinfo.txt

apport information

Revision history for this message
Arthur Magill (arthurmagill) wrote : ProcCpuinfoMinimal.txt

apport information

Revision history for this message
Arthur Magill (arthurmagill) wrote : ProcEnviron.txt

apport information

Revision history for this message
Arthur Magill (arthurmagill) wrote : ProcInterrupts.txt

apport information

Revision history for this message
Arthur Magill (arthurmagill) wrote : ProcModules.txt

apport information

Revision history for this message
Arthur Magill (arthurmagill) wrote : PulseList.txt

apport information

Revision history for this message
Arthur Magill (arthurmagill) wrote : UdevDb.txt

apport information

Revision history for this message
Arthur Magill (arthurmagill) wrote : acpidump.txt

apport information

Changed in linux (Ubuntu):
status: Incomplete → Confirmed
description: updated
description: updated
summary: - GPIO character device API not enabled in kernel
+ GPIO character device v1 API not enabled in kernel
Stefan Bader (smb)
Changed in linux (Ubuntu Jammy):
importance: Undecided → Medium
status: New → Fix Committed
Changed in linux (Ubuntu):
status: Confirmed → Fix Committed
importance: Undecided → Medium
Changed in linux-hwe-5.17 (Ubuntu):
status: New → Invalid
Changed in linux-hwe-5.17 (Ubuntu Jammy):
status: New → In Progress
Changed in linux-allwinner-5.17 (Ubuntu):
status: New → Invalid
Changed in linux-allwinner-5.17 (Ubuntu Jammy):
status: New → In Progress
Changed in linux-starfive-5.17 (Ubuntu):
status: New → Invalid
Changed in linux-starfive-5.17 (Ubuntu Jammy):
status: New → In Progress
Changed in linux-starfive-5.17 (Ubuntu Jammy):
status: In Progress → Fix Committed
Changed in linux-hwe-5.17 (Ubuntu Jammy):
status: In Progress → Fix Committed
Changed in linux-allwinner-5.17 (Ubuntu Jammy):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (75.1 KiB)

This bug was fixed in the package linux - 5.15.0-47.51

---------------
linux (5.15.0-47.51) jammy; urgency=medium

  * jammy/linux: 5.15.0-47.51 -proposed tracker (LP: #1983903)

  * Jammy update: v5.15.46 upstream stable release (LP: #1981864)
    - UBUNTU: [Packaging] Move python3-dev to build-depends

  * touchpad and touchscreen doesn't work at all on ACER Spin 5 (SP513-54N)
    (LP: #1884232)
    - x86/PCI: Eliminate remove_e820_regions() common subexpressions
    - x86: Log resource clipping for E820 regions
    - x86/PCI: Clip only host bridge windows for E820 regions
    - x86/PCI: Add kernel cmdline options to use/ignore E820 reserved regions
    - x86/PCI: Disable E820 reserved region clipping via quirks
    - x86/PCI: Revert "x86/PCI: Clip only host bridge windows for E820 regions"

  * [SRU][H/OEM-5.13/OEM-5.14/U][J/OEM-5.17/U] Fix invalid MAC address after
    hotplug tbt dock (LP: #1942999)
    - SAUCE: igc: wait for the MAC copy when enabled MAC passthrough

  * Mass Storage Gadget driver truncates device >2TB (LP: #1981390)
    - usb: gadget: storage: add support for media larger than 2T

  * AMD Rembrandt: DP tunneling fails with Thunderbolt monitors (LP: #1983143)
    - SAUCE: drm/amd: Fix DP Tunneling with Thunderbolt monitors
    - drm/amd/display: Fix for dmub outbox notification enable
    - Revert "drm/amd/display: Fix DPIA outbox timeout after S3/S4/reset"
    - drm/amd/display: Reset link encoder assignments for GPU reset
    - drm/amd/display: Fix DPIA outbox timeout after S3/S4/reset
    - drm/amd/display: Fix new dmub notification enabling in DM
    - SAUCE: thunderbolt: Add DP out resource when DP tunnel is discovered.

  * Fix sub-optimal I210 network speed (LP: #1976438)
    - igb: Make DMA faster when CPU is active on the PCIe link

  * e1000e report hardware hang (LP: #1973104)
    - e1000e: Enable GPT clock before sending message to CSME
    - Revert "e1000e: Fix possible HW unit hang after an s0ix exit"

  * ioam6.sh in net from ubuntu_kernel_selftests fails with 5.15 kernels in
    Focal (LP: #1982930)
    - selftests: net: fix IOAM test skip return code

  * Additional fix for TGL + AUO panel flickering (LP: #1983297)
    - Revert "UBUNTU: SAUCE: drm/i915/display/psr: Fix flicker on TGL + AUO panel"
    - drm/i915/display: Fix sel fetch plane offset calculation
    - drm/i915: Nuke ORIGIN_GTT
    - drm/i915/display: Drop PSR support from HSW and BDW
    - drm/i915/display/psr: Handle plane and pipe restrictions at every page flip
    - drm/i915/display/psr: Do full fetch when handling multi-planar formats
    - drm/i915/display: Drop unnecessary frontbuffer flushes
    - drm/i915/display: Handle frontbuffer rendering when PSR2 selective fetch is
      enabled
    - drm/i915/display: Fix glitches when moving cursor with PSR2 selective fetch
      enabled
    - SAUCE: drm/i915/display/psr: Reinstate fix for TGL + AUO panel flicker

  * AMD Yellow Carp DMCUB fw update for s0i3 B0 fixes (LP: #1957026)
    - drm/amd/display: Optimize bandwidth on following fast update
    - drm/amd/display: Fix surface optimization regression on Carrizo
    - drm/amd/display: Reset DMCUB before HW init

  * GPIO character devi...

Changed in linux (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux-allwinner-5.17 - 5.17.0-1005.5

---------------
linux-allwinner-5.17 (5.17.0-1005.5) jammy; urgency=medium

  * jammy/linux-allwinner-5.17: 5.17.0-1005.5 -proposed tracker (LP: #1983904)

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

  * GPIO character device v1 API not enabled in kernel (LP: #1953613)
    - [Config] Enable CONFIG_GPIO_CDEV_V1

  * /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf cannot be booted with KVM
    (LP: #1980594)
    - RISC-V: KVM: Fix SRCU deadlock caused by kvm_riscv_check_vcpu_requests()

  [ Ubuntu: 5.17.0-8.8~22.04.8 ]

  * jammy/linux-hwe-5.17: 5.17.0-8.8~22.04.8 -proposed tracker (LP: #1983907)
  * Packaging resync (LP: #1786013)
    - debian/dkms-versions -- update from kernel-versions (main/2022.08.08)
  * GPIO character device v1 API not enabled in kernel (LP: #1953613)
    - [Config] Enable CONFIG_GPIO_CDEV_V1
  * refactoring of overlayfs fix to properly support shiftfs (LP: #1983640)
    - SAUCE: for aufs mmap: print the virtual file path
    - SAUCE: overlayfs: fix incorrect mnt_id of files opened from map_files
  * Audio mute key (f5) LED and Mic mute key (f8) LED are no function on HP
    440/450/640/650 G9 (LP: #1982716)
    - ALSA: hda/realtek: fix mute/micmute LEDs for HP machines

 -- Emil Renner Berthing <email address hidden> Fri, 19 Aug 2022 13:26:23 +0200

Changed in linux-allwinner-5.17 (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux-starfive-5.17 - 5.17.0-1007.8

---------------
linux-starfive-5.17 (5.17.0-1007.8) jammy; urgency=medium

  * jammy/linux-starfive-5.17: 5.17.0-1007.8 -proposed tracker (LP: #1983906)

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

  * GPIO character device v1 API not enabled in kernel (LP: #1953613)
    - [Config] Enable CONFIG_GPIO_CDEV_V1

  [ Ubuntu: 5.17.0-8.8~22.04.8 ]

  * jammy/linux-hwe-5.17: 5.17.0-8.8~22.04.8 -proposed tracker (LP: #1983907)
  * Packaging resync (LP: #1786013)
    - debian/dkms-versions -- update from kernel-versions (main/2022.08.08)
  * GPIO character device v1 API not enabled in kernel (LP: #1953613)
    - [Config] Enable CONFIG_GPIO_CDEV_V1
  * refactoring of overlayfs fix to properly support shiftfs (LP: #1983640)
    - SAUCE: for aufs mmap: print the virtual file path
    - SAUCE: overlayfs: fix incorrect mnt_id of files opened from map_files
  * Audio mute key (f5) LED and Mic mute key (f8) LED are no function on HP
    440/450/640/650 G9 (LP: #1982716)
    - ALSA: hda/realtek: fix mute/micmute LEDs for HP machines

 -- Emil Renner Berthing <email address hidden> Fri, 19 Aug 2022 14:15:18 +0200

Changed in linux-starfive-5.17 (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux - 5.19.0-15.15

---------------
linux (5.19.0-15.15) kinetic; urgency=medium

  * kinetic/linux: 5.19.0-15.15 -proposed tracker (LP: #1983335)

  * Miscellaneous Ubuntu changes
    - [Config] update annotations to support both gcc-11 and gcc-12

 -- Andrea Righi <email address hidden> Tue, 02 Aug 2022 09:23:01 +0200

Changed in linux (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote :

This bug is awaiting verification that the linux-lowlatency-hwe-5.15/5.15.0-48.54~20.04.1 kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-focal' to 'verification-done-focal'. If the problem still exists, change the tag 'verification-needed-focal' to 'verification-failed-focal'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

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

This bug is awaiting verification that the linux-hwe-5.15/5.15.0-48.54~20.04.1 kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-focal' to 'verification-done-focal'. If the problem still exists, change the tag 'verification-needed-focal' to 'verification-failed-focal'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

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

This bug is awaiting verification that the linux-nvidia/5.15.0-1006.6 kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-jammy' to 'verification-done-jammy'. If the problem still exists, change the tag 'verification-needed-jammy' to 'verification-failed-jammy'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

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

This bug is awaiting verification that the linux-oem-5.17/5.17.0-1017.18 kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-jammy' to 'verification-done-jammy'. If the problem still exists, change the tag 'verification-needed-jammy' to 'verification-failed-jammy'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

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

This bug is awaiting verification that the linux-nvidia/5.15.0-1007.7 kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-jammy' to 'verification-done-jammy'. If the problem still exists, change the tag 'verification-needed-jammy' to 'verification-failed-jammy'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

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

This bug is awaiting verification that the linux-gkeop-5.15/5.15.0-1003.5~20.04.2 kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-focal' to 'verification-done-focal'. If the problem still exists, change the tag 'verification-needed-focal' to 'verification-failed-focal'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

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.