Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b6c37ad authored by Vijay Patil's avatar Vijay Patil Committed by Gerrit - the friendly Code Review server
Browse files

icnss2: Enhance debugging information



Print subsystem notify event string for wpss & modem instead of
event code. Print proper file type in log while downloading BDF
and REGDB file. Log the error immediately if request_firmware
API get fail.

Change-Id: I32a07895faf2bce640e0bfe89e348c36b02c5150
Signed-off-by: default avatarVijay Patil <vijaylil@codeaurora.org>
parent 1afca709
Loading
Loading
Loading
Loading
+34 −2
Original line number Diff line number Diff line
@@ -1656,6 +1656,36 @@ static void icnss_update_state_send_modem_shutdown(struct icnss_priv *priv,
	}
}

static char *icnss_subsys_notify_state_to_str(enum subsys_notif_type code)
{
	switch (code) {
	case SUBSYS_BEFORE_SHUTDOWN:
		return "BEFORE_SHUTDOWN";
	case SUBSYS_AFTER_SHUTDOWN:
		return "AFTER_SHUTDOWN";
	case SUBSYS_BEFORE_POWERUP:
		return "BEFORE_POWERUP";
	case SUBSYS_AFTER_POWERUP:
		return "AFTER_POWERUP";
	case SUBSYS_BEFORE_AUTH_AND_RESET:
		return "BEFORE_AUTH_AND_RESET";
	case SUBSYS_RAMDUMP_NOTIFICATION:
		return "RAMDUMP_NOTIFICATION";
	case SUBSYS_POWERUP_FAILURE:
		return "POWERUP_FAILURE";
	case SUBSYS_PROXY_VOTE:
		return "PROXY_VOTE";
	case SUBSYS_PROXY_UNVOTE:
		return "PROXY_UNVOTE";
	case SUBSYS_SOC_RESET:
		return "SOC_RESET";
	case SUBSYS_NOTIF_TYPE_COUNT:
		return "NOTIF_TYPE_COUNT";
	default:
		return "UNKNOWN";
	}
};

static int icnss_wpss_notifier_nb(struct notifier_block *nb,
				  unsigned long code,
				  void *data)
@@ -1666,7 +1696,8 @@ static int icnss_wpss_notifier_nb(struct notifier_block *nb,
					       wpss_ssr_nb);
	struct icnss_uevent_fw_down_data fw_down_data = {0};

	icnss_pr_vdbg("WPSS-Notify: event %lu\n", code);
	icnss_pr_vdbg("WPSS-Notify: event %s(%lu)\n",
		      icnss_subsys_notify_state_to_str(code), code);

	if (code == SUBSYS_AFTER_SHUTDOWN) {
		icnss_pr_info("Collecting msa0 segment dump\n");
@@ -1723,7 +1754,8 @@ static int icnss_modem_notifier_nb(struct notifier_block *nb,
					       modem_ssr_nb);
	struct icnss_uevent_fw_down_data fw_down_data = {0};

	icnss_pr_vdbg("Modem-Notify: event %lu\n", code);
	icnss_pr_vdbg("Modem-Notify: event %s(%lu)\n",
		      icnss_subsys_notify_state_to_str(code), code);

	if (code == SUBSYS_AFTER_SHUTDOWN) {
		icnss_pr_info("Collecting msa0 segment dump\n");
+33 −14
Original line number Diff line number Diff line
@@ -976,6 +976,22 @@ static int icnss_get_bdf_file_name(struct icnss_priv *priv,
	return ret;
}

static char *icnss_bdf_type_to_str(enum icnss_bdf_type bdf_type)
{
	switch (bdf_type) {
	case ICNSS_BDF_BIN:
		return "BDF";
	case ICNSS_BDF_ELF:
		return "BDF";
	case ICNSS_BDF_REGDB:
		return "REGDB";
	case ICNSS_BDF_DUMMY:
		return "BDF";
	default:
		return "UNKNOWN";
	}
};

int icnss_wlfw_bdf_dnld_send_sync(struct icnss_priv *priv, u32 bdf_type)
{
	struct wlfw_bdf_download_req_msg_v01 *req;
@@ -987,8 +1003,8 @@ int icnss_wlfw_bdf_dnld_send_sync(struct icnss_priv *priv, u32 bdf_type)
	unsigned int remaining;
	int ret = 0;

	icnss_pr_dbg("Sending BDF download message, state: 0x%lx, type: %d\n",
		     priv->state, bdf_type);
	icnss_pr_dbg("Sending %s download message, state: 0x%lx, type: %d\n",
		     icnss_bdf_type_to_str(bdf_type), priv->state, bdf_type);

	req = kzalloc(sizeof(*req), GFP_KERNEL);
	if (!req)
@@ -1012,7 +1028,8 @@ int icnss_wlfw_bdf_dnld_send_sync(struct icnss_priv *priv, u32 bdf_type)

	ret = request_firmware(&fw_entry, filename, &priv->pdev->dev);
	if (ret) {
		icnss_pr_err("Failed to load BDF: %s\n", filename);
		icnss_pr_err("Failed to load %s: %s ret:%d\n",
			     icnss_bdf_type_to_str(bdf_type), filename, ret);
		goto err_req_fw;
	}

@@ -1020,7 +1037,8 @@ int icnss_wlfw_bdf_dnld_send_sync(struct icnss_priv *priv, u32 bdf_type)
	remaining = fw_entry->size;

bypass_bdf:
	icnss_pr_dbg("Downloading BDF: %s, size: %u\n", filename, remaining);
	icnss_pr_dbg("Downloading %s: %s, size: %u\n",
		     icnss_bdf_type_to_str(bdf_type), filename, remaining);

	while (remaining) {
		req->valid = 1;
@@ -1046,8 +1064,8 @@ int icnss_wlfw_bdf_dnld_send_sync(struct icnss_priv *priv, u32 bdf_type)
		ret = qmi_txn_init(&priv->qmi, &txn,
				   wlfw_bdf_download_resp_msg_v01_ei, resp);
		if (ret < 0) {
			icnss_pr_err("Failed to initialize txn for BDF download request, err: %d\n",
				      ret);
			icnss_pr_err("Failed to initialize txn for %s download request, err: %d\n",
				     icnss_bdf_type_to_str(bdf_type), ret);
			goto err_send;
		}

@@ -1058,21 +1076,22 @@ int icnss_wlfw_bdf_dnld_send_sync(struct icnss_priv *priv, u32 bdf_type)
			 wlfw_bdf_download_req_msg_v01_ei, req);
		if (ret < 0) {
			qmi_txn_cancel(&txn);
			icnss_pr_err("Failed to send respond BDF download request, err: %d\n",
				      ret);
			icnss_pr_err("Failed to send respond %s download request, err: %d\n",
				     icnss_bdf_type_to_str(bdf_type), ret);
			goto err_send;
		}

		ret = qmi_txn_wait(&txn, priv->ctrl_params.qmi_timeout);
		if (ret < 0) {
			icnss_pr_err("Failed to wait for response of BDF download request, err: %d\n",
				      ret);
			icnss_pr_err("Failed to wait for response of %s download request, err: %d\n",
				     icnss_bdf_type_to_str(bdf_type), ret);
			goto err_send;
		}

		if (resp->resp.result != QMI_RESULT_SUCCESS_V01) {
			icnss_pr_err("BDF download request failed, result: %d, err: %d\n",
				      resp->resp.result, resp->resp.error);
			icnss_pr_err("%s download request failed, result: %d, err: %d\n",
				     icnss_bdf_type_to_str(bdf_type), resp->resp.result,
				     resp->resp.error);
			ret = -resp->resp.result;
			goto err_send;
		}
@@ -1250,8 +1269,8 @@ int icnss_wlfw_qdss_dnld_send_sync(struct icnss_priv *priv)
	ret = request_firmware(&fw_entry, filename,
			       &priv->pdev->dev);
	if (ret) {
		icnss_pr_err("Failed to load QDSS: %s\n",
			     filename);
		icnss_pr_err("Failed to load QDSS: %s ret:%d\n",
			     filename, ret);
		goto err_req_fw;
	}