tt.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. /******************************************************************************
  2. *
  3. * This file is provided under a dual BSD/GPLv2 license. When using or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * GPL LICENSE SUMMARY
  7. *
  8. * Copyright(c) 2013 Intel Corporation. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of version 2 of the GNU General Public License as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  22. * USA
  23. *
  24. * The full GNU General Public License is included in this distribution
  25. * in the file called COPYING.
  26. *
  27. * Contact Information:
  28. * Intel Linux Wireless <ilw@linux.intel.com>
  29. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  30. *
  31. * BSD LICENSE
  32. *
  33. * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
  34. * All rights reserved.
  35. *
  36. * Redistribution and use in source and binary forms, with or without
  37. * modification, are permitted provided that the following conditions
  38. * are met:
  39. *
  40. * * Redistributions of source code must retain the above copyright
  41. * notice, this list of conditions and the following disclaimer.
  42. * * Redistributions in binary form must reproduce the above copyright
  43. * notice, this list of conditions and the following disclaimer in
  44. * the documentation and/or other materials provided with the
  45. * distribution.
  46. * * Neither the name Intel Corporation nor the names of its
  47. * contributors may be used to endorse or promote products derived
  48. * from this software without specific prior written permission.
  49. *
  50. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  51. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  52. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  53. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  54. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  55. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  56. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  57. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  58. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  59. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  60. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  61. *
  62. *****************************************************************************/
  63. #include "mvm.h"
  64. #include "iwl-config.h"
  65. #include "iwl-io.h"
  66. #include "iwl-csr.h"
  67. #include "iwl-prph.h"
  68. #define OTP_DTS_DIODE_DEVIATION 96 /*in words*/
  69. /* VBG - Voltage Band Gap error data (temperature offset) */
  70. #define OTP_WP_DTS_VBG (OTP_DTS_DIODE_DEVIATION + 2)
  71. #define MEAS_VBG_MIN_VAL 2300
  72. #define MEAS_VBG_MAX_VAL 3000
  73. #define MEAS_VBG_DEFAULT_VAL 2700
  74. #define DTS_DIODE_VALID(flags) (flags & DTS_DIODE_REG_FLAGS_PASS_ONCE)
  75. #define MIN_TEMPERATURE 0
  76. #define MAX_TEMPERATURE 125
  77. #define TEMPERATURE_ERROR (MAX_TEMPERATURE + 1)
  78. #define PTAT_DIGITAL_VALUE_MIN_VALUE 0
  79. #define PTAT_DIGITAL_VALUE_MAX_VALUE 0xFF
  80. #define DTS_VREFS_NUM 5
  81. static inline u32 DTS_DIODE_GET_VREFS_ID(u32 flags)
  82. {
  83. return (flags & DTS_DIODE_REG_FLAGS_VREFS_ID) >>
  84. DTS_DIODE_REG_FLAGS_VREFS_ID_POS;
  85. }
  86. #define CALC_VREFS_MIN_DIFF 43
  87. #define CALC_VREFS_MAX_DIFF 51
  88. #define CALC_LUT_SIZE (1 + CALC_VREFS_MAX_DIFF - CALC_VREFS_MIN_DIFF)
  89. #define CALC_LUT_INDEX_OFFSET CALC_VREFS_MIN_DIFF
  90. #define CALC_TEMPERATURE_RESULT_SHIFT_OFFSET 23
  91. /*
  92. * @digital_value: The diode's digital-value sampled (temperature/voltage)
  93. * @vref_low: The lower voltage-reference (the vref just below the diode's
  94. * sampled digital-value)
  95. * @vref_high: The higher voltage-reference (the vref just above the diode's
  96. * sampled digital-value)
  97. * @flags: bits[1:0]: The ID of the Vrefs pair (lowVref,highVref)
  98. * bits[6:2]: Reserved.
  99. * bits[7:7]: Indicates completion of at least 1 successful sample
  100. * since last DTS reset.
  101. */
  102. struct iwl_mvm_dts_diode_bits {
  103. u8 digital_value;
  104. u8 vref_low;
  105. u8 vref_high;
  106. u8 flags;
  107. } __packed;
  108. union dts_diode_results {
  109. u32 reg_value;
  110. struct iwl_mvm_dts_diode_bits bits;
  111. } __packed;
  112. static s16 iwl_mvm_dts_get_volt_band_gap(struct iwl_mvm *mvm)
  113. {
  114. struct iwl_nvm_section calib_sec;
  115. const __le16 *calib;
  116. u16 vbg;
  117. /* TODO: move parsing to NVM code */
  118. calib_sec = mvm->nvm_sections[NVM_SECTION_TYPE_CALIBRATION];
  119. calib = (__le16 *)calib_sec.data;
  120. vbg = le16_to_cpu(calib[OTP_WP_DTS_VBG]);
  121. if (vbg < MEAS_VBG_MIN_VAL || vbg > MEAS_VBG_MAX_VAL)
  122. vbg = MEAS_VBG_DEFAULT_VAL;
  123. return vbg;
  124. }
  125. static u16 iwl_mvm_dts_get_ptat_deviation_offset(struct iwl_mvm *mvm)
  126. {
  127. const u8 *calib;
  128. u8 ptat, pa1, pa2, median;
  129. /* TODO: move parsing to NVM code */
  130. calib = mvm->nvm_sections[NVM_SECTION_TYPE_CALIBRATION].data;
  131. ptat = calib[OTP_DTS_DIODE_DEVIATION];
  132. pa1 = calib[OTP_DTS_DIODE_DEVIATION + 1];
  133. pa2 = calib[OTP_DTS_DIODE_DEVIATION + 2];
  134. /* get the median: */
  135. if (ptat > pa1) {
  136. if (ptat > pa2)
  137. median = (pa1 > pa2) ? pa1 : pa2;
  138. else
  139. median = ptat;
  140. } else {
  141. if (pa1 > pa2)
  142. median = (ptat > pa2) ? ptat : pa2;
  143. else
  144. median = pa1;
  145. }
  146. return ptat - median;
  147. }
  148. static u8 iwl_mvm_dts_calibrate_ptat_deviation(struct iwl_mvm *mvm, u8 value)
  149. {
  150. /* Calibrate the PTAT digital value, based on PTAT deviation data: */
  151. s16 new_val = value - iwl_mvm_dts_get_ptat_deviation_offset(mvm);
  152. if (new_val > PTAT_DIGITAL_VALUE_MAX_VALUE)
  153. new_val = PTAT_DIGITAL_VALUE_MAX_VALUE;
  154. else if (new_val < PTAT_DIGITAL_VALUE_MIN_VALUE)
  155. new_val = PTAT_DIGITAL_VALUE_MIN_VALUE;
  156. return new_val;
  157. }
  158. static bool dts_get_adjacent_vrefs(struct iwl_mvm *mvm,
  159. union dts_diode_results *avg_ptat)
  160. {
  161. u8 vrefs_results[DTS_VREFS_NUM];
  162. u8 low_vref_index = 0, flags;
  163. u32 reg;
  164. reg = iwl_read_prph(mvm->trans, DTSC_VREF_AVG);
  165. memcpy(vrefs_results, &reg, sizeof(reg));
  166. reg = iwl_read_prph(mvm->trans, DTSC_VREF5_AVG);
  167. vrefs_results[4] = reg & 0xff;
  168. if (avg_ptat->bits.digital_value < vrefs_results[0] ||
  169. avg_ptat->bits.digital_value > vrefs_results[4])
  170. return false;
  171. if (avg_ptat->bits.digital_value > vrefs_results[3])
  172. low_vref_index = 3;
  173. else if (avg_ptat->bits.digital_value > vrefs_results[2])
  174. low_vref_index = 2;
  175. else if (avg_ptat->bits.digital_value > vrefs_results[1])
  176. low_vref_index = 1;
  177. avg_ptat->bits.vref_low = vrefs_results[low_vref_index];
  178. avg_ptat->bits.vref_high = vrefs_results[low_vref_index + 1];
  179. flags = avg_ptat->bits.flags;
  180. avg_ptat->bits.flags =
  181. (flags & ~DTS_DIODE_REG_FLAGS_VREFS_ID) |
  182. (low_vref_index & DTS_DIODE_REG_FLAGS_VREFS_ID);
  183. return true;
  184. }
  185. /*
  186. * return true it the results are valid, and false otherwise.
  187. */
  188. static bool dts_read_ptat_avg_results(struct iwl_mvm *mvm,
  189. union dts_diode_results *avg_ptat)
  190. {
  191. u32 reg;
  192. u8 tmp;
  193. /* fill the diode value and pass_once with avg-reg results */
  194. reg = iwl_read_prph(mvm->trans, DTSC_PTAT_AVG);
  195. reg &= DTS_DIODE_REG_DIG_VAL | DTS_DIODE_REG_PASS_ONCE;
  196. avg_ptat->reg_value = reg;
  197. /* calibrate the PTAT digital value */
  198. tmp = avg_ptat->bits.digital_value;
  199. tmp = iwl_mvm_dts_calibrate_ptat_deviation(mvm, tmp);
  200. avg_ptat->bits.digital_value = tmp;
  201. /*
  202. * fill vrefs fields, based on the avgVrefs results
  203. * and the diode value
  204. */
  205. return dts_get_adjacent_vrefs(mvm, avg_ptat) &&
  206. DTS_DIODE_VALID(avg_ptat->bits.flags);
  207. }
  208. static s32 calculate_nic_temperature(union dts_diode_results avg_ptat,
  209. u16 volt_band_gap)
  210. {
  211. u32 tmp_result;
  212. u8 vrefs_diff;
  213. /*
  214. * For temperature calculation (at the end, shift right by 23)
  215. * LUT[(D2-D1)] = ROUND{ 2^23 / ((D2-D1)*9*10) }
  216. * (D2-D1) == 43 44 45 46 47 48 49 50 51
  217. */
  218. static const u16 calc_lut[CALC_LUT_SIZE] = {
  219. 2168, 2118, 2071, 2026, 1983, 1942, 1902, 1864, 1828,
  220. };
  221. /*
  222. * The diff between the high and low voltage-references is assumed
  223. * to be strictly be in range of [60,68]
  224. */
  225. vrefs_diff = avg_ptat.bits.vref_high - avg_ptat.bits.vref_low;
  226. if (vrefs_diff < CALC_VREFS_MIN_DIFF ||
  227. vrefs_diff > CALC_VREFS_MAX_DIFF)
  228. return TEMPERATURE_ERROR;
  229. /* calculate the result: */
  230. tmp_result =
  231. vrefs_diff * (DTS_DIODE_GET_VREFS_ID(avg_ptat.bits.flags) + 9);
  232. tmp_result += avg_ptat.bits.digital_value;
  233. tmp_result -= avg_ptat.bits.vref_high;
  234. /* multiply by the LUT value (based on the diff) */
  235. tmp_result *= calc_lut[vrefs_diff - CALC_LUT_INDEX_OFFSET];
  236. /*
  237. * Get the BandGap (the voltage refereces source) error data
  238. * (temperature offset)
  239. */
  240. tmp_result *= volt_band_gap;
  241. /*
  242. * here, tmp_result value can be up to 32-bits. We want to right-shift
  243. * it *without* sign-extend.
  244. */
  245. tmp_result = tmp_result >> CALC_TEMPERATURE_RESULT_SHIFT_OFFSET;
  246. /*
  247. * at this point, tmp_result should be in the range:
  248. * 200 <= tmp_result <= 365
  249. */
  250. return (s16)tmp_result - 240;
  251. }
  252. static s32 check_nic_temperature(struct iwl_mvm *mvm)
  253. {
  254. u16 volt_band_gap;
  255. union dts_diode_results avg_ptat;
  256. volt_band_gap = iwl_mvm_dts_get_volt_band_gap(mvm);
  257. /* disable DTS */
  258. iwl_write_prph(mvm->trans, SHR_MISC_WFM_DTS_EN, 0);
  259. /* SV initialization */
  260. iwl_write_prph(mvm->trans, SHR_MISC_WFM_DTS_EN, 1);
  261. iwl_write_prph(mvm->trans, DTSC_CFG_MODE,
  262. DTSC_CFG_MODE_PERIODIC);
  263. /* wait for results */
  264. msleep(100);
  265. if (!dts_read_ptat_avg_results(mvm, &avg_ptat))
  266. return TEMPERATURE_ERROR;
  267. /* disable DTS */
  268. iwl_write_prph(mvm->trans, SHR_MISC_WFM_DTS_EN, 0);
  269. return calculate_nic_temperature(avg_ptat, volt_band_gap);
  270. }
  271. static void iwl_mvm_enter_ctkill(struct iwl_mvm *mvm)
  272. {
  273. u32 duration = mvm->thermal_throttle.params->ct_kill_duration;
  274. IWL_ERR(mvm, "Enter CT Kill\n");
  275. iwl_mvm_set_hw_ctkill_state(mvm, true);
  276. schedule_delayed_work(&mvm->thermal_throttle.ct_kill_exit,
  277. round_jiffies_relative(duration * HZ));
  278. }
  279. static void iwl_mvm_exit_ctkill(struct iwl_mvm *mvm)
  280. {
  281. IWL_ERR(mvm, "Exit CT Kill\n");
  282. iwl_mvm_set_hw_ctkill_state(mvm, false);
  283. }
  284. static void check_exit_ctkill(struct work_struct *work)
  285. {
  286. struct iwl_mvm_tt_mgmt *tt;
  287. struct iwl_mvm *mvm;
  288. u32 duration;
  289. s32 temp;
  290. tt = container_of(work, struct iwl_mvm_tt_mgmt, ct_kill_exit.work);
  291. mvm = container_of(tt, struct iwl_mvm, thermal_throttle);
  292. duration = tt->params->ct_kill_duration;
  293. iwl_trans_start_hw(mvm->trans);
  294. temp = check_nic_temperature(mvm);
  295. iwl_trans_stop_hw(mvm->trans, false);
  296. if (temp < MIN_TEMPERATURE || temp > MAX_TEMPERATURE) {
  297. IWL_DEBUG_TEMP(mvm, "Failed to measure NIC temperature\n");
  298. goto reschedule;
  299. }
  300. IWL_DEBUG_TEMP(mvm, "NIC temperature: %d\n", temp);
  301. if (temp <= tt->params->ct_kill_exit) {
  302. iwl_mvm_exit_ctkill(mvm);
  303. return;
  304. }
  305. reschedule:
  306. schedule_delayed_work(&mvm->thermal_throttle.ct_kill_exit,
  307. round_jiffies(duration * HZ));
  308. }
  309. static void iwl_mvm_tt_smps_iterator(void *_data, u8 *mac,
  310. struct ieee80211_vif *vif)
  311. {
  312. struct iwl_mvm *mvm = _data;
  313. enum ieee80211_smps_mode smps_mode;
  314. lockdep_assert_held(&mvm->mutex);
  315. if (mvm->thermal_throttle.dynamic_smps)
  316. smps_mode = IEEE80211_SMPS_DYNAMIC;
  317. else
  318. smps_mode = IEEE80211_SMPS_AUTOMATIC;
  319. if (vif->type != NL80211_IFTYPE_STATION)
  320. return;
  321. iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_TT, smps_mode);
  322. }
  323. static void iwl_mvm_tt_tx_protection(struct iwl_mvm *mvm, bool enable)
  324. {
  325. struct ieee80211_sta *sta;
  326. struct iwl_mvm_sta *mvmsta;
  327. int i, err;
  328. for (i = 0; i < IWL_MVM_STATION_COUNT; i++) {
  329. sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i],
  330. lockdep_is_held(&mvm->mutex));
  331. if (IS_ERR_OR_NULL(sta))
  332. continue;
  333. mvmsta = (void *)sta->drv_priv;
  334. if (enable == mvmsta->tt_tx_protection)
  335. continue;
  336. err = iwl_mvm_tx_protection(mvm, mvmsta, enable);
  337. if (err) {
  338. IWL_ERR(mvm, "Failed to %s Tx protection\n",
  339. enable ? "enable" : "disable");
  340. } else {
  341. IWL_DEBUG_TEMP(mvm, "%s Tx protection\n",
  342. enable ? "Enable" : "Disable");
  343. mvmsta->tt_tx_protection = enable;
  344. }
  345. }
  346. }
  347. static void iwl_mvm_tt_tx_backoff(struct iwl_mvm *mvm, u32 backoff)
  348. {
  349. struct iwl_host_cmd cmd = {
  350. .id = REPLY_THERMAL_MNG_BACKOFF,
  351. .len = { sizeof(u32), },
  352. .data = { &backoff, },
  353. .flags = CMD_SYNC,
  354. };
  355. if (iwl_mvm_send_cmd(mvm, &cmd) == 0) {
  356. IWL_DEBUG_TEMP(mvm, "Set Thermal Tx backoff to: %u\n",
  357. backoff);
  358. mvm->thermal_throttle.tx_backoff = backoff;
  359. } else {
  360. IWL_ERR(mvm, "Failed to change Thermal Tx backoff\n");
  361. }
  362. }
  363. void iwl_mvm_tt_handler(struct iwl_mvm *mvm)
  364. {
  365. const struct iwl_tt_params *params = mvm->thermal_throttle.params;
  366. struct iwl_mvm_tt_mgmt *tt = &mvm->thermal_throttle;
  367. s32 temperature = mvm->temperature;
  368. bool throttle_enable = false;
  369. int i;
  370. u32 tx_backoff;
  371. IWL_DEBUG_TEMP(mvm, "NIC temperature: %d\n", mvm->temperature);
  372. if (params->support_ct_kill && temperature >= params->ct_kill_entry) {
  373. iwl_mvm_enter_ctkill(mvm);
  374. return;
  375. }
  376. if (params->support_dynamic_smps) {
  377. if (!tt->dynamic_smps &&
  378. temperature >= params->dynamic_smps_entry) {
  379. IWL_DEBUG_TEMP(mvm, "Enable dynamic SMPS\n");
  380. tt->dynamic_smps = true;
  381. ieee80211_iterate_active_interfaces_atomic(
  382. mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
  383. iwl_mvm_tt_smps_iterator, mvm);
  384. throttle_enable = true;
  385. } else if (tt->dynamic_smps &&
  386. temperature <= params->dynamic_smps_exit) {
  387. IWL_DEBUG_TEMP(mvm, "Disable dynamic SMPS\n");
  388. tt->dynamic_smps = false;
  389. ieee80211_iterate_active_interfaces_atomic(
  390. mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
  391. iwl_mvm_tt_smps_iterator, mvm);
  392. }
  393. }
  394. if (params->support_tx_protection) {
  395. if (temperature >= params->tx_protection_entry) {
  396. iwl_mvm_tt_tx_protection(mvm, true);
  397. throttle_enable = true;
  398. } else if (temperature <= params->tx_protection_exit) {
  399. iwl_mvm_tt_tx_protection(mvm, false);
  400. }
  401. }
  402. if (params->support_tx_backoff) {
  403. tx_backoff = 0;
  404. for (i = 0; i < TT_TX_BACKOFF_SIZE; i++) {
  405. if (temperature < params->tx_backoff[i].temperature)
  406. break;
  407. tx_backoff = params->tx_backoff[i].backoff;
  408. }
  409. if (tx_backoff != 0)
  410. throttle_enable = true;
  411. if (tt->tx_backoff != tx_backoff)
  412. iwl_mvm_tt_tx_backoff(mvm, tx_backoff);
  413. }
  414. if (!tt->throttle && throttle_enable) {
  415. IWL_WARN(mvm,
  416. "Due to high temperature thermal throttling initiated\n");
  417. tt->throttle = true;
  418. } else if (tt->throttle && !tt->dynamic_smps && tt->tx_backoff == 0 &&
  419. temperature <= params->tx_protection_exit) {
  420. IWL_WARN(mvm,
  421. "Temperature is back to normal thermal throttling stopped\n");
  422. tt->throttle = false;
  423. }
  424. }
  425. static const struct iwl_tt_params iwl7000_tt_params = {
  426. .ct_kill_entry = 118,
  427. .ct_kill_exit = 96,
  428. .ct_kill_duration = 5,
  429. .dynamic_smps_entry = 114,
  430. .dynamic_smps_exit = 110,
  431. .tx_protection_entry = 114,
  432. .tx_protection_exit = 108,
  433. .tx_backoff = {
  434. {.temperature = 112, .backoff = 200},
  435. {.temperature = 113, .backoff = 600},
  436. {.temperature = 114, .backoff = 1200},
  437. {.temperature = 115, .backoff = 2000},
  438. {.temperature = 116, .backoff = 4000},
  439. {.temperature = 117, .backoff = 10000},
  440. },
  441. .support_ct_kill = true,
  442. .support_dynamic_smps = true,
  443. .support_tx_protection = true,
  444. .support_tx_backoff = true,
  445. };
  446. static const struct iwl_tt_params iwl7000_high_temp_tt_params = {
  447. .ct_kill_entry = 118,
  448. .ct_kill_exit = 96,
  449. .ct_kill_duration = 5,
  450. .dynamic_smps_entry = 114,
  451. .dynamic_smps_exit = 110,
  452. .tx_protection_entry = 114,
  453. .tx_protection_exit = 108,
  454. .tx_backoff = {
  455. {.temperature = 112, .backoff = 300},
  456. {.temperature = 113, .backoff = 800},
  457. {.temperature = 114, .backoff = 1500},
  458. {.temperature = 115, .backoff = 3000},
  459. {.temperature = 116, .backoff = 5000},
  460. {.temperature = 117, .backoff = 10000},
  461. },
  462. .support_ct_kill = true,
  463. .support_dynamic_smps = true,
  464. .support_tx_protection = true,
  465. .support_tx_backoff = true,
  466. };
  467. void iwl_mvm_tt_initialize(struct iwl_mvm *mvm)
  468. {
  469. struct iwl_mvm_tt_mgmt *tt = &mvm->thermal_throttle;
  470. IWL_DEBUG_TEMP(mvm, "Initialize Thermal Throttling\n");
  471. if (mvm->cfg->high_temp)
  472. tt->params = &iwl7000_high_temp_tt_params;
  473. else
  474. tt->params = &iwl7000_tt_params;
  475. tt->throttle = false;
  476. INIT_DELAYED_WORK(&tt->ct_kill_exit, check_exit_ctkill);
  477. }
  478. void iwl_mvm_tt_exit(struct iwl_mvm *mvm)
  479. {
  480. cancel_delayed_work_sync(&mvm->thermal_throttle.ct_kill_exit);
  481. IWL_DEBUG_TEMP(mvm, "Exit Thermal Throttling\n");
  482. }