diff options
| author | Benet Clark <benetc@codeaurora.org> | 2013-09-10 17:33:21 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 20:21:43 -0700 |
| commit | 752f9c2a3e02bc2c190df714e68e25500f419a2c (patch) | |
| tree | b107becd9d4066513dfb798616967fdb23a46777 | |
| parent | 002c312500b9ebab08b9fd62b82703cbeaeba0d9 (diff) | |
msm: mdss: Make DSPP PP setup more modular
The previous DSPP PP setup function included config functions for each
of the different PP blocks except for dither. Now there is a dither setup
function, as well as an opmode setup function in order to clean up what is
done inside DSPP PP setup.
Change-Id: Ia347c35bb675e20531272566647a364f6e68468c
Signed-off-by: Benet Clark <benetc@codeaurora.org>
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_hwio.h | 12 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_pp.c | 128 |
2 files changed, 84 insertions, 56 deletions
diff --git a/drivers/video/fbdev/msm/mdss_mdp_hwio.h b/drivers/video/fbdev/msm/mdss_mdp_hwio.h index 972cf82c2672..a13c5be41395 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_hwio.h +++ b/drivers/video/fbdev/msm/mdss_mdp_hwio.h @@ -216,6 +216,8 @@ enum mdss_mdp_sspp_chroma_samp_type { #define MDSS_MDP_REG_VIG_QSEED2_SHARP 0x230 #define MDSS_MDP_REG_VIG_PA_BASE 0x310 +#define MDSS_MDP_VIG_OP_PA_EN BIT(4) + #define MDSS_MDP_REG_SCALE_CONFIG 0x204 #define MDSS_MDP_REG_SCALE_PHASE_STEP_X 0x210 #define MDSS_MDP_REG_SCALE_PHASE_STEP_Y 0x214 @@ -411,6 +413,16 @@ enum mdss_mdp_dspp_index { #define MDSS_MDP_REG_DSPP_GAMUT_BASE 0x2DC #define MDSS_MDP_REG_DSPP_GC_BASE 0x2B0 +#define MDSS_MDP_DSPP_OP_IGC_LUT_EN BIT(0) +#define MDSS_MDP_DSPP_OP_PCC_EN BIT(4) +#define MDSS_MDP_DSPP_OP_DST_DITHER_EN BIT(8) +#define MDSS_MDP_DSPP_OP_HIST_EN BIT(16) +#define MDSS_MDP_DSPP_OP_HIST_LUTV_EN BIT(19) +#define MDSS_MDP_DSPP_OP_PA_EN BIT(20) +#define MDSS_MDP_DSPP_OP_ARGC_LUT_EN BIT(22) +#define MDSS_MDP_DSPP_OP_GAMUT_EN BIT(23) +#define MDSS_MDP_DSPP_OP_GAMUT_PCC_ORDER BIT(24) + enum mdss_mpd_intf_index { MDSS_MDP_NO_INTF, MDSS_MDP_INTF0, diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp.c b/drivers/video/fbdev/msm/mdss_mdp_pp.c index d98c2381baca..ed95030f70d4 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_pp.c +++ b/drivers/video/fbdev/msm/mdss_mdp_pp.c @@ -308,6 +308,10 @@ static void pp_igc_config(unsigned long flags, char __iomem *addr, static void pp_enhist_config(unsigned long flags, char __iomem *addr, struct pp_sts_type *pp_sts, struct mdp_hist_lut_data *enhist_cfg); +static void pp_dither_config(char __iomem *addr, + struct pp_sts_type *pp_sts, + struct mdp_dither_cfg_data *dither_cfg); +static void pp_dspp_opmode_config(struct pp_sts_type *pp_sts, u32 *opmode); static void pp_sharp_config(char __iomem *addr, struct pp_sts_type *pp_sts, struct mdp_sharp_cfg *sharp_config); @@ -602,7 +606,7 @@ static int pp_vig_pipe_setup(struct mdss_mdp_pipe *pipe, u32 *op) &pipe->pp_cfg.pa_cfg); if (pipe->pp_res.pp_sts.pa_sts & PP_STS_ENABLE) - opmode |= (1 << 4); /* PA_EN */ + opmode |= MDSS_MDP_VIG_OP_PA_EN; } if (pipe->pp_cfg.config_ops & MDP_OVERLAY_PP_HIST_LUT_CFG) { @@ -1014,15 +1018,67 @@ error: return ret; } +static void pp_dither_config(char __iomem *addr, + struct pp_sts_type *pp_sts, + struct mdp_dither_cfg_data *dither_cfg) +{ + u32 data; + int i; + + if (dither_cfg->flags & MDP_PP_OPS_WRITE) { + data = dither_depth_map[dither_cfg->g_y_depth]; + data |= dither_depth_map[dither_cfg->b_cb_depth] << 2; + data |= dither_depth_map[dither_cfg->r_cr_depth] << 4; + writel_relaxed(data, addr); + addr += 0x14; + for (i = 0; i << 16; i += 4) { + data = dither_matrix[i] | + (dither_matrix[i + 1] << 4) | + (dither_matrix[i + 2] << 8) | + (dither_matrix[i + 3] << 12); + writel_relaxed(data, addr); + addr += 4; + } + } + if (dither_cfg->flags & MDP_PP_OPS_DISABLE) + pp_sts->dither_sts &= ~PP_STS_ENABLE; + else if (dither_cfg->flags & MDP_PP_OPS_ENABLE) + pp_sts->dither_sts |= PP_STS_ENABLE; +} + +static void pp_dspp_opmode_config(struct pp_sts_type *pp_sts, u32 *opmode) +{ + if (pp_sts->pa_sts & PP_STS_ENABLE) + *opmode |= MDSS_MDP_DSPP_OP_PA_EN; /* PA_EN */ + if (pp_sts->pcc_sts & PP_STS_ENABLE) + *opmode |= MDSS_MDP_DSPP_OP_PCC_EN; /* PCC_EN */ + + if (pp_sts->igc_sts & PP_STS_ENABLE) { + *opmode |= MDSS_MDP_DSPP_OP_IGC_LUT_EN | /* IGC_LUT_EN */ + (pp_sts->igc_tbl_idx << 1); + } + if (pp_sts->enhist_sts & PP_STS_ENABLE) { + *opmode |= MDSS_MDP_DSPP_OP_HIST_LUTV_EN | /* HIST_LUT_EN */ + MDSS_MDP_DSPP_OP_PA_EN; /* PA_EN */ + } + if (pp_sts->dither_sts & PP_STS_ENABLE) + *opmode |= MDSS_MDP_DSPP_OP_DST_DITHER_EN; /* DITHER_EN */ + if (pp_sts->gamut_sts & PP_STS_ENABLE) { + *opmode |= MDSS_MDP_DSPP_OP_GAMUT_EN; /* GAMUT_EN */ + if (pp_sts->gamut_sts & PP_STS_GAMUT_FIRST) + *opmode |= MDSS_MDP_DSPP_OP_GAMUT_PCC_ORDER; + } + if (pp_sts->pgc_sts & PP_STS_ENABLE) + *opmode |= MDSS_MDP_DSPP_OP_ARGC_LUT_EN; +} + static int pp_dspp_setup(u32 disp_num, struct mdss_mdp_mixer *mixer) { u32 flags, dspp_num, opmode = 0; - struct mdp_dither_cfg_data *dither_cfg; struct mdp_pgc_lut_data *pgc_config; struct pp_sts_type *pp_sts; - u32 data; char __iomem *base, *addr; - int i, ret = 0; + int ret = 0; struct mdss_data_type *mdata; struct mdss_mdp_ctl *ctl; u32 mixer_cnt; @@ -1079,62 +1135,23 @@ static int pp_dspp_setup(u32 disp_num, struct mdss_mdp_mixer *mixer) pp_enhist_config(flags, base + MDSS_MDP_REG_DSPP_HIST_LUT_BASE, pp_sts, &mdss_pp_res->enhist_disp_cfg[disp_num]); - if (pp_sts->pa_sts & PP_STS_ENABLE) - opmode |= (1 << 20); /* PA_EN */ - - if (pp_sts->pcc_sts & PP_STS_ENABLE) - opmode |= (1 << 4); /* PCC_EN */ - - if (pp_sts->igc_sts & PP_STS_ENABLE) { - opmode |= (1 << 0) | /* IGC_LUT_EN */ - (pp_sts->igc_tbl_idx << 1); - } - - if (pp_sts->enhist_sts & PP_STS_ENABLE) { - opmode |= (1 << 19) | /* HIST_LUT_EN */ - (1 << 20); /* PA_EN */ - if (!(pp_sts->pa_sts & PP_STS_ENABLE)) { - /* Program default value */ - addr = base + MDSS_MDP_REG_DSPP_PA_BASE; - writel_relaxed(0, addr); - writel_relaxed(0, addr + 4); - writel_relaxed(0, addr + 8); - writel_relaxed(0, addr + 12); - } + if (pp_sts->enhist_sts & PP_STS_ENABLE && + !(pp_sts->pa_sts & PP_STS_ENABLE)) { + /* Program default value */ + addr = base + MDSS_MDP_REG_DSPP_PA_BASE; + writel_relaxed(0, addr); + writel_relaxed(0, addr + 4); + writel_relaxed(0, addr + 8); + writel_relaxed(0, addr + 12); } if (flags & PP_FLAGS_DIRTY_DITHER) { - dither_cfg = &mdss_pp_res->dither_disp_cfg[disp_num]; - if (dither_cfg->flags & MDP_PP_OPS_WRITE) { - addr = base + MDSS_MDP_REG_DSPP_DITHER_DEPTH; - data = dither_depth_map[dither_cfg->g_y_depth]; - data |= dither_depth_map[dither_cfg->b_cb_depth] << 2; - data |= dither_depth_map[dither_cfg->r_cr_depth] << 4; - writel_relaxed(data, addr); - addr += 0x14; - for (i = 0; i << 16; i += 4) { - data = dither_matrix[i] | - (dither_matrix[i + 1] << 4) | - (dither_matrix[i + 2] << 8) | - (dither_matrix[i + 3] << 12); - writel_relaxed(data, addr); - addr += 4; - } - } - if (dither_cfg->flags & MDP_PP_OPS_DISABLE) - pp_sts->dither_sts &= ~PP_STS_ENABLE; - else if (dither_cfg->flags & MDP_PP_OPS_ENABLE) - pp_sts->dither_sts |= PP_STS_ENABLE; + addr = base + MDSS_MDP_REG_DSPP_DITHER_DEPTH; + pp_dither_config(addr, pp_sts, + &mdss_pp_res->dither_disp_cfg[disp_num]); } - if (pp_sts->dither_sts & PP_STS_ENABLE) - opmode |= (1 << 8); /* DITHER_EN */ if (flags & PP_FLAGS_DIRTY_GAMUT) pp_gamut_config(&mdss_pp_res->gamut_disp_cfg[disp_num], base, pp_sts); - if (pp_sts->gamut_sts & PP_STS_ENABLE) { - opmode |= (1 << 23); /* GAMUT_EN */ - if (pp_sts->gamut_sts & PP_STS_GAMUT_FIRST) - opmode |= (1 << 24); /* GAMUT_ORDER */ - } if (flags & PP_FLAGS_DIRTY_PGC) { pgc_config = &mdss_pp_res->pgc_disp_cfg[disp_num]; @@ -1147,9 +1164,8 @@ static int pp_dspp_setup(u32 disp_num, struct mdss_mdp_mixer *mixer) else if (pgc_config->flags & MDP_PP_OPS_ENABLE) pp_sts->pgc_sts |= PP_STS_ENABLE; } - if (pp_sts->pgc_sts & PP_STS_ENABLE) - opmode |= (1 << 22); + pp_dspp_opmode_config(pp_sts, &opmode); flush_exit: writel_relaxed(opmode, base + MDSS_MDP_REG_DSPP_OP_MODE); |
