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

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

Merge "cnss2: Add verbose IPC debug logging option"

parents 3ac00c9f fc1ff6f1
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include "pci.h"

void *cnss_ipc_log_context;
void *cnss_ipc_log_long_context;

static int cnss_pin_connect_show(struct seq_file *s, void *data)
{
@@ -762,7 +763,15 @@ int cnss_debug_init(void)
	cnss_ipc_log_context = ipc_log_context_create(CNSS_IPC_LOG_PAGES,
						      "cnss", 0);
	if (!cnss_ipc_log_context) {
		cnss_pr_err("Unable to create IPC log context!\n");
		cnss_pr_err("Unable to create IPC log context\n");
		return -EINVAL;
	}

	cnss_ipc_log_long_context = ipc_log_context_create(CNSS_IPC_LOG_PAGES,
							   "cnss-long", 0);
	if (!cnss_ipc_log_long_context) {
		cnss_pr_err("Unable to create IPC long log context\n");
		ipc_log_context_destroy(cnss_ipc_log_context);
		return -EINVAL;
	}

@@ -771,6 +780,11 @@ int cnss_debug_init(void)

void cnss_debug_deinit(void)
{
	if (cnss_ipc_log_long_context) {
		ipc_log_context_destroy(cnss_ipc_log_long_context);
		cnss_ipc_log_long_context = NULL;
	}

	if (cnss_ipc_log_context) {
		ipc_log_context_destroy(cnss_ipc_log_context);
		cnss_ipc_log_context = NULL;
+12 −0
Original line number Diff line number Diff line
@@ -10,12 +10,18 @@
#define CNSS_IPC_LOG_PAGES		32

extern void *cnss_ipc_log_context;
extern void *cnss_ipc_log_long_context;

#define cnss_ipc_log_string(_x...) do {					\
		if (cnss_ipc_log_context)				\
			ipc_log_string(cnss_ipc_log_context, _x);	\
	} while (0)

#define cnss_ipc_log_long_string(_x...) do {				\
		if (cnss_ipc_log_long_context)				\
			ipc_log_string(cnss_ipc_log_long_context, _x);	\
	} while (0)

#define cnss_pr_err(_fmt, ...) do {					\
		printk("%scnss: " _fmt, KERN_ERR, ##__VA_ARGS__);	\
		cnss_ipc_log_string("%scnss: " _fmt, "", ##__VA_ARGS__);\
@@ -36,6 +42,12 @@ extern void *cnss_ipc_log_context;
		cnss_ipc_log_string("%scnss: " _fmt, "", ##__VA_ARGS__);\
	} while (0)

#define cnss_pr_vdbg(_fmt, ...) do {					\
		printk("%scnss: " _fmt, KERN_DEBUG, ##__VA_ARGS__);	\
		cnss_ipc_log_long_string("%scnss: " _fmt, "",		\
					 ##__VA_ARGS__);		\
	} while (0)

#ifdef CONFIG_CNSS2_DEBUG
#define CNSS_ASSERT(_condition) do {					\
		if (!(_condition)) {					\
+10 −10
Original line number Diff line number Diff line
@@ -367,7 +367,7 @@ static int cnss_set_pci_link_status(struct cnss_pci_data *pci_priv,
{
	u16 link_speed, link_width;

	cnss_pr_dbg("Set PCI link status to: %u\n", status);
	cnss_pr_vdbg("Set PCI link status to: %u\n", status);

	switch (status) {
	case PCI_GEN1:
@@ -401,13 +401,13 @@ static int cnss_set_pci_link(struct cnss_pci_data *pci_priv, bool link_up)
	struct pci_dev *pci_dev = pci_priv->pci_dev;
	enum msm_pcie_pm_opt pm_ops;

	cnss_pr_dbg("%s PCI link\n", link_up ? "Resuming" : "Suspending");
	cnss_pr_vdbg("%s PCI link\n", link_up ? "Resuming" : "Suspending");

	if (link_up) {
		pm_ops = MSM_PCIE_RESUME;
	} else {
		if (pci_priv->drv_connected_last) {
			cnss_pr_dbg("Use PCIe DRV suspend\n");
			cnss_pr_vdbg("Use PCIe DRV suspend\n");
			pm_ops = MSM_PCIE_DRV_SUSPEND;
			cnss_set_pci_link_status(pci_priv, PCI_GEN1);
		} else {
@@ -692,7 +692,7 @@ static int cnss_pci_set_mhi_state(struct cnss_pci_data *pci_priv,
	if (ret)
		goto out;

	cnss_pr_dbg("Setting MHI state: %s(%d)\n",
	cnss_pr_vdbg("Setting MHI state: %s(%d)\n",
		     cnss_mhi_state_to_str(mhi_state), mhi_state);

	switch (mhi_state) {
@@ -1909,7 +1909,7 @@ static int cnss_pci_runtime_suspend(struct device *dev)
		return -EAGAIN;
	}

	cnss_pr_dbg("Runtime suspend start\n");
	cnss_pr_vdbg("Runtime suspend start\n");

	if (!test_bit(DISABLE_DRV, &plat_priv->ctrl_params.quirks))
		pci_priv->drv_connected_last =
@@ -1925,7 +1925,7 @@ static int cnss_pci_runtime_suspend(struct device *dev)
	if (ret)
		pci_priv->drv_connected_last = 0;

	cnss_pr_info("Runtime suspend status: %d\n", ret);
	cnss_pr_vdbg("Runtime suspend status: %d\n", ret);

	return ret;
}
@@ -1948,7 +1948,7 @@ static int cnss_pci_runtime_resume(struct device *dev)
		return -EAGAIN;
	}

	cnss_pr_dbg("Runtime resume start\n");
	cnss_pr_vdbg("Runtime resume start\n");

	driver_ops = pci_priv->driver_ops;
	if (driver_ops && driver_ops->runtime_ops &&
@@ -1960,14 +1960,14 @@ static int cnss_pci_runtime_resume(struct device *dev)
	if (!ret)
		pci_priv->drv_connected_last = 0;

	cnss_pr_info("Runtime resume status: %d\n", ret);
	cnss_pr_vdbg("Runtime resume status: %d\n", ret);

	return ret;
}

static int cnss_pci_runtime_idle(struct device *dev)
{
	cnss_pr_dbg("Runtime idle\n");
	cnss_pr_vdbg("Runtime idle\n");

	pm_request_autosuspend(dev);