qtnfmac: implement cfg80211 power management callback

Implement set_power_mgmt() callback that forwards power saving
settings to the device firmware.

Signed-off-by: Sergei Maksimenko <smaksimenko@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Sergei Maksimenko
2018-05-31 12:10:59 +03:00
committed by Kalle Valo
parent 0ad641919c
commit 4775ad06b5
4 changed files with 82 additions and 0 deletions

View File

@@ -2799,3 +2799,37 @@ int qtnf_cmd_set_mac_acl(const struct qtnf_vif *vif,
return ret;
}
int qtnf_cmd_send_pm_set(const struct qtnf_vif *vif, u8 pm_mode, int timeout)
{
struct qtnf_bus *bus = vif->mac->bus;
struct sk_buff *cmd_skb;
u16 res_code = QLINK_CMD_RESULT_OK;
struct qlink_cmd_pm_set *cmd;
int ret = 0;
cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid,
QLINK_CMD_PM_SET, sizeof(*cmd));
if (!cmd_skb)
return -ENOMEM;
cmd = (struct qlink_cmd_pm_set *)cmd_skb->data;
cmd->pm_mode = pm_mode;
cmd->pm_standby_timer = cpu_to_le32(timeout);
qtnf_bus_lock(bus);
ret = qtnf_cmd_send(bus, cmd_skb, &res_code);
if (unlikely(ret))
goto out;
if (unlikely(res_code != QLINK_CMD_RESULT_OK)) {
pr_err("cmd exec failed: 0x%.4X\n", res_code);
ret = -EFAULT;
}
out:
qtnf_bus_unlock(bus);
return ret;
}