wifi: iwlwifi: mld: send the WPFC table to the FW
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Wed, 30 Apr 2025 12:23:09 +0000 (15:23 +0300)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Tue, 6 May 2025 17:22:40 +0000 (20:22 +0300)
Read the table on op mode start, and send it to the FW when it is
loaded.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250430151952.e349a33cd871.Ied196cf0fbe18b82b87ce713c4e3347f9aca1c25@changeid
drivers/net/wireless/intel/iwlwifi/mld/fw.c
drivers/net/wireless/intel/iwlwifi/mld/phy.c
drivers/net/wireless/intel/iwlwifi/mld/phy.h
drivers/net/wireless/intel/iwlwifi/mld/regulatory.c

index 6e9af37fb86dba666b8d234d293f17adf9b15a62..238e8ad8ba82a6f9d550486cc92eae0eaaa38c7e 100644 (file)
@@ -8,6 +8,7 @@
 #include "fw/api/alive.h"
 #include "fw/api/scan.h"
 #include "fw/api/rx.h"
+#include "phy.h"
 #include "fw/dbg.h"
 #include "fw/pnvm.h"
 #include "hcmd.h"
@@ -254,7 +255,9 @@ static int iwl_mld_load_fw_wait_alive(struct iwl_mld *mld)
 static int iwl_mld_run_fw_init_sequence(struct iwl_mld *mld)
 {
        struct iwl_notification_wait init_wait;
-       struct iwl_init_extended_cfg_cmd init_cfg = {};
+       struct iwl_init_extended_cfg_cmd init_cfg = {
+               .init_flags = cpu_to_le32(BIT(IWL_INIT_PHY)),
+       };
        static const u16 init_complete[] = {
                INIT_COMPLETE_NOTIF,
        };
@@ -291,6 +294,13 @@ static int iwl_mld_run_fw_init_sequence(struct iwl_mld *mld)
                return ret;
        }
 
+       ret = iwl_mld_send_phy_cfg_cmd(mld);
+       if (ret) {
+               IWL_ERR(mld, "Failed to send PHY config command: %d\n", ret);
+               iwl_remove_notification(&mld->notif_wait, &init_wait);
+               return ret;
+       }
+
        ret = iwl_wait_notification(&mld->notif_wait, &init_wait,
                                    MLD_INIT_COMPLETE_TIMEOUT);
        if (ret) {
index 2fbc8090088bec943a1e6878a7fd28d1b21b9b0b..2345fe5c3291528bb5ea82f5d62dd2d1f736c15e 100644 (file)
@@ -153,3 +153,32 @@ int iwl_mld_phy_fw_action(struct iwl_mld *mld,
 
        return ret;
 }
+
+static u32 iwl_mld_get_phy_config(struct iwl_mld *mld)
+{
+       u32 phy_config = ~(FW_PHY_CFG_TX_CHAIN |
+                          FW_PHY_CFG_RX_CHAIN);
+       u32 valid_rx_ant = iwl_mld_get_valid_rx_ant(mld);
+       u32 valid_tx_ant = iwl_mld_get_valid_tx_ant(mld);
+
+       phy_config |= valid_tx_ant << FW_PHY_CFG_TX_CHAIN_POS |
+                     valid_rx_ant << FW_PHY_CFG_RX_CHAIN_POS;
+
+       return mld->fw->phy_config & phy_config;
+}
+
+int iwl_mld_send_phy_cfg_cmd(struct iwl_mld *mld)
+{
+       const struct iwl_tlv_calib_ctrl *default_calib =
+               &mld->fw->default_calib[IWL_UCODE_REGULAR];
+       struct iwl_phy_cfg_cmd_v3 cmd = {
+               .phy_cfg = cpu_to_le32(iwl_mld_get_phy_config(mld)),
+               .calib_control.event_trigger = default_calib->event_trigger,
+               .calib_control.flow_trigger = default_calib->flow_trigger,
+               .phy_specific_cfg = mld->fwrt.phy_filters,
+       };
+
+       IWL_INFO(mld, "Sending Phy CFG command: 0x%x\n", cmd.phy_cfg);
+
+       return iwl_mld_send_cmd_pdu(mld, PHY_CONFIGURATION_CMD, &cmd);
+}
index 2212a89321b7e5678651546247b57b2f293a8bce..563e309deb0a0e46ffbe908bda249218716f31da 100644 (file)
@@ -52,4 +52,6 @@ iwl_mld_get_chandef_from_chanctx(struct iwl_mld *mld,
                                 struct ieee80211_chanctx_conf *ctx);
 u8 iwl_mld_get_fw_ctrl_pos(const struct cfg80211_chan_def *chandef);
 
+int iwl_mld_send_phy_cfg_cmd(struct iwl_mld *mld);
+
 #endif /* __iwl_mld_phy_h__ */
index a75af8c1e8ab0417006788066835aee417bd4678..fa9f8ac1463102cae663d4e40a6208eeb291ca64 100644 (file)
@@ -66,6 +66,8 @@ void iwl_mld_get_bios_tables(struct iwl_mld *mld)
        ret = iwl_uefi_get_uats_table(mld->trans, &mld->fwrt);
        if (ret)
                IWL_DEBUG_RADIO(mld, "failed to read UATS table (%d)\n", ret);
+
+       iwl_bios_get_phy_filters(&mld->fwrt);
 }
 
 static int iwl_mld_geo_sar_init(struct iwl_mld *mld)