video: msm: Add Histogram collection framework for MDP blocks
Expand the previous histogram collection implementation to support the
addition of other MDP blocks that allow for histogram data collection.
Support the VG1, VG2, DMA-P, and DMA-S histograms using this new
framework (VG pipes only supplying the histogram of luminance).
Change-Id: I94088c1f714fa5d91256ae7b0f5548f8a0b81763
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
diff --git a/drivers/video/msm/mdp4_util.c b/drivers/video/msm/mdp4_util.c
index a197c90..3aa848c 100644
--- a/drivers/video/msm/mdp4_util.c
+++ b/drivers/video/msm/mdp4_util.c
@@ -358,6 +358,9 @@
{
uint32 isr, mask, panel;
struct mdp_dma_data *dma;
+ struct mdp_hist_mgmt *mgmt = NULL;
+ char *base_addr;
+ int i, ret;
mdp_is_in_isr = TRUE;
@@ -379,10 +382,17 @@
/* When underun occurs mdp clear the histogram registers
that are set before in hw_init so restore them back so
that histogram works.*/
- MDP_OUTP(MDP_BASE + 0x95010, 1);
- outpdw(MDP_BASE + 0x9501c, INTR_HIST_DONE);
- mdp_is_hist_valid = FALSE;
- __mdp_histogram_reset();
+ for (i = 0; i < MDP_HIST_MGMT_MAX; i++) {
+ mgmt = mdp_hist_mgmt_array[i];
+ if (!mgmt)
+ continue;
+ base_addr = MDP_BASE + mgmt->base;
+ MDP_OUTP(base_addr + 0x010, 1);
+ outpdw(base_addr + 0x01c, INTR_HIST_DONE |
+ INTR_HIST_RESET_SEQ_DONE);
+ mgmt->mdp_is_hist_valid = FALSE;
+ __mdp_histogram_reset(mgmt);
+ }
}
if (isr & INTR_EXTERNAL_INTF_UDERRUN)
@@ -556,24 +566,27 @@
}
if (isr & INTR_DMA_P_HISTOGRAM) {
mdp4_stat.intr_histogram++;
- isr = inpdw(MDP_DMA_P_HIST_INTR_STATUS);
- mask = inpdw(MDP_DMA_P_HIST_INTR_ENABLE);
- outpdw(MDP_DMA_P_HIST_INTR_CLEAR, isr);
- mb();
- isr &= mask;
- if (isr & INTR_HIST_RESET_SEQ_DONE)
- __mdp_histogram_kickoff();
-
- if (isr & INTR_HIST_DONE) {
- if (waitqueue_active(&mdp_hist_comp.wait)) {
- if (!queue_work(mdp_hist_wq,
- &mdp_histogram_worker)) {
- pr_err("%s - can't queue hist_read\n",
- __func__);
- }
- } else
- __mdp_histogram_reset();
- }
+ ret = mdp_histogram_block2mgmt(MDP_BLOCK_DMA_P, &mgmt);
+ if (!ret)
+ mdp_histogram_handle_isr(mgmt);
+ }
+ if (isr & INTR_DMA_S_HISTOGRAM) {
+ mdp4_stat.intr_histogram++;
+ ret = mdp_histogram_block2mgmt(MDP_BLOCK_DMA_S, &mgmt);
+ if (!ret)
+ mdp_histogram_handle_isr(mgmt);
+ }
+ if (isr & INTR_VG1_HISTOGRAM) {
+ mdp4_stat.intr_histogram++;
+ ret = mdp_histogram_block2mgmt(MDP_BLOCK_VG_1, &mgmt);
+ if (!ret)
+ mdp_histogram_handle_isr(mgmt);
+ }
+ if (isr & INTR_VG2_HISTOGRAM) {
+ mdp4_stat.intr_histogram++;
+ ret = mdp_histogram_block2mgmt(MDP_BLOCK_VG_2, &mgmt);
+ if (!ret)
+ mdp_histogram_handle_isr(mgmt);
}
out: