iwlwifi: acpi: move ACPI-related definitions to acpi.h

The ACPI table size definitions were spread around the different files
that used them.  Move them all to a common place.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
This commit is contained in:
Luca Coelho 2017-09-21 13:22:59 +03:00
parent 1c73acf58b
commit e7a3b8d879
4 changed files with 40 additions and 32 deletions

View File

@ -63,8 +63,6 @@
#include <linux/acpi.h> #include <linux/acpi.h>
#ifdef CONFIG_ACPI
#define ACPI_WRDS_METHOD "WRDS" #define ACPI_WRDS_METHOD "WRDS"
#define ACPI_EWRD_METHOD "EWRD" #define ACPI_EWRD_METHOD "EWRD"
#define ACPI_WGDS_METHOD "WGDS" #define ACPI_WGDS_METHOD "WGDS"
@ -73,13 +71,25 @@
#define ACPI_WIFI_DOMAIN (0x07) #define ACPI_WIFI_DOMAIN (0x07)
#define ACPI_WRDS_WIFI_DATA_SIZE (IWL_MVM_SAR_TABLE_SIZE + 2) #define ACPI_SAR_TABLE_SIZE 10
#define ACPI_EWRD_WIFI_DATA_SIZE ((IWL_MVM_SAR_PROFILE_NUM - 1) * \ #define ACPI_SAR_PROFILE_NUM 4
IWL_MVM_SAR_TABLE_SIZE + 3)
#define ACPI_GEO_TABLE_SIZE 6
#define ACPI_NUM_GEO_PROFILES 3
#define ACPI_GEO_PER_CHAIN_SIZE 3
#define ACPI_SAR_NUM_CHAIN_LIMITS 2
#define ACPI_SAR_NUM_SUB_BANDS 5
#define ACPI_WRDS_WIFI_DATA_SIZE (ACPI_SAR_TABLE_SIZE + 2)
#define ACPI_EWRD_WIFI_DATA_SIZE ((ACPI_SAR_PROFILE_NUM - 1) * \
ACPI_SAR_TABLE_SIZE + 3)
#define ACPI_WGDS_WIFI_DATA_SIZE 18 #define ACPI_WGDS_WIFI_DATA_SIZE 18
#define ACPI_WGDS_NUM_BANDS 2 #define ACPI_WGDS_NUM_BANDS 2
#define ACPI_WGDS_TABLE_SIZE 3 #define ACPI_WGDS_TABLE_SIZE 3
#ifdef CONFIG_ACPI
void *iwl_acpi_get_object(struct device *dev, acpi_string method); void *iwl_acpi_get_object(struct device *dev, acpi_string method);
#else /* CONFIG_ACPI */ #else /* CONFIG_ACPI */

View File

@ -357,8 +357,7 @@ struct iwl_dev_tx_power_cmd {
u8 reserved[3]; u8 reserved[3];
} __packed; /* TX_REDUCED_POWER_API_S_VER_4 */ } __packed; /* TX_REDUCED_POWER_API_S_VER_4 */
#define IWL_NUM_GEO_PROFILES 3 #define IWL_NUM_GEO_PROFILES 3
#define IWL_GEO_PER_CHAIN_SIZE 3
/** /**
* enum iwl_geo_per_chain_offset_operation - type of operation * enum iwl_geo_per_chain_offset_operation - type of operation

View File

@ -588,7 +588,7 @@ static int iwl_mvm_sar_set_profile(struct iwl_mvm *mvm,
profile->enabled = enabled; profile->enabled = enabled;
for (i = 0; i < IWL_MVM_SAR_TABLE_SIZE; i++) { for (i = 0; i < ACPI_SAR_TABLE_SIZE; i++) {
if ((table[i].type != ACPI_TYPE_INTEGER) || if ((table[i].type != ACPI_TYPE_INTEGER) ||
(table[i].integer.value > U8_MAX)) (table[i].integer.value > U8_MAX))
return -EINVAL; return -EINVAL;
@ -732,7 +732,7 @@ static int iwl_mvm_sar_get_ewrd_table(struct iwl_mvm *mvm)
break; break;
/* go to the next table */ /* go to the next table */
pos += IWL_MVM_SAR_TABLE_SIZE; pos += ACPI_SAR_TABLE_SIZE;
} }
out_free: out_free:
@ -757,8 +757,8 @@ static int iwl_mvm_sar_get_wgds_table(struct iwl_mvm *mvm)
goto out_free; goto out_free;
} }
for (i = 0; i < IWL_NUM_GEO_PROFILES; i++) { for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) {
for (j = 0; j < IWL_MVM_GEO_TABLE_SIZE; j++) { for (j = 0; j < ACPI_GEO_TABLE_SIZE; j++) {
union acpi_object *entry; union acpi_object *entry;
entry = &wifi_pkg->package.elements[idx++]; entry = &wifi_pkg->package.elements[idx++];
@ -783,25 +783,25 @@ int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b)
.v3.set_mode = cpu_to_le32(IWL_TX_POWER_MODE_SET_CHAINS), .v3.set_mode = cpu_to_le32(IWL_TX_POWER_MODE_SET_CHAINS),
}; };
int i, j, idx; int i, j, idx;
int profs[IWL_NUM_CHAIN_LIMITS] = { prof_a, prof_b }; int profs[ACPI_SAR_NUM_CHAIN_LIMITS] = { prof_a, prof_b };
int len = sizeof(cmd); int len = sizeof(cmd);
BUILD_BUG_ON(IWL_NUM_CHAIN_LIMITS < 2); BUILD_BUG_ON(ACPI_SAR_NUM_CHAIN_LIMITS < 2);
BUILD_BUG_ON(IWL_NUM_CHAIN_LIMITS * IWL_NUM_SUB_BANDS != BUILD_BUG_ON(ACPI_SAR_NUM_CHAIN_LIMITS * ACPI_SAR_NUM_SUB_BANDS !=
IWL_MVM_SAR_TABLE_SIZE); ACPI_SAR_TABLE_SIZE);
if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TX_POWER_ACK)) if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TX_POWER_ACK))
len = sizeof(cmd.v3); len = sizeof(cmd.v3);
for (i = 0; i < IWL_NUM_CHAIN_LIMITS; i++) { for (i = 0; i < ACPI_SAR_NUM_CHAIN_LIMITS; i++) {
struct iwl_mvm_sar_profile *prof; struct iwl_mvm_sar_profile *prof;
/* don't allow SAR to be disabled (profile 0 means disable) */ /* don't allow SAR to be disabled (profile 0 means disable) */
if (profs[i] == 0) if (profs[i] == 0)
return -EPERM; return -EPERM;
/* we are off by one, so allow up to IWL_MVM_SAR_PROFILE_NUM */ /* we are off by one, so allow up to ACPI_SAR_PROFILE_NUM */
if (profs[i] > IWL_MVM_SAR_PROFILE_NUM) if (profs[i] > ACPI_SAR_PROFILE_NUM)
return -EINVAL; return -EINVAL;
/* profiles go from 1 to 4, so decrement to access the array */ /* profiles go from 1 to 4, so decrement to access the array */
@ -816,8 +816,8 @@ int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b)
} }
IWL_DEBUG_RADIO(mvm, " Chain[%d]:\n", i); IWL_DEBUG_RADIO(mvm, " Chain[%d]:\n", i);
for (j = 0; j < IWL_NUM_SUB_BANDS; j++) { for (j = 0; j < ACPI_SAR_NUM_SUB_BANDS; j++) {
idx = (i * IWL_NUM_SUB_BANDS) + j; idx = (i * ACPI_SAR_NUM_SUB_BANDS) + j;
cmd.v3.per_chain_restriction[i][j] = cmd.v3.per_chain_restriction[i][j] =
cpu_to_le16(prof->table[idx]); cpu_to_le16(prof->table[idx]);
IWL_DEBUG_RADIO(mvm, " Band[%d] = %d * .125dBm\n", IWL_DEBUG_RADIO(mvm, " Band[%d] = %d * .125dBm\n",
@ -853,7 +853,7 @@ int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm)
resp = (void *)cmd.resp_pkt->data; resp = (void *)cmd.resp_pkt->data;
ret = le32_to_cpu(resp->profile_idx); ret = le32_to_cpu(resp->profile_idx);
if (WARN_ON(ret > IWL_NUM_GEO_PROFILES)) { if (WARN_ON(ret > ACPI_NUM_GEO_PROFILES)) {
ret = -EIO; ret = -EIO;
IWL_WARN(mvm, "Invalid geographic profile idx (%d)\n", ret); IWL_WARN(mvm, "Invalid geographic profile idx (%d)\n", ret);
} }
@ -881,10 +881,12 @@ static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm)
IWL_DEBUG_RADIO(mvm, "Sending GEO_TX_POWER_LIMIT\n"); IWL_DEBUG_RADIO(mvm, "Sending GEO_TX_POWER_LIMIT\n");
BUILD_BUG_ON(IWL_NUM_GEO_PROFILES * ACPI_WGDS_NUM_BANDS * BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES * ACPI_WGDS_NUM_BANDS *
ACPI_WGDS_TABLE_SIZE != ACPI_WGDS_WIFI_DATA_SIZE); ACPI_WGDS_TABLE_SIZE != ACPI_WGDS_WIFI_DATA_SIZE);
for (i = 0; i < IWL_NUM_GEO_PROFILES; i++) { BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES > IWL_NUM_GEO_PROFILES);
for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) {
struct iwl_per_chain_offset *chain = struct iwl_per_chain_offset *chain =
(struct iwl_per_chain_offset *)&cmd.table[i]; (struct iwl_per_chain_offset *)&cmd.table[i];
@ -892,7 +894,7 @@ static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm)
u8 *value; u8 *value;
value = &mvm->geo_profiles[i].values[j * value = &mvm->geo_profiles[i].values[j *
IWL_GEO_PER_CHAIN_SIZE]; ACPI_GEO_PER_CHAIN_SIZE];
chain[j].max_tx_power = cpu_to_le16(value[0]); chain[j].max_tx_power = cpu_to_le16(value[0]);
chain[j].chain_a = value[1]; chain[j].chain_a = value[1];
chain[j].chain_b = value[2]; chain[j].chain_b = value[2];

View File

@ -89,6 +89,7 @@
#include "tof.h" #include "tof.h"
#include "fw/runtime.h" #include "fw/runtime.h"
#include "fw/dbg.h" #include "fw/dbg.h"
#include "fw/acpi.h"
#define IWL_MVM_MAX_ADDRESSES 5 #define IWL_MVM_MAX_ADDRESSES 5
/* RSSI offset for WkP */ /* RSSI offset for WkP */
@ -684,17 +685,13 @@ enum iwl_mvm_queue_status {
#define IWL_MVM_NUM_CIPHERS 10 #define IWL_MVM_NUM_CIPHERS 10
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
#define IWL_MVM_SAR_TABLE_SIZE 10
#define IWL_MVM_SAR_PROFILE_NUM 4
#define IWL_MVM_GEO_TABLE_SIZE 6
struct iwl_mvm_sar_profile { struct iwl_mvm_sar_profile {
bool enabled; bool enabled;
u8 table[IWL_MVM_SAR_TABLE_SIZE]; u8 table[ACPI_SAR_TABLE_SIZE];
}; };
struct iwl_mvm_geo_profile { struct iwl_mvm_geo_profile {
u8 values[IWL_MVM_GEO_TABLE_SIZE]; u8 values[ACPI_GEO_TABLE_SIZE];
}; };
#endif #endif
@ -1014,8 +1011,8 @@ struct iwl_mvm {
struct delayed_work cs_tx_unblock_dwork; struct delayed_work cs_tx_unblock_dwork;
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
struct iwl_mvm_sar_profile sar_profiles[IWL_MVM_SAR_PROFILE_NUM]; struct iwl_mvm_sar_profile sar_profiles[ACPI_SAR_PROFILE_NUM];
struct iwl_mvm_geo_profile geo_profiles[IWL_NUM_GEO_PROFILES]; struct iwl_mvm_geo_profile geo_profiles[ACPI_NUM_GEO_PROFILES];
#endif #endif
}; };