mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 19:43:40 +02:00
wifi: rtw89: enable dynamic antenna gain based on country
The dynamic antenna gain (DAG) considers the country, meaning DAG can be activated only when countries and regulatory domains allow it. Signed-off-by: Kuan-Chung Chen <damon.chen@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20250306021144.12854-4-pkshih@realtek.com
This commit is contained in:
parent
8ef675fc79
commit
9c225e1198
|
|
@ -4666,6 +4666,7 @@ enum rtw89_ant_gain_domain_type {
|
|||
struct rtw89_ant_gain_info {
|
||||
s8 offset[RTW89_ANT_GAIN_CHAIN_NUM][RTW89_ANT_GAIN_SUBBAND_NR];
|
||||
u32 regd_enabled;
|
||||
bool block_country;
|
||||
};
|
||||
|
||||
struct rtw89_6ghz_span {
|
||||
|
|
|
|||
|
|
@ -2044,7 +2044,7 @@ static s8 rtw89_phy_ant_gain_offset(struct rtw89_dev *rtwdev, u8 band, u32 cente
|
|||
if (!chip->support_ant_gain)
|
||||
return 0;
|
||||
|
||||
if (!(ant_gain->regd_enabled & BIT(regd)))
|
||||
if (ant_gain->block_country || !(ant_gain->regd_enabled & BIT(regd)))
|
||||
return 0;
|
||||
|
||||
offset_patha = rtw89_phy_ant_gain_query(rtwdev, RF_PATH_A, center_freq);
|
||||
|
|
@ -2057,10 +2057,14 @@ s16 rtw89_phy_ant_gain_pwr_offset(struct rtw89_dev *rtwdev,
|
|||
const struct rtw89_chan *chan)
|
||||
{
|
||||
struct rtw89_ant_gain_info *ant_gain = &rtwdev->ant_gain;
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
u8 regd = rtw89_regd_get(rtwdev, chan->band_type);
|
||||
s8 offset_patha, offset_pathb;
|
||||
|
||||
if (!(ant_gain->regd_enabled & BIT(regd)))
|
||||
if (!chip->support_ant_gain)
|
||||
return 0;
|
||||
|
||||
if (ant_gain->block_country || !(ant_gain->regd_enabled & BIT(regd)))
|
||||
return 0;
|
||||
|
||||
offset_patha = rtw89_phy_ant_gain_query(rtwdev, RF_PATH_A, chan->freq);
|
||||
|
|
@ -2079,7 +2083,8 @@ int rtw89_print_ant_gain(struct rtw89_dev *rtwdev, char *buf, size_t bufsz,
|
|||
char *p = buf, *end = buf + bufsz;
|
||||
s8 offset_patha, offset_pathb;
|
||||
|
||||
if (!chip->support_ant_gain || !(ant_gain->regd_enabled & BIT(regd))) {
|
||||
if (!(chip->support_ant_gain && (ant_gain->regd_enabled & BIT(regd))) ||
|
||||
ant_gain->block_country) {
|
||||
p += scnprintf(p, end - p, "no DAG is applied\n");
|
||||
goto out;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -733,6 +733,19 @@ static void rtw89_regd_apply_policy_tas(struct rtw89_dev *rtwdev)
|
|||
tas->block_regd = !test_bit(RTW89_REGD_FUNC_TAS, regd->func_bitmap);
|
||||
}
|
||||
|
||||
static void rtw89_regd_apply_policy_ant_gain(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory;
|
||||
struct rtw89_ant_gain_info *ant_gain = &rtwdev->ant_gain;
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
const struct rtw89_regd *regd = regulatory->regd;
|
||||
|
||||
if (!chip->support_ant_gain)
|
||||
return;
|
||||
|
||||
ant_gain->block_country = !test_bit(RTW89_REGD_FUNC_DAG, regd->func_bitmap);
|
||||
}
|
||||
|
||||
static void rtw89_regd_notifier_apply(struct rtw89_dev *rtwdev,
|
||||
struct wiphy *wiphy,
|
||||
struct regulatory_request *request)
|
||||
|
|
@ -751,6 +764,7 @@ static void rtw89_regd_notifier_apply(struct rtw89_dev *rtwdev,
|
|||
rtw89_regd_apply_policy_unii4(rtwdev, wiphy);
|
||||
rtw89_regd_apply_policy_6ghz(rtwdev, wiphy);
|
||||
rtw89_regd_apply_policy_tas(rtwdev);
|
||||
rtw89_regd_apply_policy_ant_gain(rtwdev);
|
||||
}
|
||||
|
||||
static
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user