qcacmn: Add wrapper API for indoor channel check

Add the wrapper for the reg_is_freq_indoor API so other modules can
invoke it.

Change-Id: I8e5ec63b117b49a8bdd99d2afdee80b080694a4f
CRs-fixed: 2876035
This commit is contained in:
Lincoln Tran 2021-02-10 22:47:29 -08:00 • committed by Madan Koyyalamudi
commit 3195b9ac6c
4 changed files with 49 additions and 33 deletions

View file

@ -2489,6 +2489,32 @@ bool reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq)
FIVE_GIG_ENDING_EDGE_FREQ);
}
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);
}
#ifdef CONFIG_BAND_6GHZ
bool reg_is_6ghz_chan_freq(uint16_t freq)
{
@ -2549,39 +2575,6 @@ 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));

View file

@ -569,6 +569,15 @@ bool reg_is_range_overlap_2g(qdf_freq_t low_freq, qdf_freq_t high_freq);
*/
bool reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq);
/**
* 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.
*/
bool reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);
#ifdef CONFIG_BAND_6GHZ
/**
* reg_is_6ghz_chan_freq() - Check if the given channel frequency is 6GHz

View file

@ -158,6 +158,15 @@ bool wlan_reg_is_range_overlap_2g(qdf_freq_t low_freq, qdf_freq_t high_freq);
*/
bool wlan_reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq);
/**
* wlan_reg_is_freq_indoor() - Check if a frequency is indoor.
* @pdev: Pointer to pdev.
* @freq: Channel frequency.
*
* Return: Return true if a frequency is indoor, else false.
*/
bool wlan_reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);
#ifdef CONFIG_BAND_6GHZ
/**
* wlan_reg_is_6ghz_chan_freq() - Check if the given channel frequency is 6GHz

View file

@ -830,6 +830,11 @@ bool wlan_reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq)
return reg_is_range_overlap_5g(low_freq, high_freq);
}
bool wlan_reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
{
return reg_is_freq_indoor(pdev, freq);
}
#ifdef CONFIG_BAND_6GHZ
bool wlan_reg_is_6ghz_chan_freq(uint16_t freq)
{