summaryrefslogtreecommitdiff
path: root/drivers/video/fbdev
diff options
context:
space:
mode:
authorGopikrishnaiah Anandan <agopik@codeaurora.org>2016-03-18 15:08:06 -0700
committerKyle Yan <kyan@codeaurora.org>2016-06-07 11:55:36 -0700
commit5b4b23763df6b15a5c1c90e8ce00ec425ace80b6 (patch)
treee29f576c04092994dd6a0461e9ed16f60e45a16e /drivers/video/fbdev
parentc19f4224abb8a3fd5de40d74878bb2848497ddab (diff)
msm: mdss: Update the default PP binding
If mdss version is not part of get driver ops function currently we set the driver ops to NULL. When driver ops is NULL post processing driver will treat that msm is legacy target and program the post processing registers. For newer target if get driver ops function is not updated pp driver will assume it as legacy msm target and programme the registers incorrectly. Changing the default behaviour to stub function pointers will ensure that above use-case is gracefully handled. Change-Id: I03fdf88c741135f83d1939952e76b7460229a284 Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org> Signed-off-by: Ping Li <pingli@codeaurora.org>
Diffstat (limited to 'drivers/video/fbdev')
-rw-r--r--drivers/video/fbdev/msm/Makefile1
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp_pp.c28
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp_pp.h1
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp_pp_stub.c112
4 files changed, 139 insertions, 3 deletions
diff --git a/drivers/video/fbdev/msm/Makefile b/drivers/video/fbdev/msm/Makefile
index 8eeb1931cf78..9d25b08c753a 100644
--- a/drivers/video/fbdev/msm/Makefile
+++ b/drivers/video/fbdev/msm/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_FB_MSM_MDSS) += mdss_mdp_debug.o
mdss-mdp-objs += mdss_mdp_pp_v1_7.o
mdss-mdp-objs += mdss_mdp_pp_v3.o
mdss-mdp-objs += mdss_mdp_pp_common.o
+mdss-mdp-objs += mdss_mdp_pp_stub.o
ifeq ($(CONFIG_FB_MSM_MDSS),y)
obj-$(CONFIG_DEBUG_FS) += mdss_debug.o mdss_debug_xlog.o
diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp.c b/drivers/video/fbdev/msm/mdss_mdp_pp.c
index fefb4067443a..437e01535924 100644
--- a/drivers/video/fbdev/msm/mdss_mdp_pp.c
+++ b/drivers/video/fbdev/msm/mdss_mdp_pp.c
@@ -7443,6 +7443,9 @@ static int pp_get_driver_ops(struct mdp_pp_driver_ops *ops)
int ret = 0;
void *pp_cfg = NULL;
+ mdss_pp_res->pp_data_v1_7 = NULL;
+ mdss_pp_res->pp_data_v3 = NULL;
+
switch (mdata->mdp_rev) {
case MDSS_MDP_HW_REV_107:
case MDSS_MDP_HW_REV_107_1:
@@ -7463,8 +7466,6 @@ static int pp_get_driver_ops(struct mdp_pp_driver_ops *ops)
* Get the driver ops for both the versions and update the
* payload/function pointers.
*/
- mdss_pp_res->pp_data_v1_7 = NULL;
- mdss_pp_res->pp_data_v3 = NULL;
pp_cfg = pp_get_driver_ops_v1_7(ops);
if (IS_ERR_OR_NULL(pp_cfg)) {
ret = -EINVAL;
@@ -7479,9 +7480,30 @@ static int pp_get_driver_ops(struct mdp_pp_driver_ops *ops)
mdss_pp_res->pp_data_v3 = pp_cfg;
}
break;
- default:
+ case MDSS_MDP_HW_REV_100:
+ case MDSS_MDP_HW_REV_101:
+ case MDSS_MDP_HW_REV_101_1:
+ case MDSS_MDP_HW_REV_101_2:
+ case MDSS_MDP_HW_REV_102:
+ case MDSS_MDP_HW_REV_102_1:
+ case MDSS_MDP_HW_REV_103:
+ case MDSS_MDP_HW_REV_103_1:
+ case MDSS_MDP_HW_REV_105:
+ case MDSS_MDP_HW_REV_106:
+ case MDSS_MDP_HW_REV_108:
+ case MDSS_MDP_HW_REV_109:
+ case MDSS_MDP_HW_REV_110:
+ case MDSS_MDP_HW_REV_200:
+ case MDSS_MDP_HW_REV_112:
memset(ops, 0, sizeof(struct mdp_pp_driver_ops));
break;
+ default:
+ pp_cfg = pp_get_driver_ops_stub(ops);
+ if (IS_ERR(pp_cfg)) {
+ ret = -EINVAL;
+ break;
+ }
+ break;
}
return ret;
}
diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp.h b/drivers/video/fbdev/msm/mdss_mdp_pp.h
index 93406f0b4f13..809c389e99e8 100644
--- a/drivers/video/fbdev/msm/mdss_mdp_pp.h
+++ b/drivers/video/fbdev/msm/mdss_mdp_pp.h
@@ -198,6 +198,7 @@ struct mdss_pp_res_type {
void *pp_get_driver_ops_v1_7(struct mdp_pp_driver_ops *ops);
void *pp_get_driver_ops_v3(struct mdp_pp_driver_ops *ops);
+void *pp_get_driver_ops_stub(struct mdp_pp_driver_ops *ops);
static inline void pp_sts_set_split_bits(u32 *sts, u32 bits)
{
diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp_stub.c b/drivers/video/fbdev/msm/mdss_mdp_pp_stub.c
new file mode 100644
index 000000000000..3ab6bdca4bd3
--- /dev/null
+++ b/drivers/video/fbdev/msm/mdss_mdp_pp_stub.c
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 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
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+#define pr_fmt(fmt) "%s: " fmt, __func__
+
+#include "mdss_fb.h"
+#include "mdss_mdp.h"
+#include "mdss_mdp_pp.h"
+#include "mdss_mdp_pp_common.h"
+
+static int pp_stub_set_config(char __iomem *base_addr,
+ struct pp_sts_type *pp_sts, void *cfg_data,
+ u32 block_type);
+static int pp_stub_get_config(char __iomem *base_addr, void *cfg_data,
+ u32 block_type, u32 disp_num);
+static int pp_stub_get_version(u32 *version);
+
+static int pp_get_hist_offset(u32 block, u32 *ctl_off);
+static int pp_get_hist_isr(u32 *isr_mask);
+static bool pp_is_sspp_hist_supp(void);
+
+static void pp_opmode_config(int location, struct pp_sts_type *pp_sts,
+ u32 *opmode, int side);
+
+void *pp_get_driver_ops_stub(struct mdp_pp_driver_ops *ops)
+{
+ int i = 0;
+
+ if (!ops) {
+ pr_err("PP driver ops invalid %p\n", ops);
+ return ERR_PTR(-EINVAL);
+ }
+ for (i = 0; i < PP_MAX_FEATURES; i++) {
+ ops->pp_ops[i].feature = i;
+ ops->pp_ops[i].pp_get_config = pp_stub_get_config;
+ ops->pp_ops[i].pp_get_version = pp_stub_get_version;
+ ops->pp_ops[i].pp_set_config = pp_stub_set_config;
+ }
+ /* Set opmode pointers */
+ ops->pp_opmode_config = pp_opmode_config;
+ ops->get_hist_offset = pp_get_hist_offset;
+ ops->get_hist_isr_info = pp_get_hist_isr;
+ ops->is_sspp_hist_supp = pp_is_sspp_hist_supp;
+ ops->gamut_clk_gate_en = NULL;
+ return NULL;
+}
+
+static int pp_stub_get_version(u32 *version)
+{
+ if (!version) {
+ pr_err("invalid version param\n");
+ return -EINVAL;
+ }
+ *version = mdp_pp_unknown;
+ return 0;
+}
+
+static int pp_stub_set_config(char __iomem *base_addr,
+ struct pp_sts_type *pp_sts, void *cfg_data,
+ u32 block_type)
+{
+ return -ENOTSUPP;
+}
+
+static int pp_stub_get_config(char __iomem *base_addr, void *cfg_data,
+ u32 block_type, u32 disp_num)
+{
+ return -ENOTSUPP;
+}
+
+static void pp_opmode_config(int location, struct pp_sts_type *pp_sts,
+ u32 *opmode, int side)
+{
+}
+
+static int pp_get_hist_isr(u32 *isr_mask)
+{
+ if (!isr_mask) {
+ pr_err("invalid params isr_mask %p\n", isr_mask);
+ return -EINVAL;
+ }
+
+ *isr_mask = 0;
+ return 0;
+}
+
+static int pp_get_hist_offset(u32 block, u32 *ctl_off)
+{
+ int ret = 0;
+
+ if (!ctl_off) {
+ pr_err("invalid params ctl_off %p\n", ctl_off);
+ return -EINVAL;
+ }
+ *ctl_off = U32_MAX;
+ return ret;
+}
+
+static bool pp_is_sspp_hist_supp(void)
+{
+ return false;
+}