Commit 0433ae55 authored by Golan Ben Ami's avatar Golan Ben Ami Committed by Kalle Valo

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: default avatarGolan Ben Ami <golan.ben.ami@intel.com>
Fixes: 39c1a972 ("iwlwifi: refactor the SAR tables from mvm to acpi")
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Tested-By: default avatarJonathan McDowell <noodles@earth.li>
Tested-by: default avatarLen Brown <len.brown@intel.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/iwlwifi.20200318081237.46db40617cc6.Id5cf852ec8c5dbf20ba86bad7b165a0c828f8b2e@changeid
parent cf52c8a7
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* GPL LICENSE SUMMARY * GPL LICENSE SUMMARY
* *
* Copyright(c) 2017 Intel Deutschland GmbH * Copyright(c) 2017 Intel Deutschland GmbH
* Copyright (C) 2019 Intel Corporation * Copyright (C) 2019 - 2020 Intel Corporation
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as * it under the terms of version 2 of the GNU General Public License as
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
* BSD LICENSE * BSD LICENSE
* *
* Copyright(c) 2017 Intel Deutschland GmbH * Copyright(c) 2017 Intel Deutschland GmbH
* Copyright (C) 2019 Intel Corporation * Copyright (C) 2019 - 2020 Intel Corporation
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -491,13 +491,13 @@ int iwl_validate_sar_geo_profile(struct iwl_fw_runtime *fwrt, ...@@ -491,13 +491,13 @@ int iwl_validate_sar_geo_profile(struct iwl_fw_runtime *fwrt,
} }
IWL_EXPORT_SYMBOL(iwl_validate_sar_geo_profile); IWL_EXPORT_SYMBOL(iwl_validate_sar_geo_profile);
void iwl_sar_geo_init(struct iwl_fw_runtime *fwrt, int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
struct iwl_per_chain_offset_group *table) struct iwl_per_chain_offset_group *table)
{ {
int ret, i, j; int ret, i, j;
if (!iwl_sar_geo_support(fwrt)) if (!iwl_sar_geo_support(fwrt))
return; return -EOPNOTSUPP;
ret = iwl_sar_get_wgds_table(fwrt); ret = iwl_sar_get_wgds_table(fwrt);
if (ret < 0) { if (ret < 0) {
...@@ -505,7 +505,7 @@ void iwl_sar_geo_init(struct iwl_fw_runtime *fwrt, ...@@ -505,7 +505,7 @@ void iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
"Geo SAR BIOS table invalid or unavailable. (%d)\n", "Geo SAR BIOS table invalid or unavailable. (%d)\n",
ret); ret);
/* we don't fail if the table is not available */ /* we don't fail if the table is not available */
return; return -ENOENT;
} }
BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES * ACPI_WGDS_NUM_BANDS * 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, ...@@ -530,5 +530,7 @@ void iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
i, j, value[1], value[2], value[0]); i, j, value[1], value[2], value[0]);
} }
} }
return 0;
} }
IWL_EXPORT_SYMBOL(iwl_sar_geo_init); IWL_EXPORT_SYMBOL(iwl_sar_geo_init);
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* GPL LICENSE SUMMARY * GPL LICENSE SUMMARY
* *
* Copyright(c) 2017 Intel Deutschland GmbH * Copyright(c) 2017 Intel Deutschland GmbH
* Copyright(c) 2018 - 2019 Intel Corporation * Copyright(c) 2018 - 2020 Intel Corporation
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as * it under the terms of version 2 of the GNU General Public License as
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
* BSD LICENSE * BSD LICENSE
* *
* Copyright(c) 2017 Intel Deutschland GmbH * Copyright(c) 2017 Intel Deutschland GmbH
* Copyright(c) 2018 - 2019 Intel Corporation * Copyright(c) 2018 - 2020 Intel Corporation
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * 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); ...@@ -171,8 +171,9 @@ bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt);
int iwl_validate_sar_geo_profile(struct iwl_fw_runtime *fwrt, int iwl_validate_sar_geo_profile(struct iwl_fw_runtime *fwrt,
struct iwl_host_cmd *cmd); struct iwl_host_cmd *cmd);
void iwl_sar_geo_init(struct iwl_fw_runtime *fwrt, int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
struct iwl_per_chain_offset_group *table); struct iwl_per_chain_offset_group *table);
#else /* CONFIG_ACPI */ #else /* CONFIG_ACPI */
static inline void *iwl_acpi_get_object(struct device *dev, acpi_string method) 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, ...@@ -243,9 +244,10 @@ static inline int iwl_validate_sar_geo_profile(struct iwl_fw_runtime *fwrt,
return -ENOENT; return -ENOENT;
} }
static inline void iwl_sar_geo_init(struct iwl_fw_runtime *fwrt, static inline int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
struct iwl_per_chain_offset_group *table) struct iwl_per_chain_offset_group *table)
{ {
return -ENOENT;
} }
#endif /* CONFIG_ACPI */ #endif /* CONFIG_ACPI */
......
...@@ -762,10 +762,17 @@ static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) ...@@ -762,10 +762,17 @@ static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm)
u16 cmd_wide_id = WIDE_ID(PHY_OPS_GROUP, GEO_TX_POWER_LIMIT); u16 cmd_wide_id = WIDE_ID(PHY_OPS_GROUP, GEO_TX_POWER_LIMIT);
union geo_tx_power_profiles_cmd cmd; union geo_tx_power_profiles_cmd cmd;
u16 len; u16 len;
int ret;
cmd.geo_cmd.ops = cpu_to_le32(IWL_PER_CHAIN_OFFSET_SET_TABLES); cmd.geo_cmd.ops = cpu_to_le32(IWL_PER_CHAIN_OFFSET_SET_TABLES);
iwl_sar_geo_init(&mvm->fwrt, cmd.geo_cmd.table); ret = iwl_sar_geo_init(&mvm->fwrt, cmd.geo_cmd.table);
/*
* It is a valid scenario to not support SAR, or miss wgds table,
* but in that case there is no need to send the command.
*/
if (ret)
return 0;
cmd.geo_cmd.table_revision = cpu_to_le32(mvm->fwrt.geo_rev); cmd.geo_cmd.table_revision = cpu_to_le32(mvm->fwrt.geo_rev);
......
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