icnss: Add support for graceful shutdown

Add a QMI command to indicate graceful shutdown to the FW
and updating the QMI file.

Change-Id: I0360f6f5b49bc19ea4a7acbbd0e192e1596463d6
Signed-off-by: Sandeep Singh <sandsing@codeaurora.org>
This commit is contained in:
Sandeep Singh 2019-02-13 16:17:30 +05:30 committed by Gerrit - the friendly Code Review server
parent d7807eff3a
commit 14961ab5bb
3 changed files with 2336 additions and 457 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -1636,6 +1636,56 @@ out:
return ret;
}
static int wlfw_send_modem_shutdown_msg(void)
{
int ret;
struct wlfw_shutdown_req_msg_v01 req;
struct wlfw_shutdown_resp_msg_v01 resp;
struct msg_desc req_desc, resp_desc;
if (!penv || !penv->wlfw_clnt)
return -ENODEV;
icnss_pr_dbg("Sending modem shutdown request, state: 0x%lx\n",
penv->state);
memset(&req, 0, sizeof(req));
memset(&resp, 0, sizeof(resp));
req.shutdown_valid = 1;
req.shutdown = 1;
req_desc.max_msg_len = WLFW_SHUTDOWN_REQ_MSG_V01_MAX_MSG_LEN;
req_desc.msg_id = QMI_WLFW_SHUTDOWN_REQ_V01;
req_desc.ei_array = wlfw_shutdown_req_msg_v01_ei;
resp_desc.max_msg_len = WLFW_SHUTDOWN_RESP_MSG_V01_MAX_MSG_LEN;
resp_desc.msg_id = QMI_WLFW_SHUTDOWN_RESP_V01;
resp_desc.ei_array = wlfw_shutdown_resp_msg_v01_ei;
ret = qmi_send_req_wait(penv->wlfw_clnt, &req_desc, &req, sizeof(req),
&resp_desc, &resp, sizeof(resp),
WLFW_TIMEOUT_MS);
if (ret < 0) {
icnss_pr_err("Send modem shutdown req failed, ret: %d\n", ret);
goto out;
}
if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
icnss_pr_err("QMI modem shutdown request rejected result:%d error:%d\n",
resp.resp.result, resp.resp.error);
ret = -resp.resp.result;
goto out;
}
icnss_pr_dbg("modem shutdown request sent successfully, state: 0x%lx\n",
penv->state);
return 0;
out:
return ret;
}
static int wlfw_athdiag_read_send_sync_msg(struct icnss_priv *priv,
uint32_t offset, uint32_t mem_type,
uint32_t data_len, uint8_t *data)
@ -2534,6 +2584,13 @@ static int icnss_modem_notifier_nb(struct notifier_block *nb,
if (code != SUBSYS_BEFORE_SHUTDOWN)
return NOTIFY_OK;
if (code == SUBSYS_BEFORE_SHUTDOWN && !notif->crashed) {
ret = wlfw_send_modem_shutdown_msg();
if (ret)
icnss_pr_dbg("Fail to send modem shutdown Indication %d\n",
ret);
}
if (test_bit(ICNSS_PDR_REGISTERED, &priv->state)) {
set_bit(ICNSS_FW_DOWN, &priv->state);
icnss_ignore_qmi_timeout(true);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff