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

Commit 8d488173 authored by Anurag Chouhan's avatar Anurag Chouhan Committed by Gerrit - the friendly Code Review server
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 4b8ed544
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -285,6 +285,7 @@ enum icnss_driver_state {
	ICNSS_FW_DOWN,
	ICNSS_DRIVER_UNLOADING,
	ICNSS_REJUVENATE,
	ICNSS_MODE_ON,
};

struct ce_irq_list {
@@ -1610,6 +1611,16 @@ static int wlfw_wlan_mode_send_sync_msg(enum wlfw_driver_mode_enum_v01 mode)
	}
	penv->stats.mode_resp++;

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

	return 0;

out:
@@ -2344,6 +2355,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);

@@ -3298,6 +3310,12 @@ 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 -EINVAL;
	}

	icnss_pr_dbg("Mode: %d, config: %p, host_version: %s\n",
		     mode, config, host_version);

@@ -4016,6 +4034,9 @@ static int icnss_stats_show_state(struct seq_file *s, struct icnss_priv *priv)
			continue;
		case ICNSS_DRIVER_UNLOADING:
			seq_puts(s, "DRIVER UNLOADING");
			continue;
		case ICNSS_MODE_ON:
			seq_puts(s, "MODE ON DONE");
		}

		seq_printf(s, "UNKNOWN-%d", i);