diff mbox series

[06/10] atmodem: introduce SIMCom A76XX vendor quirks

Message ID 20240430115234.180185-6-martin@geanix.com (mailing list archive)
State Accepted
Commit 4ef41eecf675305b219d1daf514725ab7ea8bbe8
Headers show
Series [01/10] sim7100: simplify serial device opening | expand

Commit Message

Martin Hundebøll April 30, 2024, 11:52 a.m. UTC
As a preparation for adding support for the SIMCom A7672 modem, certain
quirks are needed in the atmodem driver. The OFONO_VENDOR_SIMCOM enum is
already shared by the existing sim7100 and sim900 drivers, so a new
"sub-vendor" enum is needed.

The new sub-vendor enum allows adding A7672 support to the sim7100
driver without changing behavior for other devices already supported.

A few of the existing simcom vendor quirks are replaced by the new
sub-vendor enum instead of making them apply to both. These places were
introduced in commit c3da88e1
("drivers: adding support for the SIMCom A7605E-H"), which should apply
to the A7672E modem too.
---
 drivers/atmodem/gprs.c                 | 4 ++--
 drivers/atmodem/network-registration.c | 1 +
 drivers/atmodem/sim.c                  | 4 +++-
 drivers/atmodem/sms.c                  | 1 +
 drivers/atmodem/vendor.h               | 1 +
 5 files changed, 8 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index e0441545..8ff9d796 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -675,7 +675,7 @@  static void gprs_initialized(gboolean ok, GAtResult *result, gpointer user_data)
 		g_at_chat_send(gd->chat, "AT#PSNT=1", none_prefix,
 						NULL, NULL, NULL);
 		break;
-	case OFONO_VENDOR_SIMCOM:
+	case OFONO_VENDOR_SIMCOM_A76XX:
 		g_at_chat_register(gd->chat, "+CNSMOD:", simcom_mode_notify,
 						FALSE, gprs, NULL);
 		g_at_chat_send(gd->chat, "AT+CNSMOD=1", none_prefix,
@@ -805,7 +805,7 @@  retry:
 
 	g_at_chat_send(gd->chat, cmd, none_prefix, NULL, NULL, NULL);
 
-	if (gd->vendor != OFONO_VENDOR_SIMCOM)
+	if (gd->vendor != OFONO_VENDOR_SIMCOM_A76XX)
 		g_at_chat_send(gd->chat, "AT+CGAUTO=0", none_prefix,
 					NULL, NULL, NULL);
 
diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c
index 2697d3c5..3ceca12d 100644
--- a/drivers/atmodem/network-registration.c
+++ b/drivers/atmodem/network-registration.c
@@ -1936,6 +1936,7 @@  static void at_creg_set_cb(gboolean ok, GAtResult *result, gpointer user_data)
 
 	switch (nd->vendor) {
 	case OFONO_VENDOR_SIMCOM:
+	case OFONO_VENDOR_SIMCOM_A76XX:
 		/* Register for CSQ changes */
 		g_at_chat_send(nd->chat, "AT+AUTOCSQ=1,1", none_prefix,
 				NULL, NULL, NULL);
diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index d75a09c2..6fe5efce 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -1199,6 +1199,7 @@  static void at_pin_retries_query(struct ofono_sim *sim,
 			return;
 		break;
 	case OFONO_VENDOR_SIMCOM:
+	case OFONO_VENDOR_SIMCOM_A76XX:
 		if (g_at_chat_send(sd->chat, "AT+SPIC", simcom_spic_prefix,
 					simcom_spic_cb, cbd, g_free) > 0)
 			return;
@@ -1355,6 +1356,7 @@  static void at_pin_send_cb(gboolean ok, GAtResult *result,
 	case OFONO_VENDOR_ALCATEL:
 	case OFONO_VENDOR_HUAWEI:
 	case OFONO_VENDOR_SIMCOM:
+	case OFONO_VENDOR_SIMCOM_A76XX:
 	case OFONO_VENDOR_SIERRA:
 		/*
 		 * On ZTE modems, after pin is entered, SIM state is checked
@@ -1647,7 +1649,7 @@  static void at_discover_apps(struct ofono_sim *sim,
 	 * command with SIM cards of some operators
 	 */
 	if (sd->vendor == OFONO_VENDOR_QUECTEL_EC2X
-			|| sd->vendor == OFONO_VENDOR_SIMCOM)
+			|| sd->vendor == OFONO_VENDOR_SIMCOM_A76XX)
 		goto error;
 
 	cbd = cb_data_new(cb, data);
diff --git a/drivers/atmodem/sms.c b/drivers/atmodem/sms.c
index c69fe947..be0c7ada 100644
--- a/drivers/atmodem/sms.c
+++ b/drivers/atmodem/sms.c
@@ -846,6 +846,7 @@  static gboolean build_cnmi_string(char *buf, int *cnmi_opts,
 	case OFONO_VENDOR_HUAWEI:
 	case OFONO_VENDOR_ZTE:
 	case OFONO_VENDOR_SIMCOM:
+	case OFONO_VENDOR_SIMCOM_A76XX:
 	case OFONO_VENDOR_QUECTEL:
 	case OFONO_VENDOR_QUECTEL_EC2X:
 	case OFONO_VENDOR_DROID:
diff --git a/drivers/atmodem/vendor.h b/drivers/atmodem/vendor.h
index 82284e44..90446943 100644
--- a/drivers/atmodem/vendor.h
+++ b/drivers/atmodem/vendor.h
@@ -41,6 +41,7 @@  enum ofono_vendor {
 	OFONO_VENDOR_SAMSUNG,
 	OFONO_VENDOR_SIMCOM,
 	OFONO_VENDOR_SIMCOM_SIM900,
+	OFONO_VENDOR_SIMCOM_A76XX,
 	OFONO_VENDOR_ICERA,
 	OFONO_VENDOR_WAVECOM_Q2XXX,
 	OFONO_VENDOR_ALCATEL,