Skip to content

Commit

Permalink
led-daemon: use different GPIO base for each platform
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilioPeJu committed May 20, 2021
1 parent 11f4cbd commit f25cb3b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions rootfs/led-daemon/led-daemon
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,19 @@ GRAIN=100000 # Our timing granularity: 100ms in microseconds
# LED initialisation

# The LED GPIO numbers are determined from the physical GPIO numbers (50 for the
# STA status LED, 51 for the DIA diagnostic LED), but an offset of 906 is added
# STA status LED, 51 for the DIA diagnostic LED), but an offset is added
# for somewhat mysterious reasons.
GPIO_BASE=906
ZYNQ_GPIO_BASE=906
ZYNQMP_GPIO_BASE=338
if [ -e /sys/class/gpio/gpiochip${ZYNQ_GPIO_BASE} ]; then
GPIO_BASE=${ZYNQ_GPIO_BASE}
elif [ -e /sys/class/gpio/gpiochip${ZYNQMP_GPIO_BASE} ]; then
GPIO_BASE=${ZYNQMP_GPIO_BASE}
else
echo "Unknown GPIO chip"
exit -1
fi

STA_LED_GPIO=$((GPIO_BASE + 51))
DIA_LED_GPIO=$((GPIO_BASE + 50))

Expand Down

0 comments on commit f25cb3b

Please sign in to comment.