]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: ath12k: introduce QMI firmware ready flag
authorKarthikeyan Periyasamy <quic_periyasa@quicinc.com>
Fri, 29 Nov 2024 11:20:33 +0000 (13:20 +0200)
committerKalle Valo <quic_kvalo@quicinc.com>
Sat, 30 Nov 2024 12:10:36 +0000 (14:10 +0200)
When hardware device group abstraction is introduced, the QMI firmware ready
event of different devices in a group can be received simultaneously. To
indicate the firmware ready event is completed for a particular device in a
group set a flag (ATH12K_FLAG_QMI_FW_READY_COMPLETE). This helps the upcoming
hardware recovery implementation for hardware device group abstraction.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://patch.msgid.link/20241128165026.2618331-5-kvalo@kernel.org
drivers/net/wireless/ath/ath12k/core.c
drivers/net/wireless/ath/ath12k/core.h
drivers/net/wireless/ath/ath12k/qmi.c

index 386d42db29ac0aee3ee9a4549c1ac98fd384f1e0..4da147f7bfac6656b4adb90a16b39b73c690e846 100644 (file)
@@ -1145,7 +1145,7 @@ static void ath12k_core_reset(struct work_struct *work)
        int reset_count, fail_cont_count;
        long time_left;
 
-       if (!(test_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags))) {
+       if (!(test_bit(ATH12K_FLAG_QMI_FW_READY_COMPLETE, &ab->dev_flags))) {
                ath12k_warn(ab, "ignore reset dev flags 0x%lx\n", ab->dev_flags);
                return;
        }
index 4bfc7a7cc89488b594ad5ea864cb892315246669..9ddced140056c4da4624c1e9a2447b2c136d5d42 100644 (file)
@@ -228,6 +228,7 @@ enum ath12k_dev_flags {
        ATH12K_FLAG_HTC_SUSPEND_COMPLETE,
        ATH12K_FLAG_CE_IRQ_ENABLED,
        ATH12K_FLAG_EXT_IRQ_ENABLED,
+       ATH12K_FLAG_QMI_FW_READY_COMPLETE,
 };
 
 struct ath12k_tx_conf {
index f5388eae01dc97a96cc3dd05e13661aa94303c67..77d8ee14bf33e657e270a74a95d13c229b56d2e1 100644 (file)
@@ -3033,6 +3033,8 @@ void ath12k_qmi_firmware_stop(struct ath12k_base *ab)
 {
        int ret;
 
+       clear_bit(ATH12K_FLAG_QMI_FW_READY_COMPLETE, &ab->dev_flags);
+
        ret = ath12k_qmi_wlanfw_mode_send(ab, ATH12K_FIRMWARE_MODE_OFF);
        if (ret < 0) {
                ath12k_warn(ab, "qmi failed to send wlan mode off\n");
@@ -3336,7 +3338,7 @@ static void ath12k_qmi_driver_event_work(struct work_struct *work)
                        break;
                case ATH12K_QMI_EVENT_FW_READY:
                        clear_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags);
-                       if (test_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags)) {
+                       if (test_bit(ATH12K_FLAG_QMI_FW_READY_COMPLETE, &ab->dev_flags)) {
                                if (ab->is_reset)
                                        ath12k_hal_dump_srng_stats(ab);
                                queue_work(ab->workqueue, &ab->restart_work);
@@ -3346,8 +3348,12 @@ static void ath12k_qmi_driver_event_work(struct work_struct *work)
                        clear_bit(ATH12K_FLAG_CRASH_FLUSH,
                                  &ab->dev_flags);
                        clear_bit(ATH12K_FLAG_RECOVERY, &ab->dev_flags);
-                       ath12k_core_qmi_firmware_ready(ab);
-                       set_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags);
+                       ret = ath12k_core_qmi_firmware_ready(ab);
+                       if (!ret) {
+                               set_bit(ATH12K_FLAG_QMI_FW_READY_COMPLETE,
+                                       &ab->dev_flags);
+                               set_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags);
+                       }
 
                        break;
                default: