mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 23:24:22 -04:00
qcacmn: Add new APIs to regulatory component
Policy mgr needs APIs for chan to freq and freq to chan APIs. Add these APIs to regulatory component at pdev level. Change-Id: I4a0cf2a4b02e16b81d24088c9e9b6c8d36ce6b6c CRs-Fixed: 2002892
This commit is contained in:
parent
45e7d95017
commit
b4071431e9
4 changed files with 159 additions and 69 deletions
|
|
@ -834,23 +834,6 @@ void reg_set_dfs_region(struct wlan_objmgr_psoc *psoc,
|
|||
soc_reg->dfs_region = dfs_reg;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* reg_is_dfs_ch () - Checks the channel state for DFS
|
||||
* @ch: channel
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev, uint8_t ch)
|
||||
{
|
||||
enum channel_state ch_state;
|
||||
|
||||
ch_state = reg_get_channel_state(pdev, ch);
|
||||
|
||||
return ch_state == CHANNEL_STATE_DFS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* reg_get_domain_from_country_code() - get the regulatory domain
|
||||
* @reg_domain_ptr: ptr to store regulatory domain
|
||||
|
|
@ -1746,3 +1729,77 @@ void reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *ch_list,
|
|||
psoc_priv_obj->nol_chan[chan_enum] = nol_ch;
|
||||
}
|
||||
}
|
||||
|
||||
bool reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev, uint32_t chan)
|
||||
{
|
||||
enum channel_state ch_state;
|
||||
|
||||
ch_state = reg_get_channel_state(pdev, chan);
|
||||
|
||||
return ch_state == CHANNEL_STATE_DFS;
|
||||
}
|
||||
|
||||
bool reg_is_passive_or_disable_ch(struct wlan_objmgr_pdev *pdev, uint32_t chan)
|
||||
{
|
||||
enum channel_state ch_state;
|
||||
|
||||
ch_state = reg_get_channel_state(pdev, chan);
|
||||
|
||||
return (ch_state == CHANNEL_STATE_DFS) ||
|
||||
(ch_state == CHANNEL_STATE_DISABLE);
|
||||
}
|
||||
|
||||
|
||||
uint32_t reg_freq_to_chan(struct wlan_objmgr_pdev *pdev, uint32_t freq)
|
||||
{
|
||||
uint32_t count;
|
||||
struct regulatory_channel *chan_list;
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
|
||||
|
||||
wlan_pdev_obj_lock(pdev);
|
||||
pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
|
||||
WLAN_UMAC_COMP_REGULATORY);
|
||||
wlan_pdev_obj_unlock(pdev);
|
||||
|
||||
if (NULL == pdev_priv_obj) {
|
||||
reg_err("reg pdev private obj is NULL");
|
||||
return QDF_STATUS_E_FAULT;
|
||||
}
|
||||
|
||||
chan_list = pdev_priv_obj->cur_chan_list;
|
||||
|
||||
for (count = 0; count < NUM_CHANNELS; count++)
|
||||
if (chan_list[count].center_freq == freq)
|
||||
return chan_list[count].chan_num;
|
||||
|
||||
reg_err("invalid frequency %d", freq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t reg_chan_to_freq(struct wlan_objmgr_pdev *pdev, uint32_t chan_num)
|
||||
{
|
||||
uint32_t count;
|
||||
struct regulatory_channel *chan_list;
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
|
||||
|
||||
wlan_pdev_obj_lock(pdev);
|
||||
pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
|
||||
WLAN_UMAC_COMP_REGULATORY);
|
||||
wlan_pdev_obj_unlock(pdev);
|
||||
|
||||
if (NULL == pdev_priv_obj) {
|
||||
reg_err("reg pdev private obj is NULL");
|
||||
return QDF_STATUS_E_FAULT;
|
||||
}
|
||||
|
||||
chan_list = pdev_priv_obj->cur_chan_list;
|
||||
|
||||
for (count = 0; count < NUM_CHANNELS; count++)
|
||||
if (chan_list[count].chan_num == chan_num)
|
||||
return chan_list[count].center_freq;
|
||||
|
||||
reg_err("invalid channel %d", chan_num);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -421,8 +421,6 @@ void reg_set_channel_params(struct wlan_objmgr_pdev *pdev,
|
|||
void reg_get_dfs_region(struct wlan_objmgr_psoc *psoc,
|
||||
enum dfs_reg *dfs_reg);
|
||||
|
||||
bool reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev, uint8_t ch);
|
||||
|
||||
uint32_t reg_get_channel_reg_power(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t chan_num);
|
||||
|
||||
|
|
@ -488,4 +486,21 @@ QDF_STATUS reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev,
|
|||
|
||||
void reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *ch_list,
|
||||
uint8_t num_ch, bool nol_ch);
|
||||
|
||||
|
||||
/**
|
||||
* reg_is_dfs_ch () - Checks the channel state for DFS
|
||||
* @chan: channel
|
||||
* @pdev: pdev ptr
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev, uint32_t chan);
|
||||
|
||||
bool reg_is_passive_or_disable_ch(struct wlan_objmgr_pdev *pdev, uint32_t chan);
|
||||
|
||||
uint32_t reg_freq_to_chan(struct wlan_objmgr_pdev *pdev, uint32_t freq);
|
||||
|
||||
uint32_t reg_chan_to_freq(struct wlan_objmgr_pdev *pdev, uint32_t chan_num);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -133,14 +133,6 @@ void wlan_reg_set_channel_params(struct wlan_objmgr_pdev *pdev, uint8_t ch,
|
|||
void wlan_reg_get_dfs_region(struct wlan_objmgr_psoc *psoc,
|
||||
enum dfs_reg *dfs_reg);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_dfs_ch () - Checks the channel state for DFS
|
||||
* @ch: channel
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool wlan_reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev, uint8_t ch);
|
||||
|
||||
/**
|
||||
* wlan_reg_get_channel_reg_power() - Provide the channel regulatory power
|
||||
* @chan_num: chennal number
|
||||
|
|
@ -300,4 +292,42 @@ QDF_STATUS wlan_reg_get_current_chan_list(struct wlan_objmgr_pdev
|
|||
*chan_list);
|
||||
void wlan_reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *ch_list,
|
||||
uint8_t num_ch, bool nol_ch);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_dfs_ch () - Checks the channel state for DFS
|
||||
* @chan: channel
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool wlan_reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t chan);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_passive_or_disable_ch () - Checks chan state for passive
|
||||
* and disabled
|
||||
* @chan: channel
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool wlan_reg_is_passive_or_disable_ch(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t chan);
|
||||
|
||||
/**
|
||||
* wlan_reg_freq_to_chan () - convert channel freq to channel number
|
||||
* @freq: frequency
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
uint32_t wlan_reg_freq_to_chan(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t freq);
|
||||
|
||||
/**
|
||||
* wlan_reg_chan_to_freq () - convert channel number to frequency
|
||||
* @chan: channel number
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
uint32_t wlan_reg_chan_to_freq(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t chan);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -143,25 +143,11 @@ void wlan_reg_get_dfs_region(struct wlan_objmgr_psoc *psoc,
|
|||
}
|
||||
|
||||
/**
|
||||
* wlan_reg_is_dfs_ch () - Checks the channel state for DFS
|
||||
* @ch: channel
|
||||
* wlan_reg_get_channel_reg_power() - get regulatory power for channel
|
||||
* @chan_num: channel number
|
||||
*
|
||||
* Return: true or false
|
||||
* Return: int
|
||||
*/
|
||||
bool wlan_reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev, uint8_t ch)
|
||||
{
|
||||
/*
|
||||
* Get the current dfs region
|
||||
*/
|
||||
return reg_is_dfs_ch(pdev, ch);
|
||||
}
|
||||
|
||||
/**
|
||||
* wlan_reg_get_channel_reg_power() - get regulatory power for channel
|
||||
* @chan_num: channel number
|
||||
*
|
||||
* Return: int
|
||||
*/
|
||||
uint32_t wlan_reg_get_channel_reg_power(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t chan_num)
|
||||
{
|
||||
|
|
@ -234,12 +220,6 @@ void wlan_reg_set_dfs_region(struct wlan_objmgr_psoc *psoc,
|
|||
reg_set_dfs_region(psoc, dfs_reg);
|
||||
}
|
||||
|
||||
/**
|
||||
* wlan_reg_get_domain_from_country_code() - get the regulatory domain
|
||||
* @reg_domain_ptr: ptr to store regulatory domain
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS wlan_reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
|
||||
const uint8_t *country_alpha2, enum country_src source)
|
||||
{
|
||||
|
|
@ -277,11 +257,6 @@ uint16_t wlan_reg_dmn_get_curr_opclasses(uint8_t *num_classes,
|
|||
return reg_dmn_get_curr_opclasses(num_classes, class);
|
||||
}
|
||||
|
||||
/**
|
||||
* wlan_regulatory_init() - init regulatory component
|
||||
*
|
||||
* Return: Success or Failure
|
||||
*/
|
||||
QDF_STATUS wlan_regulatory_init(void)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
|
|
@ -331,11 +306,6 @@ QDF_STATUS wlan_regulatory_init(void)
|
|||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* wlan_regulatory_deinit() - deinit regulatory component
|
||||
*
|
||||
* Return: Success or Failure
|
||||
*/
|
||||
QDF_STATUS wlan_regulatory_deinit(void)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
|
|
@ -406,17 +376,35 @@ QDF_STATUS wlan_reg_get_current_chan_list(struct wlan_objmgr_pdev
|
|||
return reg_get_current_chan_list(pdev, chan_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* wlan_reg_update_nol_ch () - Updates NOL channels in current channel list
|
||||
* @pdev: pointer to pdev object
|
||||
* @ch_list: pointer to NOL channel list
|
||||
* @num_ch: No.of channels in list
|
||||
* @nol_ch: set/reset the NOL status
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void wlan_reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *ch_list,
|
||||
uint8_t num_ch, bool nol_ch)
|
||||
{
|
||||
reg_update_nol_ch(pdev, ch_list, num_ch, nol_ch);
|
||||
}
|
||||
|
||||
bool wlan_reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev, uint32_t chan)
|
||||
{
|
||||
return reg_is_dfs_ch(pdev, chan);
|
||||
}
|
||||
|
||||
bool wlan_reg_is_passive_or_disable_ch(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t chan)
|
||||
{
|
||||
return reg_is_passive_or_disable_ch(pdev, chan);
|
||||
}
|
||||
|
||||
uint32_t wlan_reg_freq_to_chan(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t freq)
|
||||
{
|
||||
return reg_freq_to_chan(pdev, freq);
|
||||
}
|
||||
|
||||
uint32_t wlan_reg_chan_to_freq(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t chan_num)
|
||||
{
|
||||
return reg_chan_to_freq(pdev, chan_num);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue