The "driver" that can only work with v5 for now, is me.
I am following a workshop of 30+ lessons, with examples of how to write LKM (Loadable Kernel Module) drivers for Raspberry Pi. Doing that to learn more about the Linux kernel in general, and hardware drivers in particular. The classes are for v5 kernel, and they do not apply any more for v6 kernel.
The GPIO access has changed in the last year 2-3 times. With the v6 kernel, there is now a different interface, with different function names, different functionality of the callback functions, and different mechanisms of requesting and handling hardware pins (GPIO, I2C, SPI, etc.). If a driver was written using gpio pins the old style, there are zero chances for the same code to work in kernel v6, without rewriting the driver.
Due to the history of GPIO interfaces in the kernel, there are two different ways to obtain and use GPIOs:
- The descriptor-based interface is the preferred way to manipulate GPIOs, and is described by all the files in this directory excepted Legacy GPIO Interfaces.
- The legacy integer-based interface which is considered deprecated (but still usable for compatibility reasons) is documented in Legacy GPIO Interfaces.
The remainder of this document applies to the new descriptor-based interface. Legacy GPIO Interfaces contains the same information applied to the legacy integer-based interface.
Quote from:
https://www.kernel.org/doc/html/latest/driver-api/gpio/intro.htmlThey say the old style is still usable, but I've tried for my RPi and drivers that worked with kernel v5 do not work in v6. Some examples do not even compile, other examples compile but give runtime errors.
To make things even more confusing, while the old style of accessing gpio pins was already removed from v6, there is still in place a mocking interface with the old function names, but they do not work, the mocking old style function names are there only to emit compilation warnings.
TL;DR would like to use kernel v5 during the workshop, to avoid any doubt when eventual errors appear. Once I get a better understanding of how the kernel interacts with the rest of the hardware and software, I will rewrite the workshop examples for the new gpio style, as an exercise. Or, at least that's the plan.