2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 20:53:53 +08:00

iwlwifi: add support for version 2 of SOC_CONFIGURATION_CMD

This new command is mostly backwards compatible, with the exception
that the device_type element was changed into a bitmask.  The device
type bit remains the same (because we only had 0 and 1 anyway), but
when using v1 we can't set any other bits, because that would change
the integer.

Other than that, the struct remains the same and the driver can set
the device_type bit in both cases, but it can only set the low_latency
bit if VER_2 is used.

Change-Id: Ib68d4c821ebcce253b42ed0ea15881fb4e3e01da
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
This commit is contained in:
Luca Coelho 2019-11-06 09:27:51 +02:00
parent 6815e3d0bb
commit 095650c054
3 changed files with 32 additions and 15 deletions

View File

@ -8,6 +8,7 @@
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
* Copyright(c) 2019 Intel Deutschland GmbH
* *
* 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
@ -30,6 +31,7 @@
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
* Copyright(c) 2019 Intel Deutschland GmbH
* 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
@ -63,21 +65,23 @@
#ifndef __iwl_fw_api_soc_h__ #ifndef __iwl_fw_api_soc_h__
#define __iwl_fw_api_soc_h__ #define __iwl_fw_api_soc_h__
/* type of devices for defining SOC latency */ #define SOC_CONFIG_CMD_FLAGS_DISCRETE BIT(0)
enum iwl_soc_device_types { #define SOC_CONFIG_CMD_FLAGS_LOW_LATENCY BIT(1)
SOC_CONFIG_CMD_INTEGRATED = 0x0,
SOC_CONFIG_CMD_DISCRETE = 0x1,
};
/** /**
* struct iwl_soc_configuration_cmd - Set device stabilization latency * struct iwl_soc_configuration_cmd - Set device stabilization latency
* *
* @device_type: the device type as defined in &enum iwl_soc_device_types * @flags: soc settings flags. In VER_1, we can only set the DISCRETE
* @soc_latency: time for SOC to ensure stable power & XTAL * flag, because the FW treats the whole value as an integer. In
* VER_2, we can set the bits independently.
* @latency: time for SOC to ensure stable power & XTAL
*/ */
struct iwl_soc_configuration_cmd { struct iwl_soc_configuration_cmd {
__le32 device_type; __le32 flags;
__le32 soc_latency; __le32 latency;
} __packed; /* SOC_CONFIGURATION_CMD_S_VER_1 */ } __packed; /*
* SOC_CONFIGURATION_CMD_S_VER_1 (see description above)
* SOC_CONFIGURATION_CMD_S_VER_2
*/
#endif /* __iwl_fw_api_soc_h__ */ #endif /* __iwl_fw_api_soc_h__ */

View File

@ -303,6 +303,7 @@ struct iwl_pwr_tx_backoff {
* @gen2: 22000 and on transport operation * @gen2: 22000 and on transport operation
* @mq_rx_supported: multi-queue rx support * @mq_rx_supported: multi-queue rx support
* @integrated: discrete or integrated * @integrated: discrete or integrated
* @low_latency_xtal: use the low latency xtal if supported
*/ */
struct iwl_cfg_trans_params { struct iwl_cfg_trans_params {
const struct iwl_base_params *base_params; const struct iwl_base_params *base_params;
@ -315,6 +316,7 @@ struct iwl_cfg_trans_params {
gen2:1, gen2:1,
mq_rx_supported:1, mq_rx_supported:1,
integrated:1, integrated:1,
low_latency_xtal:1,
bisr_workaround:1; bisr_workaround:1;
}; };

View File

@ -90,13 +90,24 @@ struct iwl_mvm_alive_data {
/* set device type and latency */ /* set device type and latency */
static int iwl_set_soc_latency(struct iwl_mvm *mvm) static int iwl_set_soc_latency(struct iwl_mvm *mvm)
{ {
struct iwl_soc_configuration_cmd cmd; struct iwl_soc_configuration_cmd cmd = {};
int ret; int ret;
cmd.device_type = (mvm->trans->trans_cfg->integrated) ? /*
cpu_to_le32(SOC_CONFIG_CMD_INTEGRATED) : * In VER_1 of this command, the discrete value is considered
cpu_to_le32(SOC_CONFIG_CMD_DISCRETE); * an integer; In VER_2, it's a bitmask. Since we have only 2
cmd.soc_latency = cpu_to_le32(mvm->trans->trans_cfg->xtal_latency); * values in VER_1, this is backwards-compatible with VER_2,
* as long as we don't set any other bits.
*/
if (!mvm->trans->trans_cfg->integrated)
cmd.flags = cpu_to_le32(SOC_CONFIG_CMD_FLAGS_DISCRETE);
if (iwl_mvm_lookup_cmd_ver(mvm->fw, IWL_ALWAYS_LONG_GROUP,
SCAN_REQ_UMAC) >= 2 &&
(mvm->trans->trans_cfg->low_latency_xtal))
cmd.flags |= cpu_to_le32(SOC_CONFIG_CMD_FLAGS_LOW_LATENCY);
cmd.latency = cpu_to_le32(mvm->trans->trans_cfg->xtal_latency);
ret = iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(SOC_CONFIGURATION_CMD, ret = iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(SOC_CONFIGURATION_CMD,
SYSTEM_GROUP, 0), 0, SYSTEM_GROUP, 0), 0,