Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5da4b55f authored by Mohamed Abbas's avatar Mohamed Abbas Committed by John W. Linville
Browse files

iwlwifi: Add power level support



Add power level support

Signed-off-by: default avatarMohamed Abbas <mabbas@linux.intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 7eafd25d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
obj-$(CONFIG_IWLCORE)	+= iwlcore.o
iwlcore-objs 		:= iwl-core.o iwl-eeprom.o iwl-hcmd.o
iwlcore-objs 		:= iwl-core.o iwl-eeprom.o iwl-hcmd.o iwl-power.o
iwlcore-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
iwlcore-$(CONFIG_IWLWIFI_LEDS) += iwl-led.o
iwlcore-$(CONFIG_IWLWIFI_RFKILL) += iwl-rfkill.o
+1 −0
Original line number Diff line number Diff line
@@ -1853,6 +1853,7 @@ struct iwl4965_spectrum_notification {
#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK	__constant_cpu_to_le16(1 << 0)
#define IWL_POWER_SLEEP_OVER_DTIM_MSK		__constant_cpu_to_le16(1 << 2)
#define IWL_POWER_PCI_PM_MSK			__constant_cpu_to_le16(1 << 3)
#define IWL_POWER_FAST_PD			__constant_cpu_to_le16(1 << 4)

struct iwl4965_powertable_cmd {
	__le16 flags;
+13 −2
Original line number Diff line number Diff line
@@ -702,8 +702,6 @@ int iwl4965_hw_nic_init(struct iwl_priv *priv)
	u32 val;
	u8 val_link;

	iwl4965_power_init_handle(priv);

	/* nic_init */
	spin_lock_irqsave(&priv->lock, flags);

@@ -1433,6 +1431,17 @@ int iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl4965_tx_queue *txq)
	return 0;
}

/* set card power command */
static int iwl4965_set_power(struct iwl_priv *priv,
		      void *cmd)
{
	int ret = 0;

	ret = iwl_send_cmd_pdu_async(priv, POWER_TABLE_CMD,
				    sizeof(struct iwl4965_powertable_cmd),
				    cmd, NULL);
	return ret;
}
int iwl4965_hw_reg_set_txpower(struct iwl_priv *priv, s8 power)
{
	IWL_ERROR("TODO: Implement iwl4965_hw_reg_set_txpower!\n");
@@ -4336,6 +4345,8 @@ static struct iwl_lib_ops iwl4965_lib = {
		.release_semaphore = iwlcore_eeprom_release_semaphore,
	},
	.radio_kill_sw = iwl4965_radio_kill_sw,
	.set_power = iwl4965_set_power,
	.update_chain_flags = iwl4965_update_chain_flags,
};

static struct iwl_ops iwl4965_ops = {
+3 −26
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
#include "iwl-prph.h"
#include "iwl-debug.h"
#include "iwl-led.h"
#include "iwl-power.h"

/* configuration for the iwl4965 */
extern struct iwl_cfg iwl4965_agn_cfg;
@@ -257,31 +258,6 @@ enum iwl_pwr_src {
	IWL_PWR_SRC_VAUX,
};

struct iwl4965_power_vec_entry {
	struct iwl4965_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 iwl4965_power_mgr {
	spinlock_t lock;
	struct iwl4965_power_vec_entry pwr_range_0[IWL_POWER_AC];
	struct iwl4965_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)
@@ -674,6 +650,7 @@ extern unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv,
extern int iwl4965_rx_queue_update_write_ptr(struct iwl_priv *priv,
					 struct iwl4965_rx_queue *q);
extern __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr);
extern void iwl4965_update_chain_flags(struct iwl_priv *priv);
int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src);

int iwl4965_init_geos(struct iwl_priv *priv);
@@ -1100,7 +1077,7 @@ struct iwl_priv {
		u64 bytes;
	} tx_stats[3], rx_stats[3];

	struct iwl4965_power_mgr power_data;
	struct iwl_power_mgr power_data;

	struct iwl4965_notif_statistics statistics;
	unsigned long last_statistics_time;
+3 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ struct iwl_priv; /* FIXME: remove */
#include "iwl-4965.h" /* FIXME: remove */
#include "iwl-core.h"
#include "iwl-rfkill.h"
#include "iwl-power.h"


MODULE_DESCRIPTION("iwl core");
@@ -263,8 +264,10 @@ int iwlcore_low_level_notify(struct iwl_priv *priv,
		if (ret)
			IWL_ERROR("Unable to initialize RFKILL system. "
				  "Ignoring error: %d\n", ret);
		iwl_power_initialize(priv);
		break;
	case IWLCORE_START_EVT:
		iwl_power_update_mode(priv, 1);
		break;
	case IWLCORE_STOP_EVT:
		break;
Loading