From c06ca6df3f096a53665611b26b4add933317e873 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 13 Oct 2021 13:36:24 +0200 Subject: [PATCH] qcom-soc: require udev tag for ports Since the 'wwan' subsystem addition to the qcom-soc plugin, the rules to say a modem is handled by this plugin are too broad, and the plugin attempts to support any kind of device exposed by the WWAN subsystem, not just those from Qualcomm SoCs. Update the plugin to require a new ID_MM_QCOM_SOC udev tag that is set in the plugin udev rules, given that these rules already check for the expected SoC drivers (bam-dmux, ipa, qcom-q6v5-mss). --- plugins/qcom-soc/77-mm-qcom-soc.rules | 5 ++++- plugins/qcom-soc/mm-plugin-qcom-soc.c | 5 +++++ src/kerneldevice/mm-kernel-device-qrtr.c | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/qcom-soc/77-mm-qcom-soc.rules b/plugins/qcom-soc/77-mm-qcom-soc.rules index 32195c1a..6511bf20 100644 --- a/plugins/qcom-soc/77-mm-qcom-soc.rules +++ b/plugins/qcom-soc/77-mm-qcom-soc.rules @@ -2,7 +2,7 @@ ACTION!="add|change|move|bind", GOTO="mm_qcom_soc_end" -# Process only known net and rpmsg ports +# Process only known wwan, net and rpmsg ports SUBSYSTEM=="net", DRIVERS=="bam-dmux", GOTO="mm_qcom_soc_process" SUBSYSTEM=="net", DRIVERS=="ipa", GOTO="mm_qcom_soc_process" SUBSYSTEM=="wwan", DRIVERS=="qcom-q6v5-mss", GOTO="mm_qcom_soc_process" @@ -11,6 +11,9 @@ GOTO="mm_qcom_soc_end" LABEL="mm_qcom_soc_process" +# Flag the port as being part of the SoC +ENV{ID_MM_QCOM_SOC}="1" + # # Add a common physdev UID to all ports in the Qualcomm SoC, so that they # are all bound together to the same modem object. diff --git a/plugins/qcom-soc/mm-plugin-qcom-soc.c b/plugins/qcom-soc/mm-plugin-qcom-soc.c index 35b5981b..58743a8d 100644 --- a/plugins/qcom-soc/mm-plugin-qcom-soc.c +++ b/plugins/qcom-soc/mm-plugin-qcom-soc.c @@ -68,6 +68,10 @@ G_MODULE_EXPORT MMPlugin * mm_plugin_create (void) { static const gchar *subsystems[] = { "wwan", "rpmsg", "net", "qrtr", NULL }; + static const gchar *udev_tags[] = { + "ID_MM_QCOM_SOC", + NULL + }; return MM_PLUGIN ( g_object_new (MM_TYPE_PLUGIN_QCOM_SOC, @@ -75,6 +79,7 @@ mm_plugin_create (void) MM_PLUGIN_ALLOWED_SUBSYSTEMS, subsystems, MM_PLUGIN_ALLOWED_AT, TRUE, MM_PLUGIN_ALLOWED_QMI, TRUE, + MM_PLUGIN_ALLOWED_UDEV_TAGS, udev_tags, NULL)); } diff --git a/src/kerneldevice/mm-kernel-device-qrtr.c b/src/kerneldevice/mm-kernel-device-qrtr.c index a352b972..1abfebb0 100644 --- a/src/kerneldevice/mm-kernel-device-qrtr.c +++ b/src/kerneldevice/mm-kernel-device-qrtr.c @@ -144,7 +144,8 @@ mm_kernel_device_qrtr_init (MMKernelDeviceQrtr *self) /* Set properties*/ g_object_set_data_full (G_OBJECT (self), ID_MM_PORT_TYPE_QMI, g_strdup ("true"), g_free); g_object_set_data_full (G_OBJECT (self), ID_MM_CANDIDATE, g_strdup ("1"), g_free); - + /* For now we're assuming that QRTR ports are available exclusively on Qualcomm SoCs */ + g_object_set_data_full (G_OBJECT (self), "ID_MM_QCOM_SOC", g_strdup ("1"), g_free); } static void