pmaports/device/testing/device-pine64-pinephone/eg25.initd
Oliver Smith 64035ac463
device/*: move to device/testing/* (!1063)
Prepare for better device categorization by moving everything to testing
subdir first.

[skip-ci]: chicken-egg problem: passing pmaports CI depends on pmbootstrap MR
				depends on this MR

Related: postmarketos#16
2020-03-14 08:35:32 +01:00

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
}