aboutsummaryrefslogtreecommitdiff
path: root/src/mm-shared-qmi.c
diff options
context:
space:
mode:
authorPrakash Pabba <quic_ppabba@quicinc.com>2021-12-14 14:25:45 +0530
committerAleksander Morgado <aleksander@aleksander.es>2022-01-30 15:37:05 +0000
commit38f067c4e44d7f994c3fd75e29d36ee199002ff4 (patch)
tree0f7e381ba41751cef8c4dde3fb718b5ac681aa9e /src/mm-shared-qmi.c
parentf05258e757558b93559b4d36087e89ec926c5423 (diff)
mm-shared-qmi,mm-modem-helpers: Fix supported capabilities and modes for multimode device
We use capability switching logic exclusively for configuring GSM/UMTS+CDMA/EVDO devices (regardless of whether it has LTE/5GNR or not) to add or remove the GSM/UMTS and CDMA/EVDO capabilities. Based on the same logic, we will allow 4 combinations for GSM/UMTS+CDMA/EVDO+LTE+5GNR device: "GSM/UMTS+CDMA/EVDO+LTE+5GNR", "GSM/UMTS+LTE+5GNR", "CDMA/EVDO+LTE+5GNR" and "LTE+5GNR" Similarly, we will allow 4 combinations for GSM/UMTS+CDMA/EVDO+LTE device: "GSM/UMTS+CDMA/EVDO+LTE", "GSM/UMTS+LTE", "CDMA/EVDO+LTE" and "LTE" And, we will allow 3 combinations for GSM/UMTS+CDMA/EVDO device: "GSM/UMTS+CDMA/EVDO", "GSM/UMTS" and "CDMA/EVDO" Also, supported combination modes should be based on current capabilities and not entirely upon supported radio interfaces. 1) If current capability has "gsm-umts" or "cdma-evdo" or both, do not support 4G only, 5G only, or 4G+5G combination modes 2) If current capability neither has "gsm-umts" nor "cdma-evdo", only support combination modes involving 4G and 5G.
Diffstat (limited to 'src/mm-shared-qmi.c')
-rw-r--r--src/mm-shared-qmi.c84
1 files changed, 40 insertions, 44 deletions
diff --git a/src/mm-shared-qmi.c b/src/mm-shared-qmi.c
index c9a90812..bae946fa 100644
--- a/src/mm-shared-qmi.c
+++ b/src/mm-shared-qmi.c
@@ -77,7 +77,6 @@ typedef struct {
Feature feature_nas_ssp_extended_lte_band_preference;
Feature feature_nas_ssp_acquisition_order_preference;
GArray *feature_nas_ssp_acquisition_order_preference_array;
- gboolean disable_4g_only_mode;
GArray *supported_bands;
/* Location helpers */
@@ -1133,35 +1132,23 @@ mm_shared_qmi_load_supported_capabilities (MMIfaceModem *self,
* switching only when switching GSM/UMTS+CDMA/EVDO multimode devices, and only if
* we have support for the commands doing it.
*/
+#define MULTIMODE (MM_MODEM_CAPABILITY_GSM_UMTS | MM_MODEM_CAPABILITY_CDMA_EVDO)
if (priv->feature_nas_tp == FEATURE_SUPPORTED || priv->feature_nas_ssp == FEATURE_SUPPORTED) {
- if (mask == (MM_MODEM_CAPABILITY_GSM_UMTS | MM_MODEM_CAPABILITY_CDMA_EVDO)) {
- /* Multimode GSM/UMTS+CDMA/EVDO device switched to GSM/UMTS only */
- single = MM_MODEM_CAPABILITY_GSM_UMTS;
+ if ((mask & MULTIMODE) == MULTIMODE) {
+ /* Multimode GSM/UMTS+CDMA/EVDO+(LTE/5GNR) device switched to GSM/UMTS+(LTE/5GNR) device */
+ single = MM_MODEM_CAPABILITY_GSM_UMTS | (MULTIMODE ^ mask);
g_array_append_val (supported_combinations, single);
- /* Multimode GSM/UMTS+CDMA/EVDO device switched to CDMA/EVDO only */
- single = MM_MODEM_CAPABILITY_CDMA_EVDO;
- g_array_append_val (supported_combinations, single);
- } else if (mask == (MM_MODEM_CAPABILITY_GSM_UMTS | MM_MODEM_CAPABILITY_CDMA_EVDO | MM_MODEM_CAPABILITY_LTE)) {
- /* Multimode GSM/UMTS+CDMA/EVDO+LTE device switched to GSM/UMTS+LTE only */
- single = MM_MODEM_CAPABILITY_GSM_UMTS | MM_MODEM_CAPABILITY_LTE;
- g_array_append_val (supported_combinations, single);
- /* Multimode GSM/UMTS+CDMA/EVDO+LTE device switched to CDMA/EVDO+LTE only */
- single = MM_MODEM_CAPABILITY_CDMA_EVDO | MM_MODEM_CAPABILITY_LTE;
+ /* Multimode GSM/UMTS+CDMA/EVDO+(LTE/5GNR) device switched to CDMA/EVDO+(LTE/5GNR) device */
+ single = MM_MODEM_CAPABILITY_CDMA_EVDO | (MULTIMODE ^ mask);
g_array_append_val (supported_combinations, single);
/*
- * Multimode GSM/UMTS+CDMA/EVDO+LTE device switched to LTE only.
+ * Multimode GSM/UMTS+CDMA/EVDO+(LTE/5GNR) device switched to (LTE/5GNR) device
*
* This case is required because we use the same methods and operations to
- * switch capabilities and modes. For the LTE capability there is a direct
- * related 4G mode, and so we cannot select a '4G only' mode in this device
- * because we wouldn't be able to know the full list of current capabilities
- * if the device was rebooted, as we would only see LTE capability. So,
- * handle this special case so that the LTE/4G-only mode can exclusively be
- * selected as capability switching in this kind of devices.
- */
- priv->disable_4g_only_mode = TRUE;
- single = MM_MODEM_CAPABILITY_LTE;
- g_array_append_val (supported_combinations, single);
+ * switch capabilities and modes.
+ */
+ if ((single = (MULTIMODE ^ mask)))
+ g_array_append_val (supported_combinations, single);
}
}
@@ -1731,6 +1718,7 @@ mm_shared_qmi_load_supported_modes (MMIfaceModem *self,
priv = get_private (MM_SHARED_QMI (self));
g_assert (priv->supported_radio_interfaces);
+ g_assert (priv->current_capabilities);
/* Build all, based on the supported radio interfaces */
mask_all = MM_MODEM_MODE_NONE;
@@ -1782,34 +1770,42 @@ mm_shared_qmi_load_supported_modes (MMIfaceModem *self,
g_array_append_val (combinations, mode); \
} \
} while (0)
+#define MULTIMODE (MM_MODEM_CAPABILITY_GSM_UMTS | MM_MODEM_CAPABILITY_CDMA_EVDO)
- /* 2G-only, 3G-only */
- ADD_MODE_PREFERENCE (MM_MODEM_MODE_2G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
- ADD_MODE_PREFERENCE (MM_MODEM_MODE_3G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
+ if ((priv->current_capabilities & MULTIMODE)) {
+ /* 2G-only, 3G-only */
+ ADD_MODE_PREFERENCE (MM_MODEM_MODE_2G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
+ ADD_MODE_PREFERENCE (MM_MODEM_MODE_3G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
+ }
- /* 4G-only mode is not possible in multimode GSM/UMTS+CDMA/EVDO+LTE
- * devices. This configuration may be selected as "LTE only" capability
- * instead. */
- if (!priv->disable_4g_only_mode)
+ if (!(priv->current_capabilities & MULTIMODE)) {
+ /* 4G-only */
ADD_MODE_PREFERENCE (MM_MODEM_MODE_4G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
+ }
- /* 2G, 3G, 4G combinations */
- ADD_MODE_PREFERENCE (MM_MODEM_MODE_2G, MM_MODEM_MODE_3G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
- ADD_MODE_PREFERENCE (MM_MODEM_MODE_2G, MM_MODEM_MODE_4G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
- ADD_MODE_PREFERENCE (MM_MODEM_MODE_3G, MM_MODEM_MODE_4G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
- ADD_MODE_PREFERENCE (MM_MODEM_MODE_2G, MM_MODEM_MODE_3G, MM_MODEM_MODE_4G, MM_MODEM_MODE_NONE);
+ if ((priv->current_capabilities & MULTIMODE)) {
+ /* 2G, 3G, 4G combinations */
+ ADD_MODE_PREFERENCE (MM_MODEM_MODE_2G, MM_MODEM_MODE_3G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
+ ADD_MODE_PREFERENCE (MM_MODEM_MODE_2G, MM_MODEM_MODE_4G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
+ ADD_MODE_PREFERENCE (MM_MODEM_MODE_3G, MM_MODEM_MODE_4G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
+ ADD_MODE_PREFERENCE (MM_MODEM_MODE_2G, MM_MODEM_MODE_3G, MM_MODEM_MODE_4G, MM_MODEM_MODE_NONE);
+ }
/* 5G related mode combinations are only supported when NAS SSP is supported,
* as there is no 5G support in NAS TP. */
if (priv->feature_nas_ssp != FEATURE_UNSUPPORTED) {
- ADD_MODE_PREFERENCE (MM_MODEM_MODE_5G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
- ADD_MODE_PREFERENCE (MM_MODEM_MODE_2G, MM_MODEM_MODE_5G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
- ADD_MODE_PREFERENCE (MM_MODEM_MODE_3G, MM_MODEM_MODE_5G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
- ADD_MODE_PREFERENCE (MM_MODEM_MODE_4G, MM_MODEM_MODE_5G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
- ADD_MODE_PREFERENCE (MM_MODEM_MODE_2G, MM_MODEM_MODE_3G, MM_MODEM_MODE_5G, MM_MODEM_MODE_NONE);
- ADD_MODE_PREFERENCE (MM_MODEM_MODE_2G, MM_MODEM_MODE_4G, MM_MODEM_MODE_5G, MM_MODEM_MODE_NONE);
- ADD_MODE_PREFERENCE (MM_MODEM_MODE_3G, MM_MODEM_MODE_4G, MM_MODEM_MODE_5G, MM_MODEM_MODE_NONE);
- ADD_MODE_PREFERENCE (MM_MODEM_MODE_2G, MM_MODEM_MODE_3G, MM_MODEM_MODE_4G, MM_MODEM_MODE_5G);
+ if (!(priv->current_capabilities & MULTIMODE)) {
+ ADD_MODE_PREFERENCE (MM_MODEM_MODE_5G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
+ ADD_MODE_PREFERENCE (MM_MODEM_MODE_4G, MM_MODEM_MODE_5G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
+ }
+ if ((priv->current_capabilities & MULTIMODE)) {
+ ADD_MODE_PREFERENCE (MM_MODEM_MODE_2G, MM_MODEM_MODE_5G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
+ ADD_MODE_PREFERENCE (MM_MODEM_MODE_3G, MM_MODEM_MODE_5G, MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE);
+ ADD_MODE_PREFERENCE (MM_MODEM_MODE_2G, MM_MODEM_MODE_3G, MM_MODEM_MODE_5G, MM_MODEM_MODE_NONE);
+ ADD_MODE_PREFERENCE (MM_MODEM_MODE_2G, MM_MODEM_MODE_4G, MM_MODEM_MODE_5G, MM_MODEM_MODE_NONE);
+ ADD_MODE_PREFERENCE (MM_MODEM_MODE_3G, MM_MODEM_MODE_4G, MM_MODEM_MODE_5G, MM_MODEM_MODE_NONE);
+ ADD_MODE_PREFERENCE (MM_MODEM_MODE_2G, MM_MODEM_MODE_3G, MM_MODEM_MODE_4G, MM_MODEM_MODE_5G);
+ }
}
/* Filter out unsupported modes */