pmaports/device/device-pine64-pinephone/eg25.initd
Icenowy Zheng 5bf2defdcf
pine64-pinephone: add script to bring up EG25 on current sample (!620)
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
2019-12-28 20:43:05 +05:30

37 lines
859 B
Text

#!/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
}