Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dde08fe4 authored by Ashish Kumar Dhanotiya's avatar Ashish Kumar Dhanotiya
Browse files

qcacmn: Add support to check if a freq is indoor frequency

Currently there is no api in driver to check if a frequency is
indoor frequency or not, with this change add support to check if
a frequency is indoor frequency.

Change-Id: I8ff07629f189e194509517d314a306d99abcd7c3
CRs-Fixed: 2969054
parent abeb3db3
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -2341,6 +2341,32 @@ static inline bool BAND_5G_PRESENT(uint8_t band_mask)
	return !!(band_mask & (BIT(REG_BAND_5G)));
}

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)
{
+9 −0
Original line number Diff line number Diff line
@@ -489,6 +489,15 @@ bool reg_is_24ghz_ch_freq(uint32_t freq);
 */
bool reg_is_5ghz_ch_freq(uint32_t 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
+9 −0
Original line number Diff line number Diff line
@@ -132,6 +132,15 @@ bool wlan_reg_is_24ghz_ch_freq(qdf_freq_t freq);
#define WLAN_REG_IS_5GHZ_CH_FREQ(freq) wlan_reg_is_5ghz_ch_freq(freq)
bool wlan_reg_is_5ghz_ch_freq(qdf_freq_t 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
+5 −0
Original line number Diff line number Diff line
@@ -751,6 +751,11 @@ bool wlan_reg_is_5ghz_ch_freq(qdf_freq_t freq)
	return reg_is_5ghz_ch_freq(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)
{