All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: luca@coelho.fi, linux-wireless@vger.kernel.org
Subject: [PATCH 02/11] iwlwifi: acpi: fill in WGDS table with defaults
Date: Thu, 19 Aug 2021 18:40:26 +0300	[thread overview]
Message-ID: <iwlwifi.20210819183728.01b12461a30b.I08d1f9154f26eca25c44616efdb5223bcc1935f3@changeid> (raw)
In-Reply-To: <20210819154035.72584-1-luca@coelho.fi>

From: Luca Coelho <luciano.coelho@intel.com>

The tables we store are the larger of all the revisions, so we need to
fill in the values that we don't get from ACPI when using older
revisions.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 42 ++++++++++++++------
 1 file changed, 29 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
index de1e9271dcd2..37da836a8c08 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
@@ -745,20 +745,18 @@ int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt)
 read_table:
 	fwrt->geo_rev = tbl_rev;
 	for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) {
-		for (j = 0; j < num_bands; j++) {
+		for (j = 0; j < ACPI_GEO_NUM_BANDS_REV2; j++) {
 			union acpi_object *entry;
 
-			entry = &wifi_pkg->package.elements[idx++];
-			if (entry->type != ACPI_TYPE_INTEGER ||
-			    entry->integer.value > U8_MAX) {
-				ret = -EINVAL;
-				goto out_free;
-			}
-
-			fwrt->geo_profiles[i].bands[j].max =
-				entry->integer.value;
-
-			for (k = 0; k < ACPI_GEO_NUM_CHAINS; k++) {
+			/*
+			 * num_bands is either 2 or 3, if it's only 2 then
+			 * fill the third band (6 GHz) with the values from
+			 * 5 GHz (second band)
+			 */
+			if (j >= num_bands) {
+				fwrt->geo_profiles[i].bands[j].max =
+					fwrt->geo_profiles[i].bands[1].max;
+			} else {
 				entry = &wifi_pkg->package.elements[idx++];
 				if (entry->type != ACPI_TYPE_INTEGER ||
 				    entry->integer.value > U8_MAX) {
@@ -766,9 +764,27 @@ int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt)
 					goto out_free;
 				}
 
-				fwrt->geo_profiles[i].bands[j].chains[k] =
+				fwrt->geo_profiles[i].bands[j].max =
 					entry->integer.value;
 			}
+
+			for (k = 0; k < ACPI_GEO_NUM_CHAINS; k++) {
+				/* same here as above */
+				if (j >= num_bands) {
+					fwrt->geo_profiles[i].bands[j].chains[k] =
+						fwrt->geo_profiles[i].bands[1].chains[k];
+				} else {
+					entry = &wifi_pkg->package.elements[idx++];
+					if (entry->type != ACPI_TYPE_INTEGER ||
+					    entry->integer.value > U8_MAX) {
+						ret = -EINVAL;
+						goto out_free;
+					}
+
+					fwrt->geo_profiles[i].bands[j].chains[k] =
+						entry->integer.value;
+				}
+			}
 		}
 	}
 
-- 
2.33.0


  parent reply	other threads:[~2021-08-19 15:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19 15:40 [PATCH 00/11] iwlwifi: updates intended for v5.15 2021-08-19 Luca Coelho
2021-08-19 15:40 ` [PATCH 01/11] iwlwifi: bump FW API to 65 for AX devices Luca Coelho
2021-08-26 20:37   ` Luca Coelho
2021-08-19 15:40 ` Luca Coelho [this message]
2021-08-19 15:40 ` [PATCH 03/11] iwlwifi: acpi: fill in SAR tables with defaults Luca Coelho
2021-08-19 15:40 ` [PATCH 04/11] iwlwifi: pcie: avoid dma unmap/remap in crash dump Luca Coelho
2021-08-19 15:40 ` [PATCH 05/11] iwlwifi: fix __percpu annotation Luca Coelho
2021-08-19 15:40 ` [PATCH 06/11] iwlwifi: api: remove datamember from struct Luca Coelho
2021-08-19 15:40 ` [PATCH 07/11] iwlwifi: fw: fix debug dump data declarations Luca Coelho
2021-08-19 15:40 ` [PATCH 08/11] iwlwifi: add 'Rx control frame to MBSSID' HE capability Luca Coelho
2021-08-19 15:40 ` [PATCH 09/11] iwlwifi: yoyo: support for new DBGI_SRAM region Luca Coelho
2021-08-19 15:40 ` [PATCH 10/11] iwlwifi: mvm: don't schedule the roc_done_wk if it is already running Luca Coelho
2021-08-19 15:40 ` [PATCH 11/11] iwlwifi: allow debug init in RF-kill Luca Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=iwlwifi.20210819183728.01b12461a30b.I08d1f9154f26eca25c44616efdb5223bcc1935f3@changeid \
    --to=luca@coelho.fi \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.