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

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

Merge "msm: mdss: debugfs: xlog: move reg dump function to xlog"

parents e5f930a3 e2f34d97
Loading
Loading
Loading
Loading
+1 −68
Original line number Diff line number Diff line
/* Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2009-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -663,73 +663,6 @@ int mdss_debugfs_remove(struct mdss_data_type *mdata)
	return 0;
}

void mdss_dump_reg(struct mdss_debug_base *dbg, u32 reg_dump_flag)
{
	char *addr;
	u32 *dump_addr = NULL;
	int len;
	int i;
	bool in_log, in_mem;

	if (!dbg || !dbg->base) {
		pr_err("dbg base is null!\n");
		return;
	}

	in_log = (reg_dump_flag & MDSS_REG_DUMP_IN_LOG);
	in_mem = (reg_dump_flag & MDSS_REG_DUMP_IN_MEM);

	addr = dbg->base;
	len = dbg->max_offset;

	if (len % 16)
		len += 16;
	len /= 16;

	pr_info("reg_dump_flag=%d in_log=%d in_mem=%d\n", reg_dump_flag, in_log,
		in_mem);
	pr_info("=========%s DUMP=========\n", dbg->name);

	if (in_mem) {
		if (!dbg->reg_dump)
			dbg->reg_dump = kzalloc(len * 16, GFP_KERNEL);

		if (dbg->reg_dump) {
			dump_addr = dbg->reg_dump;
			pr_info("start_addr:%p end_addr:%p reg_addr=%p\n",
				dump_addr, dump_addr + (u32)len * 16,
				addr);
		} else {
			in_mem = false;
			pr_err("reg_dump: kzalloc fails!\n");
		}
	}

	mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON);
	for (i = 0; i < len; i++) {
		u32 x0, x4, x8, xc;

		x0 = readl_relaxed(addr+0x0);
		x4 = readl_relaxed(addr+0x4);
		x8 = readl_relaxed(addr+0x8);
		xc = readl_relaxed(addr+0xc);

		if (in_log)
			pr_info("%p : %08x %08x %08x %08x\n", addr, x0, x4, x8,
				xc);

		if (dump_addr && in_mem) {
			dump_addr[i*4] = x0;
			dump_addr[i*4 + 1] = x4;
			dump_addr[i*4 + 2] = x8;
			dump_addr[i*4 + 3] = xc;
		}

		addr += 16;
	}
	mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF);
}

int vsync_count;
static struct mdss_mdp_misr_map {
	u32 ctrl_reg;
+0 −3
Original line number Diff line number Diff line
@@ -111,7 +111,6 @@ void mdss_misr_crc_collect(struct mdss_data_type *mdata, int block_id);

int mdss_create_xlog_debug(struct mdss_debug_data *mdd);
void mdss_xlog(const char *name, int line, int flag, ...);
void mdss_dump_reg(struct mdss_debug_base *dbg, u32 reg_dump_flag);
void mdss_xlog_tout_handler_default(const char *name, ...);
int mdss_xlog_tout_handler_iommu(struct iommu_domain *domain,
	struct device *dev, unsigned long iova, int flags, void *token);
@@ -136,8 +135,6 @@ static inline void mdss_misr_crc_collect(struct mdss_data_type *mdata,

static inline int create_xlog_debug(struct mdss_data_type *mdata) { return 0; }
static inline void mdss_xlog_dump(void) { }
static inline void mdss_dump_reg(struct mdss_debug_base *dbg,
	u32 reg_dump_flag) { }
static inline void mdss_xlog(const char *name, int line, int flag...) { }
static inline void mdss_dsi_debug_check_te(struct mdss_panel_data *pdata) { }
static inline void mdss_xlog_tout_handler_default(const char *name, ...) { }
+67 −0
Original line number Diff line number Diff line
@@ -175,6 +175,73 @@ static void mdss_xlog_dump_all(void)
	}
}

static void mdss_dump_reg(struct mdss_debug_base *dbg, u32 reg_dump_flag)
{
	char *addr;
	u32 *dump_addr = NULL;
	int len;
	int i;
	bool in_log, in_mem;

	if (!dbg || !dbg->base) {
		pr_err("dbg base is null!\n");
		return;
	}

	in_log = (reg_dump_flag & MDSS_REG_DUMP_IN_LOG);
	in_mem = (reg_dump_flag & MDSS_REG_DUMP_IN_MEM);

	addr = dbg->base;
	len = dbg->max_offset;

	if (len % 16)
		len += 16;
	len /= 16;

	pr_info("reg_dump_flag=%d in_log=%d in_mem=%d\n", reg_dump_flag, in_log,
		in_mem);
	pr_info("%s:=========%s DUMP=========\n", __func__, dbg->name);

	if (in_mem) {
		if (!dbg->reg_dump)
			dbg->reg_dump = kzalloc(len * 16, GFP_KERNEL);

		if (dbg->reg_dump) {
			dump_addr = dbg->reg_dump;
			pr_info("start_addr:%p end_addr:%p reg_addr=%p\n",
				dump_addr, dump_addr + (u32)len * 16,
				addr);
		} else {
			in_mem = false;
			pr_err("reg_dump: kzalloc fails!\n");
		}
	}

	mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON);
	for (i = 0; i < len; i++) {
		u32 x0, x4, x8, xc;

		x0 = readl_relaxed(addr+0x0);
		x4 = readl_relaxed(addr+0x4);
		x8 = readl_relaxed(addr+0x8);
		xc = readl_relaxed(addr+0xc);

		if (in_log)
			pr_info("%p : %08x %08x %08x %08x\n", addr, x0, x4, x8,
				xc);

		if (dump_addr && in_mem) {
			dump_addr[i*4] = x0;
			dump_addr[i*4 + 1] = x4;
			dump_addr[i*4 + 2] = x8;
			dump_addr[i*4 + 3] = xc;
		}

		addr += 16;
	}
	mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF);
}

static void mdss_dump_reg_by_blk(const char *blk_name)
{
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();