[PATCH v3 08/12] wifi: ath11k: implement QRTR endpoint ID fetching for PCI
Juha-Matti Tilli
juha-matti.tilli at iki.fi
Tue Sep 8 02:34:33 PDT 2026
QRTR endpoint ID fetching for PCIe devices will use MHI.
Originally-by: Mihai Moldovan <ionic at ionic.de>
Signed-off-by: Mihai Moldovan <ionic at ionic.de>
Signed-off-by: Juha-Matti Tilli <juha-matti.tilli at iki.fi>
---
drivers/net/wireless/ath/ath11k/mhi.c | 46 +++++++++++++++++++++++++++
drivers/net/wireless/ath/ath11k/mhi.h | 1 +
drivers/net/wireless/ath/ath11k/pci.c | 1 +
3 files changed, 48 insertions(+)
diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/ath/ath11k/mhi.c
index a6c9ff112c68f..755a57b6058a1 100644
--- a/drivers/net/wireless/ath/ath11k/mhi.c
+++ b/drivers/net/wireless/ath/ath11k/mhi.c
@@ -11,6 +11,8 @@
#include <linux/of_address.h>
#include <linux/ioport.h>
+#include <net/qrtr.h>
+
#include "core.h"
#include "debug.h"
#include "mhi.h"
@@ -502,3 +504,47 @@ void ath11k_mhi_coredump(struct mhi_controller *mhi_ctrl, bool in_panic)
{
mhi_download_rddm_image(mhi_ctrl, in_panic);
}
+
+static void ath11k_mhi_qrtr_free_mhi_id(void *mhi_cntrl_void)
+{
+ struct mhi_controller *mhi_cntrl = mhi_cntrl_void;
+ u32 id = mhi_cntrl->qrtr_endpoint_id;
+
+ if (id != 0)
+ qrtr_endpoint_free_data_id(id);
+ mhi_cntrl->qrtr_endpoint_id = 0;
+ mhi_cntrl->free_qrtr_endpoint_id = NULL;
+}
+
+int ath11k_mhi_set_qrtr_endpoint_id(struct ath11k_base *ab)
+{
+ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab);
+ struct ath11k_qmi *qmi = &ab->qmi;
+ int ret;
+
+ spin_lock(&ab_pci->mhi_ctrl->qrtr_endpoint_lock);
+
+ if (ab_pci->mhi_ctrl->qrtr_endpoint_id) {
+ qmi->handle.endpoint_id = ab_pci->mhi_ctrl->qrtr_endpoint_id;
+ } else {
+ ret = qrtr_endpoint_get_data_id(&qmi->handle.endpoint_id);
+ if (!ret) {
+ ab_pci->mhi_ctrl->qrtr_endpoint_id =
+ qmi->handle.endpoint_id;
+ ab_pci->mhi_ctrl->free_qrtr_endpoint_id =
+ ath11k_mhi_qrtr_free_mhi_id;
+ }
+ }
+
+ spin_unlock(&ab_pci->mhi_ctrl->qrtr_endpoint_lock);
+
+ ath11k_dbg(ab, ATH11K_DBG_PCI,
+ "queried mhi_ctrl QRTR endpoint ID: %u\n",
+ qmi->handle.endpoint_id);
+ if (ret) {
+ ath11k_warn(ab, "failed to query QRTR endpoint ID: %d\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
diff --git a/drivers/net/wireless/ath/ath11k/mhi.h b/drivers/net/wireless/ath/ath11k/mhi.h
index 7e7561ce883cb..46a9c978b30d1 100644
--- a/drivers/net/wireless/ath/ath11k/mhi.h
+++ b/drivers/net/wireless/ath/ath11k/mhi.h
@@ -28,4 +28,5 @@ int ath11k_mhi_suspend(struct ath11k_pci *ar_pci);
int ath11k_mhi_resume(struct ath11k_pci *ar_pci);
void ath11k_mhi_coredump(struct mhi_controller *mhi_ctrl, bool in_panic);
+int ath11k_mhi_set_qrtr_endpoint_id(struct ath11k_base *ab);
#endif
diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c
index a163168f36176..56490a21964a3 100644
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -918,6 +918,7 @@ static const struct ath11k_hif_ops ath11k_pci_hif_ops = {
.ce_irq_enable = ath11k_pci_hif_ce_irq_enable,
.ce_irq_disable = ath11k_pci_hif_ce_irq_disable,
.get_ce_msi_idx = ath11k_pcic_get_ce_msi_idx,
+ .set_qrtr_endpoint_id = ath11k_mhi_set_qrtr_endpoint_id,
#ifdef CONFIG_DEV_COREDUMP
.coredump_download = ath11k_pci_coredump_download,
#endif
--
2.34.1
More information about the ath12k
mailing list