ASoC: hdac_hdmi: Add broxton device ID
[cascardo/linux.git] / drivers / net / wireless / intel / iwlwifi / iwl-7000.c
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) 2012 - 2014 Intel Corporation. All rights reserved.
9  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
10  * Copyright(c) 2015 Intel Deutschland GmbH
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of version 2 of the GNU General Public License as
14  * published by the Free Software Foundation.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24  * USA
25  *
26  * The full GNU General Public License is included in this distribution
27  * in the file called COPYING.
28  *
29  * Contact Information:
30  *  Intel Linux Wireless <linuxwifi@intel.com>
31  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
32  *
33  * BSD LICENSE
34  *
35  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
36  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
37  * Copyright(c) 2015 Intel Deutschland GmbH
38  * All rights reserved.
39  *
40  * Redistribution and use in source and binary forms, with or without
41  * modification, are permitted provided that the following conditions
42  * are met:
43  *
44  *  * Redistributions of source code must retain the above copyright
45  *    notice, this list of conditions and the following disclaimer.
46  *  * Redistributions in binary form must reproduce the above copyright
47  *    notice, this list of conditions and the following disclaimer in
48  *    the documentation and/or other materials provided with the
49  *    distribution.
50  *  * Neither the name Intel Corporation nor the names of its
51  *    contributors may be used to endorse or promote products derived
52  *    from this software without specific prior written permission.
53  *
54  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
55  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
56  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
57  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
58  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
59  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
60  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
61  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
62  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
63  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
64  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
65  *
66  *****************************************************************************/
67
68 #include <linux/module.h>
69 #include <linux/stringify.h>
70 #include "iwl-config.h"
71 #include "iwl-agn-hw.h"
72
73 /* Highest firmware API version supported */
74 #define IWL7260_UCODE_API_MAX   17
75 #define IWL7265_UCODE_API_MAX   17
76 #define IWL7265D_UCODE_API_MAX  20
77
78 /* Oldest version we won't warn about */
79 #define IWL7260_UCODE_API_OK    13
80 #define IWL7265_UCODE_API_OK    13
81 #define IWL7265D_UCODE_API_OK   13
82
83 /* Lowest firmware API version supported */
84 #define IWL7260_UCODE_API_MIN   13
85 #define IWL7265_UCODE_API_MIN   13
86 #define IWL7265D_UCODE_API_MIN  13
87
88 /* NVM versions */
89 #define IWL7260_NVM_VERSION             0x0a1d
90 #define IWL7260_TX_POWER_VERSION        0xffff /* meaningless */
91 #define IWL3160_NVM_VERSION             0x709
92 #define IWL3160_TX_POWER_VERSION        0xffff /* meaningless */
93 #define IWL3165_NVM_VERSION             0x709
94 #define IWL3165_TX_POWER_VERSION        0xffff /* meaningless */
95 #define IWL7265_NVM_VERSION             0x0a1d
96 #define IWL7265_TX_POWER_VERSION        0xffff /* meaningless */
97 #define IWL7265D_NVM_VERSION            0x0c11
98 #define IWL7265_TX_POWER_VERSION        0xffff /* meaningless */
99
100 /* DCCM offsets and lengths */
101 #define IWL7000_DCCM_OFFSET             0x800000
102 #define IWL7260_DCCM_LEN                0x14000
103 #define IWL3160_DCCM_LEN                0x10000
104 #define IWL7265_DCCM_LEN                0x17A00
105
106 #define IWL7260_FW_PRE "iwlwifi-7260-"
107 #define IWL7260_MODULE_FIRMWARE(api) IWL7260_FW_PRE __stringify(api) ".ucode"
108
109 #define IWL3160_FW_PRE "iwlwifi-3160-"
110 #define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode"
111
112 #define IWL7265_FW_PRE "iwlwifi-7265-"
113 #define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode"
114
115 #define IWL7265D_FW_PRE "iwlwifi-7265D-"
116 #define IWL7265D_MODULE_FIRMWARE(api) IWL7265D_FW_PRE __stringify(api) ".ucode"
117
118 #define NVM_HW_SECTION_NUM_FAMILY_7000          0
119
120 static const struct iwl_base_params iwl7000_base_params = {
121         .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_7000,
122         .num_of_queues = 31,
123         .pll_cfg_val = 0,
124         .shadow_ram_support = true,
125         .led_compensation = 57,
126         .wd_timeout = IWL_LONG_WD_TIMEOUT,
127         .max_event_log_size = 512,
128         .shadow_reg_enable = true,
129         .pcie_l1_allowed = true,
130         .apmg_wake_up_wa = true,
131 };
132
133 static const struct iwl_tt_params iwl7000_high_temp_tt_params = {
134         .ct_kill_entry = 118,
135         .ct_kill_exit = 96,
136         .ct_kill_duration = 5,
137         .dynamic_smps_entry = 114,
138         .dynamic_smps_exit = 110,
139         .tx_protection_entry = 114,
140         .tx_protection_exit = 108,
141         .tx_backoff = {
142                 {.temperature = 112, .backoff = 300},
143                 {.temperature = 113, .backoff = 800},
144                 {.temperature = 114, .backoff = 1500},
145                 {.temperature = 115, .backoff = 3000},
146                 {.temperature = 116, .backoff = 5000},
147                 {.temperature = 117, .backoff = 10000},
148         },
149         .support_ct_kill = true,
150         .support_dynamic_smps = true,
151         .support_tx_protection = true,
152         .support_tx_backoff = true,
153 };
154
155 static const struct iwl_ht_params iwl7000_ht_params = {
156         .stbc = true,
157         .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
158 };
159
160 #define IWL_DEVICE_7000_COMMON                                  \
161         .device_family = IWL_DEVICE_FAMILY_7000,                \
162         .max_inst_size = IWL60_RTC_INST_SIZE,                   \
163         .max_data_size = IWL60_RTC_DATA_SIZE,                   \
164         .base_params = &iwl7000_base_params,                    \
165         .led_mode = IWL_LED_RF_STATE,                           \
166         .nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_7000,   \
167         .non_shared_ant = ANT_A,                                \
168         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,    \
169         .dccm_offset = IWL7000_DCCM_OFFSET
170
171 #define IWL_DEVICE_7000                                         \
172         IWL_DEVICE_7000_COMMON,                                 \
173         .ucode_api_max = IWL7260_UCODE_API_MAX,                 \
174         .ucode_api_ok = IWL7260_UCODE_API_OK,                   \
175         .ucode_api_min = IWL7260_UCODE_API_MIN
176
177 #define IWL_DEVICE_7005                                         \
178         IWL_DEVICE_7000_COMMON,                                 \
179         .ucode_api_max = IWL7265_UCODE_API_MAX,                 \
180         .ucode_api_ok = IWL7265_UCODE_API_OK,                   \
181         .ucode_api_min = IWL7265_UCODE_API_MIN
182
183 #define IWL_DEVICE_7005D                                        \
184         IWL_DEVICE_7000_COMMON,                                 \
185         .ucode_api_max = IWL7265D_UCODE_API_MAX,                \
186         .ucode_api_ok = IWL7265D_UCODE_API_OK,                  \
187         .ucode_api_min = IWL7265D_UCODE_API_MIN
188
189 const struct iwl_cfg iwl7260_2ac_cfg = {
190         .name = "Intel(R) Dual Band Wireless AC 7260",
191         .fw_name_pre = IWL7260_FW_PRE,
192         IWL_DEVICE_7000,
193         .ht_params = &iwl7000_ht_params,
194         .nvm_ver = IWL7260_NVM_VERSION,
195         .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
196         .host_interrupt_operation_mode = true,
197         .lp_xtal_workaround = true,
198         .dccm_len = IWL7260_DCCM_LEN,
199 };
200
201 const struct iwl_cfg iwl7260_2ac_cfg_high_temp = {
202         .name = "Intel(R) Dual Band Wireless AC 7260",
203         .fw_name_pre = IWL7260_FW_PRE,
204         IWL_DEVICE_7000,
205         .ht_params = &iwl7000_ht_params,
206         .nvm_ver = IWL7260_NVM_VERSION,
207         .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
208         .high_temp = true,
209         .host_interrupt_operation_mode = true,
210         .lp_xtal_workaround = true,
211         .dccm_len = IWL7260_DCCM_LEN,
212         .thermal_params = &iwl7000_high_temp_tt_params,
213 };
214
215 const struct iwl_cfg iwl7260_2n_cfg = {
216         .name = "Intel(R) Dual Band Wireless N 7260",
217         .fw_name_pre = IWL7260_FW_PRE,
218         IWL_DEVICE_7000,
219         .ht_params = &iwl7000_ht_params,
220         .nvm_ver = IWL7260_NVM_VERSION,
221         .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
222         .host_interrupt_operation_mode = true,
223         .lp_xtal_workaround = true,
224         .dccm_len = IWL7260_DCCM_LEN,
225 };
226
227 const struct iwl_cfg iwl7260_n_cfg = {
228         .name = "Intel(R) Wireless N 7260",
229         .fw_name_pre = IWL7260_FW_PRE,
230         IWL_DEVICE_7000,
231         .ht_params = &iwl7000_ht_params,
232         .nvm_ver = IWL7260_NVM_VERSION,
233         .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
234         .host_interrupt_operation_mode = true,
235         .lp_xtal_workaround = true,
236         .dccm_len = IWL7260_DCCM_LEN,
237 };
238
239 const struct iwl_cfg iwl3160_2ac_cfg = {
240         .name = "Intel(R) Dual Band Wireless AC 3160",
241         .fw_name_pre = IWL3160_FW_PRE,
242         IWL_DEVICE_7000,
243         .ht_params = &iwl7000_ht_params,
244         .nvm_ver = IWL3160_NVM_VERSION,
245         .nvm_calib_ver = IWL3160_TX_POWER_VERSION,
246         .host_interrupt_operation_mode = true,
247         .dccm_len = IWL3160_DCCM_LEN,
248 };
249
250 const struct iwl_cfg iwl3160_2n_cfg = {
251         .name = "Intel(R) Dual Band Wireless N 3160",
252         .fw_name_pre = IWL3160_FW_PRE,
253         IWL_DEVICE_7000,
254         .ht_params = &iwl7000_ht_params,
255         .nvm_ver = IWL3160_NVM_VERSION,
256         .nvm_calib_ver = IWL3160_TX_POWER_VERSION,
257         .host_interrupt_operation_mode = true,
258         .dccm_len = IWL3160_DCCM_LEN,
259 };
260
261 const struct iwl_cfg iwl3160_n_cfg = {
262         .name = "Intel(R) Wireless N 3160",
263         .fw_name_pre = IWL3160_FW_PRE,
264         IWL_DEVICE_7000,
265         .ht_params = &iwl7000_ht_params,
266         .nvm_ver = IWL3160_NVM_VERSION,
267         .nvm_calib_ver = IWL3160_TX_POWER_VERSION,
268         .host_interrupt_operation_mode = true,
269         .dccm_len = IWL3160_DCCM_LEN,
270 };
271
272 static const struct iwl_pwr_tx_backoff iwl7265_pwr_tx_backoffs[] = {
273         {.pwr = 1600, .backoff = 0},
274         {.pwr = 1300, .backoff = 467},
275         {.pwr = 900,  .backoff = 1900},
276         {.pwr = 800, .backoff = 2630},
277         {.pwr = 700, .backoff = 3720},
278         {.pwr = 600, .backoff = 5550},
279         {.pwr = 500, .backoff = 9350},
280         {0},
281 };
282
283 static const struct iwl_ht_params iwl7265_ht_params = {
284         .stbc = true,
285         .ldpc = true,
286         .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
287 };
288
289 const struct iwl_cfg iwl3165_2ac_cfg = {
290         .name = "Intel(R) Dual Band Wireless AC 3165",
291         .fw_name_pre = IWL7265D_FW_PRE,
292         IWL_DEVICE_7005D,
293         .ht_params = &iwl7000_ht_params,
294         .nvm_ver = IWL3165_NVM_VERSION,
295         .nvm_calib_ver = IWL3165_TX_POWER_VERSION,
296         .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
297         .dccm_len = IWL7265_DCCM_LEN,
298 };
299
300 const struct iwl_cfg iwl3168_2ac_cfg = {
301         .name = "Intel(R) Dual Band Wireless AC 3168",
302         .fw_name_pre = IWL7265D_FW_PRE,
303         IWL_DEVICE_7000,
304         .ht_params = &iwl7000_ht_params,
305         .nvm_ver = IWL3165_NVM_VERSION,
306         .nvm_calib_ver = IWL3165_TX_POWER_VERSION,
307         .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
308         .dccm_len = IWL7265_DCCM_LEN,
309 };
310
311 const struct iwl_cfg iwl7265_2ac_cfg = {
312         .name = "Intel(R) Dual Band Wireless AC 7265",
313         .fw_name_pre = IWL7265_FW_PRE,
314         IWL_DEVICE_7005,
315         .ht_params = &iwl7265_ht_params,
316         .nvm_ver = IWL7265_NVM_VERSION,
317         .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
318         .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
319         .dccm_len = IWL7265_DCCM_LEN,
320 };
321
322 const struct iwl_cfg iwl7265_2n_cfg = {
323         .name = "Intel(R) Dual Band Wireless N 7265",
324         .fw_name_pre = IWL7265_FW_PRE,
325         IWL_DEVICE_7005,
326         .ht_params = &iwl7265_ht_params,
327         .nvm_ver = IWL7265_NVM_VERSION,
328         .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
329         .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
330         .dccm_len = IWL7265_DCCM_LEN,
331 };
332
333 const struct iwl_cfg iwl7265_n_cfg = {
334         .name = "Intel(R) Wireless N 7265",
335         .fw_name_pre = IWL7265_FW_PRE,
336         IWL_DEVICE_7005,
337         .ht_params = &iwl7265_ht_params,
338         .nvm_ver = IWL7265_NVM_VERSION,
339         .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
340         .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
341         .dccm_len = IWL7265_DCCM_LEN,
342 };
343
344 const struct iwl_cfg iwl7265d_2ac_cfg = {
345         .name = "Intel(R) Dual Band Wireless AC 7265",
346         .fw_name_pre = IWL7265D_FW_PRE,
347         IWL_DEVICE_7005D,
348         .ht_params = &iwl7265_ht_params,
349         .nvm_ver = IWL7265D_NVM_VERSION,
350         .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
351         .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
352         .dccm_len = IWL7265_DCCM_LEN,
353 };
354
355 const struct iwl_cfg iwl7265d_2n_cfg = {
356         .name = "Intel(R) Dual Band Wireless N 7265",
357         .fw_name_pre = IWL7265D_FW_PRE,
358         IWL_DEVICE_7005D,
359         .ht_params = &iwl7265_ht_params,
360         .nvm_ver = IWL7265D_NVM_VERSION,
361         .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
362         .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
363         .dccm_len = IWL7265_DCCM_LEN,
364 };
365
366 const struct iwl_cfg iwl7265d_n_cfg = {
367         .name = "Intel(R) Wireless N 7265",
368         .fw_name_pre = IWL7265D_FW_PRE,
369         IWL_DEVICE_7005D,
370         .ht_params = &iwl7265_ht_params,
371         .nvm_ver = IWL7265D_NVM_VERSION,
372         .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
373         .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
374         .dccm_len = IWL7265_DCCM_LEN,
375 };
376
377 MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
378 MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
379 MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7265_UCODE_API_OK));
380 MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7265D_UCODE_API_OK));