aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-power.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-power.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-power.h80
1 files changed, 31 insertions, 49 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.h b/drivers/net/wireless/iwlwifi/iwl-power.h
index 3d49b7a45b74..df6f6a49712b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.h
+++ b/drivers/net/wireless/iwlwifi/iwl-power.h
@@ -28,22 +28,17 @@
28#ifndef __iwl_power_setting_h__ 28#ifndef __iwl_power_setting_h__
29#define __iwl_power_setting_h__ 29#define __iwl_power_setting_h__
30 30
31#include <net/mac80211.h>
32#include "iwl-commands.h" 31#include "iwl-commands.h"
33 32
34struct iwl_priv;
35
36#define IWL_ABSOLUTE_ZERO 0 33#define IWL_ABSOLUTE_ZERO 0
37#define IWL_ABSOLUTE_MAX 0xFFFFFFFF 34#define IWL_ABSOLUTE_MAX 0xFFFFFFFF
38#define IWL_TT_INCREASE_MARGIN 5 35#define IWL_TT_INCREASE_MARGIN 5
39 36
40/* Tx/Rx restrictions */ 37enum iwl_antenna_ok {
41#define IWL_TX_MULTI 0x02 38 IWL_ANT_OK_NONE,
42#define IWL_TX_SINGLE 0x01 39 IWL_ANT_OK_SINGLE,
43#define IWL_TX_NONE 0x00 40 IWL_ANT_OK_MULTI,
44#define IWL_RX_MULTI 0x02 41};
45#define IWL_RX_SINGLE 0x01
46#define IWL_RX_NONE 0x00
47 42
48/* Thermal Throttling State Machine states */ 43/* Thermal Throttling State Machine states */
49enum iwl_tt_state { 44enum iwl_tt_state {
@@ -55,27 +50,30 @@ enum iwl_tt_state {
55}; 50};
56 51
57/** 52/**
58 * struct iwl_tt_restriction - Thermal Throttling restriction table used 53 * struct iwl_tt_restriction - Thermal Throttling restriction table
59 * by advance thermal throttling management
60 * based on the current thermal throttling state, determine
61 * number of tx/rx streams; and the status of HT operation
62 * @tx_stream: number of tx stream allowed 54 * @tx_stream: number of tx stream allowed
63 * @is_ht: ht enable/disable 55 * @is_ht: ht enable/disable
64 * @rx_stream: number of rx stream allowed 56 * @rx_stream: number of rx stream allowed
57 *
58 * This table is used by advance thermal throttling management
59 * based on the current thermal throttling state, and determines
60 * the number of tx/rx streams and the status of HT operation.
65 */ 61 */
66struct iwl_tt_restriction { 62struct iwl_tt_restriction {
67 u8 tx_stream; 63 enum iwl_antenna_ok tx_stream;
64 enum iwl_antenna_ok rx_stream;
68 bool is_ht; 65 bool is_ht;
69 u8 rx_stream;
70}; 66};
71 67
72/** 68/**
73 * struct iwl_tt_trans - Thermal Throttling transaction table; used by 69 * struct iwl_tt_trans - Thermal Throttling transaction table
74 * advance thermal throttling algorithm to determine next
75 * thermal state to go based on the current temperature
76 * @next_state: next thermal throttling mode 70 * @next_state: next thermal throttling mode
77 * @tt_low: low temperature threshold to change state 71 * @tt_low: low temperature threshold to change state
78 * @tt_high: high temperature threshold to change state 72 * @tt_high: high temperature threshold to change state
73 *
74 * This is used by the advanced thermal throttling algorithm
75 * to determine the next thermal state to go based on the
76 * current temperature.
79 */ 77 */
80struct iwl_tt_trans { 78struct iwl_tt_trans {
81 enum iwl_tt_state next_state; 79 enum iwl_tt_state next_state;
@@ -85,34 +83,36 @@ struct iwl_tt_trans {
85 83
86/** 84/**
87 * struct iwl_tt_mgnt - Thermal Throttling Management structure 85 * struct iwl_tt_mgnt - Thermal Throttling Management structure
86 * @advanced_tt: advanced thermal throttle required
88 * @state: current Thermal Throttling state 87 * @state: current Thermal Throttling state
89 * @tt_power_mode: Thermal Throttling power mode index 88 * @tt_power_mode: Thermal Throttling power mode index
90 * being used to set power level when 89 * being used to set power level when
91 * when thermal throttling state != IWL_TI_0 90 * when thermal throttling state != IWL_TI_0
92 * the tt_power_mode should set to different 91 * the tt_power_mode should set to different
93 * power mode based on the current tt state 92 * power mode based on the current tt state
94 * @sys_power_mode: previous system power mode
95 * before transition into TT state
96 * @tt_previous_temperature: last measured temperature 93 * @tt_previous_temperature: last measured temperature
97 * @iwl_tt_restriction: ptr to restriction tbl, used by advance 94 * @iwl_tt_restriction: ptr to restriction tbl, used by advance
98 * thermal throttling to determine how many tx/rx streams 95 * thermal throttling to determine how many tx/rx streams
99 * should be used in tt state; and can HT be enabled or not 96 * should be used in tt state; and can HT be enabled or not
100 * @iwl_tt_trans: ptr to adv trans table, used by advance thermal throttling 97 * @iwl_tt_trans: ptr to adv trans table, used by advance thermal throttling
101 * state transaction 98 * state transaction
99 * @ct_kill_toggle: used to toggle the CSR bit when checking uCode temperature
100 * @ct_kill_exit_tm: timer to exit thermal kill
102 */ 101 */
103struct iwl_tt_mgmt { 102struct iwl_tt_mgmt {
104 enum iwl_tt_state state; 103 enum iwl_tt_state state;
104 bool advanced_tt;
105 u8 tt_power_mode; 105 u8 tt_power_mode;
106 u8 sys_power_mode; 106 bool ct_kill_toggle;
107#ifdef CONFIG_IWLWIFI_DEBUG 107#ifdef CONFIG_IWLWIFI_DEBUG
108 s32 tt_previous_temp; 108 s32 tt_previous_temp;
109#endif 109#endif
110 struct iwl_tt_restriction *restriction; 110 struct iwl_tt_restriction *restriction;
111 struct iwl_tt_trans *transaction; 111 struct iwl_tt_trans *transaction;
112 struct timer_list ct_kill_exit_tm;
112}; 113};
113 114
114enum { 115enum iwl_power_level {
115 IWL_POWER_MODE_CAM, /* Continuously Aware Mode, always on */
116 IWL_POWER_INDEX_1, 116 IWL_POWER_INDEX_1,
117 IWL_POWER_INDEX_2, 117 IWL_POWER_INDEX_2,
118 IWL_POWER_INDEX_3, 118 IWL_POWER_INDEX_3,
@@ -121,36 +121,16 @@ enum {
121 IWL_POWER_NUM 121 IWL_POWER_NUM
122}; 122};
123 123
124/* Power management (not Tx power) structures */
125
126struct iwl_power_vec_entry {
127 struct iwl_powertable_cmd cmd;
128 u8 no_dtim;
129};
130
131struct iwl_power_mgr { 124struct iwl_power_mgr {
132 struct iwl_power_vec_entry pwr_range_0[IWL_POWER_NUM]; 125 struct iwl_powertable_cmd sleep_cmd;
133 struct iwl_power_vec_entry pwr_range_1[IWL_POWER_NUM]; 126 int debug_sleep_level_override;
134 struct iwl_power_vec_entry pwr_range_2[IWL_POWER_NUM]; 127 bool pci_pm;
135 u32 dtim_period;
136 /* final power level that used to calculate final power command */
137 u8 power_mode;
138 u8 user_power_setting; /* set by user through sysfs */
139 u8 power_disabled; /* set by mac80211's CONF_PS */
140 struct iwl_tt_mgmt tt; /* Thermal Throttling Management */
141 bool adv_tt; /* false: legacy mode */
142 /* true: advance mode */
143 bool ct_kill_toggle; /* use to toggle the CSR bit when
144 * checking uCode temperature
145 */
146 struct timer_list ct_kill_exit_tm;
147}; 128};
148 129
149int iwl_power_update_mode(struct iwl_priv *priv, bool force); 130int iwl_power_update_mode(struct iwl_priv *priv, bool force);
150int iwl_power_set_user_mode(struct iwl_priv *priv, u16 mode);
151bool iwl_ht_enabled(struct iwl_priv *priv); 131bool iwl_ht_enabled(struct iwl_priv *priv);
152u8 iwl_tx_ant_restriction(struct iwl_priv *priv); 132enum iwl_antenna_ok iwl_tx_ant_restriction(struct iwl_priv *priv);
153u8 iwl_rx_ant_restriction(struct iwl_priv *priv); 133enum iwl_antenna_ok iwl_rx_ant_restriction(struct iwl_priv *priv);
154void iwl_tt_enter_ct_kill(struct iwl_priv *priv); 134void iwl_tt_enter_ct_kill(struct iwl_priv *priv);
155void iwl_tt_exit_ct_kill(struct iwl_priv *priv); 135void iwl_tt_exit_ct_kill(struct iwl_priv *priv);
156void iwl_tt_handler(struct iwl_priv *priv); 136void iwl_tt_handler(struct iwl_priv *priv);
@@ -158,4 +138,6 @@ void iwl_tt_initialize(struct iwl_priv *priv);
158void iwl_tt_exit(struct iwl_priv *priv); 138void iwl_tt_exit(struct iwl_priv *priv);
159void iwl_power_initialize(struct iwl_priv *priv); 139void iwl_power_initialize(struct iwl_priv *priv);
160 140
141extern bool no_sleep_autoadjust;
142
161#endif /* __iwl_power_setting_h__ */ 143#endif /* __iwl_power_setting_h__ */