wifi: ath11k: Fix incorrect QMI message ID mappings
authorManikanta Pubbisetty <quic_mpubbise@quicinc.com>
Wed, 31 Aug 2022 06:04:19 +0000 (09:04 +0300)
committerKalle Valo <quic_kvalo@quicinc.com>
Thu, 1 Sep 2022 16:14:04 +0000 (19:14 +0300)
QMI message IDs for some of the QMI messages were incorrectly
defined in the original implementation. These have to be corrected
to enable cold boot support on WCN6750. These corrections are
applicable for all chipsets and will not impact them. Refactor the
code accordingly.

Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1

Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20220720134909.15626-2-quic_mpubbise@quicinc.com
drivers/net/wireless/ath/ath11k/qmi.c
drivers/net/wireless/ath/ath11k/qmi.h

index 00136601cb7dbe88d6a7153de181bbb1bc71a2fa..e6ced8597e1d6efffca41805725aeed39a8045ac 100644 (file)
@@ -1696,6 +1696,13 @@ static struct qmi_elem_info qmi_wlanfw_wlan_ini_resp_msg_v01_ei[] = {
        },
 };
 
+static struct qmi_elem_info qmi_wlfw_fw_init_done_ind_msg_v01_ei[] = {
+       {
+               .data_type = QMI_EOTI,
+               .array_type = NO_ARRAY,
+       },
+};
+
 static int ath11k_qmi_host_cap_send(struct ath11k_base *ab)
 {
        struct qmi_wlanfw_host_cap_req_msg_v01 req;
@@ -3006,6 +3013,10 @@ static void ath11k_qmi_msg_fw_ready_cb(struct qmi_handle *qmi_hdl,
        struct ath11k_base *ab = qmi->ab;
 
        ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi firmware ready\n");
+
+       ab->qmi.cal_done = 1;
+       wake_up(&ab->qmi.cold_boot_waitq);
+
        ath11k_qmi_driver_event_post(qmi, ATH11K_QMI_EVENT_FW_READY, NULL);
 }
 
@@ -3018,11 +3029,22 @@ static void ath11k_qmi_msg_cold_boot_cal_done_cb(struct qmi_handle *qmi_hdl,
                                              struct ath11k_qmi, handle);
        struct ath11k_base *ab = qmi->ab;
 
-       ab->qmi.cal_done = 1;
-       wake_up(&ab->qmi.cold_boot_waitq);
        ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi cold boot calibration done\n");
 }
 
+static void ath11k_qmi_msg_fw_init_done_cb(struct qmi_handle *qmi_hdl,
+                                          struct sockaddr_qrtr *sq,
+                                          struct qmi_txn *txn,
+                                          const void *decoded)
+{
+       struct ath11k_qmi *qmi = container_of(qmi_hdl,
+                                             struct ath11k_qmi, handle);
+       struct ath11k_base *ab = qmi->ab;
+
+       ath11k_qmi_driver_event_post(qmi, ATH11K_QMI_EVENT_FW_INIT_DONE, NULL);
+       ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi firmware init done\n");
+}
+
 static const struct qmi_msg_handler ath11k_qmi_msg_handlers[] = {
        {
                .type = QMI_INDICATION,
@@ -3053,6 +3075,14 @@ static const struct qmi_msg_handler ath11k_qmi_msg_handlers[] = {
                        sizeof(struct qmi_wlanfw_fw_cold_cal_done_ind_msg_v01),
                .fn = ath11k_qmi_msg_cold_boot_cal_done_cb,
        },
+       {
+               .type = QMI_INDICATION,
+               .msg_id = QMI_WLFW_FW_INIT_DONE_IND_V01,
+               .ei = qmi_wlfw_fw_init_done_ind_msg_v01_ei,
+               .decoded_size =
+                       sizeof(struct qmi_wlfw_fw_init_done_ind_msg_v01),
+               .fn = ath11k_qmi_msg_fw_init_done_cb,
+       },
 };
 
 static int ath11k_qmi_ops_new_server(struct qmi_handle *qmi_hdl,
@@ -3145,7 +3175,7 @@ static void ath11k_qmi_driver_event_work(struct work_struct *work)
                        }
 
                        break;
-               case ATH11K_QMI_EVENT_FW_READY:
+               case ATH11K_QMI_EVENT_FW_INIT_DONE:
                        clear_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags);
                        if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) {
                                ath11k_hal_dump_srng_stats(ab);
@@ -3168,6 +3198,8 @@ static void ath11k_qmi_driver_event_work(struct work_struct *work)
                                set_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags);
                        }
 
+                       break;
+               case ATH11K_QMI_EVENT_FW_READY:
                        break;
                case ATH11K_QMI_EVENT_COLD_BOOT_CAL_DONE:
                        break;
index c83cf822be81a144da44aa7ccd34ed4cd18db6bc..2ec56a34fa810970469f299491ae39a32af9b747 100644 (file)
@@ -31,8 +31,9 @@
 
 #define QMI_WLFW_REQUEST_MEM_IND_V01           0x0035
 #define QMI_WLFW_FW_MEM_READY_IND_V01          0x0037
-#define QMI_WLFW_COLD_BOOT_CAL_DONE_IND_V01    0x0021
-#define QMI_WLFW_FW_READY_IND_V01              0x0038
+#define QMI_WLFW_COLD_BOOT_CAL_DONE_IND_V01    0x003E
+#define QMI_WLFW_FW_READY_IND_V01              0x0021
+#define QMI_WLFW_FW_INIT_DONE_IND_V01          0x0038
 
 #define QMI_WLANFW_MAX_DATA_SIZE_V01           6144
 #define ATH11K_FIRMWARE_MODE_OFF               4
@@ -69,6 +70,7 @@ enum ath11k_qmi_event_type {
        ATH11K_QMI_EVENT_FORCE_FW_ASSERT,
        ATH11K_QMI_EVENT_POWER_UP,
        ATH11K_QMI_EVENT_POWER_DOWN,
+       ATH11K_QMI_EVENT_FW_INIT_DONE,
        ATH11K_QMI_EVENT_MAX,
 };
 
@@ -291,6 +293,10 @@ struct qmi_wlanfw_fw_cold_cal_done_ind_msg_v01 {
        char placeholder;
 };
 
+struct qmi_wlfw_fw_init_done_ind_msg_v01 {
+       char placeholder;
+};
+
 #define QMI_WLANFW_CAP_REQ_MSG_V01_MAX_LEN             0
 #define QMI_WLANFW_CAP_RESP_MSG_V01_MAX_LEN            235
 #define QMI_WLANFW_CAP_REQ_V01                         0x0024