msm_fb: display: add mdp clock control to histogram enable/disable

Add mdp clock control to histogram enable and disable block to
prevent system from crashing when accessing register with mdp
clocks off.

Change-Id: Ide808b332b5456f3fc639fcbb0d03d5cad0e387f
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
This commit is contained in:
Kuogee Hsieh 2013-01-30 14:26:42 -08:00 committed by Iliyan Malchev
parent ed2f609893
commit b6b3f16609

View file

@ -377,11 +377,13 @@ static int mdp_hist_lut_write_off(struct mdp_hist_lut_data *data,
pr_err("%s: Error copying histogram data", __func__);
return -ENOMEM;
}
mdp_clk_ctrl(1);
mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_ON, FALSE);
for (i = 0; i < MDP_HIST_LUT_SIZE; i++)
MDP_OUTP(MDP_BASE + base + offset + (0x400*(sel)) + (4*i),
element[i]);
mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_OFF, FALSE);
mdp_clk_ctrl(0);
return 0;
}
@ -911,6 +913,7 @@ static int mdp_histogram_enable(struct mdp_hist_mgmt *mgmt)
return -EINVAL;
}
mdp_clk_ctrl(1);
mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_ON, FALSE);
base = (uint32_t) (MDP_BASE + mgmt->base);
/*First make sure that device is not collecting histogram*/
@ -952,6 +955,7 @@ static int mdp_histogram_enable(struct mdp_hist_mgmt *mgmt)
mgmt->mdp_is_hist_init = FALSE;
__mdp_histogram_reset(mgmt);
mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_OFF, FALSE);
mdp_clk_ctrl(0);
return 0;
}
@ -970,6 +974,7 @@ static int mdp_histogram_disable(struct mdp_hist_mgmt *mgmt)
base = (uint32_t) (MDP_BASE + mgmt->base);
mdp_clk_ctrl(1);
mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_ON, FALSE);
spin_lock_irqsave(&mdp_spin_lock, flag);
outp32(MDP_INTR_CLEAR, mgmt->intr);
@ -986,6 +991,7 @@ static int mdp_histogram_disable(struct mdp_hist_mgmt *mgmt)
MDP_OUTP(base + 0x0018, INTR_HIST_DONE | INTR_HIST_RESET_SEQ_DONE);
mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_OFF, FALSE);
mdp_clk_ctrl(0);
if (mgmt->hist != NULL) {
mgmt->hist = NULL;
@ -1287,12 +1293,14 @@ static void mdp_hist_read_work(struct work_struct *data)
if (mgmt->mdp_is_hist_init == FALSE)
mgmt->mdp_is_hist_init = TRUE;
mdp_clk_ctrl(1);
mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_ON, FALSE);
if (!ret && hist_ready)
__mdp_histogram_kickoff(mgmt);
else
__mdp_histogram_reset(mgmt);
mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_OFF, FALSE);
mdp_clk_ctrl(0);
error:
mutex_unlock(&mgmt->mdp_hist_mutex);