summaryrefslogtreecommitdiff
path: root/recipes-bsp/multitech/mts-io
diff options
context:
space:
mode:
authorMike Nicholson <mike.nicholson@multitech.com>2020-08-28 17:33:51 -0500
committerJohn Klug <john.klug@multitech.com>2020-11-11 17:25:19 -0600
commit9174ff8cd8010f581c7a2dbafea8323af388aa6d (patch)
tree15a40e4cd7d1b541a317e7fcdfa9926af19b7805 /recipes-bsp/multitech/mts-io
parent62d0bc428cedf48e8000b7b161b90ae1a089c008 (diff)
downloadmeta-multitech-9174ff8cd8010f581c7a2dbafea8323af388aa6d.tar.gz
meta-multitech-9174ff8cd8010f581c7a2dbafea8323af388aa6d.tar.bz2
meta-multitech-9174ff8cd8010f581c7a2dbafea8323af388aa6d.zip
Add mt-dt-overlay to support GPS PPS on mtcap
Diffstat (limited to 'recipes-bsp/multitech/mts-io')
-rw-r--r--recipes-bsp/multitech/mts-io/mts-io.mtcap.init24
1 files changed, 24 insertions, 0 deletions
diff --git a/recipes-bsp/multitech/mts-io/mts-io.mtcap.init b/recipes-bsp/multitech/mts-io/mts-io.mtcap.init
index e54dd2f..2642de9 100644
--- a/recipes-bsp/multitech/mts-io/mts-io.mtcap.init
+++ b/recipes-bsp/multitech/mts-io/mts-io.mtcap.init
@@ -4,6 +4,9 @@ sysdir=/sys/devices/platform/mts-io
i2c=/sys/bus/i2c/devices/
+DEVTREE="/sys/kernel/config/device-tree/overlays/"
+SYSFS="/usr/sbin/mts-io-sysfs"
+
setwificap() {
WIFICAP=0
if [[ -f ${sysdir}/capability/wifi ]] && (($(cat ${sysdir}/capability/wifi) == 1)) ; then
@@ -60,6 +63,26 @@ start_lora_led_updater() {
lora-led-updater &
}
+setdevtree() {
+ hw=$(${SYSFS} show hw-version)
+
+ # add device tree overlays, if they exist.
+ [[ -d /lib/dtoverlays ]] || return 1
+ (
+ cd /lib/dtoverlays
+ for f in $(ls ${hw}*) ; do
+ if ! [[ -d ${DEVTREE} ]] ; then
+ mount configfs
+ fi
+ f1=${f/#${hw}-/}
+ f2=${f1/%.dtbo}
+ # f2 is the extracted device name
+ /bin/mkdir ${DEVTREE}/$f2
+ /bin/cat $f >${DEVTREE}/$f2/dtbo
+ done
+ )
+}
+
case $1 in
start)
# SPI driver for LoRa
@@ -71,6 +94,7 @@ case $1 in
# Point the firmware API at our i2c EEPROMs
echo -n ${i2c} > /sys/module/firmware_class/parameters/path
modprobe mts_io
+ setdevtree
setwificap
wifi_init1
lora_init