qtnfmac: add support for getting/setting transmit power

Add new command for getting/setting current transmit power
and propagate requests from user space to firmware.

Signed-off-by: Mikhail Karpenko <mkarpenko@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Mikhail Karpenko
2019-11-13 11:06:59 +00:00
committed by Kalle Valo
parent 239ce8a797
commit 0756e913fc
4 changed files with 151 additions and 0 deletions

View File

@@ -897,6 +897,45 @@ static int qtnf_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
return ret;
}
static int qtnf_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
int *dbm)
{
struct qtnf_vif *vif = qtnf_netdev_get_priv(wdev->netdev);
int ret;
ret = qtnf_cmd_get_tx_power(vif, dbm);
if (ret)
pr_err("MAC%u: failed to get Tx power\n", vif->mac->macid);
return ret;
}
static int qtnf_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
enum nl80211_tx_power_setting type, int mbm)
{
struct qtnf_vif *vif;
int ret;
if (wdev) {
vif = qtnf_netdev_get_priv(wdev->netdev);
} else {
struct qtnf_wmac *mac = wiphy_priv(wiphy);
vif = qtnf_mac_get_base_vif(mac);
if (!vif) {
pr_err("MAC%u: primary VIF is not configured\n",
mac->macid);
return -EFAULT;
}
}
ret = qtnf_cmd_set_tx_power(vif, type, mbm);
if (ret)
pr_err("MAC%u: failed to set Tx power\n", vif->mac->macid);
return ret;
}
#ifdef CONFIG_PM
static int qtnf_suspend(struct wiphy *wiphy, struct cfg80211_wowlan *wowlan)
{
@@ -991,6 +1030,8 @@ static struct cfg80211_ops qtn_cfg80211_ops = {
.start_radar_detection = qtnf_start_radar_detection,
.set_mac_acl = qtnf_set_mac_acl,
.set_power_mgmt = qtnf_set_power_mgmt,
.get_tx_power = qtnf_get_tx_power,
.set_tx_power = qtnf_set_tx_power,
#ifdef CONFIG_PM
.suspend = qtnf_suspend,
.resume = qtnf_resume,