libgpio-tools

  • Hi,


    I am using fsimx6-Y2024.04 Release, which should have kernel version 5.15.


    I want to use the GPIOs, as shown in the documentation "Linux on FS Boards", page 134.


    The way of using /sys/class/gpio is marked as deprecated for kernel version 5.15, and I am told to use libgpio-tools and gpiodetect instead.


    But this package and the command are not available in my built image.


    Do I need to install it when building the image with yocto?


    Thanks!

  • Hi,


    the issue is resolved by using the package libgpiod by libgpiod in Yocto (interelectronix.com).

    Here, it is decreibed how to install the package in y Yocto build.


    My goal is, to use the GPIOs 65 (SD_B_DAT2), 67 (SD_B_DAT3), 77 (SD_B_DAT0), and 79 (SD_B_DAT1) for controlling the shutdown control, mute control and gain signals for an external audio channel (on a custom baseboard, not the SINTF), which shall output audio files to an exciter.


    The GPIOs numbered earlier are being used by the SD_B SD card port, hence, I have commendted out the defines in the device tree source file, by using a patch:


    Code
    1. /*
    2. * SD_B - External SD port with Card Detect (CD) and Write Protect (WP)
    3. * On efus SKIT: external port is normal-sized SD card slot with CD and WP
    4. */
    5. //#define CONFIG_EFUSA9_SD_B
    6. //#define CONFIG_EFUSA9_SD_B_CD
    7. //#define CONFIG_EFUSA9_SD_B_WP

    Using /sys/class/gpio, to manually set the GPIOs did not do the trick, I believe, because it is deprecated in kernel versions 5.15.


    However, the GPIO reference card (for both, efusa9 and efusa9r2) do not provide the mapping between the gpiochip# numbers and lines printed by

    Code
    1. $ gpioinfo

    and the actual GPIO pins on the board, rather only the mapping for using /sys/class/gpio.


    I have attached the output of my gpioinfo command to this post.


    How is the mapping between the GPIOs and the gpiochip# numbers and lines done for this package, e.g., what J1 pin corresponds to which gpiochip and line?

  • Hello,


    I have overseen the part in the docs, where the mapping between the J1 pins and the GPIOs is done. This works fine now.

    Quote

    Example

    On PicoCoreMX8MP, use pin GPIO_1_54 on feature connector as output pin. This is pin 54

    on the PicoCoreBBDSI connector J1, also available on pin 8 of the feature connector J11 on

    the PicoCoreBBDSI SKIT. The “GPIO Reference Card” for PicoCoreMX8MP in the row GPIO

    the GPIO1_IO1 which means that this GPIO is on gpiochip1 the IO number 1.

    However, setting GPIOs HIGH or LOW is not working with the libgpiod toolI have installed. I checked the version, and it is v1.6.3.


    With what version of the libgpiod tool has the eFusA9R2Q been tested?


    Tah!

  • Hello,

    please excuse the late answer.

    Could you post the exact gpiod command, you are using?


    Did you make sure, that the pins, you are trying to use, are routed to GPIO in device tree?

    You might have to to thisis additionally, because not all pins are routed to GPIO by default.


    For example for for muxing the SD_B DATA pads to GPIO with a 100k internal pullup you would have to add the following node to your DTS

    You can find the pin muxing macros at

    https://github.com/FSEmbedded/…/boot/dts/imx6q-pinfunc.h

    For information on the pad settings, please see

    https://github.com/FSEmbedded/…l/fsl%2Cimx6q-pinctrl.txt



    Your F&S Support Team

  • Hi,


    than ks for the answer, I could resolve the issue by defining the relevant pins as LED GPIOs in the efusa9qdl.dtsi file, which I can then toggle via sysfs:

    and then assigning the pin control:



    This works good. The issue can be regarded as resolved, but I will consider and try using gpiohog, to have them in /sys/class/gpio rather than /sys/class/led. Thanks!