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

Commit d8e38875 authored by Anurag Chouhan's avatar Anurag Chouhan
Browse files

icnss: Avoid sending mode on twice



Do not send mode on request to the firmware, if sent already.
Keep a flag maintianing mode on state, check before sending
mode on request to the firmware and clear the flag once FW ready
is received or mode off is sent to the firmware.

Change-Id: I66ff348b1b25046ee3a40971458475e6b9699c40
Signed-off-by: default avatarAnurag Chouhan <achouhan@codeaurora.org>
parent 01697ba5
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -972,6 +972,7 @@ static int icnss_driver_event_fw_ready_ind(void *data)
		return -ENODEV;

	set_bit(ICNSS_FW_READY, &penv->state);
	clear_bit(ICNSS_MODE_ON, &penv->state);

	icnss_pr_info("WLAN FW is ready: 0x%lx\n", penv->state);

@@ -1896,6 +1897,11 @@ int icnss_wlan_enable(struct device *dev, struct icnss_wlan_enable_cfg *config,
		return -EINVAL;
	}

	if (test_bit(ICNSS_MODE_ON, &penv->state)) {
		icnss_pr_err("Already Mode on, ignoring wlan_enable state: 0x%lx\n",
			     penv->state);
	}

	return icnss_send_wlan_enable_to_fw(penv, config, mode, host_version);
}
EXPORT_SYMBOL(icnss_wlan_enable);
@@ -2538,6 +2544,9 @@ static int icnss_stats_show_state(struct seq_file *s, struct icnss_priv *priv)
			continue;
		case ICNSS_REJUVENATE:
			seq_puts(s, "FW REJUVENATE");
			continue;
		case ICNSS_MODE_ON:
			seq_puts(s, "MODE ON DONE");
		}

		seq_printf(s, "UNKNOWN-%d", i);
+1 −0
Original line number Diff line number Diff line
@@ -155,6 +155,7 @@ enum icnss_driver_state {
	ICNSS_FW_DOWN,
	ICNSS_DRIVER_UNLOADING,
	ICNSS_REJUVENATE,
	ICNSS_MODE_ON,
};

struct ce_irq_list {
+10 −0
Original line number Diff line number Diff line
@@ -471,6 +471,16 @@ int wlfw_wlan_mode_send_sync_msg(struct icnss_priv *priv,

	priv->stats.mode_resp++;

	if (mode == QMI_WLFW_OFF_V01) {
		icnss_pr_dbg("Clear mode on 0x%lx, mode: %d\n",
			     priv->state, mode);
		clear_bit(ICNSS_MODE_ON, &priv->state);
	} else {
		icnss_pr_dbg("Set mode on 0x%lx, mode: %d\n",
			     priv->state, mode);
		set_bit(ICNSS_MODE_ON, &priv->state);
	}

	kfree(resp);
	kfree(req);
	return 0;