summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2020-11-26 17:43:06 +0100
committerMax Krummenacher <max.krummenacher@toradex.com>2020-11-26 18:29:03 +0100
commitdeabb60123ce2454694d643bdfb2ee7501888f7f (patch)
tree0f78b7165404494b8ea23e2542dba9a552a8b54b
parentb1d95a6bb125e5a84f8e02adf6f1df0552317c8b (diff)
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 <max.krummenacher@toradex.com>
-rw-r--r--recipes-core/udev/files/verdin-imx8mp/99-toradex.rules13
-rwxr-xr-xrecipes-core/udev/files/verdin-imx8mp/toradex-adc.sh21
2 files changed, 34 insertions, 0 deletions
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
+