wifi: rtw89: extend tx shape format for regulatory 6 GHz power type

Even under the same regulation, TX shape may need different settings for
different 6 GHz power types. So, add one more dimension for that. Because
TX shape parameters are not quite large, the 2/5/6 GHz sections are not
divided into different structures. So, the 2/5 GHz sections will also get
the new dimension. To 2/5 GHz sections, fill the TX shape settings with
RTW89_REG_6GHZ_POWER_DFLT (0) field.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260712034506.53209-7-pkshih@realtek.com
This commit is contained in:
Zong-Zhe Yang
2026-07-12 11:45:04 +08:00
committed by Ping-Ke Shih
parent 7054b03136
commit b4eaac15cb
3 changed files with 28 additions and 7 deletions

View File

@@ -4921,8 +4921,9 @@ struct rtw89_txpwr_rule_6ghz {
};
struct rtw89_tx_shape {
const u8 (*lmt)[RTW89_BAND_NUM][RTW89_RS_TX_SHAPE_NUM][RTW89_REGD_NUM];
const u8 (*lmt_ru)[RTW89_BAND_NUM][RTW89_REGD_NUM];
const u8 (*lmt)[RTW89_BAND_NUM][RTW89_RS_TX_SHAPE_NUM][RTW89_REGD_NUM]
[NUM_OF_RTW89_REG_6GHZ_POWER];
const u8 (*lmt_ru)[RTW89_BAND_NUM][RTW89_REGD_NUM][NUM_OF_RTW89_REG_6GHZ_POWER];
const u8 (*lmt_v0)[RTW89_BAND_NUM][RTW89_RS_TX_SHAPE_NUM][RTW89_REGD_NUM];
const u8 (*lmt_ru_v0)[RTW89_BAND_NUM][RTW89_REGD_NUM];
@@ -5019,12 +5020,13 @@ struct rtw89_txpwr_lmt_ru_6ghz_data {
struct rtw89_tx_shape_lmt_data {
struct rtw89_txpwr_conf conf;
u8 v[RTW89_BAND_NUM][RTW89_RS_TX_SHAPE_NUM][RTW89_REGD_NUM];
u8 v[RTW89_BAND_NUM][RTW89_RS_TX_SHAPE_NUM][RTW89_REGD_NUM]
[NUM_OF_RTW89_REG_6GHZ_POWER];
};
struct rtw89_tx_shape_lmt_ru_data {
struct rtw89_txpwr_conf conf;
u8 v[RTW89_BAND_NUM][RTW89_REGD_NUM];
u8 v[RTW89_BAND_NUM][RTW89_REGD_NUM][NUM_OF_RTW89_REG_6GHZ_POWER];
};
struct rtw89_rfe_data {
@@ -8454,8 +8456,10 @@ static inline u8 rtw89_regd_get(struct rtw89_dev *rtwdev, u8 band)
static inline u8 rtw89_get_tx_shape_idx(struct rtw89_dev *rtwdev, u8 band,
enum rtw89_rate_section rs)
{
struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory;
const struct rtw89_rfe_parms *rfe_parms = rtwdev->rfe_parms;
const struct rtw89_tx_shape *tx_shape = &rfe_parms->tx_shape;
u8 reg6_pwr = regulatory->reg_6ghz_power;
u8 regd = rtw89_regd_get(rtwdev, band);
if (unlikely(rs >= RTW89_RS_TX_SHAPE_NUM))
@@ -8464,7 +8468,10 @@ static inline u8 rtw89_get_tx_shape_idx(struct rtw89_dev *rtwdev, u8 band,
if (!tx_shape->lmt)
goto v0;
return (*tx_shape->lmt)[band][rs][regd];
if (band != RTW89_BAND_6G)
reg6_pwr = RTW89_REG_6GHZ_POWER_DFLT;
return (*tx_shape->lmt)[band][rs][regd][reg6_pwr];
v0:
return (*tx_shape->lmt_v0)[band][rs][regd];

View File

@@ -11916,6 +11916,12 @@ fw_tx_shape_lmt_entry_valid(const struct rtw89_fw_tx_shape_lmt_entry *e,
if (e->regd >= RTW89_REGD_NUM)
return false;
/* ensure compatibility work with 2/5 GHz */
static_assert(RTW89_REG_6GHZ_POWER_DFLT == 0);
if (e->reg6_pwr >= NUM_OF_RTW89_REG_6GHZ_POWER)
return false;
return true;
}
@@ -11930,7 +11936,7 @@ void rtw89_fw_load_tx_shape_lmt(struct rtw89_tx_shape_lmt_data *data)
if (!fw_tx_shape_lmt_entry_valid(&entry, cursor, conf))
continue;
data->v[entry.band][entry.tx_shape_rs][entry.regd] = entry.v;
data->v[entry.band][entry.tx_shape_rs][entry.regd][entry.reg6_pwr] = entry.v;
}
}
@@ -11947,6 +11953,12 @@ fw_tx_shape_lmt_ru_entry_valid(const struct rtw89_fw_tx_shape_lmt_ru_entry *e,
if (e->regd >= RTW89_REGD_NUM)
return false;
/* ensure compatibility work with 2/5 GHz */
static_assert(RTW89_REG_6GHZ_POWER_DFLT == 0);
if (e->reg6_pwr >= NUM_OF_RTW89_REG_6GHZ_POWER)
return false;
return true;
}
@@ -11961,7 +11973,7 @@ void rtw89_fw_load_tx_shape_lmt_ru(struct rtw89_tx_shape_lmt_ru_data *data)
if (!fw_tx_shape_lmt_ru_entry_valid(&entry, cursor, conf))
continue;
data->v[entry.band][entry.regd] = entry.v;
data->v[entry.band][entry.regd][entry.reg6_pwr] = entry.v;
}
}

View File

@@ -5812,6 +5812,7 @@ struct rtw89_fw_tx_shape_lmt_entry {
u8 tx_shape_rs;
u8 regd;
u8 v;
u8 reg6_pwr;
} __packed;
/* must consider compatibility; don't insert new in the mid */
@@ -5819,6 +5820,7 @@ struct rtw89_fw_tx_shape_lmt_ru_entry {
u8 band;
u8 regd;
u8 v;
u8 reg6_pwr;
} __packed;
const struct rtw89_rfe_parms *