wifi: rtw89: indicate TX shape table inside RFE parameter
authorZong-Zhe Yang <kevin_yang@realtek.com>
Wed, 20 Sep 2023 07:43:17 +0000 (15:43 +0800)
committerKalle Valo <kvalo@kernel.org>
Fri, 22 Sep 2023 07:43:57 +0000 (10:43 +0300)
For next-generation chips, TX shape table comes from RFE (RF front end)
parameter. It can be different according to RFE type. So, we indicate
TX shape table inside RFE parameter ahead. For current chips, even with
different RFE types, a chip is configured with a single TX shape table.
So, this commit doesn't really affect these currently supported chips.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230920074322.42898-3-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.h
drivers/net/wireless/realtek/rtw89/rtw8851b.c
drivers/net/wireless/realtek/rtw89/rtw8851b_table.c
drivers/net/wireless/realtek/rtw89/rtw8851b_table.h
drivers/net/wireless/realtek/rtw89/rtw8852b.c
drivers/net/wireless/realtek/rtw89/rtw8852b_table.c
drivers/net/wireless/realtek/rtw89/rtw8852b_table.h
drivers/net/wireless/realtek/rtw89/rtw8852c.c
drivers/net/wireless/realtek/rtw89/rtw8852c_table.c
drivers/net/wireless/realtek/rtw89/rtw8852c_table.h

index cafc1e09f4d63565e8f553bdaade4883fe3b57c0..61d46d1301432bf906e441fa49b6a908f1fb3281 100644 (file)
@@ -3358,6 +3358,7 @@ struct rtw89_rfe_parms {
        struct rtw89_txpwr_rule_2ghz rule_2ghz;
        struct rtw89_txpwr_rule_5ghz rule_5ghz;
        struct rtw89_txpwr_rule_6ghz rule_6ghz;
+       const u8 (*tx_shape)[RTW89_BAND_NUM][RTW89_RS_TX_SHAPE_NUM][RTW89_REGD_NUM];
 };
 
 struct rtw89_rfe_parms_conf {
index f4ef2a7e4b1a85ff83cc4ccf8400275b85fe7938..a6170c8f881361cb12be5a197d2e3cbb08b39543 100644 (file)
@@ -1704,10 +1704,11 @@ static void rtw8851b_set_tx_shape(struct rtw89_dev *rtwdev,
                                  const struct rtw89_chan *chan,
                                  enum rtw89_phy_idx phy_idx)
 {
+       const struct rtw89_rfe_parms *rfe_parms = rtwdev->rfe_parms;
        u8 band = chan->band_type;
        u8 regd = rtw89_regd_get(rtwdev, band);
-       u8 tx_shape_cck = rtw89_8851b_tx_shape[band][RTW89_RS_CCK][regd];
-       u8 tx_shape_ofdm = rtw89_8851b_tx_shape[band][RTW89_RS_OFDM][regd];
+       u8 tx_shape_cck = (*rfe_parms->tx_shape)[band][RTW89_RS_CCK][regd];
+       u8 tx_shape_ofdm = (*rfe_parms->tx_shape)[band][RTW89_RS_OFDM][regd];
 
        if (band == RTW89_BAND_2G)
                rtw8851b_bb_set_tx_shape_dfir(rtwdev, chan, tx_shape_cck, phy_idx);
index c447f91a4bd006cd93f44ec26a97e21119934f2c..58d413f61e987a49df5c14996b70711fc0bf44df 100644 (file)
@@ -3321,6 +3321,7 @@ static const s8 _txpwr_track_delta_swingidx_2g_cck_a_p[] = {
         0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4
 };
 
+static
 const u8 rtw89_8851b_tx_shape[RTW89_BAND_NUM][RTW89_RS_TX_SHAPE_NUM]
                             [RTW89_REGD_NUM] = {
        [0][0][RTW89_ACMA] = 0,
@@ -14818,6 +14819,7 @@ const struct rtw89_rfe_parms rtw89_8851b_dflt_parms = {
                .lmt = &rtw89_8851b_txpwr_lmt_5g,
                .lmt_ru = &rtw89_8851b_txpwr_lmt_ru_5g,
        },
+       .tx_shape = &rtw89_8851b_tx_shape,
 };
 
 static const struct rtw89_rfe_parms rtw89_8851b_rfe_parms_type2 = {
@@ -14829,6 +14831,7 @@ static const struct rtw89_rfe_parms rtw89_8851b_rfe_parms_type2 = {
                .lmt = &rtw89_8851b_txpwr_lmt_5g_type2,
                .lmt_ru = &rtw89_8851b_txpwr_lmt_ru_5g_type2,
        },
+       .tx_shape = &rtw89_8851b_tx_shape,
 };
 
 const struct rtw89_rfe_parms_conf rtw89_8851b_rfe_parms_conf[] = {
index a8737de02f669fddb2794901f2a826e4ea27b386..7967a98d830e8f332b067ed4d671ee7553b6475e 100644 (file)
@@ -13,8 +13,6 @@ extern const struct rtw89_phy_table rtw89_8851b_phy_radioa_table;
 extern const struct rtw89_phy_table rtw89_8851b_phy_nctl_table;
 extern const struct rtw89_txpwr_table rtw89_8851b_byr_table;
 extern const struct rtw89_txpwr_track_cfg rtw89_8851b_trk_cfg;
-extern const u8 rtw89_8851b_tx_shape[RTW89_BAND_NUM][RTW89_RS_TX_SHAPE_NUM]
-                                   [RTW89_REGD_NUM];
 extern const struct rtw89_rfe_parms rtw89_8851b_dflt_parms;
 extern const struct rtw89_rfe_parms_conf rtw89_8851b_rfe_parms_conf[];
 
index f6222e9c7eda574a12cc21b7ea2947ebe1f3e61b..90764d8c539ec5ddf38fcc7b4fc80adf373bee6c 100644 (file)
@@ -1689,10 +1689,11 @@ static void rtw8852b_set_tx_shape(struct rtw89_dev *rtwdev,
                                  const struct rtw89_chan *chan,
                                  enum rtw89_phy_idx phy_idx)
 {
+       const struct rtw89_rfe_parms *rfe_parms = rtwdev->rfe_parms;
        u8 band = chan->band_type;
        u8 regd = rtw89_regd_get(rtwdev, band);
-       u8 tx_shape_cck = rtw89_8852b_tx_shape[band][RTW89_RS_CCK][regd];
-       u8 tx_shape_ofdm = rtw89_8852b_tx_shape[band][RTW89_RS_OFDM][regd];
+       u8 tx_shape_cck = (*rfe_parms->tx_shape)[band][RTW89_RS_CCK][regd];
+       u8 tx_shape_ofdm = (*rfe_parms->tx_shape)[band][RTW89_RS_OFDM][regd];
 
        if (band == RTW89_BAND_2G)
                rtw8852b_bb_set_tx_shape_dfir(rtwdev, chan, tx_shape_cck, phy_idx);
index 17124d851a228e17eff2a66a437432f9f4d3e872..0939e37a9c522ddd497792aeec2ef63a790e7fa6 100644 (file)
@@ -14666,6 +14666,7 @@ static const s8 _txpwr_track_delta_swingidx_2g_cck_a_p[] = {
        0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
 
+static
 const u8 rtw89_8852b_tx_shape[RTW89_BAND_NUM][RTW89_RS_TX_SHAPE_NUM]
                             [RTW89_REGD_NUM] = {
        [0][0][RTW89_ACMA] = 0,
@@ -22889,4 +22890,5 @@ const struct rtw89_rfe_parms rtw89_8852b_dflt_parms = {
                .lmt = &rtw89_8852b_txpwr_lmt_5g,
                .lmt_ru = &rtw89_8852b_txpwr_lmt_ru_5g,
        },
+       .tx_shape = &rtw89_8852b_tx_shape,
 };
index 7ef217629f46fc44d72ac00acea3e9aa2b6ede82..816b15285c6633178c39f80ba7130cb9ba74579b 100644 (file)
@@ -14,8 +14,6 @@ extern const struct rtw89_phy_table rtw89_8852b_phy_radiob_table;
 extern const struct rtw89_phy_table rtw89_8852b_phy_nctl_table;
 extern const struct rtw89_txpwr_table rtw89_8852b_byr_table;
 extern const struct rtw89_txpwr_track_cfg rtw89_8852b_trk_cfg;
-extern const u8 rtw89_8852b_tx_shape[RTW89_BAND_NUM][RTW89_RS_TX_SHAPE_NUM]
-                                   [RTW89_REGD_NUM];
 extern const struct rtw89_rfe_parms rtw89_8852b_dflt_parms;
 
 #endif
index 9c38612eb0687d56667c11effd4a4bcd8cf1bbf1..4d88118f4f6edfc65960ad15bc1b910b8af975df 100644 (file)
@@ -1966,10 +1966,11 @@ static void rtw8852c_set_tx_shape(struct rtw89_dev *rtwdev,
                                  const struct rtw89_chan *chan,
                                  enum rtw89_phy_idx phy_idx)
 {
+       const struct rtw89_rfe_parms *rfe_parms = rtwdev->rfe_parms;
        u8 band = chan->band_type;
        u8 regd = rtw89_regd_get(rtwdev, band);
-       u8 tx_shape_cck = rtw89_8852c_tx_shape[band][RTW89_RS_CCK][regd];
-       u8 tx_shape_ofdm = rtw89_8852c_tx_shape[band][RTW89_RS_OFDM][regd];
+       u8 tx_shape_cck = (*rfe_parms->tx_shape)[band][RTW89_RS_CCK][regd];
+       u8 tx_shape_ofdm = (*rfe_parms->tx_shape)[band][RTW89_RS_OFDM][regd];
 
        if (band == RTW89_BAND_2G)
                rtw8852c_bb_set_tx_shape_dfir(rtwdev, chan, tx_shape_cck, phy_idx);
index 2ffd979750e350cbbf7b46cd1bb2854840a7d9ae..3b393d17a08cffcf630d994bdd9645f1a1d2ff99 100644 (file)
@@ -31525,6 +31525,7 @@ static const s8 _txpwr_track_delta_swingidx_2g_cck_a_p[] = {
         3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5
 };
 
+static
 const u8 rtw89_8852c_tx_shape[RTW89_BAND_NUM][RTW89_RS_TX_SHAPE_NUM]
                             [RTW89_REGD_NUM] = {
        [0][0][RTW89_ACMA] = 0,
@@ -56473,4 +56474,5 @@ const struct rtw89_rfe_parms rtw89_8852c_dflt_parms = {
                .lmt = &rtw89_8852c_txpwr_lmt_6g,
                .lmt_ru = &rtw89_8852c_txpwr_lmt_ru_6g,
        },
+       .tx_shape = &rtw89_8852c_tx_shape,
 };
index 3eb0c49951744aa05ddd99c8d6d7ef71c2be0bf1..4cff36dbf08701d31a3663b3be6bdcd1428a9412 100644 (file)
@@ -15,8 +15,6 @@ extern const struct rtw89_phy_table rtw89_8852c_phy_nctl_table;
 extern const struct rtw89_txpwr_table rtw89_8852c_byr_table;
 extern const struct rtw89_phy_tssi_dbw_table rtw89_8852c_tssi_dbw_table;
 extern const struct rtw89_txpwr_track_cfg rtw89_8852c_trk_cfg;
-extern const u8 rtw89_8852c_tx_shape[RTW89_BAND_NUM][RTW89_RS_TX_SHAPE_NUM]
-                                   [RTW89_REGD_NUM];
 extern const struct rtw89_rfe_parms rtw89_8852c_dflt_parms;
 
 #endif