aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorSamuel Ortiz <samuel.ortiz@intel.com>2008-12-18 21:37:14 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 15:58:59 -0500
commit1125eff3ae26b2e39c6bf940b5e0b8774ebd2896 (patch)
tree52fdfab290f3c3a7e287a635850abfddbdcff297 /drivers/net/wireless/iwlwifi
parentb5b83239e7a3540ff31db24249b90f9f6d7f5be8 (diff)
iwl3945: Remove power related definitions from 3945 code
Most of the power (not TX power, but power management) structures and definitions are duplicated accross iwl-power.h and iwl-3945.h. We should try to only use the iwl header. Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com> Acked-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h28
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-power.h16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c25
3 files changed, 30 insertions, 39 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index 6d0ec0a65b1..dd15b3203a6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -47,6 +47,7 @@ extern struct pci_device_id iwl3945_hw_card_ids[];
47#include "iwl-prph.h" 47#include "iwl-prph.h"
48#include "iwl-3945-hw.h" 48#include "iwl-3945-hw.h"
49#include "iwl-debug.h" 49#include "iwl-debug.h"
50#include "iwl-power.h"
50#include "iwl-3945-led.h" 51#include "iwl-3945-led.h"
51 52
52/* Highest firmware API version supported */ 53/* Highest firmware API version supported */
@@ -246,33 +247,6 @@ struct iwl3945_clip_group {
246/* Minimum number of queues. MAX_NUM is defined in hw specific files */ 247/* Minimum number of queues. MAX_NUM is defined in hw specific files */
247#define IWL_MIN_NUM_QUEUES 4 248#define IWL_MIN_NUM_QUEUES 4
248 249
249/* Power management (not Tx power) structures */
250
251struct iwl3945_power_vec_entry {
252 struct iwl_powertable_cmd cmd;
253 u8 no_dtim;
254};
255#define IWL_POWER_RANGE_0 (0)
256#define IWL_POWER_RANGE_1 (1)
257
258#define IWL_POWER_MODE_CAM 0x00 /* Continuously Aware Mode, always on */
259#define IWL_POWER_INDEX_3 0x03
260#define IWL_POWER_INDEX_5 0x05
261#define IWL_POWER_AC 0x06
262#define IWL_POWER_BATTERY 0x07
263#define IWL_POWER_LIMIT 0x07
264#define IWL_POWER_MASK 0x0F
265#define IWL_POWER_ENABLED 0x10
266#define IWL_POWER_LEVEL(x) ((x) & IWL_POWER_MASK)
267
268struct iwl3945_power_mgr {
269 spinlock_t lock;
270 struct iwl3945_power_vec_entry pwr_range_0[IWL_POWER_AC];
271 struct iwl3945_power_vec_entry pwr_range_1[IWL_POWER_AC];
272 u8 active_index;
273 u32 dtim_val;
274};
275
276#define IEEE80211_DATA_LEN 2304 250#define IEEE80211_DATA_LEN 2304
277#define IEEE80211_4ADDR_LEN 30 251#define IEEE80211_4ADDR_LEN 30
278#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) 252#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.h b/drivers/net/wireless/iwlwifi/iwl-power.h
index fa098d8975c..7cab04f1bf4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.h
+++ b/drivers/net/wireless/iwlwifi/iwl-power.h
@@ -42,7 +42,10 @@ enum {
42 IWL_POWER_INDEX_5, 42 IWL_POWER_INDEX_5,
43 IWL_POWER_AUTO, 43 IWL_POWER_AUTO,
44 IWL_POWER_MAX = IWL_POWER_AUTO, 44 IWL_POWER_MAX = IWL_POWER_AUTO,
45 IWL39_POWER_AC = IWL_POWER_AUTO, /* 0x06 */
45 IWL_POWER_AC, 46 IWL_POWER_AC,
47 IWL39_POWER_BATTERY = IWL_POWER_AC, /* 0x07 */
48 IWL39_POWER_LIMIT = IWL_POWER_AC,
46 IWL_POWER_BATTERY, 49 IWL_POWER_BATTERY,
47}; 50};
48 51
@@ -56,6 +59,11 @@ enum {
56#define IWL_POWER_MASK 0x0F 59#define IWL_POWER_MASK 0x0F
57#define IWL_POWER_ENABLED 0x10 60#define IWL_POWER_ENABLED 0x10
58 61
62#define IWL_POWER_RANGE_0 (0)
63#define IWL_POWER_RANGE_1 (1)
64
65#define IWL_POWER_LEVEL(x) ((x) & IWL_POWER_MASK)
66
59/* Power management (not Tx power) structures */ 67/* Power management (not Tx power) structures */
60 68
61struct iwl_power_vec_entry { 69struct iwl_power_vec_entry {
@@ -78,6 +86,14 @@ struct iwl_power_mgr {
78 u8 power_disabled; /* flag to disable using power saving level */ 86 u8 power_disabled; /* flag to disable using power saving level */
79}; 87};
80 88
89struct iwl3945_power_mgr {
90 spinlock_t lock;
91 struct iwl_power_vec_entry pwr_range_0[IWL_POWER_AC];
92 struct iwl_power_vec_entry pwr_range_1[IWL_POWER_AC];
93 u8 active_index;
94 u32 dtim_val;
95};
96
81void iwl_setup_power_deferred_work(struct iwl_priv *priv); 97void iwl_setup_power_deferred_work(struct iwl_priv *priv);
82void iwl_power_cancel_timeout(struct iwl_priv *priv); 98void iwl_power_cancel_timeout(struct iwl_priv *priv);
83int iwl_power_update_mode(struct iwl_priv *priv, bool force); 99int iwl_power_update_mode(struct iwl_priv *priv, bool force);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index df785246ba1..aac8825237f 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1815,7 +1815,7 @@ static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force)
1815 1815
1816/* default power management (not Tx power) table values */ 1816/* default power management (not Tx power) table values */
1817/* for TIM 0-10 */ 1817/* for TIM 0-10 */
1818static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = { 1818static struct iwl_power_vec_entry range_0[IWL39_POWER_AC] = {
1819 {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 1819 {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
1820 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, 1820 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0},
1821 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 7)}, 0}, 1821 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 7)}, 0},
@@ -1825,7 +1825,7 @@ static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = {
1825}; 1825};
1826 1826
1827/* for TIM > 10 */ 1827/* for TIM > 10 */
1828static struct iwl3945_power_vec_entry range_1[IWL_POWER_AC] = { 1828static struct iwl_power_vec_entry range_1[IWL39_POWER_AC] = {
1829 {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 1829 {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
1830 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), 1830 {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500),
1831 SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, 1831 SLP_VEC(1, 2, 3, 4, 0xFF)}, 0},
@@ -1842,7 +1842,7 @@ int iwl3945_power_init_handle(struct iwl3945_priv *priv)
1842{ 1842{
1843 int rc = 0, i; 1843 int rc = 0, i;
1844 struct iwl3945_power_mgr *pow_data; 1844 struct iwl3945_power_mgr *pow_data;
1845 int size = sizeof(struct iwl3945_power_vec_entry) * IWL_POWER_AC; 1845 int size = sizeof(struct iwl_power_vec_entry) * IWL39_POWER_AC;
1846 u16 pci_pm; 1846 u16 pci_pm;
1847 1847
1848 IWL_DEBUG_POWER("Initialize power \n"); 1848 IWL_DEBUG_POWER("Initialize power \n");
@@ -1865,7 +1865,7 @@ int iwl3945_power_init_handle(struct iwl3945_priv *priv)
1865 1865
1866 IWL_DEBUG_POWER("adjust power command flags\n"); 1866 IWL_DEBUG_POWER("adjust power command flags\n");
1867 1867
1868 for (i = 0; i < IWL_POWER_AC; i++) { 1868 for (i = 0; i < IWL39_POWER_AC; i++) {
1869 cmd = &pow_data->pwr_range_0[i].cmd; 1869 cmd = &pow_data->pwr_range_0[i].cmd;
1870 1870
1871 if (pci_pm & 0x1) 1871 if (pci_pm & 0x1)
@@ -1883,7 +1883,7 @@ static int iwl3945_update_power_cmd(struct iwl3945_priv *priv,
1883 int rc = 0, i; 1883 int rc = 0, i;
1884 u8 skip; 1884 u8 skip;
1885 u32 max_sleep = 0; 1885 u32 max_sleep = 0;
1886 struct iwl3945_power_vec_entry *range; 1886 struct iwl_power_vec_entry *range;
1887 u8 period = 0; 1887 u8 period = 0;
1888 struct iwl3945_power_mgr *pow_data; 1888 struct iwl3945_power_mgr *pow_data;
1889 1889
@@ -1951,10 +1951,10 @@ static int iwl3945_send_power_mode(struct iwl3945_priv *priv, u32 mode)
1951 * if plugged into AC power, set to CAM ("continuously aware mode"), 1951 * if plugged into AC power, set to CAM ("continuously aware mode"),
1952 * else user level */ 1952 * else user level */
1953 switch (mode) { 1953 switch (mode) {
1954 case IWL_POWER_BATTERY: 1954 case IWL39_POWER_BATTERY:
1955 final_mode = IWL_POWER_INDEX_3; 1955 final_mode = IWL_POWER_INDEX_3;
1956 break; 1956 break;
1957 case IWL_POWER_AC: 1957 case IWL39_POWER_AC:
1958 final_mode = IWL_POWER_MODE_CAM; 1958 final_mode = IWL_POWER_MODE_CAM;
1959 break; 1959 break;
1960 default: 1960 default:
@@ -7511,8 +7511,9 @@ static ssize_t store_power_level(struct device *d,
7511 goto out; 7511 goto out;
7512 } 7512 }
7513 7513
7514 if ((mode < 1) || (mode > IWL_POWER_LIMIT) || (mode == IWL_POWER_AC)) 7514 if ((mode < 1) || (mode > IWL39_POWER_LIMIT) ||
7515 mode = IWL_POWER_AC; 7515 (mode == IWL39_POWER_AC))
7516 mode = IWL39_POWER_AC;
7516 else 7517 else
7517 mode |= IWL_POWER_ENABLED; 7518 mode |= IWL_POWER_ENABLED;
7518 7519
@@ -7560,10 +7561,10 @@ static ssize_t show_power_level(struct device *d,
7560 p += sprintf(p, "%d ", level); 7561 p += sprintf(p, "%d ", level);
7561 switch (level) { 7562 switch (level) {
7562 case IWL_POWER_MODE_CAM: 7563 case IWL_POWER_MODE_CAM:
7563 case IWL_POWER_AC: 7564 case IWL39_POWER_AC:
7564 p += sprintf(p, "(AC)"); 7565 p += sprintf(p, "(AC)");
7565 break; 7566 break;
7566 case IWL_POWER_BATTERY: 7567 case IWL39_POWER_BATTERY:
7567 p += sprintf(p, "(BATTERY)"); 7568 p += sprintf(p, "(BATTERY)");
7568 break; 7569 break;
7569 default: 7570 default:
@@ -7968,7 +7969,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
7968 7969
7969 priv->rates_mask = IWL_RATES_MASK; 7970 priv->rates_mask = IWL_RATES_MASK;
7970 /* If power management is turned on, default to AC mode */ 7971 /* If power management is turned on, default to AC mode */
7971 priv->power_mode = IWL_POWER_AC; 7972 priv->power_mode = IWL39_POWER_AC;
7972 priv->user_txpower_limit = IWL_DEFAULT_TX_POWER; 7973 priv->user_txpower_limit = IWL_DEFAULT_TX_POWER;
7973 7974
7974 err = iwl3945_init_channel_map(priv); 7975 err = iwl3945_init_channel_map(priv);