Commit 664c011b authored by Luca Coelho's avatar Luca Coelho

iwlwifi: acpi: support reading and storing WGDS revision 2

Revisions 0 and 1 are identical, so we were already supporting that.
But revision 2 has a different size, so we have to try to read them
separately.

Add support for this new revision.
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.78e441b16f9c.I2d79492f05624ddd02c533c673811a36eaf8a396@changeidSigned-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent eb09ae93
...@@ -703,27 +703,49 @@ int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt) ...@@ -703,27 +703,49 @@ int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt)
union acpi_object *wifi_pkg, *data; union acpi_object *wifi_pkg, *data;
int i, j, k, ret, tbl_rev; int i, j, k, ret, tbl_rev;
int idx = 1; /* start from one to skip the domain */ int idx = 1; /* start from one to skip the domain */
u8 num_bands;
data = iwl_acpi_get_object(fwrt->dev, ACPI_WGDS_METHOD); data = iwl_acpi_get_object(fwrt->dev, ACPI_WGDS_METHOD);
if (IS_ERR(data)) if (IS_ERR(data))
return PTR_ERR(data); return PTR_ERR(data);
/* start by trying to read revision 2 */
wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
ACPI_WGDS_WIFI_DATA_SIZE, &tbl_rev); ACPI_WGDS_WIFI_DATA_SIZE_REV2,
&tbl_rev);
if (!IS_ERR(wifi_pkg)) {
if (tbl_rev != 2) {
ret = PTR_ERR(wifi_pkg);
goto out_free;
}
if (IS_ERR(wifi_pkg)) { num_bands = ACPI_GEO_NUM_BANDS_REV2;
ret = PTR_ERR(wifi_pkg);
goto out_free; goto read_table;
} }
if (tbl_rev > 1) { /* then try revision 0 (which is the same as 1) */
ret = -EINVAL; wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
goto out_free; ACPI_WGDS_WIFI_DATA_SIZE_REV0,
&tbl_rev);
if (!IS_ERR(wifi_pkg)) {
if (tbl_rev != 0 && tbl_rev != 1) {
ret = PTR_ERR(wifi_pkg);
goto out_free;
}
num_bands = ACPI_GEO_NUM_BANDS_REV0;
goto read_table;
} }
ret = PTR_ERR(wifi_pkg);
goto out_free;
read_table:
fwrt->geo_rev = tbl_rev; fwrt->geo_rev = tbl_rev;
for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) { for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) {
for (j = 0; j < ACPI_GEO_NUM_BANDS_REV0; j++) { for (j = 0; j < num_bands; j++) {
union acpi_object *entry; union acpi_object *entry;
entry = &wifi_pkg->package.elements[idx++]; entry = &wifi_pkg->package.elements[idx++];
......
...@@ -38,11 +38,6 @@ ...@@ -38,11 +38,6 @@
#define ACPI_SAR_NUM_SUB_BANDS_REV1 11 #define ACPI_SAR_NUM_SUB_BANDS_REV1 11
#define ACPI_SAR_NUM_SUB_BANDS_REV2 11 #define ACPI_SAR_NUM_SUB_BANDS_REV2 11
#define ACPI_GEO_NUM_CHAINS 2
#define ACPI_GEO_NUM_BANDS_REV0 2
#define ACPI_GEO_NUM_BANDS_REV1 2
#define ACPI_GEO_NUM_BANDS_REV2 3
#define ACPI_WRDS_WIFI_DATA_SIZE_REV0 (ACPI_SAR_NUM_CHAINS_REV0 * \ #define ACPI_WRDS_WIFI_DATA_SIZE_REV0 (ACPI_SAR_NUM_CHAINS_REV0 * \
ACPI_SAR_NUM_SUB_BANDS_REV0 + 2) ACPI_SAR_NUM_SUB_BANDS_REV0 + 2)
#define ACPI_WRDS_WIFI_DATA_SIZE_REV1 (ACPI_SAR_NUM_CHAINS_REV1 * \ #define ACPI_WRDS_WIFI_DATA_SIZE_REV1 (ACPI_SAR_NUM_CHAINS_REV1 * \
...@@ -58,7 +53,19 @@ ...@@ -58,7 +53,19 @@
#define ACPI_EWRD_WIFI_DATA_SIZE_REV2 ((ACPI_SAR_PROFILE_NUM - 1) * \ #define ACPI_EWRD_WIFI_DATA_SIZE_REV2 ((ACPI_SAR_PROFILE_NUM - 1) * \
ACPI_SAR_NUM_CHAINS_REV2 * \ ACPI_SAR_NUM_CHAINS_REV2 * \
ACPI_SAR_NUM_SUB_BANDS_REV2 + 3) ACPI_SAR_NUM_SUB_BANDS_REV2 + 3)
#define ACPI_WGDS_WIFI_DATA_SIZE 19
/* revision 0 and 1 are identical, except for the semantics in the FW */
#define ACPI_GEO_NUM_BANDS_REV0 2
#define ACPI_GEO_NUM_BANDS_REV2 3
#define ACPI_GEO_NUM_CHAINS 2
#define ACPI_WGDS_WIFI_DATA_SIZE_REV0 (ACPI_NUM_GEO_PROFILES * \
ACPI_GEO_NUM_BANDS_REV0 * \
ACPI_GEO_PER_CHAIN_SIZE + 1)
#define ACPI_WGDS_WIFI_DATA_SIZE_REV2 (ACPI_NUM_GEO_PROFILES * \
ACPI_GEO_NUM_BANDS_REV2 * \
ACPI_GEO_PER_CHAIN_SIZE + 1)
#define ACPI_WRDD_WIFI_DATA_SIZE 2 #define ACPI_WRDD_WIFI_DATA_SIZE 2
#define ACPI_SPLC_WIFI_DATA_SIZE 2 #define ACPI_SPLC_WIFI_DATA_SIZE 2
#define ACPI_ECKV_WIFI_DATA_SIZE 2 #define ACPI_ECKV_WIFI_DATA_SIZE 2
......
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