]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: iwlwifi: fw: support PPAG command version 7
authorPagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Wed, 30 Apr 2025 12:23:20 +0000 (15:23 +0300)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Tue, 6 May 2025 17:23:20 +0000 (20:23 +0300)
PPAG command version 7 will send exact data read from BIOS to
firmware without filtering/altering BIOS data. This enables the
driver to become purely a pipe for this feature.

Signed-off-by: Pagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250430151952.88ed7b2cadef.Iad78f6cec617d1f111b704352795dde81af71a99@changeid
drivers/net/wireless/intel/iwlwifi/fw/acpi.c
drivers/net/wireless/intel/iwlwifi/fw/api/power.h
drivers/net/wireless/intel/iwlwifi/fw/regulatory.c
drivers/net/wireless/intel/iwlwifi/fw/runtime.h
drivers/net/wireless/intel/iwlwifi/fw/uefi.c

index a1c949d15d945db77155ffd96cd829fc95bac3d6..bee7d92293b8d69e43e5ef3892e0b9f9e9281d52 100644 (file)
@@ -912,6 +912,7 @@ read_table:
                }
        }
 
+       fwrt->ppag_bios_source = BIOS_SOURCE_ACPI;
        ret = 0;
 
 out_free:
index 1c09c30055b1b5cdc4fb49f7303c8ec94aecbf96..23140205ccb9f90a214f7e0d25995f3e862d2a7e 100644 (file)
@@ -7,6 +7,8 @@
 #ifndef __iwl_fw_api_power_h__
 #define __iwl_fw_api_power_h__
 
+#include "nvm-reg.h"
+
 /* Power Management Commands, Responses, Notifications */
 
 /**
@@ -629,28 +631,37 @@ enum iwl_ppag_flags {
 
 /**
  * union iwl_ppag_table_cmd - union for all versions of PPAG command
- * @v1: version 1
- * @v2: version 2
- * version 3, 4, 5 and 6 are the same structure as v2,
+ * @v1: command version 1 structure.
+ * @v2: command version from 2 to 6 are same structure as v2.
  *     but has a different format of the flags bitmap
+ * @v3: command version 7 structure.
  * @v1.flags: values from &enum iwl_ppag_flags
  * @v1.gain: table of antenna gain values per chain and sub-band
  * @v1.reserved: reserved
  * @v2.flags: values from &enum iwl_ppag_flags
  * @v2.gain: table of antenna gain values per chain and sub-band
- * @v2.reserved: reserved
+ * @v3.ppag_config_info: see @struct bios_value_u32
+ * @v3.gain: table of antenna gain values per chain and sub-band
+ * @v3.reserved: reserved
  */
 union iwl_ppag_table_cmd {
        struct {
                __le32 flags;
                s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
                s8 reserved[2];
-       } v1;
+       } __packed v1; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_1 */
        struct {
                __le32 flags;
                s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
                s8 reserved[2];
-       } v2;
+       } __packed v2; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_2, VER3, VER4,
+                       * VER5, VER6
+                       */
+       struct {
+               struct bios_value_u32 ppag_config_info;
+               s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
+               s8 reserved[2];
+       } __packed v3; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_7 */
 } __packed;
 
 #define IWL_PPAG_CMD_V4_MASK (IWL_PPAG_ETSI_MASK | IWL_PPAG_CHINA_MASK)
index 4508de2508d7f7be42d58827ee9ae63027eb51d4..4038de2df75e7bbae3e3049b50596f4de29931b0 100644 (file)
@@ -339,16 +339,12 @@ int iwl_fill_ppag_table(struct iwl_fw_runtime *fwrt,
                return -EINVAL;
        }
 
-       /* The 'flags' field is the same in v1 and in v2 so we can just
-        * use v1 to access it.
-        */
-       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);
+               cmd->v1.flags = cpu_to_le32(fwrt->ppag_flags);
                if (fwrt->ppag_bios_rev >= 1) {
                        /* in this case FW supports revision 0 */
                        IWL_DEBUG_RADIO(fwrt,
@@ -359,11 +355,19 @@ int iwl_fill_ppag_table(struct iwl_fw_runtime *fwrt,
                num_sub_bands = IWL_NUM_SUB_BANDS_V2;
                gain = cmd->v2.gain[0];
                *cmd_size = sizeof(cmd->v2);
+               cmd->v2.flags = cpu_to_le32(fwrt->ppag_flags);
                if (fwrt->ppag_bios_rev == 0) {
                        /* in this case FW supports revisions 1,2 or 3 */
                        IWL_DEBUG_RADIO(fwrt,
                                        "PPAG table rev is 0, send padded table\n");
                }
+       } else if (cmd_ver == 7) {
+               num_sub_bands = IWL_NUM_SUB_BANDS_V2;
+               gain = cmd->v3.gain[0];
+               *cmd_size = sizeof(cmd->v3);
+               cmd->v3.ppag_config_info.table_source = fwrt->ppag_bios_source;
+               cmd->v3.ppag_config_info.table_revision = fwrt->ppag_bios_rev;
+               cmd->v3.ppag_config_info.value = cpu_to_le32(fwrt->ppag_flags);
        } else {
                IWL_DEBUG_RADIO(fwrt, "Unsupported PPAG command version\n");
                return -EINVAL;
@@ -372,7 +376,7 @@ int iwl_fill_ppag_table(struct iwl_fw_runtime *fwrt,
        /* ppag mode */
        IWL_DEBUG_RADIO(fwrt,
                        "PPAG MODE bits were read from bios: %d\n",
-                       le32_to_cpu(cmd->v1.flags));
+                       fwrt->ppag_flags);
 
        if (cmd_ver == 6)
                cmd->v1.flags &= cpu_to_le32(IWL_PPAG_CMD_V6_MASK);
@@ -391,9 +395,13 @@ int iwl_fill_ppag_table(struct iwl_fw_runtime *fwrt,
                IWL_DEBUG_RADIO(fwrt, "isn't masking ppag China bit\n");
        }
 
+       /* The 'flags' field is the same in v1 and v2 so we can just
+        * use v1 to access it.
+        */
        IWL_DEBUG_RADIO(fwrt,
                        "PPAG MODE bits going to be sent: %d\n",
-                       le32_to_cpu(cmd->v1.flags));
+                       (cmd_ver < 7) ? le32_to_cpu(cmd->v1.flags) :
+                                       le32_to_cpu(cmd->v3.ppag_config_info.value));
 
        for (i = 0; i < IWL_NUM_CHAIN_LIMITS; i++) {
                for (j = 0; j < num_sub_bands; j++) {
index 8ff85a24307597113252cf6005dcd669f324a86a..0444a736c2b2060db3002496b942bcc520137d7b 100644 (file)
@@ -112,6 +112,7 @@ struct iwl_txf_iter_data {
  * @geo_profiles: geographic profiles as read from WGDS BIOS table
  * @phy_filters: specific phy filters as read from WPFC BIOS table
  * @ppag_bios_rev: PPAG BIOS revision
+ * @ppag_bios_source: see &enum bios_source
  */
 struct iwl_fw_runtime {
        struct iwl_trans *trans;
@@ -181,6 +182,7 @@ struct iwl_fw_runtime {
        struct iwl_ppag_chain ppag_chains[IWL_NUM_CHAIN_LIMITS];
        u32 ppag_flags;
        u8 ppag_bios_rev;
+       u8 ppag_bios_source;
        struct iwl_sar_offset_mapping_cmd sgom_table;
        bool sgom_enabled;
        struct iwl_mcc_allowed_ap_type_cmd uats_table;
index 74b7984e8ebe52f0ab84a3edc03a60689270dd79..d314920350891b50066a331b1890855c89c2a87f 100644 (file)
@@ -564,6 +564,7 @@ int iwl_uefi_get_ppag_table(struct iwl_fw_runtime *fwrt)
        BUILD_BUG_ON(sizeof(fwrt->ppag_chains) != sizeof(data->ppag_chains));
        memcpy(&fwrt->ppag_chains, &data->ppag_chains,
               sizeof(data->ppag_chains));
+       fwrt->ppag_bios_source = BIOS_SOURCE_UEFI;
 out:
        kfree(data);
        return ret;