Commit ff75c21c authored by Alon Giladi's avatar Alon Giladi Committed by Johannes Berg
Browse files

wifi: iwlwifi: improve debug prints in iwl_read_ppag_table()



Add prints of ETSI and China bits.
Check if need to mask the China bit (when the firmware doesn't
support it) in a separate flow, so it will be easier to follow
the conditions. Add a separate message for the command version.

Signed-off-by: default avatarAlon Giladi <alon.giladi@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.4ee455ec1ee8.I6f1a4b7dfa5cfd9b4f4a4b5bb5567849e629ae96@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 97110233
Loading
Loading
Loading
Loading
+22 −15
Original line number Diff line number Diff line
@@ -1169,41 +1169,48 @@ int iwl_read_ppag_table(struct iwl_fw_runtime *fwrt, union iwl_ppag_table_cmd *c
         */
        cmd->v1.flags = cpu_to_le32(fwrt->ppag_flags);

	IWL_DEBUG_RADIO(fwrt, "PPAG cmd ver is %d\n", cmd_ver);
	if (cmd_ver == 1) {
                num_sub_bands = IWL_NUM_SUB_BANDS_V1;
                gain = cmd->v1.gain[0];
                *cmd_size = sizeof(cmd->v1);
                if (fwrt->ppag_ver == 1 || fwrt->ppag_ver == 2) {
			/* in this case FW supports revision 0 */
                        IWL_DEBUG_RADIO(fwrt,
                                        "PPAG table rev is %d but FW supports v1, sending truncated table\n",
					"PPAG table rev is %d, send truncated table\n",
                                        fwrt->ppag_ver);
			if (!fw_has_capa(&fwrt->fw->ucode_capa,
					 IWL_UCODE_TLV_CAPA_PPAG_CHINA_BIOS_SUPPORT)) {
				cmd->v1.flags &= cpu_to_le32(IWL_PPAG_ETSI_MASK);
				IWL_DEBUG_RADIO(fwrt,
						"FW doesn't support ppag China bit\n");
			} else {
				IWL_DEBUG_RADIO(fwrt,
						"FW supports ppag China bit\n");
			}
		}
	} else if (cmd_ver >= 2 && cmd_ver <= 4) {
                num_sub_bands = IWL_NUM_SUB_BANDS_V2;
                gain = cmd->v2.gain[0];
                *cmd_size = sizeof(cmd->v2);
                if (fwrt->ppag_ver == 0) {
			/* in this case FW supports revisions 1 or 2 */
                        IWL_DEBUG_RADIO(fwrt,
                                        "PPAG table is v1 but FW supports v2, sending padded table\n");
                } else if (cmd_ver == 2 && fwrt->ppag_ver == 2) {
                        IWL_DEBUG_RADIO(fwrt,
                                        "PPAG table is v3 but FW supports v2, sending partial bitmap.\n");
                        cmd->v1.flags &= cpu_to_le32(IWL_PPAG_ETSI_MASK);
					"PPAG table rev is 0, send padded table\n");
                }
        } else {
                IWL_DEBUG_RADIO(fwrt, "Unsupported PPAG command version\n");
                return -EINVAL;
        }

	/* ppag mode */
	IWL_DEBUG_RADIO(fwrt,
			"PPAG MODE bits were read from bios: %d\n",
			cmd->v1.flags & cpu_to_le32(ACPI_PPAG_MASK));
	if ((cmd_ver == 1 && !fw_has_capa(&fwrt->fw->ucode_capa,
					  IWL_UCODE_TLV_CAPA_PPAG_CHINA_BIOS_SUPPORT)) ||
	    (cmd_ver == 2 && fwrt->ppag_ver == 2)) {
		cmd->v1.flags &= cpu_to_le32(IWL_PPAG_ETSI_MASK);
		IWL_DEBUG_RADIO(fwrt, "masking ppag China bit\n");
	} else {
		IWL_DEBUG_RADIO(fwrt, "isn't masking ppag China bit\n");
	}

	IWL_DEBUG_RADIO(fwrt,
			"PPAG MODE bits going to be sent: %d\n",
			cmd->v1.flags & cpu_to_le32(ACPI_PPAG_MASK));

	for (i = 0; i < IWL_NUM_CHAIN_LIMITS; i++) {
                for (j = 0; j < num_sub_bands; j++) {
                        gain[i * num_sub_bands + j] =