aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-power.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-08-07 18:41:48 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-14 09:13:50 -0400
commit3ad3b92a5517c043ef30e4b95c4c39a35bbc36be (patch)
treeb0dbc0ef7fb0787088f2a9e20e954a025774e1ed /drivers/net/wireless/iwlwifi/iwl-power.h
parent3a780d25428a0a391a8ba6c888cf4e89ac3fdbb1 (diff)
iwlwifi: refactor some thermal throttle code
Some of the thermal throttle data structures and code are really very intermingled with the sleep (power) control code. They really do belong together in a way since the thermal throttle code uses powersaving to achieve its goal, but it's making it hard to work on the powersave code. Split this up to make that easier. I've also changed the antenna defines to an enum and used the same enum for RX and TX. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> 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/iwl-power.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-power.h50
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.h b/drivers/net/wireless/iwlwifi/iwl-power.h
index 3d49b7a45b74..15e3eabd2e84 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.h
+++ b/drivers/net/wireless/iwlwifi/iwl-power.h
@@ -37,13 +37,11 @@ struct iwl_priv;
37#define IWL_ABSOLUTE_MAX 0xFFFFFFFF 37#define IWL_ABSOLUTE_MAX 0xFFFFFFFF
38#define IWL_TT_INCREASE_MARGIN 5 38#define IWL_TT_INCREASE_MARGIN 5
39 39
40/* Tx/Rx restrictions */ 40enum iwl_antenna_ok {
41#define IWL_TX_MULTI 0x02 41 IWL_ANT_OK_NONE,
42#define IWL_TX_SINGLE 0x01 42 IWL_ANT_OK_SINGLE,
43#define IWL_TX_NONE 0x00 43 IWL_ANT_OK_MULTI,
44#define IWL_RX_MULTI 0x02 44};
45#define IWL_RX_SINGLE 0x01
46#define IWL_RX_NONE 0x00
47 45
48/* Thermal Throttling State Machine states */ 46/* Thermal Throttling State Machine states */
49enum iwl_tt_state { 47enum iwl_tt_state {
@@ -55,27 +53,30 @@ enum iwl_tt_state {
55}; 53};
56 54
57/** 55/**
58 * struct iwl_tt_restriction - Thermal Throttling restriction table used 56 * 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 57 * @tx_stream: number of tx stream allowed
63 * @is_ht: ht enable/disable 58 * @is_ht: ht enable/disable
64 * @rx_stream: number of rx stream allowed 59 * @rx_stream: number of rx stream allowed
60 *
61 * This table is used by advance thermal throttling management
62 * based on the current thermal throttling state, and determines
63 * the number of tx/rx streams and the status of HT operation.
65 */ 64 */
66struct iwl_tt_restriction { 65struct iwl_tt_restriction {
67 u8 tx_stream; 66 enum iwl_antenna_ok tx_stream;
67 enum iwl_antenna_ok rx_stream;
68 bool is_ht; 68 bool is_ht;
69 u8 rx_stream;
70}; 69};
71 70
72/** 71/**
73 * struct iwl_tt_trans - Thermal Throttling transaction table; used by 72 * 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 73 * @next_state: next thermal throttling mode
77 * @tt_low: low temperature threshold to change state 74 * @tt_low: low temperature threshold to change state
78 * @tt_high: high temperature threshold to change state 75 * @tt_high: high temperature threshold to change state
76 *
77 * This is used by the advanced thermal throttling algorithm
78 * to determine the next thermal state to go based on the
79 * current temperature.
79 */ 80 */
80struct iwl_tt_trans { 81struct iwl_tt_trans {
81 enum iwl_tt_state next_state; 82 enum iwl_tt_state next_state;
@@ -85,6 +86,7 @@ struct iwl_tt_trans {
85 86
86/** 87/**
87 * struct iwl_tt_mgnt - Thermal Throttling Management structure 88 * struct iwl_tt_mgnt - Thermal Throttling Management structure
89 * @advanced_tt: advanced thermal throttle required
88 * @state: current Thermal Throttling state 90 * @state: current Thermal Throttling state
89 * @tt_power_mode: Thermal Throttling power mode index 91 * @tt_power_mode: Thermal Throttling power mode index
90 * being used to set power level when 92 * being used to set power level when
@@ -99,16 +101,21 @@ struct iwl_tt_trans {
99 * should be used in tt state; and can HT be enabled or not 101 * 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 102 * @iwl_tt_trans: ptr to adv trans table, used by advance thermal throttling
101 * state transaction 103 * state transaction
104 * @ct_kill_toggle: used to toggle the CSR bit when checking uCode temperature
105 * @ct_kill_exit_tm: timer to exit thermal kill
102 */ 106 */
103struct iwl_tt_mgmt { 107struct iwl_tt_mgmt {
104 enum iwl_tt_state state; 108 enum iwl_tt_state state;
109 bool advanced_tt;
105 u8 tt_power_mode; 110 u8 tt_power_mode;
106 u8 sys_power_mode; 111 u8 sys_power_mode;
112 bool ct_kill_toggle;
107#ifdef CONFIG_IWLWIFI_DEBUG 113#ifdef CONFIG_IWLWIFI_DEBUG
108 s32 tt_previous_temp; 114 s32 tt_previous_temp;
109#endif 115#endif
110 struct iwl_tt_restriction *restriction; 116 struct iwl_tt_restriction *restriction;
111 struct iwl_tt_trans *transaction; 117 struct iwl_tt_trans *transaction;
118 struct timer_list ct_kill_exit_tm;
112}; 119};
113 120
114enum { 121enum {
@@ -137,20 +144,13 @@ struct iwl_power_mgr {
137 u8 power_mode; 144 u8 power_mode;
138 u8 user_power_setting; /* set by user through sysfs */ 145 u8 user_power_setting; /* set by user through sysfs */
139 u8 power_disabled; /* set by mac80211's CONF_PS */ 146 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}; 147};
148 148
149int iwl_power_update_mode(struct iwl_priv *priv, bool force); 149int iwl_power_update_mode(struct iwl_priv *priv, bool force);
150int iwl_power_set_user_mode(struct iwl_priv *priv, u16 mode); 150int iwl_power_set_user_mode(struct iwl_priv *priv, u16 mode);
151bool iwl_ht_enabled(struct iwl_priv *priv); 151bool iwl_ht_enabled(struct iwl_priv *priv);
152u8 iwl_tx_ant_restriction(struct iwl_priv *priv); 152enum iwl_antenna_ok iwl_tx_ant_restriction(struct iwl_priv *priv);
153u8 iwl_rx_ant_restriction(struct iwl_priv *priv); 153enum iwl_antenna_ok iwl_rx_ant_restriction(struct iwl_priv *priv);
154void iwl_tt_enter_ct_kill(struct iwl_priv *priv); 154void iwl_tt_enter_ct_kill(struct iwl_priv *priv);
155void iwl_tt_exit_ct_kill(struct iwl_priv *priv); 155void iwl_tt_exit_ct_kill(struct iwl_priv *priv);
156void iwl_tt_handler(struct iwl_priv *priv); 156void iwl_tt_handler(struct iwl_priv *priv);