|
| 1 | +From 50bdef1cc677f55240d1fb781a8ee81c15d9375b Mon Sep 17 00:00:00 2001 |
| 2 | +From: hzy <hzyitc@outlook.com> |
| 3 | +Date: Sat, 7 Oct 2023 22:22:05 +0800 |
| 4 | +Subject: [PATCH 2/2] ath11k: Support reading board_id from filesystem |
| 5 | + |
| 6 | +--- |
| 7 | + drivers/net/wireless/ath/ath11k/qmi.c | 28 ++++++++++++++++++++++++++- |
| 8 | + 1 file changed, 27 insertions(+), 1 deletion(-) |
| 9 | + |
| 10 | +diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c |
| 11 | +index e4a28359..d50b6300 100644 |
| 12 | +--- a/drivers/net/wireless/ath/ath11k/qmi.c |
| 13 | ++++ b/drivers/net/wireless/ath/ath11k/qmi.c |
| 14 | +@@ -2210,6 +2210,30 @@ out: |
| 15 | + return ret; |
| 16 | + } |
| 17 | + |
| 18 | ++static int ath11k_qmi_fetch_board_id_from_fs(struct ath11k_base *ab, u32 *board_id) |
| 19 | ++{ |
| 20 | ++ const struct firmware *fw; |
| 21 | ++ char buf[64]; |
| 22 | ++ int len; |
| 23 | ++ int ret; |
| 24 | ++ |
| 25 | ++ snprintf(buf, sizeof(buf), "board_id-%s-%s", |
| 26 | ++ ath11k_bus_str(ab->hif.bus), dev_name(ab->dev)); |
| 27 | ++ |
| 28 | ++ fw = ath11k_core_firmware_request(ab, buf); |
| 29 | ++ if(IS_ERR(fw)) |
| 30 | ++ return PTR_ERR(fw); |
| 31 | ++ |
| 32 | ++ len = min(fw->size, sizeof(buf) - 1); |
| 33 | ++ memcpy(buf, fw->data, len); |
| 34 | ++ buf[len] = 0; |
| 35 | ++ |
| 36 | ++ ret = kstrtouint(buf, 0, board_id); |
| 37 | ++ |
| 38 | ++ release_firmware(fw); |
| 39 | ++ return ret; |
| 40 | ++} |
| 41 | ++ |
| 42 | + static int ath11k_qmi_request_target_cap(struct ath11k_base *ab) |
| 43 | + { |
| 44 | + struct qmi_wlanfw_cap_req_msg_v01 req; |
| 45 | +@@ -2260,7 +2284,9 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab) |
| 46 | + ab->qmi.target.chip_family = resp.chip_info.chip_family; |
| 47 | + } |
| 48 | + |
| 49 | +- if (!of_property_read_u32(ab->dev->of_node, "qcom,board_id", &board_id) && board_id != 0xFF) |
| 50 | ++ if (!ath11k_qmi_fetch_board_id_from_fs(ab, &board_id) && board_id != 0xFF) |
| 51 | ++ ab->qmi.target.board_id = board_id; |
| 52 | ++ else if (!of_property_read_u32(ab->dev->of_node, "qcom,board_id", &board_id) && board_id != 0xFF) |
| 53 | + ab->qmi.target.board_id = board_id; |
| 54 | + else if (resp.board_info_valid) |
| 55 | + ab->qmi.target.board_id = resp.board_info.board_id; |
| 56 | +-- |
| 57 | +2.40.1 |
| 58 | + |
0 commit comments