summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJon Mayo <jmayo@nvidia.com>2011-08-26 14:49:03 -0700
committerSimone Willett <swillett@nvidia.com>2011-09-19 17:22:19 -0700
commit1d39d430ad90a027be43323f65eef85a3a30faab (patch)
treeab33c4745c507f9774340e822b3e68c2f39b9be9 /drivers
parent21cf13c123684153a524cb199d95e20bc5bca883 (diff)
video: tegra: dc: improve underflow statistics
Collect individual underflow counts for underflow statistics to provide a more accurate number of underflows. Changed stats to use 64-bit numbers due to the larger numbers involved, about 100x from previously. Change-Id: Idac25d210fd48328a7c8295271f5a0f83bff7ef4 Reviewed-on: http://git-master/r/52940 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/tegra/dc/dc.c26
-rw-r--r--drivers/video/tegra/dc/dc_priv.h8
-rw-r--r--drivers/video/tegra/dc/dc_reg.h4
3 files changed, 27 insertions, 11 deletions
diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c
index d01e680afb5a..4b3bacc7be60 100644
--- a/drivers/video/tegra/dc/dc.c
+++ b/drivers/video/tegra/dc/dc.c
@@ -417,10 +417,10 @@ static int dbg_dc_stats_show(struct seq_file *s, void *unused)
mutex_lock(&dc->lock);
seq_printf(s,
- "underflows: %u\n"
- "underflows_a: %u\n"
- "underflows_b: %u\n"
- "underflows_c: %u\n",
+ "underflows: %llu\n"
+ "underflows_a: %llu\n"
+ "underflows_b: %llu\n"
+ "underflows_c: %llu\n",
dc->stats.underflows,
dc->stats.underflows_a,
dc->stats.underflows_b,
@@ -1965,6 +1965,15 @@ static void tegra_dc_continuous_irq(struct tegra_dc *dc, unsigned long status)
}
#endif
+/* return an arbitrarily large number if count overflow occurs.
+ * make it a nice base-10 number to show up in stats output */
+static u64 tegra_dc_underflow_count(struct tegra_dc *dc, unsigned reg)
+{
+ unsigned count = tegra_dc_readl(dc, reg);
+ tegra_dc_writel(dc, 0, reg);
+ return ((count & 0x80000000) == 0) ? count : 10000000000ll;
+}
+
static irqreturn_t tegra_dc_irq(int irq, void *ptr)
{
#ifdef CONFIG_TEGRA_SILICON_PLATFORM
@@ -1991,11 +2000,14 @@ static irqreturn_t tegra_dc_irq(int irq, void *ptr)
dc->underflow_mask |= underflow_mask;
dc->stats.underflows++;
if (status & WIN_A_UF_INT)
- dc->stats.underflows_a++;
+ dc->stats.underflows_a += tegra_dc_underflow_count(dc,
+ DC_WINBUF_AD_UFLOW_STATUS);
if (status & WIN_B_UF_INT)
- dc->stats.underflows_b++;
+ dc->stats.underflows_b += tegra_dc_underflow_count(dc,
+ DC_WINBUF_BD_UFLOW_STATUS);
if (status & WIN_C_UF_INT)
- dc->stats.underflows_c++;
+ dc->stats.underflows_c += tegra_dc_underflow_count(dc,
+ DC_WINBUF_CD_UFLOW_STATUS);
}
if (dc->out->flags & TEGRA_DC_OUT_ONE_SHOT_MODE)
diff --git a/drivers/video/tegra/dc/dc_priv.h b/drivers/video/tegra/dc/dc_priv.h
index b108967cd8b2..9b29a18276f4 100644
--- a/drivers/video/tegra/dc/dc_priv.h
+++ b/drivers/video/tegra/dc/dc_priv.h
@@ -124,10 +124,10 @@ struct tegra_dc {
struct work_struct vblank_work;
struct {
- unsigned underflows;
- unsigned underflows_a;
- unsigned underflows_b;
- unsigned underflows_c;
+ u64 underflows;
+ u64 underflows_a;
+ u64 underflows_b;
+ u64 underflows_c;
} stats;
struct tegra_dc_ext *ext;
diff --git a/drivers/video/tegra/dc/dc_reg.h b/drivers/video/tegra/dc/dc_reg.h
index 1e02d45c7c92..43b41cc02398 100644
--- a/drivers/video/tegra/dc/dc_reg.h
+++ b/drivers/video/tegra/dc/dc_reg.h
@@ -471,6 +471,10 @@
#define DC_WINBUF_ADDR_V_OFFSET_NS 0x809
#define DC_WINBUF_UFLOW_STATUS 0x80a
+/* direct versions of DC_WINBUF_UFLOW_STATUS */
+#define DC_WINBUF_AD_UFLOW_STATUS 0xbca
+#define DC_WINBUF_BD_UFLOW_STATUS 0xdca
+#define DC_WINBUF_CD_UFLOW_STATUS 0xfca
#define DC_DISP_SD_CONTROL 0x4c2
#define SD_ENABLE_NORMAL (1 << 0)