diff options
-rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp.h | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_overlay.c | 22 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_pp.c | 26 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_pp.h | 17 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_pp_v1_7.c | 90 | ||||
-rw-r--r-- | include/uapi/linux/msm_mdp.h | 74 |
6 files changed, 178 insertions, 53 deletions
diff --git a/drivers/video/fbdev/msm/mdss_mdp.h b/drivers/video/fbdev/msm/mdss_mdp.h index b619fcf9c23b..a6900c283df7 100644 --- a/drivers/video/fbdev/msm/mdss_mdp.h +++ b/drivers/video/fbdev/msm/mdss_mdp.h @@ -1076,5 +1076,5 @@ int mdss_mdp_cmd_set_autorefresh_mode(struct mdss_mdp_ctl *ctl, int frame_cnt); int mdss_mdp_ctl_cmd_autorefresh_enable(struct mdss_mdp_ctl *ctl, int frame_cnt); - +int mdss_mdp_pp_get_version(struct mdp_pp_feature_version *version); #endif /* MDSS_MDP_H */ diff --git a/drivers/video/fbdev/msm/mdss_mdp_overlay.c b/drivers/video/fbdev/msm/mdss_mdp_overlay.c index 9dca01bae88b..e56f7cca9ecc 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_overlay.c +++ b/drivers/video/fbdev/msm/mdss_mdp_overlay.c @@ -3789,12 +3789,32 @@ static int mdss_mdp_overlay_ioctl_handler(struct msm_fb_data_type *mfd, struct mdp_overlay *req = NULL; int val, ret = -ENOSYS; struct msmfb_metadata metadata; + struct mdp_pp_feature_version pp_feature_version; switch (cmd) { case MSMFB_MDP_PP: ret = mdss_mdp_pp_ioctl(mfd, argp); break; - + case MSMFB_MDP_PP_GET_FEATURE_VERSION: + ret = copy_from_user(&pp_feature_version, argp, + sizeof(pp_feature_version)); + if (ret) { + pr_err("copy_from_user failed for pp_feature_version\n"); + ret = -EFAULT; + } else { + ret = mdss_mdp_pp_get_version(&pp_feature_version); + if (!ret) { + ret = copy_to_user(argp, &pp_feature_version, + sizeof(pp_feature_version)); + if (ret) { + pr_err("copy_to_user failed for pp_feature_version\n"); + ret = -EFAULT; + } + } else { + pr_err("get pp version failed ret %d\n", ret); + } + } + break; case MSMFB_HISTOGRAM_START: case MSMFB_HISTOGRAM_STOP: case MSMFB_HISTOGRAM: diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp.c b/drivers/video/fbdev/msm/mdss_mdp_pp.c index b64e8097458d..e846cdf622e1 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_pp.c +++ b/drivers/video/fbdev/msm/mdss_mdp_pp.c @@ -6236,3 +6236,29 @@ static int pp_update_pcc_pipe_setup(struct mdss_mdp_pipe *pipe, u32 location) exit_sspp_setup: return ret; } + +int mdss_mdp_pp_get_version(struct mdp_pp_feature_version *version) +{ + int ret = 0; + u32 ver_info = mdp_pp_legacy; + + if (!version) { + pr_err("invalid param version %p\n", version); + ret = -EINVAL; + goto exit_version; + } + if (version->pp_feature >= PP_FEATURE_MAX) { + pr_err("invalid feature passed %d\n", version->pp_feature); + ret = -EINVAL; + goto exit_version; + } + if (pp_ops[version->pp_feature].pp_get_version) + ret = pp_ops[version->pp_feature].pp_get_version(&ver_info); + if (ret) + pr_err("failed to query version for feature %d ret %d\n", + version->pp_feature, ret); + else + version->version_info = ver_info; +exit_version: + return ret; +} diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp.h b/drivers/video/fbdev/msm/mdss_mdp_pp.h index 86eb9c376a5e..0815f3d7d28a 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_pp.h +++ b/drivers/video/fbdev/msm/mdss_mdp_pp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -68,20 +68,6 @@ GAMUT_T2_SIZE + GAMUT_T3_SIZE + GAMUT_T4_SIZE + \ GAMUT_T5_SIZE + GAMUT_T6_SIZE + GAMUT_T7_SIZE) -/* PP Feature Operations */ -enum pp_features { - IGC, - PCC, - GC, - PA, - GAMUT, - CSC, - DITHER, - QSEED, - HIST_LUT, - HIST, - PP_FEATURE_MAX -}; enum pp_block_opmodes { PP_OPMODE_VIG = 1, @@ -104,6 +90,7 @@ struct mdp_pp_feature_ops { int (*pp_set_config)(char __iomem *base_addr, struct pp_sts_type *pp_sts, void *cfg_data, u32 block_type); + int (*pp_get_version)(u32 *version); }; struct mdp_pp_driver_ops { diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp_v1_7.c b/drivers/video/fbdev/msm/mdss_mdp_pp_v1_7.c index 98bdb3379619..984db404ad62 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_pp_v1_7.c +++ b/drivers/video/fbdev/msm/mdss_mdp_pp_v1_7.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -218,6 +218,13 @@ static int pp_pgc_set_config(char __iomem *base_addr, u32 block_type); static int pp_pgc_get_config(char __iomem *base_addr, void *cfg_data, u32 block_type, u32 disp_num); +static int pp_pcc_get_version(u32 *version); +static int pp_igc_get_version(u32 *version); +static int pp_pgc_get_version(u32 *version); +static int pp_pa_get_version(u32 *version); +static int pp_gamut_get_version(u32 *version); +static int pp_dither_get_version(u32 *version); +static int pp_hist_lut_get_version(u32 *version); void *pp_get_driver_ops(struct mdp_pp_driver_ops *ops) { @@ -229,42 +236,51 @@ void *pp_get_driver_ops(struct mdp_pp_driver_ops *ops) /* IGC ops */ ops->pp_ops[IGC].pp_set_config = pp_igc_set_config; ops->pp_ops[IGC].pp_get_config = pp_igc_get_config; + ops->pp_ops[IGC].pp_get_version = pp_igc_get_version; /* PCC ops */ ops->pp_ops[PCC].pp_set_config = pp_pcc_set_config; ops->pp_ops[PCC].pp_get_config = pp_pcc_get_config; - + ops->pp_ops[PCC].pp_get_version = pp_pcc_get_version; /* GC ops */ ops->pp_ops[GC].pp_set_config = pp_pgc_set_config; ops->pp_ops[GC].pp_get_config = pp_pgc_get_config; + ops->pp_ops[GC].pp_get_version = pp_pgc_get_version; /* PA ops */ ops->pp_ops[PA].pp_set_config = pp_pa_set_config; ops->pp_ops[PA].pp_get_config = pp_pa_get_config; + ops->pp_ops[PA].pp_get_version = pp_pa_get_version; /* Gamut ops */ ops->pp_ops[GAMUT].pp_set_config = pp_gamut_set_config; ops->pp_ops[GAMUT].pp_get_config = pp_gamut_get_config; + ops->pp_ops[GAMUT].pp_get_version = pp_gamut_get_version; /* CSC ops */ ops->pp_ops[CSC].pp_set_config = NULL; ops->pp_ops[CSC].pp_get_config = NULL; + ops->pp_ops[CSC].pp_get_version = NULL; /* Dither ops */ ops->pp_ops[DITHER].pp_set_config = pp_dither_set_config; ops->pp_ops[DITHER].pp_get_config = pp_dither_get_config; + ops->pp_ops[DITHER].pp_get_version = pp_dither_get_version; /* QSEED ops */ ops->pp_ops[QSEED].pp_set_config = NULL; ops->pp_ops[QSEED].pp_get_config = NULL; + ops->pp_ops[QSEED].pp_get_version = NULL; /* HIST_LUT ops */ ops->pp_ops[HIST_LUT].pp_set_config = pp_hist_lut_set_config; ops->pp_ops[HIST_LUT].pp_get_config = pp_hist_lut_get_config; + ops->pp_ops[HIST_LUT].pp_get_version = pp_hist_lut_get_version; /* HIST ops */ ops->pp_ops[HIST].pp_set_config = NULL; ops->pp_ops[HIST].pp_get_config = pp_hist_get_config; + ops->pp_ops[HIST].pp_get_version = NULL; /* Set opmode pointers */ ops->pp_opmode_config = pp_opmode_config; @@ -1962,3 +1978,73 @@ static int pp_pgc_get_config(char __iomem *base_addr, void *cfg_data, kfree(c0_data); return ret; } + +static int pp_pcc_get_version(u32 *version) +{ + if (!version) { + pr_err("invalid param version %p\n", version); + return -EINVAL; + } + *version = mdp_pcc_v1_7; + return 0; +} + +static int pp_igc_get_version(u32 *version) +{ + if (!version) { + pr_err("invalid param version %p\n", version); + return -EINVAL; + } + *version = mdp_igc_v1_7; + return 0; +} + +static int pp_pgc_get_version(u32 *version) +{ + if (!version) { + pr_err("invalid param version %p\n", version); + return -EINVAL; + } + *version = mdp_pgc_v1_7; + return 0; +} + +static int pp_pa_get_version(u32 *version) +{ + if (!version) { + pr_err("invalid param version %p\n", version); + return -EINVAL; + } + *version = mdp_pa_v1_7; + return 0; +} + +static int pp_gamut_get_version(u32 *version) +{ + if (!version) { + pr_err("invalid param version %p\n", version); + return -EINVAL; + } + *version = mdp_gamut_v1_7; + return 0; +} + +static int pp_dither_get_version(u32 *version) +{ + if (!version) { + pr_err("invalid param version %p\n", version); + return -EINVAL; + } + *version = mdp_dither_v1_7; + return 0; +} + +static int pp_hist_lut_get_version(u32 *version) +{ + if (!version) { + pr_err("invalid param version %p\n", version); + return -EINVAL; + } + *version = mdp_hist_lut_v1_7; + return 0; +} diff --git a/include/uapi/linux/msm_mdp.h b/include/uapi/linux/msm_mdp.h index fd16c53d6b62..f5548a3baf5e 100644 --- a/include/uapi/linux/msm_mdp.h +++ b/include/uapi/linux/msm_mdp.h @@ -72,6 +72,8 @@ #define MSMFB_OVERLAY_PREPARE _IOWR(MSMFB_IOCTL_MAGIC, 169, \ struct mdp_overlay_list) #define MSMFB_LPM_ENABLE _IOWR(MSMFB_IOCTL_MAGIC, 170, unsigned int) +#define MSMFB_MDP_PP_GET_FEATURE_VERSION _IOWR(MSMFB_IOCTL_MAGIC, 171, \ + struct mdp_pp_feature_version) #define FB_TYPE_3D_PANEL 0x10101010 #define MDP_IMGTYPE2_START 0x10000 @@ -539,10 +541,6 @@ struct mdp_pa_data_v1_7 { uint32_t *six_zone_curve_p1; }; -enum { - mdp_pa_v1_7 = 0x1, - mdp_pa_vmax, -}; struct mdp_pa_v2_cfg_data { uint32_t version; @@ -552,10 +550,6 @@ struct mdp_pa_v2_cfg_data { void *cfg_payload; }; -enum { - mdp_igc_v1_7 = 1, - mdp_igc_vmax, -}; enum { mdp_igc_rec601 = 1, @@ -588,11 +582,6 @@ struct mdp_histogram_cfg { uint16_t num_bins; }; -enum { - mdp_hist_lut_v1_7 = 1, - mdp_hist_lut_vmax, -}; - struct mdp_hist_lut_data_v1_7 { uint32_t len; uint32_t *data; @@ -608,11 +597,6 @@ struct mdp_hist_lut_data { void *cfg_payload; }; -enum { - mdp_pcc_v1_7 = 0x1, - mdp_pcc_vmax, -}; - struct mdp_pcc_coeff { uint32_t c, r, g, b, rr, gg, bb, rg, gb, rb, rgb_0, rgb_1; }; @@ -929,11 +913,6 @@ struct mdp_pgc_lut_data { void *cfg_payload; }; -enum { - mdp_pgc_v1_7 = 1, - mdp_pgc_vmax, -}; - #define PGC_LUT_ENTRIES 1024 struct mdp_pgc_lut_data_v1_7 { uint32_t len; @@ -961,11 +940,6 @@ struct mdp_pa_cfg_data { struct mdp_pa_cfg pa_data; }; -enum { - mdp_dither_v1_7 = 1, - mdp_dither_vmax, -}; - struct mdp_dither_data_v1_7 { uint32_t g_y_depth; uint32_t r_cr_depth; @@ -990,12 +964,6 @@ struct mdp_dither_cfg_data { #define MDP_GAMUT_SCALE_OFF_SZ 16 #define MDP_GAMUT_TABLE_V1_7_COARSE_SZ 32 -enum { - mdp_gamut_v1_7 = 1, - mdp_gamut_vmax, -}; - - struct mdp_gamut_cfg_data { uint32_t block; uint32_t flags; @@ -1338,4 +1306,42 @@ enum { MDP_CSC_ITU_R_601_FR, MDP_CSC_ITU_R_709, }; + +enum { + mdp_igc_v1_7 = 1, + mdp_igc_vmax, + mdp_hist_lut_v1_7, + mdp_hist_lut_vmax, + mdp_pgc_v1_7, + mdp_pgc_vmax, + mdp_dither_v1_7, + mdp_dither_vmax, + mdp_gamut_v1_7, + mdp_gamut_vmax, + mdp_pa_v1_7, + mdp_pa_vmax, + mdp_pcc_v1_7, + mdp_pcc_vmax, + mdp_pp_legacy, +}; + +/* PP Features */ +enum { + IGC = 1, + PCC, + GC, + PA, + GAMUT, + CSC, + DITHER, + QSEED, + HIST_LUT, + HIST, + PP_FEATURE_MAX, +}; + +struct mdp_pp_feature_version { + uint32_t pp_feature; + uint32_t version_info; +}; #endif /*_UAPI_MSM_MDP_H_*/ |