#include "iwl-prph.h"
#include "iwl-3945-hw.h"
#include "iwl-debug.h"
+#include "iwl-power.h"
#include "iwl-3945-led.h"
/* Highest firmware API version supported */
/* Minimum number of queues. MAX_NUM is defined in hw specific files */
#define IWL_MIN_NUM_QUEUES 4
-/* Power management (not Tx power) structures */
-
-struct iwl3945_power_vec_entry {
- struct iwl_powertable_cmd cmd;
- u8 no_dtim;
-};
-#define IWL_POWER_RANGE_0 (0)
-#define IWL_POWER_RANGE_1 (1)
-
-#define IWL_POWER_MODE_CAM 0x00 /* Continuously Aware Mode, always on */
-#define IWL_POWER_INDEX_3 0x03
-#define IWL_POWER_INDEX_5 0x05
-#define IWL_POWER_AC 0x06
-#define IWL_POWER_BATTERY 0x07
-#define IWL_POWER_LIMIT 0x07
-#define IWL_POWER_MASK 0x0F
-#define IWL_POWER_ENABLED 0x10
-#define IWL_POWER_LEVEL(x) ((x) & IWL_POWER_MASK)
-
-struct iwl3945_power_mgr {
- spinlock_t lock;
- struct iwl3945_power_vec_entry pwr_range_0[IWL_POWER_AC];
- struct iwl3945_power_vec_entry pwr_range_1[IWL_POWER_AC];
- u8 active_index;
- u32 dtim_val;
-};
-
#define IEEE80211_DATA_LEN 2304
#define IEEE80211_4ADDR_LEN 30
#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
IWL_POWER_INDEX_5,
IWL_POWER_AUTO,
IWL_POWER_MAX = IWL_POWER_AUTO,
+ IWL39_POWER_AC = IWL_POWER_AUTO, /* 0x06 */
IWL_POWER_AC,
+ IWL39_POWER_BATTERY = IWL_POWER_AC, /* 0x07 */
+ IWL39_POWER_LIMIT = IWL_POWER_AC,
IWL_POWER_BATTERY,
};
#define IWL_POWER_MASK 0x0F
#define IWL_POWER_ENABLED 0x10
+#define IWL_POWER_RANGE_0 (0)
+#define IWL_POWER_RANGE_1 (1)
+
+#define IWL_POWER_LEVEL(x) ((x) & IWL_POWER_MASK)
+
/* Power management (not Tx power) structures */
struct iwl_power_vec_entry {
u8 power_disabled; /* flag to disable using power saving level */
};
+struct iwl3945_power_mgr {
+ spinlock_t lock;
+ struct iwl_power_vec_entry pwr_range_0[IWL_POWER_AC];
+ struct iwl_power_vec_entry pwr_range_1[IWL_POWER_AC];
+ u8 active_index;
+ u32 dtim_val;
+};
+
void iwl_setup_power_deferred_work(struct iwl_priv *priv);
void iwl_power_cancel_timeout(struct iwl_priv *priv);
int iwl_power_update_mode(struct iwl_priv *priv, bool force);
/* default power management (not Tx power) table values */
/* for TIM 0-10 */
-static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = {
+static struct iwl_power_vec_entry range_0[IWL39_POWER_AC] = {
{{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
{{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0},
{{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 7)}, 0},
};
/* for TIM > 10 */
-static struct iwl3945_power_vec_entry range_1[IWL_POWER_AC] = {
+static struct iwl_power_vec_entry range_1[IWL39_POWER_AC] = {
{{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
{{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500),
SLP_VEC(1, 2, 3, 4, 0xFF)}, 0},
{
int rc = 0, i;
struct iwl3945_power_mgr *pow_data;
- int size = sizeof(struct iwl3945_power_vec_entry) * IWL_POWER_AC;
+ int size = sizeof(struct iwl_power_vec_entry) * IWL39_POWER_AC;
u16 pci_pm;
IWL_DEBUG_POWER("Initialize power \n");
IWL_DEBUG_POWER("adjust power command flags\n");
- for (i = 0; i < IWL_POWER_AC; i++) {
+ for (i = 0; i < IWL39_POWER_AC; i++) {
cmd = &pow_data->pwr_range_0[i].cmd;
if (pci_pm & 0x1)
int rc = 0, i;
u8 skip;
u32 max_sleep = 0;
- struct iwl3945_power_vec_entry *range;
+ struct iwl_power_vec_entry *range;
u8 period = 0;
struct iwl3945_power_mgr *pow_data;
* if plugged into AC power, set to CAM ("continuously aware mode"),
* else user level */
switch (mode) {
- case IWL_POWER_BATTERY:
+ case IWL39_POWER_BATTERY:
final_mode = IWL_POWER_INDEX_3;
break;
- case IWL_POWER_AC:
+ case IWL39_POWER_AC:
final_mode = IWL_POWER_MODE_CAM;
break;
default:
goto out;
}
- if ((mode < 1) || (mode > IWL_POWER_LIMIT) || (mode == IWL_POWER_AC))
- mode = IWL_POWER_AC;
+ if ((mode < 1) || (mode > IWL39_POWER_LIMIT) ||
+ (mode == IWL39_POWER_AC))
+ mode = IWL39_POWER_AC;
else
mode |= IWL_POWER_ENABLED;
p += sprintf(p, "%d ", level);
switch (level) {
case IWL_POWER_MODE_CAM:
- case IWL_POWER_AC:
+ case IWL39_POWER_AC:
p += sprintf(p, "(AC)");
break;
- case IWL_POWER_BATTERY:
+ case IWL39_POWER_BATTERY:
p += sprintf(p, "(BATTERY)");
break;
default:
priv->rates_mask = IWL_RATES_MASK;
/* If power management is turned on, default to AC mode */
- priv->power_mode = IWL_POWER_AC;
+ priv->power_mode = IWL39_POWER_AC;
priv->user_txpower_limit = IWL_DEFAULT_TX_POWER;
err = iwl3945_init_channel_map(priv);