mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
qcacmn: Find if a range has only 6Ghz channels
The range given/provided by the FW (low_5g, hi_5g), may contain both 5Ghz IEEE channels and 6Ghz IEEE channels. Add an API wlan_reg_is_range_only6g to check if the input low and high channel frequencies are only in the 6Ghz frequency range, and also, place the API changes under a macro CONFIG_6G_FREQ_OVERLAP. First find out if 5Ghz and/or 6Ghz range are available. Then, by applying the method of exclusion find out if the range provided by the FW is only a 6G range. Change-Id: I29675a6520a27257f3d1c7424b7f0c94797244cc CRs-Fixed: 2676307
This commit is contained in:
parent
41890f9647
commit
794de3dacb
6 changed files with 145 additions and 0 deletions
|
|
@ -1135,6 +1135,8 @@ struct wlan_lmac_if_reg_rx_ops {
|
|||
QDF_STATUS
|
||||
(*reg_update_pdev_wireless_modes)(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t wireless_modes);
|
||||
bool
|
||||
(*reg_is_range_only6g)(qdf_freq_t low_freq, qdf_freq_t high_freq);
|
||||
QDF_STATUS (*reg_disable_chan_coex)(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t unii_5g_bitmap);
|
||||
bool (*reg_ignore_fw_reg_offload_ind)(struct wlan_objmgr_psoc *psoc);
|
||||
|
|
|
|||
|
|
@ -346,6 +346,9 @@ static void wlan_lmac_if_umac_reg_rx_ops_register(
|
|||
rx_ops->reg_rx_ops.reg_update_pdev_wireless_modes =
|
||||
wlan_reg_update_pdev_wireless_modes;
|
||||
|
||||
rx_ops->reg_rx_ops.reg_is_range_only6g =
|
||||
wlan_reg_is_range_only6g;
|
||||
|
||||
rx_ops->reg_rx_ops.reg_ignore_fw_reg_offload_ind =
|
||||
tgt_reg_ignore_fw_reg_offload_ind;
|
||||
|
||||
|
|
|
|||
|
|
@ -2380,6 +2380,75 @@ bool reg_is_6ghz_chan_freq(uint16_t freq)
|
|||
return REG_IS_6GHZ_FREQ(freq);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_6G_FREQ_OVERLAP
|
||||
/**
|
||||
* reg_is_freq_in_between() - Check whether freq falls within low_freq and
|
||||
* high_freq, inclusively.
|
||||
* @low_freq - Low frequency.
|
||||
* @high_freq - High frequency.
|
||||
* @freq - Frequency to be checked.
|
||||
*
|
||||
* Return: True if freq falls within low_freq and high_freq, else false.
|
||||
*/
|
||||
static bool reg_is_freq_in_between(qdf_freq_t low_freq, qdf_freq_t high_freq,
|
||||
qdf_freq_t freq)
|
||||
{
|
||||
return (low_freq <= freq && freq <= high_freq);
|
||||
}
|
||||
|
||||
static bool reg_is_ranges_overlap(qdf_freq_t low_freq, qdf_freq_t high_freq,
|
||||
qdf_freq_t start_edge_freq,
|
||||
qdf_freq_t end_edge_freq)
|
||||
{
|
||||
return (reg_is_freq_in_between(start_edge_freq,
|
||||
end_edge_freq,
|
||||
low_freq) ||
|
||||
reg_is_freq_in_between(start_edge_freq,
|
||||
end_edge_freq,
|
||||
high_freq) ||
|
||||
reg_is_freq_in_between(low_freq,
|
||||
high_freq,
|
||||
start_edge_freq) ||
|
||||
reg_is_freq_in_between(low_freq,
|
||||
high_freq,
|
||||
end_edge_freq));
|
||||
}
|
||||
|
||||
static bool reg_is_range_overlap_6g(qdf_freq_t low_freq,
|
||||
qdf_freq_t high_freq)
|
||||
{
|
||||
return reg_is_ranges_overlap(low_freq, high_freq,
|
||||
SIXG_STARTING_EDGE_FREQ,
|
||||
SIXG_ENDING_EDGE_FREQ);
|
||||
}
|
||||
|
||||
static bool reg_is_range_overlap_5g(qdf_freq_t low_freq,
|
||||
qdf_freq_t high_freq)
|
||||
{
|
||||
return reg_is_ranges_overlap(low_freq, high_freq,
|
||||
FIVEG_STARTING_EDGE_FREQ,
|
||||
FIVEG_ENDING_EDGE_FREQ);
|
||||
}
|
||||
|
||||
bool reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq)
|
||||
{
|
||||
if (low_freq >= high_freq) {
|
||||
reg_err_rl("Low freq is greater than or equal to high freq");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (reg_is_range_overlap_6g(low_freq, high_freq) &&
|
||||
!reg_is_range_overlap_5g(low_freq, high_freq)) {
|
||||
reg_debug_rl("The device is 6G only");
|
||||
return true;
|
||||
}
|
||||
|
||||
reg_debug_rl("The device is not 6G only");
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint16_t reg_min_6ghz_chan_freq(void)
|
||||
{
|
||||
return REG_MIN_6GHZ_CHAN_FREQ;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,24 @@
|
|||
(((freq) >= channel_map[MIN_5GHZ_CHANNEL].center_freq) && \
|
||||
((freq) <= channel_map[MAX_5GHZ_CHANNEL].center_freq))
|
||||
|
||||
/*
|
||||
* It should be 2.5 MHz actually but since we are using integer use 2
|
||||
* instead, which does not create any problem in the start edge calculation.
|
||||
*/
|
||||
#define HALF_5MHZ_BW 2
|
||||
#define HALF_20MHZ_BW 10
|
||||
|
||||
#define FIVEG_STARTING_EDGE_FREQ (channel_map_global[MIN_49GHZ_CHANNEL]. \
|
||||
center_freq - HALF_5MHZ_BW)
|
||||
#define FIVEG_ENDING_EDGE_FREQ (channel_map_global[MAX_5GHZ_CHANNEL]. \
|
||||
center_freq + HALF_20MHZ_BW)
|
||||
|
||||
#ifdef CONFIG_BAND_6GHZ
|
||||
#define SIXG_STARTING_EDGE_FREQ (channel_map_global[MIN_6GHZ_CHANNEL]. \
|
||||
center_freq - HALF_20MHZ_BW)
|
||||
#define SIXG_ENDING_EDGE_FREQ (channel_map_global[MAX_6GHZ_CHANNEL]. \
|
||||
center_freq + HALF_20MHZ_BW)
|
||||
|
||||
#define FREQ_LEFT_SHIFT 55
|
||||
#define SIXG_STARTING_FREQ 5940
|
||||
#define NUM_80MHZ_BAND_IN_6G 16
|
||||
|
|
@ -508,6 +525,20 @@ bool reg_is_5ghz_ch_freq(uint32_t freq);
|
|||
*/
|
||||
bool reg_is_6ghz_chan_freq(uint16_t freq);
|
||||
|
||||
#ifdef CONFIG_6G_FREQ_OVERLAP
|
||||
/**
|
||||
* reg_is_range_only6g() - Check if the given low_freq and high_freq is in
|
||||
* the 6G range.
|
||||
*
|
||||
* @low_freq - Low frequency.
|
||||
* @high_freq - High frequency.
|
||||
*
|
||||
* Return: Return true if given low_freq and high_freq overlaps 6G range,
|
||||
* else false.
|
||||
*/
|
||||
bool reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* REG_IS_6GHZ_FREQ() - Check if the given channel frequency is 6GHz
|
||||
* @freq: Channel frequency
|
||||
|
|
@ -549,6 +580,14 @@ static inline bool reg_is_6ghz_chan_freq(uint16_t freq)
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_6G_FREQ_OVERLAP
|
||||
static inline bool reg_is_range_only6g(qdf_freq_t low_freq,
|
||||
qdf_freq_t high_freq)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline bool REG_IS_6GHZ_FREQ(uint16_t freq)
|
||||
{
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -142,6 +142,25 @@ bool wlan_reg_is_5ghz_ch_freq(qdf_freq_t freq);
|
|||
#define WLAN_REG_IS_6GHZ_CHAN_FREQ(freq) wlan_reg_is_6ghz_chan_freq(freq)
|
||||
bool wlan_reg_is_6ghz_chan_freq(uint16_t freq);
|
||||
|
||||
#ifdef CONFIG_6G_FREQ_OVERLAP
|
||||
/**
|
||||
* wlan_reg_is_range_only6g() - Check if the given low_freq and high_freq
|
||||
* is in the 6G range.
|
||||
* @low_freq - Low frequency.
|
||||
* @high_freq - High frequency.
|
||||
*
|
||||
* Return: Return true if given low_freq and high_freq overlaps 6G range,
|
||||
* else false.
|
||||
*/
|
||||
bool wlan_reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq);
|
||||
#else
|
||||
static inline bool wlan_reg_is_range_only6g(qdf_freq_t low_freq,
|
||||
qdf_freq_t high_freq)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* wlan_reg_is_6ghz_psc_chan_freq() - Check if the given 6GHz channel frequency
|
||||
* is preferred scanning channel frequency.
|
||||
|
|
@ -178,6 +197,12 @@ static inline bool wlan_reg_is_6ghz_chan_freq(uint16_t freq)
|
|||
return false;
|
||||
}
|
||||
|
||||
static inline bool wlan_reg_is_range_only6g(qdf_freq_t low_freq,
|
||||
qdf_freq_t high_freq)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#define WLAN_REG_IS_6GHZ_PSC_CHAN_FREQ(freq) (false)
|
||||
static inline bool wlan_reg_is_6ghz_psc_chan_freq(uint16_t freq)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -752,6 +752,13 @@ bool wlan_reg_is_6ghz_chan_freq(uint16_t freq)
|
|||
return reg_is_6ghz_chan_freq(freq);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_6G_FREQ_OVERLAP
|
||||
bool wlan_reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq)
|
||||
{
|
||||
return reg_is_range_only6g(low_freq, high_freq);
|
||||
}
|
||||
#endif
|
||||
|
||||
uint16_t wlan_reg_min_6ghz_chan_freq(void)
|
||||
{
|
||||
return reg_min_6ghz_chan_freq();
|
||||
|
|
|
|||
Loading…
Reference in a new issue