From 250a6308016fb984e32b0e64e5be449d8b5d17a9 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Thu, 26 Nov 2020 17:43:06 +0100 Subject: verdin-imx8mp: udev: add symlink rules Create stable symlinks mapping Verdin family function names to the kernel device files. Related-to: ELB-3293 Signed-off-by: Max Krummenacher (cherry picked from commit deabb60123ce2454694d643bdfb2ee7501888f7f) --- .../udev/files/verdin-imx8mp/99-toradex.rules | 13 +++++++++++++ .../udev/files/verdin-imx8mp/toradex-adc.sh | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 recipes-core/udev/files/verdin-imx8mp/99-toradex.rules create mode 100755 recipes-core/udev/files/verdin-imx8mp/toradex-adc.sh diff --git a/recipes-core/udev/files/verdin-imx8mp/99-toradex.rules b/recipes-core/udev/files/verdin-imx8mp/99-toradex.rules new file mode 100644 index 0000000..f1554e2 --- /dev/null +++ b/recipes-core/udev/files/verdin-imx8mp/99-toradex.rules @@ -0,0 +1,13 @@ +ACTION=="add", KERNEL=="i2c-[0-9]*", ATTRS{name}=="30a50000.i2c", SYMLINK+="verdin-i2c1" +ACTION=="add", KERNEL=="i2c-[0-9]*", ATTRS{name}=="30a30000.i2c", SYMLINK+="verdin-i2c2" +ACTION=="add", KERNEL=="i2c-[0-9]*", ATTRS{name}=="30a40000.i2c", SYMLINK+="verdin-i2c4" +ACTION=="add", KERNEL=="i2c-[0-9]*", ATTRS{name}=="30a20000.i2c", SYMLINK+="verdin-i2c-on-module" +ACTION=="add", ATTRS{iomem_base}=="0x30860000", SYMLINK+="verdin-uart1" +ACTION=="add", ATTRS{iomem_base}=="0x30890000", SYMLINK+="verdin-uart2" +ACTION=="add", ATTRS{iomem_base}=="0x30880000", SYMLINK+="verdin-uart3" +ACTION=="add", KERNELS=="watchdog", SYMLINK+="verdin-watchdog" +ACTION=="add", SUBSYSTEM=="spidev", KERNELS=="30820000.ecspi", SYMLINK+="verdin-spi-cs%n" +KERNEL=="mmcblk[0-9]", ENV{DEVTYPE}=="disk", KERNELS=="30b60000.mmc", SYMLINK+="emmc" +KERNEL=="mmcblk[0-9]boot[0-9]", ENV{DEVTYPE}=="disk", KERNELS=="30b60000.mmc", SYMLINK+="emmc-boot%n" +KERNEL=="mmcblk[0-9]p[0-9]", ENV{DEVTYPE}=="partition", KERNELS=="30b60000.mmc", SYMLINK+="emmc-part%n" +SUBSYSTEM=="iio", KERNELS=="iio:device0", RUN+="/etc/udev/scripts/toradex-adc.sh" diff --git a/recipes-core/udev/files/verdin-imx8mp/toradex-adc.sh b/recipes-core/udev/files/verdin-imx8mp/toradex-adc.sh new file mode 100755 index 0000000..1591170 --- /dev/null +++ b/recipes-core/udev/files/verdin-imx8mp/toradex-adc.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env sh +# +# Called from udev. Compatible to verdin-imx8mp. +# +# Create/remove symlinks to/from the files with raw adc data. + +# Map the ADC lines: +# verdin-adc{1..4} -> TLA2024 ADC{3,2,1,0} + +if [ "$ACTION" = "add" ]; then + ln -s "/sys$DEVPATH/in_voltage0_raw" /dev/verdin-adc4 + ln -s "/sys$DEVPATH/in_voltage1_raw" /dev/verdin-adc3 + ln -s "/sys$DEVPATH/in_voltage2_raw" /dev/verdin-adc2 + ln -s "/sys$DEVPATH/in_voltage3_raw" /dev/verdin-adc1 +elif [ "$ACTION" = "remove" ]; then + rm -f /dev/verdin-adc1 + rm -f /dev/verdin-adc2 + rm -f /dev/verdin-adc3 + rm -f /dev/verdin-adc4 +fi + -- cgit v1.2.3