Linux Audio

Check our new training course

Linux BSP development engineering services

Need help to port Linux and bootloaders to your hardware?
Loading...
v6.8
  1/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
  2/*
  3 * Copyright (C) 2017 Intel Deutschland GmbH
  4 * Copyright (C) 2018-2023 Intel Corporation
  5 */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  6#ifndef __iwl_fw_acpi__
  7#define __iwl_fw_acpi__
  8
  9#include <linux/acpi.h>
 10#include "fw/api/commands.h"
 11#include "fw/api/power.h"
 12#include "fw/api/phy.h"
 13#include "fw/api/nvm-reg.h"
 14#include "fw/api/config.h"
 15#include "fw/img.h"
 16#include "iwl-trans.h"
 17
 18
 19#define ACPI_WRDS_METHOD	"WRDS"
 20#define ACPI_EWRD_METHOD	"EWRD"
 21#define ACPI_WGDS_METHOD	"WGDS"
 22#define ACPI_WRDD_METHOD	"WRDD"
 23#define ACPI_SPLC_METHOD	"SPLC"
 24#define ACPI_ECKV_METHOD	"ECKV"
 25#define ACPI_PPAG_METHOD	"PPAG"
 26#define ACPI_WTAS_METHOD	"WTAS"
 27#define ACPI_WPFC_METHOD	"WPFC"
 28
 29#define ACPI_WIFI_DOMAIN	(0x07)
 30
 
 31#define ACPI_SAR_PROFILE_NUM		4
 32
 
 33#define ACPI_NUM_GEO_PROFILES		3
 34#define ACPI_NUM_GEO_PROFILES_REV3	8
 35#define ACPI_GEO_PER_CHAIN_SIZE		3
 36
 37#define ACPI_SAR_NUM_CHAINS_REV0	2
 38#define ACPI_SAR_NUM_CHAINS_REV1	2
 39#define ACPI_SAR_NUM_CHAINS_REV2	4
 40#define ACPI_SAR_NUM_SUB_BANDS_REV0	5
 41#define ACPI_SAR_NUM_SUB_BANDS_REV1	11
 42#define ACPI_SAR_NUM_SUB_BANDS_REV2	11
 43
 44#define ACPI_WRDS_WIFI_DATA_SIZE_REV0	(ACPI_SAR_NUM_CHAINS_REV0 * \
 45					 ACPI_SAR_NUM_SUB_BANDS_REV0 + 2)
 46#define ACPI_WRDS_WIFI_DATA_SIZE_REV1	(ACPI_SAR_NUM_CHAINS_REV1 * \
 47					 ACPI_SAR_NUM_SUB_BANDS_REV1 + 2)
 48#define ACPI_WRDS_WIFI_DATA_SIZE_REV2	(ACPI_SAR_NUM_CHAINS_REV2 * \
 49					 ACPI_SAR_NUM_SUB_BANDS_REV2 + 2)
 50#define ACPI_EWRD_WIFI_DATA_SIZE_REV0	((ACPI_SAR_PROFILE_NUM - 1) * \
 51					 ACPI_SAR_NUM_CHAINS_REV0 * \
 52					 ACPI_SAR_NUM_SUB_BANDS_REV0 + 3)
 53#define ACPI_EWRD_WIFI_DATA_SIZE_REV1	((ACPI_SAR_PROFILE_NUM - 1) * \
 54					 ACPI_SAR_NUM_CHAINS_REV1 * \
 55					 ACPI_SAR_NUM_SUB_BANDS_REV1 + 3)
 56#define ACPI_EWRD_WIFI_DATA_SIZE_REV2	((ACPI_SAR_PROFILE_NUM - 1) * \
 57					 ACPI_SAR_NUM_CHAINS_REV2 * \
 58					 ACPI_SAR_NUM_SUB_BANDS_REV2 + 3)
 59#define ACPI_WPFC_WIFI_DATA_SIZE	4 /* 4 filter config words */
 60
 61/* revision 0 and 1 are identical, except for the semantics in the FW */
 62#define ACPI_GEO_NUM_BANDS_REV0		2
 63#define ACPI_GEO_NUM_BANDS_REV2		3
 64#define ACPI_GEO_NUM_CHAINS		2
 65
 
 
 
 
 66#define ACPI_WRDD_WIFI_DATA_SIZE	2
 67#define ACPI_SPLC_WIFI_DATA_SIZE	2
 68#define ACPI_ECKV_WIFI_DATA_SIZE	2
 69
 70/*
 71 * TAS size: 1 elelment for type,
 72 *	     1 element for enabled field,
 73 *	     1 element for block list size,
 74 *	     16 elements for block list array
 75 */
 76#define APCI_WTAS_BLACK_LIST_MAX	16
 77#define ACPI_WTAS_WIFI_DATA_SIZE	(3 + APCI_WTAS_BLACK_LIST_MAX)
 78#define ACPI_WTAS_ENABLED_MSK		0x1
 79#define ACPI_WTAS_OVERRIDE_IEC_MSK	0x2
 80#define ACPI_WTAS_ENABLE_IEC_MSK	0x4
 81#define ACPI_WTAS_OVERRIDE_IEC_POS	0x1
 82#define ACPI_WTAS_ENABLE_IEC_POS	0x2
 83#define ACPI_WTAS_USA_UHB_MSK		BIT(16)
 84#define ACPI_WTAS_USA_UHB_POS		16
 85
 86
 87#define ACPI_PPAG_WIFI_DATA_SIZE_V1	((IWL_NUM_CHAIN_LIMITS * \
 88					  IWL_NUM_SUB_BANDS_V1) + 2)
 89#define ACPI_PPAG_WIFI_DATA_SIZE_V2	((IWL_NUM_CHAIN_LIMITS * \
 90					  IWL_NUM_SUB_BANDS_V2) + 2)
 91
 92/* PPAG gain value bounds in 1/8 dBm */
 93#define ACPI_PPAG_MIN_LB -16
 94#define ACPI_PPAG_MAX_LB 24
 95#define ACPI_PPAG_MIN_HB -16
 96#define ACPI_PPAG_MAX_HB 40
 97#define ACPI_PPAG_MASK 3
 98#define IWL_PPAG_ETSI_MASK BIT(0)
 99
100#define IWL_SAR_ENABLE_MSK		BIT(0)
101#define IWL_REDUCE_POWER_FLAGS_POS	1
102
103/*
104 * The profile for revision 2 is a superset of revision 1, which is in
105 * turn a superset of revision 0.  So we can store all revisions
106 * inside revision 2, which is what we represent here.
107 */
108struct iwl_sar_profile_chain {
109	u8 subbands[ACPI_SAR_NUM_SUB_BANDS_REV2];
110};
111
112struct iwl_sar_profile {
113	bool enabled;
114	struct iwl_sar_profile_chain chains[ACPI_SAR_NUM_CHAINS_REV2];
115};
116
117/* Same thing as with SAR, all revisions fit in revision 2 */
118struct iwl_geo_profile_band {
119	u8 max;
120	u8 chains[ACPI_GEO_NUM_CHAINS];
121};
122
123struct iwl_geo_profile {
124	struct iwl_geo_profile_band bands[ACPI_GEO_NUM_BANDS_REV2];
125};
126
127/* Same thing as with SAR, all revisions fit in revision 2 */
128struct iwl_ppag_chain {
129	s8 subbands[ACPI_SAR_NUM_SUB_BANDS_REV2];
130};
131
132enum iwl_dsm_funcs_rev_0 {
133	DSM_FUNC_QUERY = 0,
134	DSM_FUNC_DISABLE_SRD = 1,
135	DSM_FUNC_ENABLE_INDONESIA_5G2 = 2,
136	DSM_FUNC_ENABLE_6E = 3,
137	DSM_FUNC_REGULATORY_CONFIG = 4,
138	DSM_FUNC_11AX_ENABLEMENT = 6,
139	DSM_FUNC_ENABLE_UNII4_CHAN = 7,
140	DSM_FUNC_ACTIVATE_CHANNEL = 8,
141	DSM_FUNC_FORCE_DISABLE_CHANNELS = 9,
142	DSM_FUNC_ENERGY_DETECTION_THRESHOLD = 10,
143};
144
145enum iwl_dsm_values_srd {
146	DSM_VALUE_SRD_ACTIVE,
147	DSM_VALUE_SRD_PASSIVE,
148	DSM_VALUE_SRD_DISABLE,
149	DSM_VALUE_SRD_MAX
150};
151
152enum iwl_dsm_values_indonesia {
153	DSM_VALUE_INDONESIA_DISABLE,
154	DSM_VALUE_INDONESIA_ENABLE,
155	DSM_VALUE_INDONESIA_RESERVED,
156	DSM_VALUE_INDONESIA_MAX
157};
158
159/* DSM RFI uses a different GUID, so need separate definitions */
160
161#define DSM_RFI_FUNC_ENABLE 3
162
163enum iwl_dsm_values_rfi {
164	DSM_VALUE_RFI_ENABLE,
165	DSM_VALUE_RFI_DISABLE,
166	DSM_VALUE_RFI_MAX
167};
168
169enum iwl_dsm_masks_reg {
170	DSM_MASK_CHINA_22_REG = BIT(2)
171};
172
173#ifdef CONFIG_ACPI
174
175struct iwl_fw_runtime;
176
177extern const guid_t iwl_guid;
178extern const guid_t iwl_rfi_guid;
179
180int iwl_acpi_get_dsm_u8(struct device *dev, int rev, int func,
181			const guid_t *guid, u8 *value);
182
183int iwl_acpi_get_dsm_u32(struct device *dev, int rev, int func,
184			 const guid_t *guid, u32 *value);
185
186/**
187 * iwl_acpi_get_mcc - read MCC from ACPI, if available
188 *
189 * @dev: the struct device
190 * @mcc: output buffer (3 bytes) that will get the MCC
191 *
192 * This function tries to read the current MCC from ACPI if available.
193 */
194int iwl_acpi_get_mcc(struct device *dev, char *mcc);
195
196u64 iwl_acpi_get_pwr_limit(struct device *dev);
197
198/*
199 * iwl_acpi_get_eckv - read external clock validation from ACPI, if available
200 *
201 * @dev: the struct device
202 * @extl_clk: output var (2 bytes) that will get the clk indication.
203 *
204 * This function tries to read the external clock indication
205 * from ACPI if available.
206 */
207int iwl_acpi_get_eckv(struct device *dev, u32 *extl_clk);
208
209int iwl_sar_select_profile(struct iwl_fw_runtime *fwrt,
210			   __le16 *per_chain, u32 n_tables, u32 n_subbands,
211			   int prof_a, int prof_b);
212
213int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt);
214
215int iwl_sar_get_ewrd_table(struct iwl_fw_runtime *fwrt);
216
217int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt);
218
219bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt);
220
221int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
222		     struct iwl_per_chain_offset *table,
223		     u32 n_bands, u32 n_profiles);
224
225int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt,
226		     union iwl_tas_config_cmd *cmd, int fw_ver);
227
228__le32 iwl_acpi_get_lari_config_bitmap(struct iwl_fw_runtime *fwrt);
229
230int iwl_acpi_get_ppag_table(struct iwl_fw_runtime *fwrt);
231
232int iwl_read_ppag_table(struct iwl_fw_runtime *fwrt, union iwl_ppag_table_cmd *cmd,
233			int *cmd_size);
234
235bool iwl_acpi_is_ppag_approved(struct iwl_fw_runtime *fwrt);
236
237void iwl_acpi_get_phy_filters(struct iwl_fw_runtime *fwrt,
238			      struct iwl_phy_specific_cfg *filters);
239
240#else /* CONFIG_ACPI */
241
242static inline void *iwl_acpi_get_dsm_object(struct device *dev, int rev,
243					    int func, union acpi_object *args)
244{
245	return ERR_PTR(-ENOENT);
246}
247
248static inline int iwl_acpi_get_dsm_u8(struct device *dev, int rev, int func,
249				      const guid_t *guid, u8 *value)
 
250{
251	return -ENOENT;
252}
253
254static inline int iwl_acpi_get_dsm_u32(struct device *dev, int rev, int func,
255				       const guid_t *guid, u32 *value)
256{
257	return -ENOENT;
258}
259
260static inline int iwl_acpi_get_mcc(struct device *dev, char *mcc)
261{
262	return -ENOENT;
263}
264
265static inline u64 iwl_acpi_get_pwr_limit(struct device *dev)
266{
267	return 0;
268}
269
270static inline int iwl_acpi_get_eckv(struct device *dev, u32 *extl_clk)
271{
272	return -ENOENT;
273}
274
275static inline int iwl_sar_select_profile(struct iwl_fw_runtime *fwrt,
276			   __le16 *per_chain, u32 n_tables, u32 n_subbands,
277			   int prof_a, int prof_b)
278{
279	return -ENOENT;
280}
281
282static inline int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt)
283{
284	return -ENOENT;
285}
286
287static inline int iwl_sar_get_ewrd_table(struct iwl_fw_runtime *fwrt)
288{
289	return -ENOENT;
290}
291
292static inline int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt)
293{
294	return 1;
295}
296
297static inline bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt)
298{
299	return false;
300}
301
302static inline int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt,
303				   union iwl_tas_config_cmd *cmd, int fw_ver)
304{
305	return -ENOENT;
306}
307
308static inline __le32 iwl_acpi_get_lari_config_bitmap(struct iwl_fw_runtime *fwrt)
309{
310	return 0;
311}
312
313static inline int iwl_acpi_get_ppag_table(struct iwl_fw_runtime *fwrt)
314{
315	return -ENOENT;
316}
317
318static inline int iwl_read_ppag_table(struct iwl_fw_runtime *fwrt,
319				    union iwl_ppag_table_cmd *cmd, int *cmd_size)
320{
321	return -ENOENT;
322}
323
324static inline bool iwl_acpi_is_ppag_approved(struct iwl_fw_runtime *fwrt)
325{
326	return false;
327}
328
329static inline void iwl_acpi_get_phy_filters(struct iwl_fw_runtime *fwrt,
330					    struct iwl_phy_specific_cfg *filters)
331{
332}
333
334#endif /* CONFIG_ACPI */
335
336#endif /* __iwl_fw_acpi__ */
v4.17
  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) 2017        Intel Deutschland GmbH
  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;
 21 *
 22 * The full GNU General Public License is included in this distribution
 23 * in the file called COPYING.
 24 *
 25 * Contact Information:
 26 *  Intel Linux Wireless <linuxwifi@intel.com>
 27 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
 28 *
 29 * BSD LICENSE
 30 *
 31 * Copyright(c) 2017        Intel Deutschland GmbH
 32 * All rights reserved.
 33 *
 34 * Redistribution and use in source and binary forms, with or without
 35 * modification, are permitted provided that the following conditions
 36 * are met:
 37 *
 38 *  * Redistributions of source code must retain the above copyright
 39 *    notice, this list of conditions and the following disclaimer.
 40 *  * Redistributions in binary form must reproduce the above copyright
 41 *    notice, this list of conditions and the following disclaimer in
 42 *    the documentation and/or other materials provided with the
 43 *    distribution.
 44 *  * Neither the name Intel Corporation nor the names of its
 45 *    contributors may be used to endorse or promote products derived
 46 *    from this software without specific prior written permission.
 47 *
 48 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 49 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 50 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 51 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 52 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 53 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 54 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 55 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 56 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 57 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 58 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 59 *
 60 *****************************************************************************/
 61#ifndef __iwl_fw_acpi__
 62#define __iwl_fw_acpi__
 63
 64#include <linux/acpi.h>
 
 
 
 
 
 
 
 
 65
 66#define ACPI_WRDS_METHOD	"WRDS"
 67#define ACPI_EWRD_METHOD	"EWRD"
 68#define ACPI_WGDS_METHOD	"WGDS"
 69#define ACPI_WRDD_METHOD	"WRDD"
 70#define ACPI_SPLC_METHOD	"SPLC"
 
 
 
 
 71
 72#define ACPI_WIFI_DOMAIN	(0x07)
 73
 74#define ACPI_SAR_TABLE_SIZE		10
 75#define ACPI_SAR_PROFILE_NUM		4
 76
 77#define ACPI_GEO_TABLE_SIZE		6
 78#define ACPI_NUM_GEO_PROFILES		3
 
 79#define ACPI_GEO_PER_CHAIN_SIZE		3
 80
 81#define ACPI_SAR_NUM_CHAIN_LIMITS	2
 82#define ACPI_SAR_NUM_SUB_BANDS		5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 83
 84#define ACPI_WRDS_WIFI_DATA_SIZE	(ACPI_SAR_TABLE_SIZE + 2)
 85#define ACPI_EWRD_WIFI_DATA_SIZE	((ACPI_SAR_PROFILE_NUM - 1) * \
 86					 ACPI_SAR_TABLE_SIZE + 3)
 87#define ACPI_WGDS_WIFI_DATA_SIZE	18
 88#define ACPI_WRDD_WIFI_DATA_SIZE	2
 89#define ACPI_SPLC_WIFI_DATA_SIZE	2
 
 90
 91#define ACPI_WGDS_NUM_BANDS		2
 92#define ACPI_WGDS_TABLE_SIZE		3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 93
 94#ifdef CONFIG_ACPI
 95
 96void *iwl_acpi_get_object(struct device *dev, acpi_string method);
 97union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
 98					 union acpi_object *data,
 99					 int data_size);
 
 
 
 
 
 
100
101/**
102 * iwl_acpi_get_mcc - read MCC from ACPI, if available
103 *
104 * @dev: the struct device
105 * @mcc: output buffer (3 bytes) that will get the MCC
106 *
107 * This function tries to read the current MCC from ACPI if available.
108 */
109int iwl_acpi_get_mcc(struct device *dev, char *mcc);
110
111u64 iwl_acpi_get_pwr_limit(struct device *dev);
112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113#else /* CONFIG_ACPI */
114
115static inline void *iwl_acpi_get_object(struct device *dev, acpi_string method)
 
116{
117	return ERR_PTR(-ENOENT);
118}
119
120static inline union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
121						       union acpi_object *data,
122						       int data_size)
123{
124	return ERR_PTR(-ENOENT);
 
 
 
 
 
 
125}
126
127static inline int iwl_acpi_get_mcc(struct device *dev, char *mcc)
128{
129	return -ENOENT;
130}
131
132static inline u64 iwl_acpi_get_pwr_limit(struct device *dev)
133{
134	return 0;
135}
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137#endif /* CONFIG_ACPI */
 
138#endif /* __iwl_fw_acpi__ */