shared-qmi,modem-helpers-qmi: Add support for NR5G band preference
Implement support for the NR5G band list to get current NR5G bands. This will also allow us to configure supported NR5G bands via mmcli.
This commit is contained in:
@@ -599,11 +599,50 @@ nas_add_extended_qmi_lte_bands (GArray *mm_bands,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nas_add_qmi_nr5g_bands (GArray *mm_bands,
|
||||||
|
const guint64 *qmi_nr5g_bands,
|
||||||
|
guint qmi_nr5g_bands_size,
|
||||||
|
gpointer log_object)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
g_assert (mm_bands != NULL);
|
||||||
|
|
||||||
|
for (i = 0; i < qmi_nr5g_bands_size; i++) {
|
||||||
|
guint j;
|
||||||
|
|
||||||
|
for (j = 0; j < 64; j++) {
|
||||||
|
guint val;
|
||||||
|
|
||||||
|
if (!(qmi_nr5g_bands[i] & (((guint64) 1) << j)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
val = 1 + j + (i * 64);
|
||||||
|
|
||||||
|
/* MM_MODEM_BAND_NGRAN_1 = 301,
|
||||||
|
* ...
|
||||||
|
* MM_MODEM_BAND_NGRAN_261 = 561
|
||||||
|
*/
|
||||||
|
if (val < 1 || val > 261)
|
||||||
|
mm_obj_dbg (log_object, "unexpected NR5G band supported by module: NGRAN %u", val);
|
||||||
|
else {
|
||||||
|
MMModemBand band;
|
||||||
|
|
||||||
|
band = (val + MM_MODEM_BAND_NGRAN_1 - 1);
|
||||||
|
g_array_append_val (mm_bands, band);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GArray *
|
GArray *
|
||||||
mm_modem_bands_from_qmi_band_preference (QmiNasBandPreference qmi_bands,
|
mm_modem_bands_from_qmi_band_preference (QmiNasBandPreference qmi_bands,
|
||||||
QmiNasLteBandPreference qmi_lte_bands,
|
QmiNasLteBandPreference qmi_lte_bands,
|
||||||
const guint64 *extended_qmi_lte_bands,
|
const guint64 *extended_qmi_lte_bands,
|
||||||
guint extended_qmi_lte_bands_size,
|
guint extended_qmi_lte_bands_size,
|
||||||
|
const guint64 *qmi_nr5g_bands,
|
||||||
|
guint qmi_nr5g_bands_size,
|
||||||
gpointer log_object)
|
gpointer log_object)
|
||||||
{
|
{
|
||||||
GArray *mm_bands;
|
GArray *mm_bands;
|
||||||
@@ -616,6 +655,9 @@ mm_modem_bands_from_qmi_band_preference (QmiNasBandPreference qmi_bands,
|
|||||||
else
|
else
|
||||||
nas_add_qmi_lte_bands (mm_bands, qmi_lte_bands);
|
nas_add_qmi_lte_bands (mm_bands, qmi_lte_bands);
|
||||||
|
|
||||||
|
if (qmi_nr5g_bands && qmi_nr5g_bands_size)
|
||||||
|
nas_add_qmi_nr5g_bands (mm_bands, qmi_nr5g_bands, qmi_nr5g_bands_size, log_object);
|
||||||
|
|
||||||
return mm_bands;
|
return mm_bands;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -625,6 +667,8 @@ mm_modem_bands_to_qmi_band_preference (GArray *mm_bands,
|
|||||||
QmiNasLteBandPreference *qmi_lte_bands,
|
QmiNasLteBandPreference *qmi_lte_bands,
|
||||||
guint64 *extended_qmi_lte_bands,
|
guint64 *extended_qmi_lte_bands,
|
||||||
guint extended_qmi_lte_bands_size,
|
guint extended_qmi_lte_bands_size,
|
||||||
|
guint64 *qmi_nr5g_bands,
|
||||||
|
guint qmi_nr5g_bands_size,
|
||||||
gpointer log_object)
|
gpointer log_object)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
@@ -633,6 +677,8 @@ mm_modem_bands_to_qmi_band_preference (GArray *mm_bands,
|
|||||||
*qmi_lte_bands = 0;
|
*qmi_lte_bands = 0;
|
||||||
if (extended_qmi_lte_bands)
|
if (extended_qmi_lte_bands)
|
||||||
memset (extended_qmi_lte_bands, 0, extended_qmi_lte_bands_size * sizeof (guint64));
|
memset (extended_qmi_lte_bands, 0, extended_qmi_lte_bands_size * sizeof (guint64));
|
||||||
|
if (qmi_nr5g_bands)
|
||||||
|
memset (qmi_nr5g_bands, 0, qmi_nr5g_bands_size * sizeof (guint64));
|
||||||
|
|
||||||
for (i = 0; i < mm_bands->len; i++) {
|
for (i = 0; i < mm_bands->len; i++) {
|
||||||
MMModemBand band;
|
MMModemBand band;
|
||||||
@@ -669,6 +715,22 @@ mm_modem_bands_to_qmi_band_preference (GArray *mm_bands,
|
|||||||
mm_obj_dbg (log_object, "cannot add the following LTE band: '%s'",
|
mm_obj_dbg (log_object, "cannot add the following LTE band: '%s'",
|
||||||
mm_modem_band_get_string (band));
|
mm_modem_band_get_string (band));
|
||||||
}
|
}
|
||||||
|
} else if (band >= MM_MODEM_BAND_NGRAN_1 && band <= MM_MODEM_BAND_NGRAN_261) {
|
||||||
|
if (qmi_nr5g_bands && qmi_nr5g_bands_size) {
|
||||||
|
/* Add NR5G band preference */
|
||||||
|
guint val;
|
||||||
|
guint j;
|
||||||
|
guint k;
|
||||||
|
|
||||||
|
/* it's really (band - MM_MODEM_BAND_NGRAN_1 +1 -1), because
|
||||||
|
* we want NGRAN1 in index 0 */
|
||||||
|
val = band - MM_MODEM_BAND_NGRAN_1;
|
||||||
|
j = val / 64;
|
||||||
|
g_assert (j < qmi_nr5g_bands_size);
|
||||||
|
k = val % 64;
|
||||||
|
|
||||||
|
qmi_nr5g_bands[j] |= ((guint64)1 << k);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Add non-LTE band preference */
|
/* Add non-LTE band preference */
|
||||||
guint j;
|
guint j;
|
||||||
|
@@ -89,12 +89,16 @@ GArray *mm_modem_bands_from_qmi_band_preference (QmiNasBandPreference qmi_ba
|
|||||||
QmiNasLteBandPreference qmi_lte_bands,
|
QmiNasLteBandPreference qmi_lte_bands,
|
||||||
const guint64 *extended_qmi_lte_bands,
|
const guint64 *extended_qmi_lte_bands,
|
||||||
guint extended_qmi_lte_bands_size,
|
guint extended_qmi_lte_bands_size,
|
||||||
|
const guint64 *qmi_nr5g_bands,
|
||||||
|
guint qmi_nr5g_bands_size,
|
||||||
gpointer log_object);
|
gpointer log_object);
|
||||||
void mm_modem_bands_to_qmi_band_preference (GArray *mm_bands,
|
void mm_modem_bands_to_qmi_band_preference (GArray *mm_bands,
|
||||||
QmiNasBandPreference *qmi_bands,
|
QmiNasBandPreference *qmi_bands,
|
||||||
QmiNasLteBandPreference *qmi_lte_bands,
|
QmiNasLteBandPreference *qmi_lte_bands,
|
||||||
guint64 *extended_qmi_lte_bands,
|
guint64 *extended_qmi_lte_bands,
|
||||||
guint extended_qmi_lte_bands_size,
|
guint extended_qmi_lte_bands_size,
|
||||||
|
guint64 *qmi_nr5g_bands,
|
||||||
|
guint qmi_nr5g_bands_size,
|
||||||
gpointer log_object);
|
gpointer log_object);
|
||||||
|
|
||||||
MMModem3gppRegistrationState mm_modem_3gpp_registration_state_from_qmi_registration_state (QmiNasAttachState attach_state,
|
MMModem3gppRegistrationState mm_modem_3gpp_registration_state_from_qmi_registration_state (QmiNasAttachState attach_state,
|
||||||
|
@@ -1946,6 +1946,10 @@ load_bands_get_system_selection_preference_ready (QmiClientNas *client,
|
|||||||
QmiNasLteBandPreference lte_band_preference_mask = 0;
|
QmiNasLteBandPreference lte_band_preference_mask = 0;
|
||||||
guint64 extended_lte_band_preference[4] = { 0 };
|
guint64 extended_lte_band_preference[4] = { 0 };
|
||||||
guint extended_lte_band_preference_size = 0;
|
guint extended_lte_band_preference_size = 0;
|
||||||
|
guint64 nr5g_sa_band_preference[8] = { 0 };
|
||||||
|
guint64 nr5g_nsa_band_preference[8] = { 0 };
|
||||||
|
guint64 nr5g_band_preference[8] = { 0 };
|
||||||
|
guint nr5g_band_preference_size = 0;
|
||||||
|
|
||||||
self = g_task_get_source_object (task);
|
self = g_task_get_source_object (task);
|
||||||
priv = get_private (self);
|
priv = get_private (self);
|
||||||
@@ -1976,10 +1980,40 @@ load_bands_get_system_selection_preference_ready (QmiClientNas *client,
|
|||||||
NULL))
|
NULL))
|
||||||
extended_lte_band_preference_size = G_N_ELEMENTS (extended_lte_band_preference);
|
extended_lte_band_preference_size = G_N_ELEMENTS (extended_lte_band_preference);
|
||||||
|
|
||||||
|
if (qmi_message_nas_get_system_selection_preference_output_get_nr5g_sa_band_preference (
|
||||||
|
output,
|
||||||
|
&nr5g_sa_band_preference[0],
|
||||||
|
&nr5g_sa_band_preference[1],
|
||||||
|
&nr5g_sa_band_preference[2],
|
||||||
|
&nr5g_sa_band_preference[3],
|
||||||
|
&nr5g_sa_band_preference[4],
|
||||||
|
&nr5g_sa_band_preference[5],
|
||||||
|
&nr5g_sa_band_preference[6],
|
||||||
|
&nr5g_sa_band_preference[7],
|
||||||
|
NULL) || qmi_message_nas_get_system_selection_preference_output_get_nr5g_nsa_band_preference (
|
||||||
|
output,
|
||||||
|
&nr5g_nsa_band_preference[0],
|
||||||
|
&nr5g_nsa_band_preference[1],
|
||||||
|
&nr5g_nsa_band_preference[2],
|
||||||
|
&nr5g_nsa_band_preference[3],
|
||||||
|
&nr5g_nsa_band_preference[4],
|
||||||
|
&nr5g_nsa_band_preference[5],
|
||||||
|
&nr5g_nsa_band_preference[6],
|
||||||
|
&nr5g_nsa_band_preference[7],
|
||||||
|
NULL)) {
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
nr5g_band_preference_size = G_N_ELEMENTS (nr5g_band_preference);
|
||||||
|
for (i = 0; i < nr5g_band_preference_size; i++)
|
||||||
|
nr5g_band_preference[i] = nr5g_sa_band_preference[i] | nr5g_nsa_band_preference[i];
|
||||||
|
}
|
||||||
|
|
||||||
mm_bands = mm_modem_bands_from_qmi_band_preference (band_preference_mask,
|
mm_bands = mm_modem_bands_from_qmi_band_preference (band_preference_mask,
|
||||||
lte_band_preference_mask,
|
lte_band_preference_mask,
|
||||||
extended_lte_band_preference_size ? extended_lte_band_preference : NULL,
|
extended_lte_band_preference_size ? extended_lte_band_preference : NULL,
|
||||||
extended_lte_band_preference_size,
|
extended_lte_band_preference_size,
|
||||||
|
nr5g_band_preference_size ? nr5g_band_preference : NULL,
|
||||||
|
nr5g_band_preference_size,
|
||||||
self);
|
self);
|
||||||
|
|
||||||
if (mm_bands->len == 0) {
|
if (mm_bands->len == 0) {
|
||||||
@@ -2071,6 +2105,7 @@ mm_shared_qmi_set_current_bands (MMIfaceModem *self,
|
|||||||
QmiNasBandPreference qmi_bands = 0;
|
QmiNasBandPreference qmi_bands = 0;
|
||||||
QmiNasLteBandPreference qmi_lte_bands = 0;
|
QmiNasLteBandPreference qmi_lte_bands = 0;
|
||||||
guint64 extended_qmi_lte_bands[4] = { 0 };
|
guint64 extended_qmi_lte_bands[4] = { 0 };
|
||||||
|
guint64 qmi_nr5g_bands[8] = { 0 };
|
||||||
|
|
||||||
if (!mm_shared_qmi_ensure_client (MM_SHARED_QMI (self),
|
if (!mm_shared_qmi_ensure_client (MM_SHARED_QMI (self),
|
||||||
QMI_SERVICE_NAS, &client,
|
QMI_SERVICE_NAS, &client,
|
||||||
@@ -2096,6 +2131,8 @@ mm_shared_qmi_set_current_bands (MMIfaceModem *self,
|
|||||||
&qmi_lte_bands,
|
&qmi_lte_bands,
|
||||||
priv->feature_nas_ssp_extended_lte_band_preference == FEATURE_SUPPORTED ? extended_qmi_lte_bands : NULL,
|
priv->feature_nas_ssp_extended_lte_band_preference == FEATURE_SUPPORTED ? extended_qmi_lte_bands : NULL,
|
||||||
G_N_ELEMENTS (extended_qmi_lte_bands),
|
G_N_ELEMENTS (extended_qmi_lte_bands),
|
||||||
|
qmi_nr5g_bands,
|
||||||
|
G_N_ELEMENTS (qmi_nr5g_bands),
|
||||||
self);
|
self);
|
||||||
|
|
||||||
input = qmi_message_nas_set_system_selection_preference_input_new ();
|
input = qmi_message_nas_set_system_selection_preference_input_new ();
|
||||||
@@ -2112,6 +2149,28 @@ mm_shared_qmi_set_current_bands (MMIfaceModem *self,
|
|||||||
else
|
else
|
||||||
qmi_message_nas_set_system_selection_preference_input_set_lte_band_preference (input, qmi_lte_bands, NULL);
|
qmi_message_nas_set_system_selection_preference_input_set_lte_band_preference (input, qmi_lte_bands, NULL);
|
||||||
}
|
}
|
||||||
|
qmi_message_nas_set_system_selection_preference_input_set_nr5g_sa_band_preference (
|
||||||
|
input,
|
||||||
|
qmi_nr5g_bands[0],
|
||||||
|
qmi_nr5g_bands[1],
|
||||||
|
qmi_nr5g_bands[2],
|
||||||
|
qmi_nr5g_bands[3],
|
||||||
|
qmi_nr5g_bands[4],
|
||||||
|
qmi_nr5g_bands[5],
|
||||||
|
qmi_nr5g_bands[6],
|
||||||
|
qmi_nr5g_bands[7],
|
||||||
|
NULL);
|
||||||
|
qmi_message_nas_set_system_selection_preference_input_set_nr5g_nsa_band_preference (
|
||||||
|
input,
|
||||||
|
qmi_nr5g_bands[0],
|
||||||
|
qmi_nr5g_bands[1],
|
||||||
|
qmi_nr5g_bands[2],
|
||||||
|
qmi_nr5g_bands[3],
|
||||||
|
qmi_nr5g_bands[4],
|
||||||
|
qmi_nr5g_bands[5],
|
||||||
|
qmi_nr5g_bands[6],
|
||||||
|
qmi_nr5g_bands[7],
|
||||||
|
NULL);
|
||||||
qmi_message_nas_set_system_selection_preference_input_set_change_duration (input, QMI_NAS_CHANGE_DURATION_PERMANENT, NULL);
|
qmi_message_nas_set_system_selection_preference_input_set_change_duration (input, QMI_NAS_CHANGE_DURATION_PERMANENT, NULL);
|
||||||
|
|
||||||
qmi_client_nas_set_system_selection_preference (
|
qmi_client_nas_set_system_selection_preference (
|
||||||
|
Reference in New Issue
Block a user