diff options
author | Oleksandr Suvorov <oleksandr.suvorov@toradex.com> | 2020-08-06 15:29:32 +0300 |
---|---|---|
committer | Oleksandr Suvorov <oleksandr.suvorov@toradex.com> | 2020-08-10 13:11:02 +0300 |
commit | 6ba70eb580167611f8a5b061a9552eba25b34d6c (patch) | |
tree | f8d15c2f161c8b305e8e4cdfd517e4a8a02575ce /recipes-core | |
parent | f627f20a298d441b5d94ba4ab80a1121065f1f75 (diff) |
colibri-imx8x: udev: add symlink to adc raw data
Create symlinks for each supported by Colibri iMX6 ADC channels,
standardizing names as colibri-ainX, according to the Colibri signal
names table.
Related-to: ELB-2839
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Diffstat (limited to 'recipes-core')
-rw-r--r-- | recipes-core/udev/files/colibri-imx8x/99-toradex.rules | 1 | ||||
-rwxr-xr-x | recipes-core/udev/files/colibri-imx8x/toradex-adc.sh | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/recipes-core/udev/files/colibri-imx8x/99-toradex.rules b/recipes-core/udev/files/colibri-imx8x/99-toradex.rules index b2ac268..e06fb5a 100644 --- a/recipes-core/udev/files/colibri-imx8x/99-toradex.rules +++ b/recipes-core/udev/files/colibri-imx8x/99-toradex.rules @@ -8,3 +8,4 @@ ACTION=="add", SUBSYSTEM=="spidev", KERNELS=="5a020000.lpspi", SYMLINK+="colibri KERNEL=="mmcblk[0-9]", ENV{DEVTYPE}=="disk", KERNELS=="5b010000.usdhc", SYMLINK+="emmc" KERNEL=="mmcblk[0-9]boot[0-9]", ENV{DEVTYPE}=="disk", KERNELS=="5b010000.usdhc", SYMLINK+="emmc-boot%n" KERNEL=="mmcblk[0-9]p[0-9]", ENV{DEVTYPE}=="partition", KERNELS=="5b010000.usdhc", SYMLINK+="emmc-part%n" +SUBSYSTEM=="iio", KERNELS=="iio:device0", RUN+="/etc/udev/scripts/toradex-adc.sh" diff --git a/recipes-core/udev/files/colibri-imx8x/toradex-adc.sh b/recipes-core/udev/files/colibri-imx8x/toradex-adc.sh new file mode 100755 index 0000000..143dfea --- /dev/null +++ b/recipes-core/udev/files/colibri-imx8x/toradex-adc.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env sh +# +# Called from udev. Compatible to colibri-imx8x. +# +# Create/remove symlinks to/from the files with raw ain data. + +# Map the ADC lines: +# colibri-ain{0..3} -> ADMA.ADC.IN{0,1,4,5} + +if [ "$ACTION" = "add" ]; then + ln -s "/sys$DEVPATH/in_voltage0_raw" /dev/colibri-ain0 + ln -s "/sys$DEVPATH/in_voltage1_raw" /dev/colibri-ain1 + ln -s "/sys$DEVPATH/in_voltage4_raw" /dev/colibri-ain2 + ln -s "/sys$DEVPATH/in_voltage5_raw" /dev/colibri-ain3 +elif [ "$ACTION" = "remove" ]; then + rm -f /dev/colibri-ain0 + rm -f /dev/colibri-ain1 + rm -f /dev/colibri-ain2 + rm -f /dev/colibri-ain3 +fi + |