qcacmn: Add a new API wlan_reg_is_6g_freq_indoor

Add a new API wlan_reg_is_6g_freq_indoor, to check if a 6G channel
frequency is indoor.

Change-Id: I2ccdcc2760b6aeade0409346a315b004014525c7
CRs-Fixed: 2731637
This commit is contained in:
Hariharan Basuthkar 2020-06-30 22:29:15 +05:30 • committed by snandini
commit 504e0726c7
4 changed files with 75 additions and 0 deletions

View file

@ -2582,6 +2582,44 @@ bool reg_is_6ghz_psc_chan_freq(uint16_t freq)
return false;
}
/**
* reg_is_freq_indoor() - Check if the input frequency is an indoor frequency.
* @pdev: Pointer to pdev.
* @freq: Channel frequency.
*
* Return: Return true if the input frequency is indoor, else false.
*/
static bool reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
{
struct regulatory_channel *cur_chan_list;
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
enum channel_enum chan_enum;
pdev_priv_obj = reg_get_pdev_obj(pdev);
if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
reg_err("reg pdev priv obj is NULL");
return false;
}
chan_enum = reg_get_chan_enum_for_freq(freq);
if (chan_enum == INVALID_CHANNEL) {
reg_err_rl("Invalid chan enum %d", chan_enum);
return false;
}
cur_chan_list = pdev_priv_obj->cur_chan_list;
return (cur_chan_list[chan_enum].chan_flags &
REGULATORY_CHAN_INDOOR_ONLY);
}
bool reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
{
return (REG_IS_6GHZ_FREQ(freq) && reg_is_freq_indoor(pdev, freq));
}
/**
* BAND_6G_PRESENT() - Check if REG_BAND_6G is set in the band_mask
* @band_mask: Bitmask for bands

View file

@ -598,6 +598,15 @@ static inline bool REG_IS_6GHZ_FREQ(uint16_t freq)
*/
bool reg_is_6ghz_psc_chan_freq(uint16_t freq);
/**
* reg_is_6g_freq_indoor() - Check if a 6GHz frequency is indoor.
* @pdev: Pointer to pdev.
* @freq: Channel frequency.
*
* Return: Return true if a 6GHz frequency is indoor, else false.
*/
bool reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);
/**
* reg_min_6ghz_chan_freq() - Get minimum 6GHz channel center frequency
*
@ -617,6 +626,12 @@ static inline bool reg_is_6ghz_chan_freq(uint16_t freq)
return false;
}
static inline bool
reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_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)

View file

@ -191,6 +191,17 @@ uint16_t wlan_reg_min_6ghz_chan_freq(void);
#define WLAN_REG_MAX_6GHZ_CHAN_FREQ wlan_reg_max_6ghz_chan_freq()
uint16_t wlan_reg_max_6ghz_chan_freq(void);
/**
* wlan_reg_is_6g_freq_indoor() - Check if a 6GHz frequency is indoor.
* @pdev: Pointer to pdev.
* @freq: Channel frequency.
*
* Return: Return true if a 6GHz frequency is indoor, else false.
*/
#define WLAN_REG_IS_6GHZ_FREQ_INDOOR(pdev, freq) \
wlan_reg_is_6g_freq_indoor(pdev, freq)
bool wlan_reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);
#else
#define WLAN_REG_IS_6GHZ_CHAN_FREQ(freq) (false)
@ -222,6 +233,13 @@ static inline uint16_t wlan_reg_max_6ghz_chan_freq(void)
{
return 0;
}
#define WLAN_REG_IS_6GHZ_FREQ_INDOOR(pdev, freq) (false)
static inline bool
wlan_reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
{
return false;
}
#endif /* CONFIG_BAND_6GHZ */
/**

View file

@ -817,6 +817,10 @@ bool wlan_reg_is_6ghz_psc_chan_freq(uint16_t freq)
return reg_is_6ghz_psc_chan_freq(freq);
}
bool wlan_reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
{
return reg_is_6g_freq_indoor(pdev, freq);
}
#endif /* CONFIG_BAND_6GHZ */
uint16_t