[PATCH v6 09/13] wifi: ath11k: fill parameters for vdev set tpc power WMI command
Wen Gong
quic_wgong at quicinc.com
Mon Sep 25 03:46:32 PDT 2023
On 9/22/2023 4:11 AM, Jeff Johnson wrote:
> On 9/20/2023 1:23 AM, Wen Gong wrote:
>> Prepare the parameters which is needed for WMI command
>> WMI_VDEV_SET_TPC_POWER_CMDID.
>>
>> Tested-on: WCN6855 hw2.0 PCI
>> WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23
>>
>> Signed-off-by: Wen Gong <quic_wgong at quicinc.com>
>> ---
>> drivers/net/wireless/ath/ath11k/mac.c | 277 ++++++++++++++++++++++++++
>> drivers/net/wireless/ath/ath11k/mac.h | 3 +
>> 2 files changed, 280 insertions(+)
>>
>> diff --git a/drivers/net/wireless/ath/ath11k/mac.c
>> b/drivers/net/wireless/ath/ath11k/mac.c
>> index bfb900d98347..f05d66913abd 100644
>> --- a/drivers/net/wireless/ath/ath11k/mac.c
>> +++ b/drivers/net/wireless/ath/ath11k/mac.c
>> @@ -7661,6 +7661,283 @@ static u8
>> ath11k_mac_get_num_pwr_levels(struct cfg80211_chan_def *chan_def)
>> }
>> }
>> +static u16 ath11k_mac_get_6ghz_start_frequency(struct
>> cfg80211_chan_def *chan_def)
>> +{
>> + u16 diff_seq;
>> +
>> + /* It is to get the lowest channel number's center frequency of
>> the chan.
>> + * For example,
>> + * bandwidth=40 MHz, center frequency is 5965, lowest channel is 1
>> + * with center frequency 5955, its diff is 5965 - 5955 = 10.
>> + * bandwidth=80 MHz, center frequency is 5985, lowest channel is 1
>> + * with center frequency 5955, its diff is 5985 - 5955 = 30.
>> + * bandwidth=160 MHz, center frequency is 6025, lowest channel is 1
>> + * with center frequency 5955, its diff is 6025 - 5955 = 70.
>> + */
>> + switch (chan_def->width) {
>> + case NL80211_CHAN_WIDTH_160:
>> + diff_seq = 70;
>> + break;
>> + case NL80211_CHAN_WIDTH_80:
>> + case NL80211_CHAN_WIDTH_80P80:
>> + diff_seq = 30;
>> + break;
>> + case NL80211_CHAN_WIDTH_40:
>> + diff_seq = 10;
>> + break;
>> + default:
>> + diff_seq = 0;
>> + }
>> +
>> + return chan_def->center_freq1 - diff_seq;
>> +}
>> +
>> +static u16 ath11k_mac_get_seg_freq(struct cfg80211_chan_def *chan_def,
>> + u16 start_seq, u8 seq)
>> +{
>> + u16 seg_seq;
>> +
>> + /* It is to get the center frequency of the specific bandwidth.
>> + * start_seq means the lowest channel number's center frequency.
>> + * seq 0/1/2/3 means 20 MHz/40 MHz/80 MHz/160 MHz&80P80.
>> + * For example,
>> + * lowest channel is 1, its center frequency 5955,
>> + * center frequency is 5955 when bandwidth=20 MHz, its diff is
>> 5955 - 5955 = 0.
>> + * lowest channel is 1, its center frequency 5955,
>> + * center frequency is 5965 when bandwidth=40 MHz, its diff is
>> 5965 - 5955 = 10.
>> + * lowest channel is 1, its center frequency 5955,
>> + * center frequency is 5985 when bandwidth=80 MHz, its diff is
>> 5985 - 5955 = 30.
>> + * lowest channel is 1, its center frequency 5955,
>> + * center frequency is 6025 when bandwidth=160 MHz, its diff is
>> 6025 - 5955 = 70.
>> + */
>> + if (chan_def->width == NL80211_CHAN_WIDTH_80P80 && seq == 3)
>> + return chan_def->center_freq2;
>> +
>> + seg_seq = 10 * (BIT(seq) - 1);
>> + return seg_seq + start_seq;
>> +}
>
> The above two functions are driver agnostic. Will other drivers need
> this as well, and if so, should these go into core wireless?
>
Not found other driver need it. If move them to core wireless, then it
will be a new dependency for it.
More information about the ath11k
mailing list