summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenet Clark <benetc@codeaurora.org>2013-11-19 17:17:01 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:23:36 -0700
commit3dadb7f6ad23d1b40cd3d22899a42d546ef5d27e (patch)
treeeac33115314f8fe85287ee29193ecf0e1ffa4337
parent41045fd95b527bd3f7a3e7e0d320dfb953f10364 (diff)
msm: mdss: Add six zone LUT size as PAv2 parameter
Added six zone LUT size as a parameter to PAv2 in order for the size to be specified by the user. This size is sanitized based on the required LUT size. Change-Id: Iaf1b418ce1a3ec4b5013b1192c7f3b7de5827e3d Signed-off-by: Benet Clark <benetc@codeaurora.org>
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp_hwio.h1
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp_pp.c22
-rw-r--r--include/uapi/linux/msm_mdp.h3
3 files changed, 16 insertions, 10 deletions
diff --git a/drivers/video/fbdev/msm/mdss_mdp_hwio.h b/drivers/video/fbdev/msm/mdss_mdp_hwio.h
index 08b237f0b797..302ad57c80d7 100644
--- a/drivers/video/fbdev/msm/mdss_mdp_hwio.h
+++ b/drivers/video/fbdev/msm/mdss_mdp_hwio.h
@@ -20,7 +20,6 @@
#define GC_LUT_SEGMENTS 16
#define ENHIST_LUT_ENTRIES 256
#define HIST_V_SIZE 256
-#define SIX_ZONE_LUT_ENTRIES 384
#define MDSS_MDP_HW_REV_100 0x10000000
#define MDSS_MDP_HW_REV_102 0x10020000
diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp.c b/drivers/video/fbdev/msm/mdss_mdp_pp.c
index b0cf024dfeff..8765e744edd2 100644
--- a/drivers/video/fbdev/msm/mdss_mdp_pp.c
+++ b/drivers/video/fbdev/msm/mdss_mdp_pp.c
@@ -289,8 +289,8 @@ struct mdss_pp_res_type {
u32 enhist_lut[MDSS_BLOCK_DISP_NUM][ENHIST_LUT_ENTRIES];
struct mdp_pa_cfg pa_disp_cfg[MDSS_BLOCK_DISP_NUM];
struct mdp_pa_v2_data pa_v2_disp_cfg[MDSS_BLOCK_DISP_NUM];
- u32 six_zone_lut_curve_p0[MDSS_BLOCK_DISP_NUM][SIX_ZONE_LUT_ENTRIES];
- u32 six_zone_lut_curve_p1[MDSS_BLOCK_DISP_NUM][SIX_ZONE_LUT_ENTRIES];
+ u32 six_zone_lut_curve_p0[MDSS_BLOCK_DISP_NUM][MDP_SIX_ZONE_LUT_SIZE];
+ u32 six_zone_lut_curve_p1[MDSS_BLOCK_DISP_NUM][MDP_SIX_ZONE_LUT_SIZE];
struct mdp_pcc_cfg_data pcc_disp_cfg[MDSS_BLOCK_DISP_NUM];
struct mdp_igc_lut_data igc_disp_cfg[MDSS_BLOCK_DISP_NUM];
struct mdp_pgc_lut_data argc_disp_cfg[MDSS_BLOCK_DISP_NUM];
@@ -641,7 +641,7 @@ static void pp_update_pa_v2_six_zone_regs(char __iomem *addr,
data, addr);
/* Remove Index Update */
- for (i = 1; i < SIX_ZONE_LUT_ENTRIES; i++) {
+ for (i = 1; i < MDP_SIX_ZONE_LUT_SIZE; i++) {
addr += 4;
writel_relaxed(pa_v2_config->six_zone_curve_p1[i],
addr);
@@ -1928,10 +1928,13 @@ static int pp_read_pa_v2_regs(char __iomem *addr,
/* Six zone LUT and thresh data */
if (pa_v2_config->flags & MDP_PP_PA_SIX_ZONE_ENABLE) {
+ if (pa_v2_config->six_zone_len != MDP_SIX_ZONE_LUT_SIZE)
+ return -EINVAL;
+
data = (3 << 25);
writel_relaxed(data, addr);
- for (i = 0; i < SIX_ZONE_LUT_ENTRIES; i++) {
+ for (i = 0; i < MDP_SIX_ZONE_LUT_SIZE; i++) {
addr += 4;
mdss_pp_res->six_zone_lut_curve_p1[disp_num][i] =
readl_relaxed(addr);
@@ -1942,13 +1945,13 @@ static int pp_read_pa_v2_regs(char __iomem *addr,
if (copy_to_user(pa_v2_config->six_zone_curve_p0,
&mdss_pp_res->six_zone_lut_curve_p0[disp_num][0],
- SIX_ZONE_LUT_ENTRIES * sizeof(u32))) {
+ pa_v2_config->six_zone_len * sizeof(u32))) {
return -EFAULT;
}
if (copy_to_user(pa_v2_config->six_zone_curve_p1,
&mdss_pp_res->six_zone_lut_curve_p1[disp_num][0],
- SIX_ZONE_LUT_ENTRIES * sizeof(u32))) {
+ pa_v2_config->six_zone_len * sizeof(u32))) {
return -EFAULT;
}
@@ -1993,14 +1996,17 @@ static void pp_read_pa_mem_col_regs(char __iomem *addr,
static int pp_copy_pa_six_zone_lut(struct mdp_pa_v2_cfg_data *pa_v2_config,
u32 disp_num)
{
+ if (pa_v2_config->pa_v2_data.six_zone_len != MDP_SIX_ZONE_LUT_SIZE)
+ return -EINVAL;
+
if (copy_from_user(&mdss_pp_res->six_zone_lut_curve_p0[disp_num][0],
pa_v2_config->pa_v2_data.six_zone_curve_p0,
- SIX_ZONE_LUT_ENTRIES * sizeof(u32))) {
+ pa_v2_config->pa_v2_data.six_zone_len * sizeof(u32))) {
return -EFAULT;
}
if (copy_from_user(&mdss_pp_res->six_zone_lut_curve_p1[disp_num][0],
pa_v2_config->pa_v2_data.six_zone_curve_p1,
- SIX_ZONE_LUT_ENTRIES * sizeof(u32))) {
+ pa_v2_config->pa_v2_data.six_zone_len * sizeof(u32))) {
return -EFAULT;
}
diff --git a/include/uapi/linux/msm_mdp.h b/include/uapi/linux/msm_mdp.h
index 9964ac6a31d1..beaeda198f2e 100644
--- a/include/uapi/linux/msm_mdp.h
+++ b/include/uapi/linux/msm_mdp.h
@@ -412,7 +412,7 @@ struct mdp_pa_mem_col_cfg {
uint32_t val_region;
};
-#define MDP_SIX_ZONE_TABLE_NUM 384
+#define MDP_SIX_ZONE_LUT_SIZE 384
struct mdp_pa_v2_data {
/* Mask bits for PA features */
@@ -421,6 +421,7 @@ struct mdp_pa_v2_data {
uint32_t global_sat_adj;
uint32_t global_val_adj;
uint32_t global_cont_adj;
+ uint32_t six_zone_len;
uint32_t *six_zone_curve_p0;
uint32_t *six_zone_curve_p1;
uint32_t six_zone_thresh;