@gadgetoid Strict mode, which prevents a pin for being claimed for GPIO and an alternate function at the same time, requires two things to enable it: a flag in the pinctrl controller driver, and a "gpio-ranges" DT property telling the kernel the relationship between the GPIO controller and the pinmux controller. These can be quite complicated, but in our case on Pi 5 it is just anything that does the same as:That is worth adding by itself. The equivalents for the SoC GPIOs is more complex, but I could give it a go.
Adding the strict flags to the drivers (pinctrl-rp1 and pinctrl-bcm2712) is a one-line patch in each case, but there may be consequences. In the absence of strict mode, some overlays have been in the habit of requesting their GPIO pins to be explicitly pinmuxed as inputs or outputs, as well as requesting the GPIOs. This does not work in strict mode. Therefore in order to safely switch over one would need to update all the offending overlays, and that won't fix overlays that are burnt into HAT EEPROM - and those HATs would then fail.
It may not be as bad as I'm suggesting. If, after a careful audit, it doesn't look as though any in-tree HAT overlays are affected I may enable strict mode, at least on RP1/Pi 5.
Code:
&rp1_gpio { gpio-ranges = <&gpio 0 0 54>;};Adding the strict flags to the drivers (pinctrl-rp1 and pinctrl-bcm2712) is a one-line patch in each case, but there may be consequences. In the absence of strict mode, some overlays have been in the habit of requesting their GPIO pins to be explicitly pinmuxed as inputs or outputs, as well as requesting the GPIOs. This does not work in strict mode. Therefore in order to safely switch over one would need to update all the offending overlays, and that won't fix overlays that are burnt into HAT EEPROM - and those HATs would then fail.
It may not be as bad as I'm suggesting. If, after a careful audit, it doesn't look as though any in-tree HAT overlays are affected I may enable strict mode, at least on RP1/Pi 5.
Statistics: Posted by PhilE — Fri Mar 08, 2024 3:38 pm