pmaports/device/testing/device-pine64-pinephone/eg25.initd

38 lines
859 B
Text
Raw Normal View History

#!/sbin/openrc-run
description="Starting EG25 WWAN module"
depend()
{
before ofono
}
start()
{
ebegin "Enabling EG25 WWAN module"
# GPIO35 is PWRKEY
# GPIO68 is RESET_N
# GPIO232 is W_DISABLE#
for i in 35 68 232
do
[ -e /sys/class/gpio/gpio$i ] && continue
echo $i > /sys/class/gpio/export || return 1
echo out > /sys/class/gpio/gpio$i/direction || return 1
done
echo 0 > /sys/class/gpio/gpio68/value || return 1
echo 0 > /sys/class/gpio/gpio232/value || return 1
( echo 1 > /sys/class/gpio/gpio35/value && sleep 2 && echo 0 > /sys/class/gpio/gpio35/value ) || return 1
}
stop()
{
ebegin "Disabling EG25 WWAN module"
echo 1 > /sys/class/gpio/gpio68/value
echo 1 > /sys/class/gpio/gpio232/value
echo 1 > /sys/class/gpio/gpio35/value && sleep 2 && echo 0 > /sys/class/gpio/gpio35/value
sleep 30 # Wait for the module to power off
}