162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2005-2014, 2018-2022 Intel Corporation
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci#ifndef __iwl_modparams_h__
662306a36Sopenharmony_ci#define __iwl_modparams_h__
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include <linux/types.h>
962306a36Sopenharmony_ci#include <linux/spinlock.h>
1062306a36Sopenharmony_ci#include <linux/gfp.h>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciextern struct iwl_mod_params iwlwifi_mod_params;
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_cienum iwl_power_level {
1562306a36Sopenharmony_ci	IWL_POWER_INDEX_1,
1662306a36Sopenharmony_ci	IWL_POWER_INDEX_2,
1762306a36Sopenharmony_ci	IWL_POWER_INDEX_3,
1862306a36Sopenharmony_ci	IWL_POWER_INDEX_4,
1962306a36Sopenharmony_ci	IWL_POWER_INDEX_5,
2062306a36Sopenharmony_ci	IWL_POWER_NUM
2162306a36Sopenharmony_ci};
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_cienum iwl_disable_11n {
2462306a36Sopenharmony_ci	IWL_DISABLE_HT_ALL	 = BIT(0),
2562306a36Sopenharmony_ci	IWL_DISABLE_HT_TXAGG	 = BIT(1),
2662306a36Sopenharmony_ci	IWL_DISABLE_HT_RXAGG	 = BIT(2),
2762306a36Sopenharmony_ci	IWL_ENABLE_HT_TXAGG	 = BIT(3),
2862306a36Sopenharmony_ci};
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_cienum iwl_amsdu_size {
3162306a36Sopenharmony_ci	IWL_AMSDU_DEF = 0,
3262306a36Sopenharmony_ci	IWL_AMSDU_4K = 1,
3362306a36Sopenharmony_ci	IWL_AMSDU_8K = 2,
3462306a36Sopenharmony_ci	IWL_AMSDU_12K = 3,
3562306a36Sopenharmony_ci	/* Add 2K at the end to avoid breaking current API */
3662306a36Sopenharmony_ci	IWL_AMSDU_2K = 4,
3762306a36Sopenharmony_ci};
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_cienum iwl_uapsd_disable {
4062306a36Sopenharmony_ci	IWL_DISABLE_UAPSD_BSS		= BIT(0),
4162306a36Sopenharmony_ci	IWL_DISABLE_UAPSD_P2P_CLIENT	= BIT(1),
4262306a36Sopenharmony_ci};
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci/**
4562306a36Sopenharmony_ci * struct iwl_mod_params
4662306a36Sopenharmony_ci *
4762306a36Sopenharmony_ci * Holds the module parameters
4862306a36Sopenharmony_ci *
4962306a36Sopenharmony_ci * @swcrypto: using hardware encryption, default = 0
5062306a36Sopenharmony_ci * @disable_11n: disable 11n capabilities, default = 0,
5162306a36Sopenharmony_ci *	use IWL_[DIS,EN]ABLE_HT_* constants
5262306a36Sopenharmony_ci * @amsdu_size: See &enum iwl_amsdu_size.
5362306a36Sopenharmony_ci * @fw_restart: restart firmware, default = 1
5462306a36Sopenharmony_ci * @bt_coex_active: enable bt coex, default = true
5562306a36Sopenharmony_ci * @led_mode: system default, default = 0
5662306a36Sopenharmony_ci * @power_save: enable power save, default = false
5762306a36Sopenharmony_ci * @power_level: power level, default = 1
5862306a36Sopenharmony_ci * @debug_level: levels are IWL_DL_*
5962306a36Sopenharmony_ci * @nvm_file: specifies a external NVM file
6062306a36Sopenharmony_ci * @uapsd_disable: disable U-APSD, see &enum iwl_uapsd_disable, default =
6162306a36Sopenharmony_ci *	IWL_DISABLE_UAPSD_BSS | IWL_DISABLE_UAPSD_P2P_CLIENT
6262306a36Sopenharmony_ci * @disable_11ac: disable VHT capabilities, default = false.
6362306a36Sopenharmony_ci * @remove_when_gone: remove an inaccessible device from the PCIe bus.
6462306a36Sopenharmony_ci * @enable_ini: enable new FW debug infratructure (INI TLVs)
6562306a36Sopenharmony_ci * @disable_11be: disable EHT capabilities, default = false.
6662306a36Sopenharmony_ci */
6762306a36Sopenharmony_cistruct iwl_mod_params {
6862306a36Sopenharmony_ci	int swcrypto;
6962306a36Sopenharmony_ci	unsigned int disable_11n;
7062306a36Sopenharmony_ci	int amsdu_size;
7162306a36Sopenharmony_ci	bool fw_restart;
7262306a36Sopenharmony_ci	bool bt_coex_active;
7362306a36Sopenharmony_ci	int led_mode;
7462306a36Sopenharmony_ci	bool power_save;
7562306a36Sopenharmony_ci	int power_level;
7662306a36Sopenharmony_ci#ifdef CONFIG_IWLWIFI_DEBUG
7762306a36Sopenharmony_ci	u32 debug_level;
7862306a36Sopenharmony_ci#endif
7962306a36Sopenharmony_ci	char *nvm_file;
8062306a36Sopenharmony_ci	u32 uapsd_disable;
8162306a36Sopenharmony_ci	bool disable_11ac;
8262306a36Sopenharmony_ci	/**
8362306a36Sopenharmony_ci	 * @disable_11ax: disable HE capabilities, default = false
8462306a36Sopenharmony_ci	 */
8562306a36Sopenharmony_ci	bool disable_11ax;
8662306a36Sopenharmony_ci	bool remove_when_gone;
8762306a36Sopenharmony_ci	u32 enable_ini;
8862306a36Sopenharmony_ci	bool disable_11be;
8962306a36Sopenharmony_ci};
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_cistatic inline bool iwl_enable_rx_ampdu(void)
9262306a36Sopenharmony_ci{
9362306a36Sopenharmony_ci	if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG)
9462306a36Sopenharmony_ci		return false;
9562306a36Sopenharmony_ci	return true;
9662306a36Sopenharmony_ci}
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_cistatic inline bool iwl_enable_tx_ampdu(void)
9962306a36Sopenharmony_ci{
10062306a36Sopenharmony_ci	if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG)
10162306a36Sopenharmony_ci		return false;
10262306a36Sopenharmony_ci	if (iwlwifi_mod_params.disable_11n & IWL_ENABLE_HT_TXAGG)
10362306a36Sopenharmony_ci		return true;
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ci	/* enabled by default */
10662306a36Sopenharmony_ci	return true;
10762306a36Sopenharmony_ci}
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci#endif /* #__iwl_modparams_h__ */
110