2021-06-17 16:20:50

by viktor.barna

[permalink] [raw]
Subject: [RFC v1 013/256] cl8k: add band.c

From: Viktor Barna <[email protected]>

(Part of the split. Please, take a look at the cover letter for more
details).

Signed-off-by: Viktor Barna <[email protected]>
---
drivers/net/wireless/celeno/cl8k/band.c | 60 +++++++++++++++++++++++++
1 file changed, 60 insertions(+)
create mode 100644 drivers/net/wireless/celeno/cl8k/band.c

diff --git a/drivers/net/wireless/celeno/cl8k/band.c b/drivers/net/wireless/celeno/cl8k/band.c
new file mode 100644
index 000000000000..6fc688613a51
--- /dev/null
+++ b/drivers/net/wireless/celeno/cl8k/band.c
@@ -0,0 +1,60 @@
+// SPDX-License-Identifier: MIT
+/* Copyright(c) 2019-2021, Celeno Communications Ltd. */
+
+#include "band.h"
+
+bool cl_band_is_6g(struct cl_hw *cl_hw)
+{
+ return (cl_hw->conf->ci_band_num == 6);
+}
+
+bool cl_band_is_6g_freq(u16 freq)
+{
+ return (freq > 5935) ? true : false;
+}
+
+bool cl_band_is_5g(struct cl_hw *cl_hw)
+{
+ return (cl_hw->conf->ci_band_num == 5);
+}
+
+bool cl_band_is_5g_freq(u16 freq)
+{
+ return (freq > 5000 && freq <= 5835) ? true : false;
+}
+
+bool cl_band_is_24g(struct cl_hw *cl_hw)
+{
+ return (cl_hw->conf->ci_band_num == 24);
+}
+
+bool cl_band_is_24g_freq(u16 freq)
+{
+ return (freq < 5000) ? true : false;
+}
+
+u8 cl_band_to_fw_idx(struct cl_hw *cl_hw)
+{
+ if (cl_hw->nl_band == NL80211_BAND_6GHZ)
+ return FW_BAND_6GHZ;
+
+ if (cl_hw->nl_band == NL80211_BAND_5GHZ)
+ return FW_BAND_5GHZ;
+
+ return FW_BAND_2GHZ;
+}
+
+static u8 fw_to_nl_band[FW_BAND_MAX] = {
+ [FW_BAND_6GHZ] = NL80211_BAND_6GHZ,
+ [FW_BAND_5GHZ] = NL80211_BAND_5GHZ,
+ [FW_BAND_2GHZ] = NL80211_BAND_2GHZ,
+};
+
+u8 cl_band_from_fw_idx(u32 phy_band)
+{
+ if (phy_band < FW_BAND_MAX)
+ return fw_to_nl_band[phy_band];
+
+ return FW_BAND_MAX;
+}
+
--
2.30.0

________________________________
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any retransmission, dissemination, copying or other use of, or taking of any action in reliance upon this information is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Nothing contained herein shall be deemed as a representation, warranty or a commitment by Celeno. No warranties are expressed or implied, including, but not limited to, any implied warranties of non-infringement, merchantability and fitness for a particular purpose.
________________________________