mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-14 04:09:18 -04:00
staging: wfx: simplify hif_set_rcpi_rssi_threshold() usage
The structure hif_mib_rcpi_rssi_threshold come from hardware API. It is not intended to be manipulated in upper layers of the driver. In add, current code for hif_set_rcpi_rssi_threshold() is dumb. It should pack data using the hardware representation instead of leaving all work to the caller. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20200115135338.14374-8-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5fd64673cf
commit
9ed8b0d0f2
@@ -44,10 +44,25 @@ static inline int hif_set_beacon_wakeup_period(struct wfx_vif *wvif,
|
||||
}
|
||||
|
||||
static inline int hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif,
|
||||
struct hif_mib_rcpi_rssi_threshold *arg)
|
||||
int rssi_thold, int rssi_hyst)
|
||||
{
|
||||
struct hif_mib_rcpi_rssi_threshold arg = {
|
||||
.rolling_average_count = 8,
|
||||
.detection = 1,
|
||||
};
|
||||
|
||||
if (!rssi_thold && !rssi_hyst) {
|
||||
arg.upperthresh = 1;
|
||||
arg.lowerthresh = 1;
|
||||
} else {
|
||||
arg.upper_threshold = rssi_thold + rssi_hyst;
|
||||
arg.upper_threshold = (arg.upper_threshold + 110) * 2;
|
||||
arg.lower_threshold = rssi_thold;
|
||||
arg.lower_threshold = (arg.lower_threshold + 110) * 2;
|
||||
}
|
||||
|
||||
return hif_write_mib(wvif->wdev, wvif->id,
|
||||
HIF_MIB_ID_RCPI_RSSI_THRESHOLD, arg, sizeof(*arg));
|
||||
HIF_MIB_ID_RCPI_RSSI_THRESHOLD, &arg, sizeof(arg));
|
||||
}
|
||||
|
||||
static inline int hif_get_counters_table(struct wfx_dev *wdev,
|
||||
|
||||
@@ -1033,31 +1033,9 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw,
|
||||
hif_slot_time(wvif, info->use_short_slot ? 9 : 20);
|
||||
|
||||
if (changed & BSS_CHANGED_ASSOC || changed & BSS_CHANGED_CQM) {
|
||||
struct hif_mib_rcpi_rssi_threshold th = {
|
||||
.rolling_average_count = 8,
|
||||
.detection = 1,
|
||||
};
|
||||
|
||||
wvif->cqm_rssi_thold = info->cqm_rssi_thold;
|
||||
|
||||
if (!info->cqm_rssi_thold && !info->cqm_rssi_hyst) {
|
||||
th.upperthresh = 1;
|
||||
th.lowerthresh = 1;
|
||||
} else {
|
||||
/* FIXME It's not a correct way of setting threshold.
|
||||
* Upper and lower must be set equal here and adjusted
|
||||
* in callback. However current implementation is much
|
||||
* more reliable and stable.
|
||||
*/
|
||||
/* RSSI: signed Q8.0, RCPI: unsigned Q7.1
|
||||
* RSSI = RCPI / 2 - 110
|
||||
*/
|
||||
th.upper_threshold = info->cqm_rssi_thold + info->cqm_rssi_hyst;
|
||||
th.upper_threshold = (th.upper_threshold + 110) * 2;
|
||||
th.lower_threshold = info->cqm_rssi_thold;
|
||||
th.lower_threshold = (th.lower_threshold + 110) * 2;
|
||||
}
|
||||
hif_set_rcpi_rssi_threshold(wvif, &th);
|
||||
hif_set_rcpi_rssi_threshold(wvif, info->cqm_rssi_thold,
|
||||
info->cqm_rssi_hyst);
|
||||
}
|
||||
|
||||
if (changed & BSS_CHANGED_TXPOWER &&
|
||||
|
||||
Reference in New Issue
Block a user