diff options
| author | Arpita Banerjee <cabane@codeaurora.org> | 2013-06-04 19:43:24 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 20:18:39 -0700 |
| commit | 9c1aa817afabafbe77654145ff94bc85ec59451f (patch) | |
| tree | 8ab8817e58d300e6deb640792ca999cc2855d16c | |
| parent | 72ed839bf67f24b2162f0963112678a2565b9bf9 (diff) | |
msm: mdss: Add read/write buffer support for calibraiton tool
This change allows to process read/write operation through
buffer instead of single IOCTL call. It is part of
optimization to save DIAG packet processing time.
Change-Id: Iffaab2dd160959f8c7950ebca043b1e0cf25877c
Signed-off-by: Arpita Banerjee <cabane@codeaurora.org>
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp.h | 2 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_overlay.c | 5 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_pp.c | 66 | ||||
| -rw-r--r-- | include/uapi/linux/msm_mdp.h | 9 |
4 files changed, 82 insertions, 0 deletions
diff --git a/drivers/video/fbdev/msm/mdss_mdp.h b/drivers/video/fbdev/msm/mdss_mdp.h index 39952c93b299..8ecc861f511f 100644 --- a/drivers/video/fbdev/msm/mdss_mdp.h +++ b/drivers/video/fbdev/msm/mdss_mdp.h @@ -567,6 +567,8 @@ u32 mdss_mdp_fb_stride(u32 fb_index, u32 xres, int bpp); int mdss_panel_register_done(struct mdss_panel_data *pdata); int mdss_mdp_limited_lut_igc_config(struct mdss_mdp_ctl *ctl); int mdss_mdp_calib_config(struct mdp_calib_config_data *cfg, u32 *copyback); +int mdss_mdp_calib_config_buffer(struct mdp_calib_config_buffer *cfg, + u32 *copyback); int mdss_mdp_pipe_is_staged(struct mdss_mdp_pipe *pipe); int mdss_mdp_writeback_display_commit(struct mdss_mdp_ctl *ctl, void *arg); diff --git a/drivers/video/fbdev/msm/mdss_mdp_overlay.c b/drivers/video/fbdev/msm/mdss_mdp_overlay.c index 328f04513b8f..24b27b4cbd57 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_overlay.c +++ b/drivers/video/fbdev/msm/mdss_mdp_overlay.c @@ -1676,6 +1676,11 @@ static int mdss_mdp_pp_ioctl(struct msm_fb_data_type *mfd, case mdp_op_calib_mode: ret = mdss_mdp_calib_mode(mfd, &mdp_pp.data.mdss_calib_cfg); break; + case mdp_op_calib_buffer: + ret = mdss_mdp_calib_config_buffer( + (struct mdp_calib_config_buffer *) + &mdp_pp.data.calib_buffer, ©back); + break; default: pr_err("Unsupported request to MDP_PP IOCTL. %d = op\n", mdp_pp.op); diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp.c b/drivers/video/fbdev/msm/mdss_mdp_pp.c index 4dd9dcbceecf..6cedd98b3edb 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_pp.c +++ b/drivers/video/fbdev/msm/mdss_mdp_pp.c @@ -3376,3 +3376,69 @@ int mdss_mdp_calib_mode(struct msm_fb_data_type *mfd, mutex_unlock(&mdss_pp_mutex); return 0; } + +int mdss_mdp_calib_config_buffer(struct mdp_calib_config_buffer *cfg, + u32 *copyback) +{ + int ret = -1; + int counter = cfg->size / (sizeof(uint32_t) * 2); + uint32_t *buff = NULL, *buff_org = NULL; + void *ptr; + int i = 0; + + buff_org = buff = kzalloc(cfg->size, GFP_KERNEL); + if (buff == NULL) { + pr_err("Allocation failed"); + return ret; + } + + if (copy_from_user(buff, cfg->buffer, cfg->size)) { + kfree(buff); + pr_err("Copy failed"); + return ret; + } + + mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON, false); + + if (cfg->ops & MDP_PP_OPS_READ) { + for (i = 0 ; i < counter ; i++) { + if (is_valid_calib_addr((void *) *buff)) { + ret = 0; + } else { + ret = -1; + pr_err("Address validation failed"); + break; + } + + ptr = (void *)(((unsigned int) *buff) + + (mdss_res->mdp_base)); + buff++; + *buff = readl_relaxed(ptr); + buff++; + } + if (!ret) + ret = copy_to_user(cfg->buffer, buff_org, cfg->size); + *copyback = 1; + } else if (cfg->ops & MDP_PP_OPS_WRITE) { + for (i = 0 ; i < counter ; i++) { + if (is_valid_calib_addr((void *) *buff)) { + ret = 0; + } else { + ret = -1; + pr_err("Address validation failed"); + break; + } + + ptr = (void *)(((unsigned int) *buff) + + (mdss_res->mdp_base)); + buff++; + writel_relaxed(*buff, ptr); + buff++; + } + } + + mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF, false); + + kfree(buff_org); + return ret; +} diff --git a/include/uapi/linux/msm_mdp.h b/include/uapi/linux/msm_mdp.h index 7464f54c046b..65c4a2e04dbc 100644 --- a/include/uapi/linux/msm_mdp.h +++ b/include/uapi/linux/msm_mdp.h @@ -596,6 +596,12 @@ struct mdp_calib_config_data { uint32_t data; }; +struct mdp_calib_config_buffer { + uint32_t ops; + uint32_t size; + uint32_t *buffer; +}; + #define MDSS_MAX_BL_BRIGHTNESS 255 #define AD_BL_LIN_LEN (MDSS_MAX_BL_BRIGHTNESS + 1) @@ -686,6 +692,8 @@ enum { mdp_op_calib_cfg, mdp_op_ad_cfg, mdp_op_ad_input, + mdp_op_calib_mode, + mdp_op_calib_buffer, mdp_op_max, }; @@ -712,6 +720,7 @@ struct msmfb_mdp_pp { struct mdp_calib_config_data calib_cfg; struct mdss_ad_init_cfg ad_init_cfg; struct mdss_ad_input ad_input; + struct mdp_calib_config_buffer calib_buffer; } data; }; |
