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

Commit 8d3676a0 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cnss2: Move fbc_bypass check to proper places"

parents b0c8c9b7 0987ef99
Loading
Loading
Loading
Loading
+71 −0
Original line number Diff line number Diff line
@@ -51,6 +51,75 @@ static const struct file_operations cnss_pin_connect_fops = {
	.llseek		= seq_lseek,
};

static int cnss_stats_show_state(struct seq_file *s,
				 struct cnss_plat_data *plat_priv)
{
	enum cnss_driver_state i;
	int skip = 0;
	unsigned long state;

	seq_printf(s, "\nState: 0x%lx(", plat_priv->driver_state);
	for (i = 0, state = plat_priv->driver_state; state != 0;
	     state >>= 1, i++) {
		if (!(state & 0x1))
			continue;

		if (skip++)
			seq_puts(s, " | ");

		switch (i) {
		case CNSS_QMI_WLFW_CONNECTED:
			seq_puts(s, "QMI_WLFW_CONNECTED");
			continue;
		case CNSS_FW_MEM_READY:
			seq_puts(s, "FW_MEM_READY");
			continue;
		case CNSS_FW_READY:
			seq_puts(s, "FW_READY");
			continue;
		case CNSS_COLD_BOOT_CAL_DONE:
			seq_puts(s, "COLD_BOOT_CAL_DONE");
			continue;
		case CNSS_DRIVER_LOAD_UNLOAD:
			seq_puts(s, "DRIVER_LOAD_UNLOAD");
			continue;
		case CNSS_DRIVER_PROBED:
			seq_puts(s, "DRIVER_PROBED");
			continue;
		case CNSS_DRIVER_RECOVERY:
			seq_puts(s, "DRIVER_RECOVERY");
			continue;
		}

		seq_printf(s, "UNKNOWN-%d", i);
	}
	seq_puts(s, ")\n");

	return 0;
}

static int cnss_stats_show(struct seq_file *s, void *data)
{
	struct cnss_plat_data *plat_priv = s->private;

	cnss_stats_show_state(s, plat_priv);

	return 0;
}

static int cnss_stats_open(struct inode *inode, struct file *file)
{
	return single_open(file, cnss_stats_show, inode->i_private);
}

static const struct file_operations cnss_stats_fops = {
	.read           = seq_read,
	.release        = single_release,
	.open           = cnss_stats_open,
	.owner          = THIS_MODULE,
	.llseek         = seq_lseek,
};

int cnss_debugfs_create(struct cnss_plat_data *plat_priv)
{
	int ret = 0;
@@ -65,6 +134,8 @@ int cnss_debugfs_create(struct cnss_plat_data *plat_priv)
	plat_priv->root_dentry = root_dentry;
	debugfs_create_file("pin_connect_result", 0644, root_dentry, plat_priv,
			    &cnss_pin_connect_fops);
	debugfs_create_file("stats", 0644, root_dentry, plat_priv,
			    &cnss_stats_fops);
out:
	return ret;
}
+3 −15
Original line number Diff line number Diff line
@@ -36,13 +36,6 @@ static struct cnss_plat_data *plat_env;

static DECLARE_RWSEM(cnss_pm_sem);

static bool fbc_bypass;
#ifdef CONFIG_CNSS2_DEBUG
module_param(fbc_bypass, bool, S_IRUSR | S_IWUSR);
MODULE_PARM_DESC(fbc_bypass,
		 "Bypass firmware download when loading WLAN driver");
#endif

static bool qmi_bypass;
#ifdef CONFIG_CNSS2_DEBUG
module_param(qmi_bypass, bool, S_IRUSR | S_IWUSR);
@@ -1044,17 +1037,14 @@ static int cnss_qca6290_powerup(struct cnss_plat_data *plat_priv)
		goto power_off;
	}

	if (fbc_bypass)
		goto bypass_fbc;

	ret = cnss_pci_start_mhi(pci_priv);
	if (ret) {
		cnss_pr_err("Failed to start MHI, err = %d\n", ret);
		goto suspend_link;
	}

	cnss_set_pin_connect_status(plat_priv);

bypass_fbc:
	if (qmi_bypass)
		goto skip_fw_ready;

@@ -1103,7 +1093,6 @@ skip_fw_ready:
	return 0;

stop_mhi:
	if (!fbc_bypass)
	cnss_pci_stop_mhi(pci_priv);
suspend_link:
	cnss_suspend_pci_link(pci_priv);
@@ -1138,7 +1127,6 @@ static int cnss_qca6290_shutdown(struct cnss_plat_data *plat_priv)
	}

bypass_driver_remove:
	if (!fbc_bypass)
	cnss_pci_stop_mhi(pci_priv);

	ret = cnss_suspend_pci_link(pci_priv);
+13 −0
Original line number Diff line number Diff line
@@ -49,6 +49,13 @@ module_param(pci_link_down_panic, uint, S_IRUSR | S_IWUSR);
MODULE_PARM_DESC(pci_link_down_panic,
		 "Trigger kernel panic when PCI link down is detected");

static bool fbc_bypass;
#ifdef CONFIG_CNSS2_DEBUG
module_param(fbc_bypass, bool, S_IRUSR | S_IWUSR);
MODULE_PARM_DESC(fbc_bypass,
		 "Bypass firmware download when loading WLAN driver");
#endif

static int cnss_set_pci_config_space(struct cnss_pci_data *pci_priv, bool save)
{
	int ret = 0;
@@ -1194,6 +1201,9 @@ int cnss_pci_start_mhi(struct cnss_pci_data *pci_priv)
		return -ENODEV;
	}

	if (fbc_bypass)
		return 0;

	ret = cnss_pci_set_mhi_state(pci_priv, CNSS_MHI_INIT);
	if (ret)
		goto out;
@@ -1217,6 +1227,9 @@ void cnss_pci_stop_mhi(struct cnss_pci_data *pci_priv)
		return;
	}

	if (fbc_bypass)
		return;

	cnss_pci_set_mhi_state(pci_priv, CNSS_MHI_POWER_OFF);
	cnss_pci_set_mhi_state(pci_priv, CNSS_MHI_DEINIT);
}