libgpiod icon indicating copy to clipboard operation
libgpiod copied to clipboard

Trouble accessing pin infos on Dragonboard 410C

Open jpelletier opened this issue 4 months ago • 11 comments

On the Dragonboard 410C, the function gpiod_chip_get_line_info can't access any of the pins of /dev/gpiochip0.

It can open the chip (gpiod_chip_open) and get the info (gpiod_chip_get_info). Hardware works fine. Code is ran as sudo.

Tried with 0 to 121, 390 to 511; same result.

Linux linaro 5.9.0-qcomlt-arm64 #138 SMP PREEMPT Sat Nov 21 00:47:13 UTC 2020 aarch64 GNU/Linux

PRETTY_NAME="Debian GNU/Linux forky/sid" NAME="Debian GNU/Linux" VERSION_CODENAME=forky ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"

libgpiod API version 2.2.1

jpelletier avatar Aug 17 '25 00:08 jpelletier

I need more info, strace logs, the exact code you're running, what the error is etc.

brgl avatar Aug 25 '25 12:08 brgl

I use 'linaro' for user name. I added a group 'gpiod' in /etc/group and added user 'linaro' to it. In fact there was many changes to the GPIO systems, but none worked with my setup no matter how the GPIO pin was specified, it always was inaccessible.

The hardware was brand new and no mishaps happened. I believe the hardware is all right.

The code is a modification of the example provided with the source of libgpiod. get_line_info.c.gz

My code just does very basic API calls and display the error in case of failure. I believe I made the API calls in a correct sequence by looking at the examples.

Here's the messages displayed when running: run-example.txt

Here is the trace: strace.log.gz

I used this board to use with the 'Internet of Things' courses at Coursera a few years ago. It was a show stopper for me. I hope the problems will be solved soon.

Thank you very much!

jpelletier avatar Aug 25 '25 18:08 jpelletier

So I'm running the same board and getting this:

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd030]
[    0.000000] Linux version 6.17.0-rc3-next-20250825 (brgl@brgl-build) (aarch64-linux-gnu-gcc (Ubuntu 14.2.0-19ubuntu2) 14.2.0, GNU ld (GNU Binutils for Ubuntu) 2.44) #105 SMP PREEMPT Mon Aug 25 18:36:07 CEST 2025
[    0.000000] KASLR disabled due to lack of seed
[    0.000000] Machine model: Qualcomm Technologies, Inc. APQ 8016 SBC
[snip]
root@qcom-armv8a:~# gpiodetect 
gpiochip0 [1000000.pinctrl] (122 lines)
gpiochip1 [200f000.spmi:pmic@0:mpps@a000] (4 lines)
gpiochip2 [200f000.spmi:pmic@0:gpio@c000] (4 lines)
root@qcom-armv8a:~# gpioinfo -c gpiochip0
gpiochip0 - 122 lines:
        line   0:       "[UART0_TX]"            input
        line   1:       "[UART0_RX]"            input
        line   2:       "[UART0_CTS_N]"         input
        line   3:       "[UART0_RTS_N]"         input
        line   4:       "[UART1_TX]"            output
        line   5:       "[UART1_RX]"            output
        line   6:       "[I2C0_SDA]"            input
        line   7:       "[I2C0_SCL]"            input
        line   8:       "[SPI1_DOUT]"           input
        line   9:       "[SPI1_DIN]"            input
        line  10:       "[SPI1_CS]"             input
        line  11:       "[SPI1_SCLK]"           input
        line  12:       "GPIO-B"                input
        line  13:       "GPIO-C"                input
        line  14:       "[I2C3_SDA]"            input
        line  15:       "[I2C3_SCL]"            input
        line  16:       "[SPI0_MOSI]"           input
        line  17:       "[SPI0_MISO]"           input
        line  18:       "[SPI0_CS_N]"           input
        line  19:       "[SPI0_CLK]"            input
        line  20:       "HDMI_HPD_N"            input
        line  21:       "USR_LED_1_CTRL"        output consumer="apq8016-sbc:green:user1"
        line  22:       "[I2C1_SDA]"            input
        line  23:       "[I2C1_SCL]"            input
        line  24:       "GPIO-G"                input
        line  25:       "GPIO-H"                input
        line  26:       "[CSI0_MCLK]"           input
        line  27:       "[CSI1_MCLK]"           input
        line  28:       "GPIO-K"                input
        line  29:       "[I2C2_SDA]"            input
        line  30:       "[I2C2_SCL]"            input
        line  31:       "DSI2HDMI_INT_N"        input
        line  32:       "DSI_SW_SEL_APQ"        output consumer="pd"
        line  33:       "GPIO-L"                input
        line  34:       "GPIO-J"                input
        line  35:       "GPIO-I"                input
        line  36:       "GPIO-A"                input
        line  37:       "FORCED_USB_BOOT"       input
        line  38:       "SD_CARD_DET_N"         input active-low consumer="cd"
        line  39:       "[WCSS_BT_SSBI]"        input
        line  40:       "[WCSS_WLAN_DATA_2]"    input
        line  41:       "[WCSS_WLAN_DATA_1]"    input
        line  42:       "[WCSS_WLAN_DATA_0]"    input
        line  43:       "[WCSS_WLAN_SET]"       input
        line  44:       "[WCSS_WLAN_CLK]"       input
        line  45:       "[WCSS_FM_SSBI]"        input
        line  46:       "[WCSS_FM_SDI]"         input
        line  47:       "[WCSS_BT_DAT_CTL]"     input
        line  48:       "[WCSS_BT_DAT_STB]"     input
        line  49:       "NC"                    input
        line  50:       "NC"                    input
        line  51:       "NC"                    input
        line  52:       "NC"                    input
        line  53:       "NC"                    input
        line  54:       "NC"                    input
        line  55:       "NC"                    input
        line  56:       "NC"                    input
        line  57:       "NC"                    input
        line  58:       "NC"                    input
        line  59:       "NC"                    input
        line  60:       "NC"                    input
        line  61:       "NC"                    input
        line  62:       "NC"                    input
        line  63:       "[CDC_PDM0_CLK]"        input
        line  64:       "[CDC_PDM0_SYNC]"       input
        line  65:       "[CDC_PDM0_TX0]"        input
        line  66:       "[CDC_PDM0_RX0]"        input
        line  67:       "[CDC_PDM0_RX1]"        input
        line  68:       "[CDC_PDM0_RX2]"        input
        line  69:       "GPIO-D"                input
        line  70:       "NC"                    input
        line  71:       "NC"                    input
        line  72:       "NC"                    input
        line  73:       "NC"                    input
        line  74:       "NC"                    input
        line  75:       "NC"                    input
        line  76:       "NC"                    input
        line  77:       "NC"                    input
        line  78:       "NC"                    input
        line  79:       "NC"                    input
        line  80:       "BOOT_CONFIG_0"         input
        line  81:       "BOOT_CONFIG_1"         input
        line  82:       "BOOT_CONFIG_2"         input
        line  83:       "BOOT_CONFIG_3"         input
        line  84:       "NC"                    input
        line  85:       "NC"                    input
        line  86:       "BOOT_CONFIG_5"         input
        line  87:       "NC"                    input
        line  88:       "NC"                    input
        line  89:       "NC"                    input
        line  90:       "NC"                    input
        line  91:       "NC"                    input
        line  92:       "NC"                    input
        line  93:       "NC"                    input
        line  94:       "NC"                    input
        line  95:       "NC"                    input
        line  96:       "NC"                    input
        line  97:       "NC"                    input
        line  98:       "NC"                    input
        line  99:       "NC"                    input
        line 100:       "NC"                    input
        line 101:       "NC"                    input
        line 102:       "NC"                    input
        line 103:       "NC"                    input
        line 104:       "SSBI_GPS"              input
        line 105:       "NC"                    input
        line 106:       "NC"                    input
        line 107:       "KEY_VOLP_N"            input active-low consumer="Volume Up"
        line 108:       "NC"                    input
        line 109:       "NC"                    input
        line 110:       "[LS_EXP_MI2S_WS]"      input
        line 111:       "NC"                    input
        line 112:       "NC"                    input
        line 113:       "[LS_EXP_MI2S_SCK]"     input
        line 114:       "[LS_EXP_MI2S_DATA0]"   input
        line 115:       "GPIO-E"                input
        line 116:       "NC"                    input
        line 117:       "[DSI2HDMI_MI2S_WS]"    input
        line 118:       "[DSI2HDMI_MI2S_SCK]"   input
        line 119:       "[DSI2HDMI_MI2S_DATA0]" input
        line 120:       "USR_LED_2_CTRL"        output consumer="apq8016-sbc:green:user2"
        line 121:       "SB_HS_ID"              input consumer="id"

As you can see, everything works fine. Can you check if the same commands give you errors?

brgl avatar Aug 25 '25 18:08 brgl

Here's what I get: linaro@linaro:/usr/local$ sudo gpiodetect gpiochip0 [1000000.pinctrl] (122 lines) gpiochip1 [200f000.spmi:pm8916@0:gpios@c00] (4 lines) gpiochip2 [200f000.spmi:pm8916@0:mpps@a000] (4 lines)

linaro@linaro:/usr/local$ sudo gpioinfo -c gpiochip0 gpioinfo: unable to read info for line 0 from gpiochip0: Invalid argument linaro@linaro:/usr/local$

linaro@linaro:/usr/local$ sudo su

root@linaro:/usr/local# gpiodetect gpiochip0 [1000000.pinctrl] (122 lines) gpiochip1 [200f000.spmi:pm8916@0:gpios@c00] (4 lines) gpiochip2 [200f000.spmi:pm8916@0:mpps@a000] (4 lines)

root@linaro:/usr/local# gpioinfo -c gpiochip0 gpioinfo: unable to read info for line 0 from gpiochip0: Invalid argument root@linaro:/usr/local#

jpelletier avatar Aug 25 '25 18:08 jpelletier

Here's the strace for gpioinfo:

gpioinfo.log

jpelletier avatar Aug 25 '25 19:08 jpelletier

Here's the strace for gpioinfo:

gpioinfo.log

Ok, so there's an EINVAL coming out from the kernel, the user-space part looks fine (as long as you have not modified libgpiod?). Are you capable of adding some logs to the kernel driver and recompiling it?

brgl avatar Aug 25 '25 19:08 brgl

I have not modified libgpiod in any way. For adding logs to the kernel driver, I don't know how to do that. I will need help for that. However, there's not much space left.

linaro@linaro:/var$ df -h Filesystem Size Used Avail Use% Mounted on udev 434M 0 434M 0% /dev tmpfs 92M 7.9M 84M 9% /run /dev/mmcblk0p14 6.7G 5.2G 1.2G 82% / tmpfs 457M 0 457M 0% /dev/shm tmpfs 457M 0 457M 0% /tmp tmpfs 92M 20K 92M 1% /run/user/1000

jpelletier avatar Aug 25 '25 19:08 jpelletier

I tried to upgrade the kernel but I get error messages:

linaro@linaro:/var$ sudo apt modernize-sources The following files need modernizing:

  • /etc/apt/sources.list
  • /etc/apt/sources.list.d/linaro.list

Modernizing will replace .list files with the new .sources format, add Signed-By values where they can be determined automatically, and save the old files into .list.bak files.

This command supports the 'signed-by' and 'trusted' options. If you have specified other options inside [] brackets, please transfer them manually to the output files; see sources.list(5) for a mapping.

For a simulation, respond N in the following prompt. Rewrite 2 sources? [Y/n] y Modernizing /etc/apt/sources.list...

  • Writing /etc/apt/sources.list.d/debian.sources

Modernizing /etc/apt/sources.list.d/linaro.list...

  • Writing /etc/apt/sources.list.d/linaro.sources Warning: Could not determine Signed-By for URIs: http://obs.linaro.org/linaro-overlay-sid/sid/, Suites: ./

linaro@linaro:/var$ sudo apt update Hit:1 http://deb.debian.org/debian sid InRelease Ign:2 http://obs.linaro.org/linaro-overlay-sid/sid ./ InRelease Get:3 http://obs.linaro.org/linaro-overlay-sid/sid ./ Release [995 B] Err:4 http://obs.linaro.org/linaro-overlay-sid/sid ./ Release.gpg Sub-process /usr/bin/sqv returned an error code (1), error message is: Signing key on C1E0C2C7E2474F76C17FE8ABC32DA102AD89C2BE is not bound: Policy rejected asymmetric algorithm because: DSA2048 is not considered secure since 2024-02-01T00:00:00Z Fetched 995 B in 2s (544 B/s) 133 packages can be upgraded. Run 'apt list --upgradable' to see them. Warning: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. OpenPGP signature verification failed: http://obs.linaro.org/linaro-overlay-sid/sid ./ Release: Sub-process /usr/bin/sqv returned an error code (1), error message is: Signing key on C1E0C2C7E2474F76C17FE8ABC32DA102AD89C2BE is not bound: Policy rejected asymmetric algorithm because: DSA2048 is not considered secure since 2024-02-01T00:00:00Z Warning: Failed to fetch http://obs.linaro.org/linaro-overlay-sid/sid/./Release.gpg Sub-process /usr/bin/sqv returned an error code (1), error message is: Signing key on C1E0C2C7E2474F76C17FE8ABC32DA102AD89C2BE is not bound: Policy rejected asymmetric algorithm because: DSA2048 is not considered secure since 2024-02-01T00:00:00Z Warning: Some index files failed to download. They have been ignored, or old ones used instead. Notice: Missing Signed-By in the sources.list(5) entry for 'http://obs.linaro.org/linaro-overlay-sid/sid'

jpelletier avatar Aug 25 '25 20:08 jpelletier

Oh, I only now noticed how old your kernel is. It probably doesn't even support libgpiod v2. I can't help you with upgrading, this is outside of the scope of this project but I'm sure once you do, all will work fine. I test linux-next on the same board.

brgl avatar Aug 26 '25 09:08 brgl

Thanks for your help! What kernel version should I look for upgrading the distro?

jpelletier avatar Aug 26 '25 14:08 jpelletier

This board is supported in mainline so you're good with any recent stable release really.

brgl avatar Aug 26 '25 17:08 brgl