diff --git a/tcl/interface/raspberrypi5-gpiod.cfg b/tcl/interface/raspberrypi5-gpiod.cfg index 9624ad511..03f3fdb6e 100644 --- a/tcl/interface/raspberrypi5-gpiod.cfg +++ b/tcl/interface/raspberrypi5-gpiod.cfg @@ -18,11 +18,19 @@ proc read_file { name } { return $result } +proc find_rp1_alias {} { + foreach f [glob -directory "/proc/device-tree/aliases" "gpio\[0-9\]"] { + if {[string match "*/rp1/*" [read_file $f]]} { + return $f + } + } +} + set pcie_aspm [read_file /sys/module/pcie_aspm/parameters/policy] if {![string match {*\[performance\]*} $pcie_aspm]} { echo "Warn : Switch PCIe power saving off or the first couple of pulses gets clocked as fast as 20 MHz" echo "Warn : Issue 'echo performance | sudo tee /sys/module/pcie_aspm/parameters/policy'" } -set GPIO_CHIP 4 +set GPIO_CHIP [string index [find_rp1_alias] end] source [find interface/raspberrypi-gpio-connector.cfg]