]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: rtw89: 8922d: add set channel of RF part
authorPing-Ke Shih <pkshih@realtek.com>
Tue, 24 Mar 2026 06:20:49 +0000 (14:20 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Mon, 30 Mar 2026 02:11:58 +0000 (10:11 +0800)
The set channel of RF part is to configure channel and bandwidth on a
register. The function to encode channel and bandwidth into register
value will be implemented by coming patch.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260324062049.52266-8-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/rtw8922d.c
drivers/net/wireless/realtek/rtw89/rtw8922d_rfk.c [new file with mode: 0644]
drivers/net/wireless/realtek/rtw89/rtw8922d_rfk.h [new file with mode: 0644]

index cae92e2abd85f1c9a92c283d8fdc620f768198c7..1b5fc6c9ea85f1758f38ccda7c27aac6c4c3dad7 100644 (file)
@@ -8,6 +8,7 @@
 #include "phy.h"
 #include "reg.h"
 #include "rtw8922d.h"
+#include "rtw8922d_rfk.h"
 #include "util.h"
 
 #define RTW8922D_FW_FORMAT_MAX 0
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8922d_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8922d_rfk.c
new file mode 100644 (file)
index 0000000..6b35d19
--- /dev/null
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+/* Copyright(c) 2026  Realtek Corporation
+ */
+
+#include "phy.h"
+#include "reg.h"
+#include "rtw8922d.h"
+#include "rtw8922d_rfk.h"
+
+static
+void rtw8922d_ctl_band_ch_bw(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
+                            const struct rtw89_chan *chan)
+{
+       u8 synpath;
+       u32 rf18;
+
+       synpath = rtw89_phy_get_syn_sel(rtwdev, phy);
+       rf18 = rtw89_chip_chan_to_rf18_val(rtwdev, chan);
+
+       rtw89_write_rf(rtwdev, synpath, RR_RSV1, RFREG_MASK, 0x0);
+       rtw89_write_rf(rtwdev, synpath, RR_MOD, RFREG_MASK, 0x30000);
+       rtw89_write_rf(rtwdev, synpath, RR_CFGCH, RFREG_MASK, rf18);
+       fsleep(400);
+       rtw89_write_rf(rtwdev, synpath, RR_RSV1, RFREG_MASK, 0x1);
+       rtw89_write_rf(rtwdev, synpath, RR_CFGCH_V1, RFREG_MASK, rf18);
+}
+
+void rtw8922d_set_channel_rf(struct rtw89_dev *rtwdev,
+                            const struct rtw89_chan *chan,
+                            enum rtw89_phy_idx phy_idx)
+{
+       rtw8922d_ctl_band_ch_bw(rtwdev, phy_idx, chan);
+}
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8922d_rfk.h b/drivers/net/wireless/realtek/rtw89/rtw8922d_rfk.h
new file mode 100644 (file)
index 0000000..03af1f0
--- /dev/null
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
+/* Copyright(c) 2026  Realtek Corporation
+ */
+
+#ifndef __RTW89_8922D_RFK_H__
+#define __RTW89_8922D_RFK_H__
+
+#include "core.h"
+
+void rtw8922d_set_channel_rf(struct rtw89_dev *rtwdev,
+                            const struct rtw89_chan *chan,
+                            enum rtw89_phy_idx phy_idx);
+
+#endif