I'm using a Raspberry Pi 4 with standard 32 bit Raspbian. I'm trying to write a driver in c that writes AT commands to some GPIO pins and reads the response from other pins. For that I want to use the open() and write() commands from Linux onto a character device f.e. /dev/gpio or similar.
However these devices do not exist, all I could find so far was /dev/gpiochip0 and /dev/gpiochip1 but no gpiohip2 or beyond. I've looked for some source codes which seems to suggest that a character device for each pin should exist (or did exist in the past...), but no matter where (/dev/, /sys/class/gpio/, /sys/bus/gpio/devices/) I look there are a maximum of two pins represented as char devices.
One of the codes that I found was: https://elinux.org/RPi_GPIO_Code_Samples
snprintf(path, DIRECTION_MAX, "/sys/class/gpio/gpio%d/direction", pin); fd = open(path, O_WRONLY);
where the path on my Raspbian only contains a link to "gpiochip0" and "gpiochip504" folders, neither of which contain a file called direction.
I'm guessing that either I have to activate something to make the char devices appear or use a different access method for each pin. How can I write or read from a specific GPIO pin in from a kernel-module?