diff mbox series

[1/8] wifi: rtw89: pass chan to rfk_band_changed()

Message ID 20240819091724.33730-2-pkshih@realtek.com
State New
Headers show
Series wifi: rtw89: use and propagate chanctx properly | expand

Commit Message

Ping-Ke Shih Aug. 19, 2024, 9:17 a.m. UTC
From: Zong-Zhe Yang <kevin_yang@realtek.com>

Originally, all chips have implemented rfk_band_changed() and access chan
with hard-code RTW89_CHANCTX_0 in it. But, it's problematic when the chip
supports multiple channels.

So, change the prototype of rfk_band_changed() and pass chan ahead. And,
we will refine the implementation of each chip in the following.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw89/core.c      | 2 +-
 drivers/net/wireless/realtek/rtw89/core.h      | 8 +++++---
 drivers/net/wireless/realtek/rtw89/rtw8851b.c  | 3 ++-
 drivers/net/wireless/realtek/rtw89/rtw8852a.c  | 3 ++-
 drivers/net/wireless/realtek/rtw89/rtw8852b.c  | 3 ++-
 drivers/net/wireless/realtek/rtw89/rtw8852bt.c | 3 ++-
 drivers/net/wireless/realtek/rtw89/rtw8852c.c  | 3 ++-
 drivers/net/wireless/realtek/rtw89/rtw8922a.c  | 3 ++-
 8 files changed, 18 insertions(+), 10 deletions(-)

Comments

Ping-Ke Shih Aug. 27, 2024, 3:06 a.m. UTC | #1
Ping-Ke Shih <pkshih@realtek.com> wrote:

> From: Zong-Zhe Yang <kevin_yang@realtek.com>
> 
> Originally, all chips have implemented rfk_band_changed() and access chan
> with hard-code RTW89_CHANCTX_0 in it. But, it's problematic when the chip
> supports multiple channels.
> 
> So, change the prototype of rfk_band_changed() and pass chan ahead. And,
> we will refine the implementation of each chip in the following.
> 
> Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

8 patch(es) applied to rtw-next branch of rtw.git, thanks.

7c31f102030f wifi: rtw89: pass chan to rfk_band_changed()
e3a2f20991fe wifi: rtw89: 8851b: use right chanctx whenever possible in RFK flow
fcad7da7d3fc wifi: rtw89: 8852a: use right chanctx whenever possible in RFK flow
50b3da25abc6 wifi: rtw89: 8852bx: use right chanctx whenever possible in RFK flow
395bd59c95fd wifi: rtw89: 8852c: use right chanctx whenever possible in RFK flow
abc129676897 wifi: rtw89: 8922a: use right chanctx whenever possible in RFK flow
d03b3d7493f5 wifi: rtw89: rename roc_entity_idx to roc_chanctx_idx
fef63150940c wifi: rtw89: introduce chip support link number and driver MLO capability

---
https://github.com/pkshih/rtw.git
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index 7b28f2c2a08e..e3b72a2b619f 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -429,7 +429,7 @@  int rtw89_set_channel(struct rtw89_dev *rtwdev)
 
 	if (!entity_active || chan_rcd->band_changed) {
 		rtw89_btc_ntfy_switch_band(rtwdev, phy_idx, chan->band_type);
-		rtw89_chip_rfk_band_changed(rtwdev, phy_idx);
+		rtw89_chip_rfk_band_changed(rtwdev, phy_idx, chan);
 	}
 
 	rtw89_set_entity_state(rtwdev, true);
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index 3edb2f4372e4..da39c24d1660 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -3544,7 +3544,8 @@  struct rtw89_chip_ops {
 	void (*rfk_init_late)(struct rtw89_dev *rtwdev);
 	void (*rfk_channel)(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
 	void (*rfk_band_changed)(struct rtw89_dev *rtwdev,
-				 enum rtw89_phy_idx phy_idx);
+				 enum rtw89_phy_idx phy_idx,
+				 const struct rtw89_chan *chan);
 	void (*rfk_scan)(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
 			 bool start);
 	void (*rfk_track)(struct rtw89_dev *rtwdev);
@@ -6174,12 +6175,13 @@  static inline void rtw89_chip_rfk_channel(struct rtw89_dev *rtwdev,
 }
 
 static inline void rtw89_chip_rfk_band_changed(struct rtw89_dev *rtwdev,
-					       enum rtw89_phy_idx phy_idx)
+					       enum rtw89_phy_idx phy_idx,
+					       const struct rtw89_chan *chan)
 {
 	const struct rtw89_chip_info *chip = rtwdev->chip;
 
 	if (chip->ops->rfk_band_changed)
-		chip->ops->rfk_band_changed(rtwdev, phy_idx);
+		chip->ops->rfk_band_changed(rtwdev, phy_idx, chan);
 }
 
 static inline void rtw89_chip_rfk_scan(struct rtw89_dev *rtwdev,
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8851b.c b/drivers/net/wireless/realtek/rtw89/rtw8851b.c
index d1358b9a73f9..d5e42b2ad9ac 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8851b.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8851b.c
@@ -1601,7 +1601,8 @@  static void rtw8851b_rfk_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtw
 }
 
 static void rtw8851b_rfk_band_changed(struct rtw89_dev *rtwdev,
-				      enum rtw89_phy_idx phy_idx)
+				      enum rtw89_phy_idx phy_idx,
+				      const struct rtw89_chan *chan)
 {
 	rtw8851b_tssi_scan(rtwdev, phy_idx);
 }
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
index 1cbea8d665a2..365f074108d4 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
@@ -1361,7 +1361,8 @@  static void rtw8852a_rfk_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtw
 }
 
 static void rtw8852a_rfk_band_changed(struct rtw89_dev *rtwdev,
-				      enum rtw89_phy_idx phy_idx)
+				      enum rtw89_phy_idx phy_idx,
+				      const struct rtw89_chan *chan)
 {
 	rtw8852a_tssi_scan(rtwdev, phy_idx);
 }
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
index 36a81c3323f8..d055847d2de4 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c
@@ -573,7 +573,8 @@  static void rtw8852b_rfk_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtw
 }
 
 static void rtw8852b_rfk_band_changed(struct rtw89_dev *rtwdev,
-				      enum rtw89_phy_idx phy_idx)
+				      enum rtw89_phy_idx phy_idx,
+				      const struct rtw89_chan *chan)
 {
 	rtw8852b_tssi_scan(rtwdev, phy_idx);
 }
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852bt.c b/drivers/net/wireless/realtek/rtw89/rtw8852bt.c
index 647bc98bcc5d..5eb38370aba4 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852bt.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852bt.c
@@ -546,7 +546,8 @@  static void rtw8852bt_rfk_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rt
 }
 
 static void rtw8852bt_rfk_band_changed(struct rtw89_dev *rtwdev,
-				       enum rtw89_phy_idx phy_idx)
+				       enum rtw89_phy_idx phy_idx,
+				       const struct rtw89_chan *chan)
 {
 	rtw8852bt_tssi_scan(rtwdev, phy_idx);
 }
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
index 65e61a2ede27..1fde8a07f73c 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
@@ -1859,7 +1859,8 @@  static void rtw8852c_rfk_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtw
 }
 
 static void rtw8852c_rfk_band_changed(struct rtw89_dev *rtwdev,
-				      enum rtw89_phy_idx phy_idx)
+				      enum rtw89_phy_idx phy_idx,
+				      const struct rtw89_chan *chan)
 {
 	rtw8852c_tssi_scan(rtwdev, phy_idx);
 }
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8922a.c b/drivers/net/wireless/realtek/rtw89/rtw8922a.c
index 7f4ac8b63e48..d67bbbffb94e 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8922a.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8922a.c
@@ -2040,7 +2040,8 @@  static void rtw8922a_rfk_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtw
 }
 
 static void rtw8922a_rfk_band_changed(struct rtw89_dev *rtwdev,
-				      enum rtw89_phy_idx phy_idx)
+				      enum rtw89_phy_idx phy_idx,
+				      const struct rtw89_chan *chan)
 {
 	rtw89_phy_rfk_tssi_and_wait(rtwdev, phy_idx, RTW89_TSSI_SCAN, 6);
 }