Verified Commit 3ca081f4 authored by Mayeul C.'s avatar Mayeul C. Committed by Oliver Smith

pine64-pinephone: reset modem after applying configuration (!978)

The datasheet says that the AT+QDAI audio routing configuration is saved
to non-volatile memory directly, and therefore needs a modem reset to be
applied.

This commits changes the audio routing configuration script to first
check for the current configuration, and only change it if it is
different from the one wanted.

The new configuration is then sent, and modem is reset to apply
configuration.
parent ecb510c2
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
pkgname="device-pine64-pinephone" pkgname="device-pine64-pinephone"
pkgdesc="PINE64 PinePhone" pkgdesc="PINE64 PinePhone"
pkgver=0.2 pkgver=0.2
pkgrel=3 pkgrel=4
url="https://postmarketos.org" url="https://postmarketos.org"
license="MIT" license="MIT"
arch="aarch64" arch="aarch64"
...@@ -89,5 +89,5 @@ aa0b7191548e89ddfc6cf5b1f637c7ee7ab4c2025cbfc6328e7e482e5b179ea072779ca332a18094 ...@@ -89,5 +89,5 @@ aa0b7191548e89ddfc6cf5b1f637c7ee7ab4c2025cbfc6328e7e482e5b179ea072779ca332a18094
3cf0f2b0d463c1cf79156facfbddfa7e5bb9dffc54c364e0aa27e4f5e4778ec889febe8aecc819782db4f8423ac3cff2264c8e96c7e4f327519a4c403e087ce1 HiFi 3cf0f2b0d463c1cf79156facfbddfa7e5bb9dffc54c364e0aa27e4f5e4778ec889febe8aecc819782db4f8423ac3cff2264c8e96c7e4f327519a4c403e087ce1 HiFi
7071765039f282185d5a5f64912f41f96562785436018b4391f87e68bd9636addac496ebec239f7d82f7ef55401ac0cfe03ec1aebb454bd2eedf5b1251da758f VoiceCall 7071765039f282185d5a5f64912f41f96562785436018b4391f87e68bd9636addac496ebec239f7d82f7ef55401ac0cfe03ec1aebb454bd2eedf5b1251da758f VoiceCall
5a1a9c774253e8211cc54f4b3961c4bdc35427726d037b0ecad099915e856590e8267a4a47943ab753772d57261eef89924b407b305b1099a9c4ecd7b5f00b35 eg25.initd 5a1a9c774253e8211cc54f4b3961c4bdc35427726d037b0ecad099915e856590e8267a4a47943ab753772d57261eef89924b407b305b1099a9c4ecd7b5f00b35 eg25.initd
78f353cfe59657614ad5629435dc72a529b052986d646e29193645dcfd3663f5704542afd9a43f8b4ea65d1614ad32598a5434409ac524559ff66a9ab9b60856 setup-modem-audio.sh dc110f617efe28df3001630836c7df0cab20e74e99c4bb9d2c2f86367ae024dd30060e8c051c7be0e66e86f4656bef345189a6c13276808c4301d1a6deb8be7d setup-modem-audio.sh
1b244cc6bfda4ff6c719c2dc077a2600376301d995607d15840994885b9044335d92d085282566a8baa0c2deb090ce958c586ea1e5950baf0e13686aef257b20 setup-modem-audio.initd" 1b244cc6bfda4ff6c719c2dc077a2600376301d995607d15840994885b9044335d92d085282566a8baa0c2deb090ce958c586ea1e5950baf0e13686aef257b20 setup-modem-audio.initd"
#!/bin/sh #!/bin/sh
RET=$(echo "AT+QDAI=1,0,0,2,0,1,1,1" | atinout - /dev/EG25.AT -) # Current modem routing
#
# 1 - Digital PCM
# 0 - I2S master
# 0 - Primary mode (short sync)
# 2 - 512kHz clock (512kHz / 16bit = 32k samples/s)
# 0 - 16bit linear format
# 1 - 16k sample/s
# 1 - 1 slot
# 1 - map to first slot (the only slot)
#
QDAI_CONFIG="1,0,0,2,0,1,1,1"
if echo $RET | grep -q OK; then DEV=/dev/EG25.AT
# Read current config
RET=$(echo "AT+QDAI?" | atinout - $DEV -)
if echo $RET | grep -q $QDAI_CONFIG
then
echo "Modem audio already configured"
exit 0
fi
# Modem not configured, we need to send it the digital interface configuration,
# then reboot it
RET=$(echo "AT+QDAI=$QDAI_CONFIG" | atinout - $DEV -)
if echo $RET | grep -q OK
then
echo "Successfully configured modem audio" echo "Successfully configured modem audio"
else else
echo "Failed to set modem audio up: $RET" echo "Failed to set modem audio up: $RET"
exit 1 exit 1
fi fi
# Reset module
# 1 Set the mode to full functionality (vs 4: no RF, and 1: min functionality)
# 1 Reset the modem before changing mode (only available with 1 above)
#
RET=$(echo "AT+CFUN=1,1" | atinout - $DEV -)
if echo $RET | grep -q OK
then
echo "Successfully reset the modem to apply audio configuration"
else
echo "Failed to reset the modem to apply audio configuration: $RET"
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment