@@ -360,13 +360,19 @@ int hif_set_edca_queue_params(struct wfx_vif *wvif,
return ret;
}
-int hif_set_pm(struct wfx_vif *wvif, const struct hif_req_set_pm_mode *arg)
+int hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout)
{
int ret;
struct hif_msg *hif;
struct hif_req_set_pm_mode *body = wfx_alloc_hif(sizeof(*body), &hif);
- memcpy(body, arg, sizeof(*body));
+ if (ps) {
+ body->pm_mode.enter_psm = 1;
+ // Firmware does not support more than 128ms
+ body->fast_psm_idle_period = min(dynamic_ps_timeout * 2, 255);
+ if (body->fast_psm_idle_period)
+ body->pm_mode.fast_psm = 1;
+ }
wfx_fill_header(hif, wvif->id, HIF_REQ_ID_SET_PM_MODE, sizeof(*body));
ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false);
kfree(hif);
@@ -47,7 +47,7 @@ int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id,
int hif_scan(struct wfx_vif *wvif, const struct wfx_scan_params *arg);
int hif_stop_scan(struct wfx_vif *wvif);
int hif_join(struct wfx_vif *wvif, const struct hif_req_join *arg);
-int hif_set_pm(struct wfx_vif *wvif, const struct hif_req_set_pm_mode *arg);
+int hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout);
int hif_set_bss_params(struct wfx_vif *wvif,
const struct hif_req_set_bss_params *arg);
int hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg);
@@ -291,37 +291,30 @@ void wfx_configure_filter(struct ieee80211_hw *hw,
static int wfx_update_pm(struct wfx_vif *wvif)
{
struct ieee80211_conf *conf = &wvif->wdev->hw->conf;
- struct hif_req_set_pm_mode pm;
+ bool ps = conf->flags & IEEE80211_CONF_PS;
+ int ps_timeout = conf->dynamic_ps_timeout;
+ WARN_ON(conf->dynamic_ps_timeout < 0);
if (wvif->state != WFX_STATE_STA || !wvif->bss_params.aid)
return 0;
-
- memset(&pm, 0, sizeof(pm));
- if (conf->flags & IEEE80211_CONF_PS) {
- pm.pm_mode.enter_psm = 1;
- // Firmware does not support more than 128ms
- pm.fast_psm_idle_period =
- min(conf->dynamic_ps_timeout * 2, 255);
- if (pm.fast_psm_idle_period)
- pm.pm_mode.fast_psm = 1;
- }
-
+ if (!ps)
+ ps_timeout = 0;
if (wvif->edca.uapsd_mask)
- pm.pm_mode.fast_psm = 0;
+ ps_timeout = 0;
// Kernel disable PowerSave when multiple vifs are in use. In contrary,
// it is absolutly necessary to enable PowerSave for WF200
// FIXME: only if channel vif0 != channel vif1
if (wvif_count(wvif->wdev) > 1) {
- pm.pm_mode.enter_psm = 1;
- pm.pm_mode.fast_psm = 0;
+ ps = true;
+ ps_timeout = 0;
}
if (!wait_for_completion_timeout(&wvif->set_pm_mode_complete,
TU_TO_JIFFIES(512)))
dev_warn(wvif->wdev->dev,
"timeout while waiting of set_pm_mode_complete\n");
- return hif_set_pm(wvif, &pm);
+ return hif_set_pm(wvif, ps, ps_timeout);
}
int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,