diff options
author | Juuso Oikarinen <juuso.oikarinen@nokia.com> | 2010-06-23 05:12:37 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-06-24 15:42:33 -0400 |
commit | fa61cf70a6ae1089e459e4b59b2e8d8e90d8535e (patch) | |
tree | 1bd81709faaa15fb207de7db4df1ceed96374208 /drivers/net | |
parent | a185045c8da1ec6627236b4ade0d949b15da43b3 (diff) |
cfg80211/mac80211: Update set_tx_power to use mBm instead of dBm units
In preparation for a TX power setting interface in the nl80211, change the
.set_tx_power function to use mBm units instead of dBm for greater accuracy and
smaller power levels.
Also, already in advance move the tx_power_setting enumeration to nl80211.
This change affects the .tx_set_power function prototype. As a result, the
corresponding changes are needed to modules using it. These are mac80211,
iwmc3200wifi and rndis_wlan.
Cc: Samuel Ortiz <samuel.ortiz@intel.com>
Cc: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Acked-by: Samuel Ortiz <samuel.ortiz@intel.com>
Acked-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/iwmc3200wifi/cfg80211.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/rndis_wlan.c | 20 |
2 files changed, 21 insertions, 11 deletions
diff --git a/drivers/net/wireless/iwmc3200wifi/cfg80211.c b/drivers/net/wireless/iwmc3200wifi/cfg80211.c index 902e95f70f6e..60619678f4ec 100644 --- a/drivers/net/wireless/iwmc3200wifi/cfg80211.c +++ b/drivers/net/wireless/iwmc3200wifi/cfg80211.c | |||
@@ -670,20 +670,24 @@ static int iwm_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, | |||
670 | } | 670 | } |
671 | 671 | ||
672 | static int iwm_cfg80211_set_txpower(struct wiphy *wiphy, | 672 | static int iwm_cfg80211_set_txpower(struct wiphy *wiphy, |
673 | enum tx_power_setting type, int dbm) | 673 | enum nl80211_tx_power_setting type, int mbm) |
674 | { | 674 | { |
675 | struct iwm_priv *iwm = wiphy_to_iwm(wiphy); | 675 | struct iwm_priv *iwm = wiphy_to_iwm(wiphy); |
676 | int ret; | 676 | int ret; |
677 | 677 | ||
678 | switch (type) { | 678 | switch (type) { |
679 | case TX_POWER_AUTOMATIC: | 679 | case NL80211_TX_POWER_AUTOMATIC: |
680 | return 0; | 680 | return 0; |
681 | case TX_POWER_FIXED: | 681 | case NL80211_TX_POWER_FIXED: |
682 | if (mbm < 0 || (mbm % 100)) | ||
683 | return -EOPNOTSUPP; | ||
684 | |||
682 | if (!test_bit(IWM_STATUS_READY, &iwm->status)) | 685 | if (!test_bit(IWM_STATUS_READY, &iwm->status)) |
683 | return 0; | 686 | return 0; |
684 | 687 | ||
685 | ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_CFG_FIX, | 688 | ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_CFG_FIX, |
686 | CFG_TX_PWR_LIMIT_USR, dbm * 2); | 689 | CFG_TX_PWR_LIMIT_USR, |
690 | MBM_TO_DBM(mbm) * 2); | ||
687 | if (ret < 0) | 691 | if (ret < 0) |
688 | return ret; | 692 | return ret; |
689 | 693 | ||
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 4102cca54882..5e26edb57d82 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -520,8 +520,9 @@ static int rndis_scan(struct wiphy *wiphy, struct net_device *dev, | |||
520 | 520 | ||
521 | static int rndis_set_wiphy_params(struct wiphy *wiphy, u32 changed); | 521 | static int rndis_set_wiphy_params(struct wiphy *wiphy, u32 changed); |
522 | 522 | ||
523 | static int rndis_set_tx_power(struct wiphy *wiphy, enum tx_power_setting type, | 523 | static int rndis_set_tx_power(struct wiphy *wiphy, |
524 | int dbm); | 524 | enum nl80211_tx_power_setting type, |
525 | int mbm); | ||
525 | static int rndis_get_tx_power(struct wiphy *wiphy, int *dbm); | 526 | static int rndis_get_tx_power(struct wiphy *wiphy, int *dbm); |
526 | 527 | ||
527 | static int rndis_connect(struct wiphy *wiphy, struct net_device *dev, | 528 | static int rndis_connect(struct wiphy *wiphy, struct net_device *dev, |
@@ -1856,20 +1857,25 @@ static int rndis_set_wiphy_params(struct wiphy *wiphy, u32 changed) | |||
1856 | return 0; | 1857 | return 0; |
1857 | } | 1858 | } |
1858 | 1859 | ||
1859 | static int rndis_set_tx_power(struct wiphy *wiphy, enum tx_power_setting type, | 1860 | static int rndis_set_tx_power(struct wiphy *wiphy, |
1860 | int dbm) | 1861 | enum nl80211_tx_power_setting type, |
1862 | int mbm) | ||
1861 | { | 1863 | { |
1862 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); | 1864 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); |
1863 | struct usbnet *usbdev = priv->usbdev; | 1865 | struct usbnet *usbdev = priv->usbdev; |
1864 | 1866 | ||
1865 | netdev_dbg(usbdev->net, "%s(): type:0x%x dbm:%i\n", | 1867 | netdev_dbg(usbdev->net, "%s(): type:0x%x mbm:%i\n", |
1866 | __func__, type, dbm); | 1868 | __func__, type, mbm); |
1869 | |||
1870 | if (mbm < 0 || (mbm % 100)) | ||
1871 | return -ENOTSUPP; | ||
1867 | 1872 | ||
1868 | /* Device doesn't support changing txpower after initialization, only | 1873 | /* Device doesn't support changing txpower after initialization, only |
1869 | * turn off/on radio. Support 'auto' mode and setting same dBm that is | 1874 | * turn off/on radio. Support 'auto' mode and setting same dBm that is |
1870 | * currently used. | 1875 | * currently used. |
1871 | */ | 1876 | */ |
1872 | if (type == TX_POWER_AUTOMATIC || dbm == get_bcm4320_power_dbm(priv)) { | 1877 | if (type == NL80211_TX_POWER_AUTOMATIC || |
1878 | MBM_TO_DBM(mbm) == get_bcm4320_power_dbm(priv)) { | ||
1873 | if (!priv->radio_on) | 1879 | if (!priv->radio_on) |
1874 | disassociate(usbdev, true); /* turn on radio */ | 1880 | disassociate(usbdev, true); /* turn on radio */ |
1875 | 1881 | ||