diff mbox series

[3/3] wifi: ath12k: Add support to read EEPROM caldata

Message ID 20221223050646.27785-4-quic_dinek@quicinc.com (mailing list archive)
State Accepted
Commit 801fc159e30d3588b0fece351e1e8bdf375590d6
Delegated to: Kalle Valo
Headers show
Series Add changes to read caldata from EEPROM | expand

Commit Message

Dinesh Karthikeyan Dec. 23, 2022, 5:06 a.m. UTC
In current implementation, there is a overhead of maintaining caldata
in the filesystem manually. To eliminate this overhead, for pci based
chipsets, if calibration data is present in EEPROM, indicate firmware
to download and read caldata from EEPROM. If the caldata is present in
EEPROM, host is notified in the target capability.
Upon this, the download request for the type ATH12K_QMI_FILE_TYPE_EEPROM
is sent to firmware.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Dinesh Karthikeyan <quic_dinek@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/qmi.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index a69307bea596..979a63f2e2ab 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -2371,12 +2371,16 @@  static int ath12k_qmi_load_file_target_mem(struct ath12k_base *ab,
 			goto out;
 		}
 
-		remaining -= req->data_len;
-		temp += req->data_len;
-		req->seg_id++;
-		ath12k_dbg(ab, ATH12K_DBG_QMI,
-			   "qmi bdf download request remaining %i\n",
-			   remaining);
+		if (type == ATH12K_QMI_FILE_TYPE_EEPROM) {
+			remaining = 0;
+		} else {
+			remaining -= req->data_len;
+			temp += req->data_len;
+			req->seg_id++;
+			ath12k_dbg(ab, ATH12K_DBG_QMI,
+				   "qmi bdf download request remaining %i\n",
+				   remaining);
+		}
 	}
 
 out:
@@ -2422,7 +2426,7 @@  static int ath12k_qmi_load_bdf_qmi(struct ath12k_base *ab,
 	case ATH12K_QMI_BDF_TYPE_CALIBRATION:
 
 		if (ab->qmi.target.eeprom_caldata) {
-			file_type = ATH12K_QMI_FILE_TYPE_CALDATA;
+			file_type = ATH12K_QMI_FILE_TYPE_EEPROM;
 			tmp = filename;
 			fw_size = ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE;
 		} else {