summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMykyta Dorokhin <mykyta.dorokhin@globallogic.com>2016-09-20 01:33:48 +0300
committerMykyta Dorokhin <mykyta.dorokhin@globallogic.com>2016-09-20 01:41:45 +0300
commitb5814feebe6315286cecbe23eea27f12e7dd0528 (patch)
tree859856f2423d5a80283d76762fb7940fea64580e
parenta82c71e9cef58863a6dbe0b38a30529f8389668e (diff)
downloadmeta-multitech-b5814feebe6315286cecbe23eea27f12e7dd0528.tar.gz
meta-multitech-b5814feebe6315286cecbe23eea27f12e7dd0528.tar.bz2
meta-multitech-b5814feebe6315286cecbe23eea27f12e7dd0528.zip
mtp: graceful restart of the cellular radio and lora chip reset.
-rw-r--r--recipes-bsp/multitech/mts-io.inc8
-rw-r--r--recipes-bsp/multitech/mts-io/mts-io.mtp.init30
2 files changed, 36 insertions, 2 deletions
diff --git a/recipes-bsp/multitech/mts-io.inc b/recipes-bsp/multitech/mts-io.inc
index 5f17458..6d77e34 100644
--- a/recipes-bsp/multitech/mts-io.inc
+++ b/recipes-bsp/multitech/mts-io.inc
@@ -15,6 +15,7 @@ SRC_URI = " \
git://git.multitech.net/mts-io.git;protocol=git \
file://led-status_heartbeat_trigger \
file://mts-io.init \
+ file://mts-io.mtp.init \
file://radio-reset.init \
file://radio-reset.default \
"
@@ -84,7 +85,10 @@ fakeroot do_install () {
install -m 0644 ${WORKDIR}/radio-reset.default ${D}${sysconfdir}/default/radio-reset
}
-# disable radio-reset for the mtp hardware
-do_install_append_mtp() {
+fakeroot do_install_append_mtp() {
+ # install MTP mts-io init script
+ install -m 0755 ${WORKDIR}/mts-io.mtp.init ${D}${sysconfdir}/init.d/mts-io
+
+ # disable radio-reset for the mtp hardware
sed -i 's/ENABLED="yes"/ENABLED="no"/g' ${D}${sysconfdir}/default/radio-reset
}
diff --git a/recipes-bsp/multitech/mts-io/mts-io.mtp.init b/recipes-bsp/multitech/mts-io/mts-io.mtp.init
new file mode 100644
index 0000000..f8df7ff
--- /dev/null
+++ b/recipes-bsp/multitech/mts-io/mts-io.mtp.init
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+hardware_init() {
+ # reset lora chip
+ mts-io-sysfs store lora-reset 0
+
+ # power down the cellular chip gracefully
+ mts-io-sysfs store radio-power 0
+
+ # power up the cellular chip
+ mts-io-sysfs store radio-power 1
+}
+
+case $1 in
+ start)
+ echo "Loading mts-io module"
+ modprobe mts_io
+ hardware_init &
+ ;;
+
+ stop)
+ echo "Unloading mts-io module"
+ modprobe -r mts_io
+ ;;
+
+ *)
+ echo "Usage: $0 {start|stop}"
+ exit 2
+ ;;
+esac