Commit 8ecf0477 authored by Luca Coelho's avatar Luca Coelho

iwlwifi: pass number of chains and sub-bands to iwl_sar_set_profile()

The number of chains and sub-bands read from the ACPI tables varies
depending on the revision.  Pass these numbers to the
iwl_sar_set_profile() function in order to make using different
revisions easier.
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.905b54c398f8.I9bac8c3bc3b1b6bbe813de53746daee33e53fc86@changeidSigned-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent dac7171c
...@@ -412,7 +412,7 @@ IWL_EXPORT_SYMBOL(iwl_acpi_get_eckv); ...@@ -412,7 +412,7 @@ IWL_EXPORT_SYMBOL(iwl_acpi_get_eckv);
static int iwl_sar_set_profile(union acpi_object *table, static int iwl_sar_set_profile(union acpi_object *table,
struct iwl_sar_profile *profile, struct iwl_sar_profile *profile,
bool enabled) bool enabled, u8 num_chains, u8 num_sub_bands)
{ {
int i, j, idx = 0; int i, j, idx = 0;
...@@ -422,8 +422,8 @@ static int iwl_sar_set_profile(union acpi_object *table, ...@@ -422,8 +422,8 @@ static int iwl_sar_set_profile(union acpi_object *table,
* The table from ACPI is flat, but we store it in a * The table from ACPI is flat, but we store it in a
* structured array. * structured array.
*/ */
for (i = 0; i < ACPI_SAR_NUM_CHAINS; i++) { for (i = 0; i < num_chains; i++) {
for (j = 0; j < ACPI_SAR_NUM_SUB_BANDS; j++) { for (j = 0; j < num_sub_bands; j++) {
if (table[idx].type != ACPI_TYPE_INTEGER || if (table[idx].type != ACPI_TYPE_INTEGER ||
table[idx].integer.value > U8_MAX) table[idx].integer.value > U8_MAX)
return -EINVAL; return -EINVAL;
...@@ -539,7 +539,8 @@ int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt) ...@@ -539,7 +539,8 @@ int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt)
/* The profile from WRDS is officially profile 1, but goes /* The profile from WRDS is officially profile 1, but goes
* into sar_profiles[0] (because we don't have a profile 0). * into sar_profiles[0] (because we don't have a profile 0).
*/ */
ret = iwl_sar_set_profile(table, &fwrt->sar_profiles[0], enabled); ret = iwl_sar_set_profile(table, &fwrt->sar_profiles[0], enabled,
ACPI_SAR_NUM_CHAINS, ACPI_SAR_NUM_SUB_BANDS);
out_free: out_free:
kfree(data); kfree(data);
return ret; return ret;
...@@ -598,7 +599,9 @@ int iwl_sar_get_ewrd_table(struct iwl_fw_runtime *fwrt) ...@@ -598,7 +599,9 @@ int iwl_sar_get_ewrd_table(struct iwl_fw_runtime *fwrt)
*/ */
ret = iwl_sar_set_profile(&wifi_pkg->package.elements[pos], ret = iwl_sar_set_profile(&wifi_pkg->package.elements[pos],
&fwrt->sar_profiles[i + 1], &fwrt->sar_profiles[i + 1],
enabled); enabled,
ACPI_SAR_NUM_CHAINS,
ACPI_SAR_NUM_SUB_BANDS);
if (ret < 0) if (ret < 0)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment