summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGopikrishnaiah Anandan <agopik@codeaurora.org>2015-09-18 12:32:38 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:20:58 -0700
commit41a12ff0ed0f69fd6180b9c8852446d58b5a0c94 (patch)
treea45052bca896c4ccec0487590f2de2daea07b5aa
parent7833d2e68db90a275475c7f417d07313d3dedd0e (diff)
mdss: msm: Update dither driver interface
Post processing driver clients can program the dither table in mdp. If length of the dither table is set to 0, driver will program the default table. If driver client would like to program the table it needs to update the length field as per mdp hardware version. CRs-fixed: 983164 Change-Id: I5e6aaa3d9376884e5ea1fe153cdf2798e3a52d1e Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp_pp_cache_config.c8
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp_pp_v1_7.c23
-rw-r--r--include/uapi/linux/msm_mdp.h5
3 files changed, 26 insertions, 10 deletions
diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp_cache_config.c b/drivers/video/fbdev/msm/mdss_mdp_pp_cache_config.c
index 42deaa9d4811..7769a8fbf644 100644
--- a/drivers/video/fbdev/msm/mdss_mdp_pp_cache_config.c
+++ b/drivers/video/fbdev/msm/mdss_mdp_pp_cache_config.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2016, 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
@@ -341,6 +341,12 @@ int pp_dither_cache_params_v1_7(struct mdp_dither_cfg_data *config,
}
memcpy(v17_cache_data, &v17_usr_config, sizeof(v17_usr_config));
}
+ if (v17_cache_data->len &&
+ v17_cache_data->len != MDP_DITHER_DATA_V1_7_SZ) {
+ pr_err("invalid dither len %d expected %d\n",
+ v17_cache_data->len, MDP_DITHER_DATA_V1_7_SZ);
+ ret = -EINVAL;
+ }
dither_config_exit:
return ret;
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 0eb7f1ae25a0..fe88fe676173 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-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2016, 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
@@ -530,6 +530,7 @@ static int pp_dither_set_config(char __iomem *base_addr,
u32 data;
struct mdp_dither_cfg_data *dither_cfg_data = NULL;
struct mdp_dither_data_v1_7 *dither_data = NULL;
+ uint32_t *pdata = NULL;
if (!base_addr || !cfg_data || !pp_sts) {
pr_err("invalid params base_addr %p cfg_data %p pp_sts_type %p\n",
@@ -565,23 +566,27 @@ static int pp_dither_set_config(char __iomem *base_addr,
if ((dither_data->g_y_depth >= DITHER_DEPTH_MAP_INDEX) ||
(dither_data->b_cb_depth >= DITHER_DEPTH_MAP_INDEX) ||
- (dither_data->r_cr_depth >= DITHER_DEPTH_MAP_INDEX)) {
- pr_err("invalid data for dither, g_y_depth %d y_cb_depth %d r_cr_depth %d\n",
+ (dither_data->r_cr_depth >= DITHER_DEPTH_MAP_INDEX) ||
+ (dither_data->len > DITHER_MATRIX_INDEX)) {
+ pr_err("invalid data for dither, g_y_depth %d y_cb_depth %d r_cr_depth %d\n len %d",
dither_data->g_y_depth, dither_data->b_cb_depth,
- dither_data->r_cr_depth);
+ dither_data->r_cr_depth, dither_data->len);
return -EINVAL;
}
+ if (!dither_data->len)
+ pdata = dither_matrix;
+ else
+ pdata = dither_data->data;
+
data = dither_depth_map[dither_data->g_y_depth];
data |= dither_depth_map[dither_data->b_cb_depth] << 2;
data |= dither_depth_map[dither_data->r_cr_depth] << 4;
- data |= dither_cfg_data->mode << 8;
+ data |= (dither_data->temporal_en) ? (1 << 8) : 0;
writel_relaxed(data, base_addr);
base_addr += DITHER_MATRIX_OFF;
for (i = 0; i < DITHER_MATRIX_INDEX; i += 4) {
- data = dither_matrix[i] |
- (dither_matrix[i + 1] << 4) |
- (dither_matrix[i + 2] << 8) |
- (dither_matrix[i + 3] << 12);
+ data = pdata[i] | (pdata[i + 1] << 4) |
+ (pdata[i + 2] << 8) | (pdata[i + 3] << 12);
writel_relaxed(data, base_addr);
base_addr += 4;
}
diff --git a/include/uapi/linux/msm_mdp.h b/include/uapi/linux/msm_mdp.h
index 4ef51ddd86e6..b12e48424412 100644
--- a/include/uapi/linux/msm_mdp.h
+++ b/include/uapi/linux/msm_mdp.h
@@ -972,10 +972,15 @@ struct mdp_pa_cfg_data {
struct mdp_pa_cfg pa_data;
};
+#define MDP_DITHER_DATA_V1_7_SZ 16
+
struct mdp_dither_data_v1_7 {
uint32_t g_y_depth;
uint32_t r_cr_depth;
uint32_t b_cb_depth;
+ uint32_t len;
+ uint32_t data[MDP_DITHER_DATA_V1_7_SZ];
+ uint32_t temporal_en;
};
struct mdp_dither_cfg_data {