From 2fc67de301ee142a82aa53fcbf432f7b7eaa5af7 Mon Sep 17 00:00:00 2001 From: "woncheon.an" Date: Mon, 13 Feb 2017 15:42:32 +0900 Subject: [PATCH] [COMMON] media: scaler: add debugging log for g2d power domain We get the channel information before suspend resume callback to debug the hw state. Change-Id: I395a8fa01209e209a3e36ac9b7d75e7adc4117ee Signed-off-by: woncheon.an --- .../platform/exynos/scaler/scaler-core.c | 33 +++++++++++++++++++ drivers/media/platform/exynos/scaler/scaler.h | 11 +++++++ 2 files changed, 44 insertions(+) diff --git a/drivers/media/platform/exynos/scaler/scaler-core.c b/drivers/media/platform/exynos/scaler/scaler-core.c index ea01d5c66bed..940dea7f38e6 100644 --- a/drivers/media/platform/exynos/scaler/scaler-core.c +++ b/drivers/media/platform/exynos/scaler/scaler-core.c @@ -23,6 +23,8 @@ #include #include +#include + #include #include #include @@ -3439,6 +3441,16 @@ static int sc_runtime_resume(struct device *dev) static int sc_runtime_suspend(struct device *dev) { struct sc_dev *sc = dev_get_drvdata(dev); + const int *ptr = sc->q_reg; + int i, idx; + + idx = sc->dbg_idx % SC_DEBUG_MAX_NUM; + sc->qch_dbg[idx].time = sched_clock(); + for (i = 0; i < G2D_QCH_NUM; i++) + sc->qch_dbg[idx].log[i] = ptr[i]; + + sc->dbg_idx++; + if (sc->qosreq_int_level > 0) pm_qos_update_request(&sc->qosreq_int, 0); return 0; @@ -3568,6 +3580,19 @@ static int sc_probe(struct platform_device *pdev) } } + sc->q_reg = ioremap(0x13a07000, 0x100); + if (sc->q_reg == NULL) { + dev_err(&pdev->dev, "failed to ioremap address region\n"); + ret = -ENOENT; + goto err_qch_reg; + } + + sc->qch_dbg = kzalloc(sizeof(struct sc_qch_dbg) * SC_DEBUG_MAX_NUM, GFP_KERNEL); + if (sc->qch_dbg == NULL) { + ret = -ENOENT; + goto err_qch_dbg; + } + sc->version = SCALER_VERSION(2, 0, 0); hwver = __raw_readl(sc->regs + SCALER_VER); @@ -3599,6 +3624,11 @@ static int sc_probe(struct platform_device *pdev) hwver, sc->version); return 0; +err_qch_dbg: + iounmap(sc->q_reg); +err_qch_reg: + if (!IS_ERR(sc->aclk)) + clk_disable_unprepare(sc->aclk); err_ver_aclk_get: if (!IS_ERR(sc->pclk)) clk_disable_unprepare(sc->pclk); @@ -3620,6 +3650,9 @@ static int sc_remove(struct platform_device *pdev) { struct sc_dev *sc = platform_get_drvdata(pdev); + iounmap(sc->q_reg); + kfree(sc->qch_dbg); + iovmm_deactivate(sc->dev); sc_clk_put(sc); diff --git a/drivers/media/platform/exynos/scaler/scaler.h b/drivers/media/platform/exynos/scaler/scaler.h index 2f8a1b1585c5..ba4b3fa51a70 100644 --- a/drivers/media/platform/exynos/scaler/scaler.h +++ b/drivers/media/platform/exynos/scaler/scaler.h @@ -39,6 +39,9 @@ extern int sc_log_level; #define SC_TIMEOUT (2 * HZ) /* 2 seconds */ #define SC_WDT_CNT 3 #define SC_MAX_CTRL_NUM 11 +#define SC_QCH_SIZE (sizeof(u32) * 21) +#define SC_DEBUG_MAX_NUM 16 +#define G2D_QCH_NUM 21 #define SC_MAX_PLANES 3 /* Address index */ @@ -353,6 +356,11 @@ struct sc_dnoise_filter { u32 h; }; +struct sc_qch_dbg { + unsigned long long time; + u32 log[G2D_QCH_NUM]; +}; + struct sc_ctx; /* @@ -387,6 +395,7 @@ struct sc_dev { struct clk *clk_chld; struct clk *clk_parn; void __iomem *regs; + void __iomem *q_reg; struct resource *regs_res; struct workqueue_struct *qosclr_int_wq; wait_queue_head_t wait; @@ -404,6 +413,8 @@ struct sc_dev { u32 version; bool pb_disable; u32 cfw; + int dbg_idx; + struct sc_qch_dbg *qch_dbg; }; enum SC_CONTEXT_TYPE { -- 2.20.1