From patchwork Mon Mar 26 05:40:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Govind Singh X-Patchwork-Id: 10307191 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 81DE0600CC for ; Mon, 26 Mar 2018 05:41:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8143E2946B for ; Mon, 26 Mar 2018 05:41:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 739292946E; Mon, 26 Mar 2018 05:41:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F1A0D2946B for ; Mon, 26 Mar 2018 05:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=X7+zBfmx1WSf03zSHVGydhhxYon0EwYQo1GUdMaMGWw=; b=G4b 31P3gp6TVjmPMlqIPjEYAKicgqHDWxLtmq5Grlp61kltQsS48cynwoNA358cyA9QQQ3zouJSKHDaM I1i6wX9Q4IX5tt1bcEmmEVbTkA7V0SEJMCJg1MAp/ktOhW7kdG+oGPDkLQKxzO6Knyb2NQJ3NANG1 PqqAtcGNGtznh0DogrzlmDfwrO1z1w8haEwyOImaM3pyCGelfTqpkANJ/ZJr1maTkjiHpMOmuPmYQ d5Skbnh/WAEZUlKeeJAE46/ogBWtYN0s0qdqmk5mchX4U3q1HYEOPwLYSsOanfjKvCaS7h6PnauHs ZrtvHvxIgEbx3CqvE+4Kia6YSU5cMYQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f0KsU-0005Tm-Ea; Mon, 26 Mar 2018 05:41:06 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f0KsR-0005Ov-GO for ath10k@lists.infradead.org; Mon, 26 Mar 2018 05:41:04 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3C1D660588; Mon, 26 Mar 2018 05:40:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522042853; bh=6+MJ1slw7aO0avryYWh1yv5QTb9QhX4c/Uzrs0s8cYg=; h=From:To:Cc:Subject:Date:From; b=HQH+1iPu+AJGAL1VGKjJKMo5SiT/V2VrmvOrICbp+DZT1d4Gg1jHk4dOQfQdyD3eG I3gR4kSZmjJL07Le5TDLzu94ehQOJ/M/Z5QIgAUf/rUeZEb6NZjFmG/amGg5CCOks6 bKmTt43pv83SauIJtuLLtkdmW6yhpIpJpni3MZXQ= Received: from govinds-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: govinds@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 54DA6602BA; Mon, 26 Mar 2018 05:40:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522042852; bh=6+MJ1slw7aO0avryYWh1yv5QTb9QhX4c/Uzrs0s8cYg=; h=From:To:Cc:Subject:Date:From; b=hmhbJ/TXY0zdsC8zAXcwcLGumH4JkSkFrlyvp8yArKFwMwLHWi0ov7KRIoIiI5Vmy oZz090jXksCpF8NDdNDb6NVuQjS7Wsy8wW2839XlsXTVxQxXjnvmyFdFCFpS7+Fn/f K+WLLsaNxGNvod2gCSQyKWwM8s4os6kUbzgzys3s= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 54DA6602BA Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=govinds@codeaurora.org From: Govind Singh To: ath10k@lists.infradead.org, bjorn.andersson@linaro.org Subject: [PATCH 08/12] ath10k: Add QMI CAP request support Date: Mon, 26 Mar 2018 11:10:47 +0530 Message-Id: <1522042847-26245-1-git-send-email-govinds@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180325_224103_581547_344E5D40 X-CRM114-Status: GOOD ( 12.27 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Govind Singh , linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for target capablity request qmi message for wcn3990 target. Signed-off-by: Govind Singh --- drivers/net/wireless/ath/ath10k/qmi.c | 91 +++++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/qmi.h | 25 ++++++++++ 2 files changed, 116 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/qmi.c b/drivers/net/wireless/ath/ath10k/qmi.c index 763b812..65a43af 100644 --- a/drivers/net/wireless/ath/ath10k/qmi.c +++ b/drivers/net/wireless/ath/ath10k/qmi.c @@ -270,6 +270,93 @@ static int ath10k_qmi_msa_ready_send_sync_msg(struct ath10k_qmi *qmi) return ret; } +static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi) +{ + struct wlfw_cap_resp_msg_v01 *resp; + struct wlfw_cap_req_msg_v01 *req; + struct qmi_txn txn; + int ret; + + req = kzalloc(sizeof(*req), GFP_KERNEL); + if (!req) + return -ENOMEM; + + resp = kzalloc(sizeof(*resp), GFP_KERNEL); + if (!resp) { + kfree(req); + return -ENOMEM; + } + + ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_cap_resp_msg_v01_ei, resp); + if (ret < 0) { + pr_err("fail to init txn for capability resp %d\n", ret); + goto out; + } + + ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, + QMI_WLFW_CAP_REQ_V01, + WLFW_CAP_REQ_MSG_V01_MAX_MSG_LEN, + wlfw_cap_req_msg_v01_ei, req); + if (ret < 0) { + qmi_txn_cancel(&txn); + pr_err("fail to send capability req %d\n", ret); + goto out; + } + + ret = qmi_txn_wait(&txn, WLFW_TIMEOUT * HZ); + if (ret < 0) + goto out; + + if (resp->resp.result != QMI_RESULT_SUCCESS_V01) { + pr_err("qmi capability request rejected, result:%d error:%d\n", + resp->resp.result, resp->resp.error); + ret = -resp->resp.result; + goto out; + } + + if (resp->chip_info_valid) { + qmi->chip_info.chip_id = resp->chip_info.chip_id; + qmi->chip_info.chip_family = resp->chip_info.chip_family; + } + + if (resp->board_info_valid) + qmi->board_info.board_id = resp->board_info.board_id; + else + qmi->board_info.board_id = 0xFF; + + if (resp->soc_info_valid) + qmi->soc_info.soc_id = resp->soc_info.soc_id; + + if (resp->fw_version_info_valid) { + qmi->fw_version_info.fw_version = + resp->fw_version_info.fw_version; + strlcpy(qmi->fw_version_info.fw_build_timestamp, + resp->fw_version_info.fw_build_timestamp, + MAX_TIMESTAMP_LEN + 1); + } + + if (resp->fw_build_id_valid) + strlcpy(qmi->fw_build_id, resp->fw_build_id, + MAX_BUILD_ID_LEN + 1); + + pr_debug("chip_id: 0x%x, chip_family: 0x%x, board_id: 0x%x, soc_id: 0x%x, fw_version: 0x%x, fw_build_timestamp: %s, fw_build_id: %s", + qmi->chip_info.chip_id, qmi->chip_info.chip_family, + qmi->board_info.board_id, qmi->soc_info.soc_id, + qmi->fw_version_info.fw_version, + qmi->fw_version_info.fw_build_timestamp, + qmi->fw_build_id); + + pr_debug("target cap request completed\n"); + kfree(resp); + kfree(req); + + return 0; +out: + kfree(resp); + kfree(req); + return ret; +} + static int ath10k_qmi_ind_register_send_sync_msg(struct ath10k_qmi *qmi) { @@ -425,6 +512,10 @@ static void ath10k_qmi_event_server_arrive(struct work_struct *work) if (ret) goto err_setup_msa; + ret = ath10k_qmi_cap_send_sync_msg(qmi); + if (ret) + goto err_setup_msa; + return; err_setup_msa: diff --git a/drivers/net/wireless/ath/ath10k/qmi.h b/drivers/net/wireless/ath/ath10k/qmi.h index 47af020..09d20a0 100644 --- a/drivers/net/wireless/ath/ath10k/qmi.h +++ b/drivers/net/wireless/ath/ath10k/qmi.h @@ -17,6 +17,8 @@ #define _QMI_H_ #define MAX_NUM_MEMORY_REGIONS 2 +#define MAX_TIMESTAMP_LEN 32 +#define MAX_BUILD_ID_LEN 128 enum ath10k_qmi_driver_event_type { ATH10K_QMI_EVENT_SERVER_ARRIVE, @@ -31,6 +33,24 @@ struct ath10k_msa_mem_region_info { u8 secure_flag; }; +struct ath10k_qmi_chip_info { + u32 chip_id; + u32 chip_family; +}; + +struct ath10k_qmi_board_info { + u32 board_id; +}; + +struct ath10k_qmi_soc_info { + u32 soc_id; +}; + +struct ath10k_qmi_fw_version_info { + u32 fw_version; + char fw_build_timestamp[MAX_TIMESTAMP_LEN + 1]; +}; + struct ath10k_qmi { struct platform_device *pdev; struct qmi_handle qmi_hdl; @@ -47,5 +67,10 @@ struct ath10k_qmi { phys_addr_t msa_pa; u32 msa_mem_size; void *msa_va; + struct ath10k_qmi_chip_info chip_info; + struct ath10k_qmi_board_info board_info; + struct ath10k_qmi_soc_info soc_info; + struct ath10k_qmi_fw_version_info fw_version_info; + char fw_build_id[MAX_BUILD_ID_LEN + 1]; }; #endif /* _QMI_H_ */