diff mbox series

[v2,05/12] iwlwifi: mvm: store PPAG enabled/disabled flag properly

Message ID iwlwifi.20210210135352.889862e6d393.I8b894c1b2b3fe0ad2fb39bf438273ea47eb5afa4@changeid (mailing list archive)
State Accepted
Commit 551d793f65364c904921ac168d4b4028bb51be69
Delegated to: Luca Coelho
Headers show
Series iwlwifi: updates intended for v5.12 2021-02-07 | expand

Commit Message

Luca Coelho Feb. 10, 2021, 11:56 a.m. UTC
From: Luca Coelho <luciano.coelho@intel.com>

When reading the PPAG table from ACPI, we should store everything in
our fwrt structure, so it can be accessed later.  But we had a local
ppag_table variable in the function and were erroneously storing the
enabled/disabled flag in it instead of storing it in the fwrt.  Fix
this by removing the local variable and storing everything directly in
fwrt.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Fixes: f2134f66f40e ("iwlwifi: acpi: support ppag table command v2")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Kai-Heng Feng Sept. 7, 2021, 11:30 a.m. UTC | #1
Hi Luca,

On Wed, Feb 10, 2021 at 8:00 PM Luca Coelho <luca@coelho.fi> wrote:
>
> From: Luca Coelho <luciano.coelho@intel.com>
>
> When reading the PPAG table from ACPI, we should store everything in
> our fwrt structure, so it can be accessed later.  But we had a local
> ppag_table variable in the function and were erroneously storing the
> enabled/disabled flag in it instead of storing it in the fwrt.  Fix
> this by removing the local variable and storing everything directly in
> fwrt.

This patch enables PPAG, but it breaks one of HP laptop with Intel 9560.

dmesg with iwlwifi.debug=0x80 attached in the bug report:
https://bugzilla.kernel.org/show_bug.cgi?id=214343

>
> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
> Fixes: f2134f66f40e ("iwlwifi: acpi: support ppag table command v2")
> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
> ---
>  drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
> index 3bfb80dd17cf..57471ab2f5ef 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
> @@ -895,7 +895,6 @@ static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm)
>  static int iwl_mvm_get_ppag_table(struct iwl_mvm *mvm)
>  {
>         union acpi_object *wifi_pkg, *data, *enabled;
> -       union iwl_ppag_table_cmd ppag_table;
>         int i, j, ret, tbl_rev, num_sub_bands;
>         int idx = 2;
>         s8 *gain;
> @@ -949,8 +948,8 @@ static int iwl_mvm_get_ppag_table(struct iwl_mvm *mvm)
>                 goto out_free;
>         }
>
> -       ppag_table.v1.enabled = cpu_to_le32(enabled->integer.value);
> -       if (!ppag_table.v1.enabled) {
> +       mvm->fwrt.ppag_table.v1.enabled = cpu_to_le32(enabled->integer.value);
> +       if (!mvm->fwrt.ppag_table.v1.enabled) {
>                 ret = 0;
>                 goto out_free;
>         }
> @@ -978,7 +977,7 @@ static int iwl_mvm_get_ppag_table(struct iwl_mvm *mvm)
>                             (j != 0 &&
>                              (gain[i * num_sub_bands + j] > ACPI_PPAG_MAX_HB ||
>                               gain[i * num_sub_bands + j] < ACPI_PPAG_MIN_HB))) {
> -                               ppag_table.v1.enabled = cpu_to_le32(0);
> +                               mvm->fwrt.ppag_table.v1.enabled = cpu_to_le32(0);
>                                 ret = -EINVAL;
>                                 goto out_free;
>                         }
> --
> 2.30.0
>
Luca Coelho Sept. 7, 2021, 12:07 p.m. UTC | #2
On Tue, 2021-09-07 at 19:30 +0800, Kai-Heng Feng wrote:
> Hi Luca,
> 
> On Wed, Feb 10, 2021 at 8:00 PM Luca Coelho <luca@coelho.fi> wrote:
> > 
> > From: Luca Coelho <luciano.coelho@intel.com>
> > 
> > When reading the PPAG table from ACPI, we should store everything in
> > our fwrt structure, so it can be accessed later.  But we had a local
> > ppag_table variable in the function and were erroneously storing the
> > enabled/disabled flag in it instead of storing it in the fwrt.  Fix
> > this by removing the local variable and storing everything directly in
> > fwrt.
> 
> This patch enables PPAG, but it breaks one of HP laptop with Intel 9560.
> 
> dmesg with iwlwifi.debug=0x80 attached in the bug report:
> https://bugzilla.kernel.org/show_bug.cgi?id=214343

Thanks for the report.  There seems to be an incompatibility between
the command the driver is sending to the FW and the version the FW
supports.

The commit you mentioned just enables sending this commands, which was
mistakenly not sent before.

Let's continue this discussion in bugzilla.  I'll add more information
there as I figure it out.

--
Cheers,
Luca.
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 3bfb80dd17cf..57471ab2f5ef 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -895,7 +895,6 @@  static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm)
 static int iwl_mvm_get_ppag_table(struct iwl_mvm *mvm)
 {
 	union acpi_object *wifi_pkg, *data, *enabled;
-	union iwl_ppag_table_cmd ppag_table;
 	int i, j, ret, tbl_rev, num_sub_bands;
 	int idx = 2;
 	s8 *gain;
@@ -949,8 +948,8 @@  static int iwl_mvm_get_ppag_table(struct iwl_mvm *mvm)
 		goto out_free;
 	}
 
-	ppag_table.v1.enabled = cpu_to_le32(enabled->integer.value);
-	if (!ppag_table.v1.enabled) {
+	mvm->fwrt.ppag_table.v1.enabled = cpu_to_le32(enabled->integer.value);
+	if (!mvm->fwrt.ppag_table.v1.enabled) {
 		ret = 0;
 		goto out_free;
 	}
@@ -978,7 +977,7 @@  static int iwl_mvm_get_ppag_table(struct iwl_mvm *mvm)
 			    (j != 0 &&
 			     (gain[i * num_sub_bands + j] > ACPI_PPAG_MAX_HB ||
 			      gain[i * num_sub_bands + j] < ACPI_PPAG_MIN_HB))) {
-				ppag_table.v1.enabled = cpu_to_le32(0);
+				mvm->fwrt.ppag_table.v1.enabled = cpu_to_le32(0);
 				ret = -EINVAL;
 				goto out_free;
 			}