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

Commit 038523e5 authored by Naman Padhiar's avatar Naman Padhiar
Browse files

icnss2: Decrement soc wake ref count



If ref count is greater than 1, decrement ref count without
calling SOC_WAKE_RELEASE QMI as for ref count greater than 1
SOC_WAKE_REQ is also not sent.
This will protect req/release mismatch in FW.

Change-Id: I8475e7b2429389c22a23483ee129db8753957ad3
Signed-off-by: default avatarNaman Padhiar <npadhiar@codeaurora.org>
parent 32735954
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -986,17 +986,10 @@ static int icnss_qdss_trace_save_hdlr(struct icnss_priv *priv,
static int icnss_event_soc_wake_request(struct icnss_priv *priv, void *data)
{
	int ret = 0;
	int count = 0;

	if (!priv)
		return -ENODEV;

	if (atomic_read(&priv->soc_wake_ref_count)) {
		count = atomic_inc_return(&priv->soc_wake_ref_count);
		icnss_pr_dbg("SOC already awake, Ref count: %d", count);
		return 0;
	}

	ret = wlfw_send_soc_wake_msg(priv, QMI_WLFW_WAKE_REQUEST_V01);
	if (!ret)
		atomic_inc(&priv->soc_wake_ref_count);
@@ -2336,6 +2329,7 @@ EXPORT_SYMBOL(icnss_set_fw_log_mode);
int icnss_force_wake_request(struct device *dev)
{
	struct icnss_priv *priv = dev_get_drvdata(dev);
	int count = 0;

	if (!dev)
		return -ENODEV;
@@ -2345,6 +2339,12 @@ int icnss_force_wake_request(struct device *dev)
		return -EINVAL;
	}

	if (atomic_read(&priv->soc_wake_ref_count)) {
		count = atomic_inc_return(&priv->soc_wake_ref_count);
		icnss_pr_dbg("SOC already awake, Ref count: %d", count);
		return 0;
	}

	icnss_pr_dbg("Calling SOC Wake request");

	icnss_soc_wake_event_post(priv, ICNSS_SOC_WAKE_REQUEST_EVENT,
@@ -2357,6 +2357,7 @@ EXPORT_SYMBOL(icnss_force_wake_request);
int icnss_force_wake_release(struct device *dev)
{
	struct icnss_priv *priv = dev_get_drvdata(dev);
	int count = 0;

	if (!dev)
		return -ENODEV;
@@ -2366,6 +2367,13 @@ int icnss_force_wake_release(struct device *dev)
		return -EINVAL;
	}

	if (atomic_read(&priv->soc_wake_ref_count) > 1) {
		count = atomic_dec_return(&priv->soc_wake_ref_count);
		icnss_pr_dbg("SOC previous release pending, Ref count: %d",
			     count);
		return 0;
	}

	icnss_pr_dbg("Calling SOC Wake response");

	icnss_soc_wake_event_post(priv, ICNSS_SOC_WAKE_RELEASE_EVENT,