staging: wfx: simplify hif_set_output_power() usage

Hardware API use 10th of dBm for output power unit. Upper layers should
use same units than mac80211 and the conversion should be done by low
level layer of the driver (hif_set_output_power())

In add, current code of hif_set_output_power() use a __le32 while the
device API specify a specific structure for this.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-7-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jérôme Pouiller 2020-01-15 13:54:10 +00:00 коммит произвёл Greg Kroah-Hartman
Родитель c360f1ccdc
Коммит 5fd64673cf
3 изменённых файлов: 9 добавлений и 7 удалений

Просмотреть файл

@ -15,13 +15,15 @@
#include "hif_tx.h"
#include "hif_api_mib.h"
static inline int hif_set_output_power(struct wfx_vif *wvif, int power_level)
static inline int hif_set_output_power(struct wfx_vif *wvif, int val)
{
__le32 val = cpu_to_le32(power_level);
struct hif_mib_current_tx_power_level arg = {
.power_level = cpu_to_le32(val * 10),
};
return hif_write_mib(wvif->wdev, wvif->id,
HIF_MIB_ID_CURRENT_TX_POWER_LEVEL,
&val, sizeof(val));
&arg, sizeof(arg));
}
static inline int hif_set_beacon_wakeup_period(struct wfx_vif *wvif,

Просмотреть файл

@ -61,7 +61,7 @@ static int send_scan_req(struct wfx_vif *wvif,
return timeout;
ret = wait_for_completion_timeout(&wvif->scan_complete, timeout);
if (req->channels[start_idx]->max_power != wvif->wdev->output_power)
hif_set_output_power(wvif, wvif->wdev->output_power * 10);
hif_set_output_power(wvif, wvif->wdev->output_power);
wfx_tx_unlock(wvif->wdev);
if (!ret) {
dev_notice(wvif->wdev->dev, "scan timeout\n");

Просмотреть файл

@ -503,7 +503,7 @@ static void wfx_do_unjoin(struct wfx_vif *wvif)
hif_keep_alive_period(wvif, 0);
hif_reset(wvif, false);
wfx_tx_policy_init(wvif);
hif_set_output_power(wvif, wvif->wdev->output_power * 10);
hif_set_output_power(wvif, wvif->wdev->output_power);
wvif->dtim_period = 0;
hif_set_macaddr(wvif, wvif->vif->addr);
wfx_free_event_queue(wvif);
@ -1063,7 +1063,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw,
if (changed & BSS_CHANGED_TXPOWER &&
info->txpower != wdev->output_power) {
wdev->output_power = info->txpower;
hif_set_output_power(wvif, wdev->output_power * 10);
hif_set_output_power(wvif, wdev->output_power);
}
mutex_unlock(&wdev->conf_mutex);
@ -1317,7 +1317,7 @@ int wfx_config(struct ieee80211_hw *hw, u32 changed)
mutex_lock(&wdev->conf_mutex);
if (changed & IEEE80211_CONF_CHANGE_POWER) {
wdev->output_power = conf->power_level;
hif_set_output_power(wvif, wdev->output_power * 10);
hif_set_output_power(wvif, wdev->output_power);
}
if (changed & IEEE80211_CONF_CHANGE_PS) {