Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional libgpiod support to linuxgpio #1299

Merged
merged 7 commits into from
Mar 21, 2023

Commits on Mar 16, 2023

  1. linuxgpio: rename all internal functions and variables to include "sy…

    …sfs"
    
    This commit renames the internal functions and variables of the linuxgpio
    pin driver to include "sysfs", to indicate that they're referring to
    the older sysfs interface.
    
    The following commits will add libgpiod support to the linuxgpio pin
    driver, and autoselect between them.
    SebKuzminsky committed Mar 16, 2023
    Configuration menu
    Copy the full SHA
    0ff4192 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a7bf91c View commit details
    Browse the repository at this point in the history
  3. linuxgpio: add optional libgpiod support

    The "linuxgpio" backend will now try both the old sysfs and new (since
    Linux 4.8) libgpiod interface to access gpio pins.  If libgpiod works
    it will use that, if it does not work it will fall back to the old
    sysfs interface.
    
    The libgpiod code is compiled in if libgpiod is available at build time,
    and compiled out otherwise.
    SebKuzminsky committed Mar 16, 2023
    Configuration menu
    Copy the full SHA
    cffd3c9 View commit details
    Browse the repository at this point in the history
  4. gpiod: find gpio lines by port ("gpiochipN") and offset (pin number)

    Before this commit, linuxgpio-gpiod used `gpiod_line_find()` to find
    gpio lines by name, and would construct the gpio name by appending the
    requested gpio number to the string "GPIO".  This had the advantage
    that it didn't have to specify the gpiochip to use, since gpio names are
    globally unique in gpiod-land.  But it has the severe drawback that only
    gpios whose name begins with "GPIO" could be used.
    
    This commit changes that to use `gpiod_line_get()` instead, which takes
    a gpiochip name (the avrdude "port") and an "offset" (the pin number on
    that chip).  This lets it use any available gpio line, no matter what
    name libgpiod assigned it.
    SebKuzminsky committed Mar 16, 2023
    Configuration menu
    Copy the full SHA
    3b93ecc View commit details
    Browse the repository at this point in the history
  5. add a new conntype for linuxgpio

    This also adds a default linuxgpio port ("gpiochip0"), and adds a
    programmer to the avrdude.conf file using linuxgpio from the Raspberry
    Pi GPIO port.
    SebKuzminsky committed Mar 16, 2023
    Configuration menu
    Copy the full SHA
    5abbefe View commit details
    Browse the repository at this point in the history
  6. avrdude.conf: move raspberry_pi_gpio reset, add prog_modes, reformat

    This makes the raspberry_pi_gpio programmer work on older Pis with the
    smaller 26-pin GPIO header.
    
    Updates based on code review by Hans (MCUdude).
    SebKuzminsky committed Mar 16, 2023
    Configuration menu
    Copy the full SHA
    bfb7955 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    2663fb4 View commit details
    Browse the repository at this point in the history