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

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

Merge "cnss2: Enhance debugfs support for device boot"

parents 09b8b55d 54042bf2
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -98,6 +98,8 @@ static int cnss_stats_show_state(struct seq_file *s,
			continue;
		case CNSS_DEV_ERR_NOTIFY:
			seq_puts(s, "DEV_ERR");
		case CNSS_DRIVER_DEBUG:
			seq_puts(s, "DRIVER_DEBUG");
		}

		seq_printf(s, "UNKNOWN-%d", i);
@@ -149,10 +151,26 @@ static ssize_t cnss_dev_boot_debug_write(struct file *fp,

	if (sysfs_streq(cmd, "on")) {
		ret = cnss_power_on_device(plat_priv);
	} else if (sysfs_streq(cmd, "off")) {
		cnss_power_off_device(plat_priv);
	} else if (sysfs_streq(cmd, "enumerate")) {
		ret = cnss_pci_init(plat_priv);
	} else if (sysfs_streq(cmd, "download")) {
		ret = cnss_pci_start_mhi(plat_priv->bus_priv);
	} else if (sysfs_streq(cmd, "linkup")) {
		ret = cnss_resume_pci_link(plat_priv->bus_priv);
	} else if (sysfs_streq(cmd, "linkdown")) {
		ret = cnss_suspend_pci_link(plat_priv->bus_priv);
	} else if (sysfs_streq(cmd, "powerup")) {
		set_bit(CNSS_DRIVER_DEBUG, &plat_priv->driver_state);
		ret = cnss_driver_event_post(plat_priv,
					     CNSS_DRIVER_EVENT_POWER_UP,
					     true, NULL);
	} else if (sysfs_streq(cmd, "shutdown")) {
		ret = cnss_driver_event_post(plat_priv,
					     CNSS_DRIVER_EVENT_POWER_DOWN,
					     true, NULL);
		clear_bit(CNSS_DRIVER_DEBUG, &plat_priv->driver_state);
	} else {
		cnss_pr_err("Device boot debugfs command is invalid\n");
		ret = -EINVAL;
@@ -169,8 +187,11 @@ static int cnss_dev_boot_debug_show(struct seq_file *s, void *data)
	seq_puts(s, "\nUsage: echo <action> > <debugfs_path>/cnss/dev_boot\n");
	seq_puts(s, "<action> can be one of below:\n");
	seq_puts(s, "on: turn on device power, assert WLAN_EN\n");
	seq_puts(s, "off: de-assert WLAN_EN, turn off device power\n");
	seq_puts(s, "enumerate: de-assert PERST, enumerate PCIe\n");
	seq_puts(s, "download: download FW and do QMI handshake with FW\n");
	seq_puts(s, "powerup: full power on sequence to boot device, download FW and do QMI handshake with FW\n");
	seq_puts(s, "shutdown: full power off sequence to shutdown device\n");

	return 0;
}
+6 −1
Original line number Diff line number Diff line
@@ -1060,11 +1060,15 @@ static int cnss_qca6174_shutdown(struct cnss_plat_data *plat_priv)
	if (!pci_priv)
		return -ENODEV;

	if (test_bit(CNSS_DRIVER_DEBUG, &plat_priv->driver_state))
		goto skip_driver_remove;

	if (!plat_priv->driver_ops)
		return -EINVAL;

	cnss_driver_call_remove(plat_priv);

skip_driver_remove:
	cnss_request_bus_bandwidth(CNSS_BUS_WIDTH_NONE);
	cnss_pci_set_monitor_wake_intr(pci_priv, false);
	cnss_pci_set_auto_suspended(pci_priv, 0);
@@ -1162,7 +1166,8 @@ static int cnss_qca6290_shutdown(struct cnss_plat_data *plat_priv)
		return -ENODEV;

	if (test_bit(CNSS_COLD_BOOT_CAL, &plat_priv->driver_state) ||
	    test_bit(CNSS_FW_BOOT_RECOVERY, &plat_priv->driver_state))
	    test_bit(CNSS_FW_BOOT_RECOVERY, &plat_priv->driver_state) ||
	    test_bit(CNSS_DRIVER_DEBUG, &plat_priv->driver_state))
		goto skip_driver_remove;

	if (!plat_priv->driver_ops)
+1 −0
Original line number Diff line number Diff line
@@ -142,6 +142,7 @@ enum cnss_driver_state {
	CNSS_DRIVER_RECOVERY,
	CNSS_FW_BOOT_RECOVERY,
	CNSS_DEV_ERR_NOTIFY,
	CNSS_DRIVER_DEBUG,
};

struct cnss_recovery_data {