From a046b539418958eeb2ee26ec5ef273835c98d0d2 Mon Sep 17 00:00:00 2001
From: Dylan Van Assche <me@dylanvanassche.be>
Date: Thu, 15 Apr 2021 20:11:03 +0200
Subject: [PATCH 2/8] config: synchronize with modem-power

We cannot assume default factory values if other drivers change them
---
 data/pine64,pinephone-1.0.toml | 13 +++++++++++--
 data/pine64,pinephone-1.1.toml | 13 +++++++++++--
 data/pine64,pinephone-1.2.toml | 12 ++++++++++++
 3 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/data/pine64,pinephone-1.0.toml b/data/pine64,pinephone-1.0.toml
index e1f5b24..6e21bda 100644
--- a/data/pine64,pinephone-1.0.toml
+++ b/data/pine64,pinephone-1.0.toml
@@ -39,12 +39,21 @@ configure = [
     { cmd = "QCFG", subcmd = "risignaltype", expect = "\"physical\"" },
     { cmd = "QCFG", subcmd = "ims", expect = "1" },
     { cmd = "QCFG", subcmd = "urc/ri/ring", expect = "\"pulse\",2000,1000,5000,\"off\",1" },
-    { cmd = "QCFG", subcmd = "urc/ri/smsincoming", expect = "\"pulse\",2000" },
-    { cmd = "QCFG", subcmd = "urc/ri/other", expect = "\"off\",1" },
+    { cmd = "QCFG", subcmd = "urc/ri/smsincoming", expect = "\"pulse\",2000,1" },
+    { cmd = "QCFG", subcmd = "urc/ri/other", expect = "\"off\",1,1" },
     { cmd = "QCFG", subcmd = "urc/delay", expect = "1" },
     { cmd = "QURCCFG", subcmd = "urcport", expect = "\"all\"" },
     { cmd = "QGPS", value = "1" },
     { cmd = "QSCLK", value = "1" },
+# Reset modem-power configurations to what we expect
+    { cmd = "QCFG", subcmd = "urc/cache", expect = "0" },
+    { cmd = "QCFG", subcmd = "fast/poweroff", expect = "1" },
+    { cmd = "QCFG", subcmd = "apready", expect = "0,0,500" },
+    { cmd = "QCFG", subcmd = "sleepind/level", expect = "0" },
+    { cmd = "QCFG", subcmd = "wakeupin/level", expect = "0,0" },
+    { cmd = "QCFG", subcmd = "ApRstLevel", expect = "0" },
+    { cmd = "QCFG", subcmd = "ModemRstLevel", expect = "0" },
+    { cmd = "QCFG", subcmd = "urc/ri/pin", expect = "uart_ri" },
 ]
 suspend = [
     { cmd = "QGPSEND" },
diff --git a/data/pine64,pinephone-1.1.toml b/data/pine64,pinephone-1.1.toml
index e1f5b24..6e21bda 100644
--- a/data/pine64,pinephone-1.1.toml
+++ b/data/pine64,pinephone-1.1.toml
@@ -39,12 +39,21 @@ configure = [
     { cmd = "QCFG", subcmd = "risignaltype", expect = "\"physical\"" },
     { cmd = "QCFG", subcmd = "ims", expect = "1" },
     { cmd = "QCFG", subcmd = "urc/ri/ring", expect = "\"pulse\",2000,1000,5000,\"off\",1" },
-    { cmd = "QCFG", subcmd = "urc/ri/smsincoming", expect = "\"pulse\",2000" },
-    { cmd = "QCFG", subcmd = "urc/ri/other", expect = "\"off\",1" },
+    { cmd = "QCFG", subcmd = "urc/ri/smsincoming", expect = "\"pulse\",2000,1" },
+    { cmd = "QCFG", subcmd = "urc/ri/other", expect = "\"off\",1,1" },
     { cmd = "QCFG", subcmd = "urc/delay", expect = "1" },
     { cmd = "QURCCFG", subcmd = "urcport", expect = "\"all\"" },
     { cmd = "QGPS", value = "1" },
     { cmd = "QSCLK", value = "1" },
+# Reset modem-power configurations to what we expect
+    { cmd = "QCFG", subcmd = "urc/cache", expect = "0" },
+    { cmd = "QCFG", subcmd = "fast/poweroff", expect = "1" },
+    { cmd = "QCFG", subcmd = "apready", expect = "0,0,500" },
+    { cmd = "QCFG", subcmd = "sleepind/level", expect = "0" },
+    { cmd = "QCFG", subcmd = "wakeupin/level", expect = "0,0" },
+    { cmd = "QCFG", subcmd = "ApRstLevel", expect = "0" },
+    { cmd = "QCFG", subcmd = "ModemRstLevel", expect = "0" },
+    { cmd = "QCFG", subcmd = "urc/ri/pin", expect = "uart_ri" },
 ]
 suspend = [
     { cmd = "QGPSEND" },
diff --git a/data/pine64,pinephone-1.2.toml b/data/pine64,pinephone-1.2.toml
index 4ca1274..598ebaf 100644
--- a/data/pine64,pinephone-1.2.toml
+++ b/data/pine64,pinephone-1.2.toml
@@ -36,9 +36,21 @@ configure = [
     { cmd = "QCFG", subcmd = "risignaltype", expect = "\"physical\"" },
     { cmd = "QCFG", subcmd = "ims", expect = "1" },
     { cmd = "QCFG", subcmd = "apready", expect = "1,0,500" },
+    { cmd = "QCFG", subcmd = "urc/ri/ring", expect = "\"pulse\",120,1000,5000,\"off\",1" },
+    { cmd = "QCFG", subcmd = "urc/ri/smsincoming", expect = "\"pulse\",120,1" },
+    { cmd = "QCFG", subcmd = "urc/ri/other", expect = "\"off\",1,1" },
+    { cmd = "QCFG", subcmd = "urc/delay", expect = "0" },
     { cmd = "QURCCFG", subcmd = "urcport", expect = "\"all\"" },
     { cmd = "QGPS", value = "1" },
     { cmd = "QSCLK", value = "1" },
+# Reset modem-power configurations to what we expect
+    { cmd = "QCFG", subcmd = "urc/cache", expect = "0" },
+    { cmd = "QCFG", subcmd = "fast/poweroff", expect = "1" },
+    { cmd = "QCFG", subcmd = "sleepind/level", expect = "0" },
+    { cmd = "QCFG", subcmd = "wakeupin/level", expect = "0,0" },
+    { cmd = "QCFG", subcmd = "ApRstLevel", expect = "0" },
+    { cmd = "QCFG", subcmd = "ModemRstLevel", expect = "0" },
+    { cmd = "QCFG", subcmd = "urc/ri/pin", expect = "uart_ri" },
 ]
 suspend = [
     { cmd = "QGPSEND" },
-- 
2.31.1

