diff options
author | Oleksandr Suvorov <oleksandr.suvorov@toradex.com> | 2020-08-06 16:05:22 +0300 |
---|---|---|
committer | Max Krummenacher <max.krummenacher@toradex.com> | 2020-09-14 09:46:55 +0200 |
commit | 9f8dd1c4ff62bee44dd3e99d0f46f812787b8eb2 (patch) | |
tree | 833d91c2f9042ff27aa22837fcd477726a026edd /recipes-core/udev/files/colibri-imx7-emmc | |
parent | 9629e9a7ff89ebf6d6ca62d94fc0980647bbb8fd (diff) |
colibri-imx7: udev: add symlink to adc raw data
Create symlinks for each supported by Colibri iMX7/iMX7-eMMC
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>
(cherry picked from commit f627f20a298d441b5d94ba4ab80a1121065f1f75)
Diffstat (limited to 'recipes-core/udev/files/colibri-imx7-emmc')
-rw-r--r-- | recipes-core/udev/files/colibri-imx7-emmc/99-toradex.rules | 1 | ||||
-rwxr-xr-x | recipes-core/udev/files/colibri-imx7-emmc/toradex-adc.sh | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/recipes-core/udev/files/colibri-imx7-emmc/99-toradex.rules b/recipes-core/udev/files/colibri-imx7-emmc/99-toradex.rules index 2681e77..707920e 100644 --- a/recipes-core/udev/files/colibri-imx7-emmc/99-toradex.rules +++ b/recipes-core/udev/files/colibri-imx7-emmc/99-toradex.rules @@ -8,3 +8,4 @@ ACTION=="add", SUBSYSTEM=="spidev", KERNELS=="30840000.*spi", SYMLINK+="colibri- KERNEL=="mmcblk[0-9]", ENV{DEVTYPE}=="disk", KERNELS=="30b60000.usdhc", SYMLINK+="emmc" KERNEL=="mmcblk[0-9]boot[0-9]", ENV{DEVTYPE}=="disk", KERNELS=="30b60000.usdhc", SYMLINK+="emmc-boot%n" KERNEL=="mmcblk[0-9]p[0-9]", ENV{DEVTYPE}=="partition", KERNELS=="30b60000.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-imx7-emmc/toradex-adc.sh b/recipes-core/udev/files/colibri-imx7-emmc/toradex-adc.sh new file mode 100755 index 0000000..0c102b4 --- /dev/null +++ b/recipes-core/udev/files/colibri-imx7-emmc/toradex-adc.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env sh +# +# Called from udev. Compatible to colibri-imx7-emmc. +# +# Create/remove symlinks to/from the files with raw ain data. + +# Map the ADC lines: +# colibri-ain{0..3} -> ADC1_IN{0,1,2,3} +LINES=4 +START=0 + +if [ "$ACTION" = "add" ]; then + for idx in `seq 0 $((LINES-1))`; do + ln -s "/sys$DEVPATH/in_voltage$((START+idx))_raw" /dev/colibri-ain$idx + done +elif [ "$ACTION" = "remove" ]; then + for idx in `seq 0 $((LINES-1))`; do + rm -f /dev/colibri-ain$idx + done +fi + |