Skip to content

Commit 0433ae5

Browse files
golanIntelKalle Valo
authored andcommitted
iwlwifi: don't send GEO_TX_POWER_LIMIT if no wgds table
The GEO_TX_POWER_LIMIT command was sent although there is no wgds table, so the fw got wrong SAR values from the driver. Fix this by avoiding sending the command if no wgds tables are available. Signed-off-by: Golan Ben Ami <[email protected]> Fixes: 39c1a97 ("iwlwifi: refactor the SAR tables from mvm to acpi") Signed-off-by: Luca Coelho <[email protected]> Tested-By: Jonathan McDowell <[email protected]> Tested-by: Len Brown <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/iwlwifi.20200318081237.46db40617cc6.Id5cf852ec8c5dbf20ba86bad7b165a0c828f8b2e@changeid
1 parent cf52c8a commit 0433ae5

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

drivers/net/wireless/intel/iwlwifi/fw/acpi.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* GPL LICENSE SUMMARY
77
*
88
* Copyright(c) 2017 Intel Deutschland GmbH
9-
* Copyright (C) 2019 Intel Corporation
9+
* Copyright (C) 2019 - 2020 Intel Corporation
1010
*
1111
* This program is free software; you can redistribute it and/or modify
1212
* it under the terms of version 2 of the GNU General Public License as
@@ -27,7 +27,7 @@
2727
* BSD LICENSE
2828
*
2929
* Copyright(c) 2017 Intel Deutschland GmbH
30-
* Copyright (C) 2019 Intel Corporation
30+
* Copyright (C) 2019 - 2020 Intel Corporation
3131
* All rights reserved.
3232
*
3333
* Redistribution and use in source and binary forms, with or without
@@ -491,21 +491,21 @@ int iwl_validate_sar_geo_profile(struct iwl_fw_runtime *fwrt,
491491
}
492492
IWL_EXPORT_SYMBOL(iwl_validate_sar_geo_profile);
493493

494-
void iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
495-
struct iwl_per_chain_offset_group *table)
494+
int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
495+
struct iwl_per_chain_offset_group *table)
496496
{
497497
int ret, i, j;
498498

499499
if (!iwl_sar_geo_support(fwrt))
500-
return;
500+
return -EOPNOTSUPP;
501501

502502
ret = iwl_sar_get_wgds_table(fwrt);
503503
if (ret < 0) {
504504
IWL_DEBUG_RADIO(fwrt,
505505
"Geo SAR BIOS table invalid or unavailable. (%d)\n",
506506
ret);
507507
/* we don't fail if the table is not available */
508-
return;
508+
return -ENOENT;
509509
}
510510

511511
BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES * ACPI_WGDS_NUM_BANDS *
@@ -530,5 +530,7 @@ void iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
530530
i, j, value[1], value[2], value[0]);
531531
}
532532
}
533+
534+
return 0;
533535
}
534536
IWL_EXPORT_SYMBOL(iwl_sar_geo_init);

drivers/net/wireless/intel/iwlwifi/fw/acpi.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* GPL LICENSE SUMMARY
77
*
88
* Copyright(c) 2017 Intel Deutschland GmbH
9-
* Copyright(c) 2018 - 2019 Intel Corporation
9+
* Copyright(c) 2018 - 2020 Intel Corporation
1010
*
1111
* This program is free software; you can redistribute it and/or modify
1212
* it under the terms of version 2 of the GNU General Public License as
@@ -27,7 +27,7 @@
2727
* BSD LICENSE
2828
*
2929
* Copyright(c) 2017 Intel Deutschland GmbH
30-
* Copyright(c) 2018 - 2019 Intel Corporation
30+
* Copyright(c) 2018 - 2020 Intel Corporation
3131
* All rights reserved.
3232
*
3333
* Redistribution and use in source and binary forms, with or without
@@ -171,8 +171,9 @@ bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt);
171171
int iwl_validate_sar_geo_profile(struct iwl_fw_runtime *fwrt,
172172
struct iwl_host_cmd *cmd);
173173

174-
void iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
175-
struct iwl_per_chain_offset_group *table);
174+
int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
175+
struct iwl_per_chain_offset_group *table);
176+
176177
#else /* CONFIG_ACPI */
177178

178179
static inline void *iwl_acpi_get_object(struct device *dev, acpi_string method)
@@ -243,9 +244,10 @@ static inline int iwl_validate_sar_geo_profile(struct iwl_fw_runtime *fwrt,
243244
return -ENOENT;
244245
}
245246

246-
static inline void iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
247-
struct iwl_per_chain_offset_group *table)
247+
static inline int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
248+
struct iwl_per_chain_offset_group *table)
248249
{
250+
return -ENOENT;
249251
}
250252

251253
#endif /* CONFIG_ACPI */

drivers/net/wireless/intel/iwlwifi/mvm/fw.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,10 +762,17 @@ static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm)
762762
u16 cmd_wide_id = WIDE_ID(PHY_OPS_GROUP, GEO_TX_POWER_LIMIT);
763763
union geo_tx_power_profiles_cmd cmd;
764764
u16 len;
765+
int ret;
765766

766767
cmd.geo_cmd.ops = cpu_to_le32(IWL_PER_CHAIN_OFFSET_SET_TABLES);
767768

768-
iwl_sar_geo_init(&mvm->fwrt, cmd.geo_cmd.table);
769+
ret = iwl_sar_geo_init(&mvm->fwrt, cmd.geo_cmd.table);
770+
/*
771+
* It is a valid scenario to not support SAR, or miss wgds table,
772+
* but in that case there is no need to send the command.
773+
*/
774+
if (ret)
775+
return 0;
769776

770777
cmd.geo_cmd.table_revision = cpu_to_le32(mvm->fwrt.geo_rev);
771778

0 commit comments

Comments
 (0)