All of lore.kernel.org
 help / color / mirror / Atom feed
From: Evan Quan <evan.quan@amd.com>
To: <rafael@kernel.org>, <lenb@kernel.org>,
	<alexander.deucher@amd.com>, <christian.koenig@amd.com>,
	<Xinhui.Pan@amd.com>, <airlied@gmail.com>, <daniel@ffwll.ch>,
	<evan.quan@amd.com>, <kvalo@kernel.org>, <nbd@nbd.name>,
	<lorenzo@kernel.org>, <ryder.lee@mediatek.com>,
	<shayne.chen@mediatek.com>, <sean.wang@mediatek.com>,
	<matthias.bgg@gmail.com>,
	<angelogioacchino.delregno@collabora.com>,
	<Mario.Limonciello@amd.com>, <Lijo.Lazar@amd.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-acpi@vger.kernel.org>,
	<amd-gfx@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>,
	<linux-wireless@vger.kernel.org>, <ath11k@lists.infradead.org>,
	<ath12k@lists.infradead.org>
Subject: [PATCH 4/9] wifi: ath12k: Add support to the Qualcomm ath12k for ACPI WBRF
Date: Tue, 30 May 2023 10:42:22 +0800	[thread overview]
Message-ID: <20230530024227.2139632-5-evan.quan@amd.com> (raw)
In-Reply-To: <20230530024227.2139632-1-evan.quan@amd.com>

Qualcomm wifi adapters are utilized in systems that support AMD's WBRF
interference mitigation mechanism. For this mechanism to work frequencies
utilized use must be notified to an ACPI device.

If the kernel is configured with CONFIG_ACPI_WBRF then notify this ACPI
device accordingly.

Change based on code review, not tested due to lack of hardware.

Signed-off-by: Evan Quan <evan.quan@amd.com>
---
v1->v2:
  - drop unnecessary EXPORT_SYMBOL_GPL(Mario)
---
 drivers/net/wireless/ath/ath12k/core.c | 21 +++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/core.h | 14 ++++++++++++++
 drivers/net/wireless/ath/ath12k/mac.c  |  4 ++++
 drivers/net/wireless/ath/ath12k/pci.c  |  3 +++
 4 files changed, 42 insertions(+)

diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
index a89e66653f04..fde811524756 100644
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -14,6 +14,7 @@
 #include "dp_rx.h"
 #include "debug.h"
 #include "hif.h"
+#include "../ath.h"
 
 unsigned int ath12k_debug_mask;
 module_param_named(debug_mask, ath12k_debug_mask, uint, 0644);
@@ -935,5 +936,25 @@ struct ath12k_base *ath12k_core_alloc(struct device *dev, size_t priv_size,
 	return NULL;
 }
 
+#if defined(CONFIG_ACPI_WBRF)
+int ath12k_add_wbrf(struct ath12k_base *ab,
+		    struct cfg80211_chan_def *chandef)
+{
+	if (!ab->wbrf)
+		return 0;
+
+	return ath_add_wbrf(ab->dev, chandef);
+}
+
+int ath12k_remove_wbrf(struct ath12k_base *ab,
+		       struct cfg80211_chan_def *chandef)
+{
+	if (!ab->wbrf)
+		return 0;
+
+	return ath_remove_wbrf(ab->dev, chandef);
+}
+#endif
+
 MODULE_DESCRIPTION("Core module for Qualcomm Atheros 802.11be wireless LAN cards.");
 MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
index 9439052a652e..53ffb679b5c1 100644
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -736,6 +736,8 @@ struct ath12k_base {
 	u64 fw_soc_drop_count;
 	bool static_window_map;
 
+	bool wbrf;
+
 	/* must be last */
 	u8 drv_priv[] __aligned(sizeof(void *));
 };
@@ -820,4 +822,16 @@ static inline const char *ath12k_bus_str(enum ath12k_bus bus)
 	return "unknown";
 }
 
+#ifdef CONFIG_ACPI_WBRF
+int ath12k_add_wbrf(struct ath12k_base *ab, struct cfg80211_chan_def *chandef);
+int ath12k_remove_wbrf(struct ath12k_base *ab, struct cfg80211_chan_def *chandef);
+#else
+static inline
+int ath12k_add_wbrf(struct ath12k_base *ab,
+		    struct cfg80211_chan_def *chandef) { return 0; }
+static inline
+int ath12k_remove_wbrf(struct ath12k_base *ab0,
+		       struct cfg80211_chan_def *chandef) { return 0; }
+#endif /* CONFIG_ACPI_WBRF */
+
 #endif /* _CORE_H_ */
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index ee792822b411..999354d60228 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -5396,6 +5396,8 @@ static int ath12k_mac_op_add_chanctx(struct ieee80211_hw *hw,
 
 	mutex_lock(&ar->conf_mutex);
 
+	ath12k_add_wbrf(ab, &ctx->def);
+
 	spin_lock_bh(&ar->data_lock);
 	/* TODO: In case of multiple channel context, populate rx_channel from
 	 * Rx PPDU desc information.
@@ -5420,6 +5422,8 @@ static void ath12k_mac_op_remove_chanctx(struct ieee80211_hw *hw,
 
 	mutex_lock(&ar->conf_mutex);
 
+	ath12k_remove_wbrf(ab, &ctx->def);
+
 	spin_lock_bh(&ar->data_lock);
 	/* TODO: In case of there is one more channel context left, populate
 	 * rx_channel with the channel of that remaining channel context.
diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c
index 9f174daf324c..544d93d66d69 100644
--- a/drivers/net/wireless/ath/ath12k/pci.c
+++ b/drivers/net/wireless/ath/ath12k/pci.c
@@ -13,6 +13,7 @@
 #include "hif.h"
 #include "mhi.h"
 #include "debug.h"
+#include "../ath.h"
 
 #define ATH12K_PCI_BAR_NUM		0
 #define ATH12K_PCI_DMA_MASK		32
@@ -1272,6 +1273,8 @@ static int ath12k_pci_probe(struct pci_dev *pdev,
 		goto err_ce_free;
 	}
 
+	ab->wbrf = ath_check_wbrf_support(ab->dev);
+
 	ret = ath12k_core_init(ab);
 	if (ret) {
 		ath12k_err(ab, "failed to init core: %d\n", ret);
-- 
2.34.1


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

WARNING: multiple messages have this Message-ID (diff)
From: Evan Quan <evan.quan@amd.com>
To: <rafael@kernel.org>, <lenb@kernel.org>,
	<alexander.deucher@amd.com>, <christian.koenig@amd.com>,
	<Xinhui.Pan@amd.com>, <airlied@gmail.com>, <daniel@ffwll.ch>,
	<evan.quan@amd.com>, <kvalo@kernel.org>, <nbd@nbd.name>,
	<lorenzo@kernel.org>, <ryder.lee@mediatek.com>,
	<shayne.chen@mediatek.com>, <sean.wang@mediatek.com>,
	<matthias.bgg@gmail.com>,
	<angelogioacchino.delregno@collabora.com>,
	<Mario.Limonciello@amd.com>, <Lijo.Lazar@amd.com>
Cc: ath12k@lists.infradead.org, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-acpi@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	ath11k@lists.infradead.org
Subject: [PATCH 4/9] wifi: ath12k: Add support to the Qualcomm ath12k for ACPI WBRF
Date: Tue, 30 May 2023 10:42:22 +0800	[thread overview]
Message-ID: <20230530024227.2139632-5-evan.quan@amd.com> (raw)
In-Reply-To: <20230530024227.2139632-1-evan.quan@amd.com>

Qualcomm wifi adapters are utilized in systems that support AMD's WBRF
interference mitigation mechanism. For this mechanism to work frequencies
utilized use must be notified to an ACPI device.

If the kernel is configured with CONFIG_ACPI_WBRF then notify this ACPI
device accordingly.

Change based on code review, not tested due to lack of hardware.

Signed-off-by: Evan Quan <evan.quan@amd.com>
---
v1->v2:
  - drop unnecessary EXPORT_SYMBOL_GPL(Mario)
---
 drivers/net/wireless/ath/ath12k/core.c | 21 +++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/core.h | 14 ++++++++++++++
 drivers/net/wireless/ath/ath12k/mac.c  |  4 ++++
 drivers/net/wireless/ath/ath12k/pci.c  |  3 +++
 4 files changed, 42 insertions(+)

diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
index a89e66653f04..fde811524756 100644
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -14,6 +14,7 @@
 #include "dp_rx.h"
 #include "debug.h"
 #include "hif.h"
+#include "../ath.h"
 
 unsigned int ath12k_debug_mask;
 module_param_named(debug_mask, ath12k_debug_mask, uint, 0644);
@@ -935,5 +936,25 @@ struct ath12k_base *ath12k_core_alloc(struct device *dev, size_t priv_size,
 	return NULL;
 }
 
+#if defined(CONFIG_ACPI_WBRF)
+int ath12k_add_wbrf(struct ath12k_base *ab,
+		    struct cfg80211_chan_def *chandef)
+{
+	if (!ab->wbrf)
+		return 0;
+
+	return ath_add_wbrf(ab->dev, chandef);
+}
+
+int ath12k_remove_wbrf(struct ath12k_base *ab,
+		       struct cfg80211_chan_def *chandef)
+{
+	if (!ab->wbrf)
+		return 0;
+
+	return ath_remove_wbrf(ab->dev, chandef);
+}
+#endif
+
 MODULE_DESCRIPTION("Core module for Qualcomm Atheros 802.11be wireless LAN cards.");
 MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
index 9439052a652e..53ffb679b5c1 100644
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -736,6 +736,8 @@ struct ath12k_base {
 	u64 fw_soc_drop_count;
 	bool static_window_map;
 
+	bool wbrf;
+
 	/* must be last */
 	u8 drv_priv[] __aligned(sizeof(void *));
 };
@@ -820,4 +822,16 @@ static inline const char *ath12k_bus_str(enum ath12k_bus bus)
 	return "unknown";
 }
 
+#ifdef CONFIG_ACPI_WBRF
+int ath12k_add_wbrf(struct ath12k_base *ab, struct cfg80211_chan_def *chandef);
+int ath12k_remove_wbrf(struct ath12k_base *ab, struct cfg80211_chan_def *chandef);
+#else
+static inline
+int ath12k_add_wbrf(struct ath12k_base *ab,
+		    struct cfg80211_chan_def *chandef) { return 0; }
+static inline
+int ath12k_remove_wbrf(struct ath12k_base *ab0,
+		       struct cfg80211_chan_def *chandef) { return 0; }
+#endif /* CONFIG_ACPI_WBRF */
+
 #endif /* _CORE_H_ */
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index ee792822b411..999354d60228 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -5396,6 +5396,8 @@ static int ath12k_mac_op_add_chanctx(struct ieee80211_hw *hw,
 
 	mutex_lock(&ar->conf_mutex);
 
+	ath12k_add_wbrf(ab, &ctx->def);
+
 	spin_lock_bh(&ar->data_lock);
 	/* TODO: In case of multiple channel context, populate rx_channel from
 	 * Rx PPDU desc information.
@@ -5420,6 +5422,8 @@ static void ath12k_mac_op_remove_chanctx(struct ieee80211_hw *hw,
 
 	mutex_lock(&ar->conf_mutex);
 
+	ath12k_remove_wbrf(ab, &ctx->def);
+
 	spin_lock_bh(&ar->data_lock);
 	/* TODO: In case of there is one more channel context left, populate
 	 * rx_channel with the channel of that remaining channel context.
diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c
index 9f174daf324c..544d93d66d69 100644
--- a/drivers/net/wireless/ath/ath12k/pci.c
+++ b/drivers/net/wireless/ath/ath12k/pci.c
@@ -13,6 +13,7 @@
 #include "hif.h"
 #include "mhi.h"
 #include "debug.h"
+#include "../ath.h"
 
 #define ATH12K_PCI_BAR_NUM		0
 #define ATH12K_PCI_DMA_MASK		32
@@ -1272,6 +1273,8 @@ static int ath12k_pci_probe(struct pci_dev *pdev,
 		goto err_ce_free;
 	}
 
+	ab->wbrf = ath_check_wbrf_support(ab->dev);
+
 	ret = ath12k_core_init(ab);
 	if (ret) {
 		ath12k_err(ab, "failed to init core: %d\n", ret);
-- 
2.34.1


WARNING: multiple messages have this Message-ID (diff)
From: Evan Quan <evan.quan@amd.com>
To: <rafael@kernel.org>, <lenb@kernel.org>,
	<alexander.deucher@amd.com>, <christian.koenig@amd.com>,
	<Xinhui.Pan@amd.com>, <airlied@gmail.com>, <daniel@ffwll.ch>,
	<evan.quan@amd.com>, <kvalo@kernel.org>, <nbd@nbd.name>,
	<lorenzo@kernel.org>, <ryder.lee@mediatek.com>,
	<shayne.chen@mediatek.com>, <sean.wang@mediatek.com>,
	<matthias.bgg@gmail.com>,
	<angelogioacchino.delregno@collabora.com>,
	<Mario.Limonciello@amd.com>, <Lijo.Lazar@amd.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-acpi@vger.kernel.org>,
	<amd-gfx@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>,
	<linux-wireless@vger.kernel.org>, <ath11k@lists.infradead.org>,
	<ath12k@lists.infradead.org>
Subject: [PATCH 4/9] wifi: ath12k: Add support to the Qualcomm ath12k for ACPI WBRF
Date: Tue, 30 May 2023 10:42:22 +0800	[thread overview]
Message-ID: <20230530024227.2139632-5-evan.quan@amd.com> (raw)
In-Reply-To: <20230530024227.2139632-1-evan.quan@amd.com>

Qualcomm wifi adapters are utilized in systems that support AMD's WBRF
interference mitigation mechanism. For this mechanism to work frequencies
utilized use must be notified to an ACPI device.

If the kernel is configured with CONFIG_ACPI_WBRF then notify this ACPI
device accordingly.

Change based on code review, not tested due to lack of hardware.

Signed-off-by: Evan Quan <evan.quan@amd.com>
---
v1->v2:
  - drop unnecessary EXPORT_SYMBOL_GPL(Mario)
---
 drivers/net/wireless/ath/ath12k/core.c | 21 +++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/core.h | 14 ++++++++++++++
 drivers/net/wireless/ath/ath12k/mac.c  |  4 ++++
 drivers/net/wireless/ath/ath12k/pci.c  |  3 +++
 4 files changed, 42 insertions(+)

diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
index a89e66653f04..fde811524756 100644
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -14,6 +14,7 @@
 #include "dp_rx.h"
 #include "debug.h"
 #include "hif.h"
+#include "../ath.h"
 
 unsigned int ath12k_debug_mask;
 module_param_named(debug_mask, ath12k_debug_mask, uint, 0644);
@@ -935,5 +936,25 @@ struct ath12k_base *ath12k_core_alloc(struct device *dev, size_t priv_size,
 	return NULL;
 }
 
+#if defined(CONFIG_ACPI_WBRF)
+int ath12k_add_wbrf(struct ath12k_base *ab,
+		    struct cfg80211_chan_def *chandef)
+{
+	if (!ab->wbrf)
+		return 0;
+
+	return ath_add_wbrf(ab->dev, chandef);
+}
+
+int ath12k_remove_wbrf(struct ath12k_base *ab,
+		       struct cfg80211_chan_def *chandef)
+{
+	if (!ab->wbrf)
+		return 0;
+
+	return ath_remove_wbrf(ab->dev, chandef);
+}
+#endif
+
 MODULE_DESCRIPTION("Core module for Qualcomm Atheros 802.11be wireless LAN cards.");
 MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
index 9439052a652e..53ffb679b5c1 100644
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -736,6 +736,8 @@ struct ath12k_base {
 	u64 fw_soc_drop_count;
 	bool static_window_map;
 
+	bool wbrf;
+
 	/* must be last */
 	u8 drv_priv[] __aligned(sizeof(void *));
 };
@@ -820,4 +822,16 @@ static inline const char *ath12k_bus_str(enum ath12k_bus bus)
 	return "unknown";
 }
 
+#ifdef CONFIG_ACPI_WBRF
+int ath12k_add_wbrf(struct ath12k_base *ab, struct cfg80211_chan_def *chandef);
+int ath12k_remove_wbrf(struct ath12k_base *ab, struct cfg80211_chan_def *chandef);
+#else
+static inline
+int ath12k_add_wbrf(struct ath12k_base *ab,
+		    struct cfg80211_chan_def *chandef) { return 0; }
+static inline
+int ath12k_remove_wbrf(struct ath12k_base *ab0,
+		       struct cfg80211_chan_def *chandef) { return 0; }
+#endif /* CONFIG_ACPI_WBRF */
+
 #endif /* _CORE_H_ */
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index ee792822b411..999354d60228 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -5396,6 +5396,8 @@ static int ath12k_mac_op_add_chanctx(struct ieee80211_hw *hw,
 
 	mutex_lock(&ar->conf_mutex);
 
+	ath12k_add_wbrf(ab, &ctx->def);
+
 	spin_lock_bh(&ar->data_lock);
 	/* TODO: In case of multiple channel context, populate rx_channel from
 	 * Rx PPDU desc information.
@@ -5420,6 +5422,8 @@ static void ath12k_mac_op_remove_chanctx(struct ieee80211_hw *hw,
 
 	mutex_lock(&ar->conf_mutex);
 
+	ath12k_remove_wbrf(ab, &ctx->def);
+
 	spin_lock_bh(&ar->data_lock);
 	/* TODO: In case of there is one more channel context left, populate
 	 * rx_channel with the channel of that remaining channel context.
diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c
index 9f174daf324c..544d93d66d69 100644
--- a/drivers/net/wireless/ath/ath12k/pci.c
+++ b/drivers/net/wireless/ath/ath12k/pci.c
@@ -13,6 +13,7 @@
 #include "hif.h"
 #include "mhi.h"
 #include "debug.h"
+#include "../ath.h"
 
 #define ATH12K_PCI_BAR_NUM		0
 #define ATH12K_PCI_DMA_MASK		32
@@ -1272,6 +1273,8 @@ static int ath12k_pci_probe(struct pci_dev *pdev,
 		goto err_ce_free;
 	}
 
+	ab->wbrf = ath_check_wbrf_support(ab->dev);
+
 	ret = ath12k_core_init(ab);
 	if (ret) {
 		ath12k_err(ab, "failed to init core: %d\n", ret);
-- 
2.34.1


-- 
ath12k mailing list
ath12k@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/ath12k

WARNING: multiple messages have this Message-ID (diff)
From: Evan Quan <evan.quan@amd.com>
To: <rafael@kernel.org>, <lenb@kernel.org>,
	<alexander.deucher@amd.com>, <christian.koenig@amd.com>,
	<Xinhui.Pan@amd.com>, <airlied@gmail.com>, <daniel@ffwll.ch>,
	<evan.quan@amd.com>, <kvalo@kernel.org>, <nbd@nbd.name>,
	<lorenzo@kernel.org>, <ryder.lee@mediatek.com>,
	<shayne.chen@mediatek.com>, <sean.wang@mediatek.com>,
	<matthias.bgg@gmail.com>,
	<angelogioacchino.delregno@collabora.com>,
	<Mario.Limonciello@amd.com>, <Lijo.Lazar@amd.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-acpi@vger.kernel.org>,
	<amd-gfx@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>,
	<linux-wireless@vger.kernel.org>, <ath11k@lists.infradead.org>,
	<ath12k@lists.infradead.org>
Subject: [PATCH 4/9] wifi: ath12k: Add support to the Qualcomm ath12k for ACPI WBRF
Date: Tue, 30 May 2023 10:42:22 +0800	[thread overview]
Message-ID: <20230530024227.2139632-5-evan.quan@amd.com> (raw)
In-Reply-To: <20230530024227.2139632-1-evan.quan@amd.com>

Qualcomm wifi adapters are utilized in systems that support AMD's WBRF
interference mitigation mechanism. For this mechanism to work frequencies
utilized use must be notified to an ACPI device.

If the kernel is configured with CONFIG_ACPI_WBRF then notify this ACPI
device accordingly.

Change based on code review, not tested due to lack of hardware.

Signed-off-by: Evan Quan <evan.quan@amd.com>
---
v1->v2:
  - drop unnecessary EXPORT_SYMBOL_GPL(Mario)
---
 drivers/net/wireless/ath/ath12k/core.c | 21 +++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/core.h | 14 ++++++++++++++
 drivers/net/wireless/ath/ath12k/mac.c  |  4 ++++
 drivers/net/wireless/ath/ath12k/pci.c  |  3 +++
 4 files changed, 42 insertions(+)

diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
index a89e66653f04..fde811524756 100644
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -14,6 +14,7 @@
 #include "dp_rx.h"
 #include "debug.h"
 #include "hif.h"
+#include "../ath.h"
 
 unsigned int ath12k_debug_mask;
 module_param_named(debug_mask, ath12k_debug_mask, uint, 0644);
@@ -935,5 +936,25 @@ struct ath12k_base *ath12k_core_alloc(struct device *dev, size_t priv_size,
 	return NULL;
 }
 
+#if defined(CONFIG_ACPI_WBRF)
+int ath12k_add_wbrf(struct ath12k_base *ab,
+		    struct cfg80211_chan_def *chandef)
+{
+	if (!ab->wbrf)
+		return 0;
+
+	return ath_add_wbrf(ab->dev, chandef);
+}
+
+int ath12k_remove_wbrf(struct ath12k_base *ab,
+		       struct cfg80211_chan_def *chandef)
+{
+	if (!ab->wbrf)
+		return 0;
+
+	return ath_remove_wbrf(ab->dev, chandef);
+}
+#endif
+
 MODULE_DESCRIPTION("Core module for Qualcomm Atheros 802.11be wireless LAN cards.");
 MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
index 9439052a652e..53ffb679b5c1 100644
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -736,6 +736,8 @@ struct ath12k_base {
 	u64 fw_soc_drop_count;
 	bool static_window_map;
 
+	bool wbrf;
+
 	/* must be last */
 	u8 drv_priv[] __aligned(sizeof(void *));
 };
@@ -820,4 +822,16 @@ static inline const char *ath12k_bus_str(enum ath12k_bus bus)
 	return "unknown";
 }
 
+#ifdef CONFIG_ACPI_WBRF
+int ath12k_add_wbrf(struct ath12k_base *ab, struct cfg80211_chan_def *chandef);
+int ath12k_remove_wbrf(struct ath12k_base *ab, struct cfg80211_chan_def *chandef);
+#else
+static inline
+int ath12k_add_wbrf(struct ath12k_base *ab,
+		    struct cfg80211_chan_def *chandef) { return 0; }
+static inline
+int ath12k_remove_wbrf(struct ath12k_base *ab0,
+		       struct cfg80211_chan_def *chandef) { return 0; }
+#endif /* CONFIG_ACPI_WBRF */
+
 #endif /* _CORE_H_ */
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index ee792822b411..999354d60228 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -5396,6 +5396,8 @@ static int ath12k_mac_op_add_chanctx(struct ieee80211_hw *hw,
 
 	mutex_lock(&ar->conf_mutex);
 
+	ath12k_add_wbrf(ab, &ctx->def);
+
 	spin_lock_bh(&ar->data_lock);
 	/* TODO: In case of multiple channel context, populate rx_channel from
 	 * Rx PPDU desc information.
@@ -5420,6 +5422,8 @@ static void ath12k_mac_op_remove_chanctx(struct ieee80211_hw *hw,
 
 	mutex_lock(&ar->conf_mutex);
 
+	ath12k_remove_wbrf(ab, &ctx->def);
+
 	spin_lock_bh(&ar->data_lock);
 	/* TODO: In case of there is one more channel context left, populate
 	 * rx_channel with the channel of that remaining channel context.
diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c
index 9f174daf324c..544d93d66d69 100644
--- a/drivers/net/wireless/ath/ath12k/pci.c
+++ b/drivers/net/wireless/ath/ath12k/pci.c
@@ -13,6 +13,7 @@
 #include "hif.h"
 #include "mhi.h"
 #include "debug.h"
+#include "../ath.h"
 
 #define ATH12K_PCI_BAR_NUM		0
 #define ATH12K_PCI_DMA_MASK		32
@@ -1272,6 +1273,8 @@ static int ath12k_pci_probe(struct pci_dev *pdev,
 		goto err_ce_free;
 	}
 
+	ab->wbrf = ath_check_wbrf_support(ab->dev);
+
 	ret = ath12k_core_init(ab);
 	if (ret) {
 		ath12k_err(ab, "failed to init core: %d\n", ret);
-- 
2.34.1


  parent reply	other threads:[~2023-05-30  2:43 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30  2:42 [PATCH 0/9] Support Wifi RFI interference mitigation feature Evan Quan
2023-05-30  2:42 ` Evan Quan
2023-05-30  2:42 ` Evan Quan
2023-05-30  2:42 ` Evan Quan
2023-05-30  2:42 ` [PATCH 1/9] drivers/acpi: Add support for Wifi band RF mitigations Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42 ` [PATCH 2/9] mt76: Add support to the Mediatek MT7921 for ACPI WBRF Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42 ` [PATCH 3/9] wifi: ath11k: Add support to the Qualcomm ath11k " Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42 ` Evan Quan [this message]
2023-05-30  2:42   ` [PATCH 4/9] wifi: ath12k: Add support to the Qualcomm ath12k " Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42 ` [PATCH 5/9] drm/amd/pm: update driver_if and ppsmc headers for coming wbrf feature Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42 ` [PATCH 6/9] drm/amd/pm: setup the framework to support Wifi RFI mitigation feature Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42 ` [PATCH 7/9] drm/amd/pm: add flood detection for wbrf events Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42 ` [PATCH 8/9] drm/amd/pm: enable Wifi RFI mitigation feature support for SMU13.0.0 Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30 13:50   ` kernel test robot
2023-05-30 13:50     ` kernel test robot
2023-05-30 13:50     ` kernel test robot
2023-05-30 13:50     ` kernel test robot
2023-05-30 14:10   ` kernel test robot
2023-05-30 14:10     ` kernel test robot
2023-05-30 14:10     ` kernel test robot
2023-05-30 14:10     ` kernel test robot
2023-05-30  2:42 ` [PATCH 9/9] drm/amd/pm: enable Wifi RFI mitigation feature support for SMU13.0.7 Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30  2:42   ` Evan Quan
2023-05-30 19:43   ` kernel test robot
2023-05-30 19:43     ` kernel test robot
2023-05-30 19:43     ` kernel test robot
2023-05-30 19:43     ` kernel test robot
2023-05-30  6:22 ` [PATCH 0/9] Support Wifi RFI interference mitigation feature Felix Fietkau
2023-05-30  6:22   ` Felix Fietkau
2023-05-30  6:22   ` Felix Fietkau
2023-05-30  6:22   ` Felix Fietkau
2023-05-30 15:34   ` Limonciello, Mario
2023-05-30 15:34     ` Limonciello, Mario
2023-05-30 15:34     ` Limonciello, Mario
2023-05-30 15:34     ` Limonciello, Mario

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230530024227.2139632-5-evan.quan@amd.com \
    --to=evan.quan@amd.com \
    --cc=Lijo.Lazar@amd.com \
    --cc=Mario.Limonciello@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=ath11k@lists.infradead.org \
    --cc=ath12k@lists.infradead.org \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kvalo@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=rafael@kernel.org \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    --cc=shayne.chen@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.