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

Commit ee072289 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cnss2: Serialize driver unload and idle restart"

parents 8002d4ca a4787de2
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@
#define FW_ASSERT_TIMEOUT		5000
#define CNSS_EVENT_PENDING		2989
#define COLD_BOOT_CAL_SHUTDOWN_DELAY_MS	50
#define WLAN_WD_TIMEOUT_MS		60000

#define CNSS_QUIRKS_DEFAULT		BIT(DISABLE_IO_COHERENCY)
#ifdef CONFIG_CNSS_EMULATION
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#define QMI_WLFW_MAX_BUILD_ID_LEN	128
#define CNSS_RDDM_TIMEOUT_MS		20000
#define RECOVERY_TIMEOUT		60000
#define WLAN_WD_TIMEOUT_MS		60000
#define TIME_CLOCK_FREQ_HZ		19200000

#define CNSS_EVENT_SYNC   BIT(0)
+19 −4
Original line number Diff line number Diff line
@@ -1371,7 +1371,7 @@ int cnss_pci_call_driver_probe(struct cnss_pci_data *pci_priv)
		}
		clear_bit(CNSS_DRIVER_RECOVERY, &plat_priv->driver_state);
		clear_bit(CNSS_DRIVER_IDLE_RESTART, &plat_priv->driver_state);
		complete(&plat_priv->power_up_complete);
		complete_all(&plat_priv->power_up_complete);
	} else {
		complete(&plat_priv->power_up_complete);
	}
@@ -2045,25 +2045,40 @@ void cnss_wlan_unregister_driver(struct cnss_wlan_driver *driver_ops)
{
	struct cnss_plat_data *plat_priv = cnss_bus_dev_to_plat_priv(NULL);
	int ret = 0;
	unsigned int timeout;

	if (!plat_priv) {
		cnss_pr_err("plat_priv is NULL\n");
		return;
	}

	if (plat_priv->device_id == QCA6174_DEVICE_ID ||
	    !test_bit(CNSS_DRIVER_IDLE_RESTART, &plat_priv->driver_state))
		goto skip_wait_idle_restart;

	timeout = cnss_get_qmi_timeout(plat_priv);
	ret = wait_for_completion_timeout(&plat_priv->power_up_complete,
					  msecs_to_jiffies((timeout << 1) +
							   WLAN_WD_TIMEOUT_MS));
	if (!ret) {
		cnss_pr_err("Timeout waiting for idle restart to complete\n");
		CNSS_ASSERT(0);
	}

skip_wait_idle_restart:
	if (!test_bit(CNSS_DRIVER_RECOVERY, &plat_priv->driver_state) &&
	    !test_bit(CNSS_DEV_ERR_NOTIFY, &plat_priv->driver_state))
		goto skip_wait;
		goto skip_wait_recovery;

	reinit_completion(&plat_priv->recovery_complete);
	ret = wait_for_completion_timeout(&plat_priv->recovery_complete,
					  RECOVERY_TIMEOUT);
					  msecs_to_jiffies(RECOVERY_TIMEOUT));
	if (!ret) {
		cnss_pr_err("Timeout waiting for recovery to complete\n");
		CNSS_ASSERT(0);
	}

skip_wait:
skip_wait_recovery:
	cnss_driver_event_post(plat_priv,
			       CNSS_DRIVER_EVENT_UNREGISTER_DRIVER,
			       CNSS_EVENT_SYNC_UNINTERRUPTIBLE, NULL);