Browse Source

disp: msm: dp: add mixer count check in dp mode validation

Add mixer count check in dp mode validation for mdp clock.

Change-Id: I37fe3037d7f7efc7bdc2a7446457af8a8e34684c
Signed-off-by: Xiaowen Wu <[email protected]>
Signed-off-by: Tatenda Chipeperekwa <[email protected]>
Tatenda Chipeperekwa 5 years ago
parent
commit
56d9849705
1 changed files with 9 additions and 2 deletions
  1. 9 2
      msm/sde/sde_kms.c

+ 9 - 2
msm/sde/sde_kms.c

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
  * Copyright (C) 2013 Red Hat
  * Copyright (C) 2013 Red Hat
  * Author: Rob Clark <[email protected]>
  * Author: Rob Clark <[email protected]>
  *
  *
@@ -2431,8 +2431,15 @@ static int sde_kms_get_mixer_count(const struct msm_kms *kms,
 	temp = drm_fixp_mul(temp, vrefresh_fp);
 	temp = drm_fixp_mul(temp, vrefresh_fp);
 	mode_clock_hz = drm_fixp_mul(temp, mdp_fudge_factor);
 	mode_clock_hz = drm_fixp_mul(temp, mdp_fudge_factor);
 	if (mode_clock_hz > max_mdp_clock_hz ||
 	if (mode_clock_hz > max_mdp_clock_hz ||
-			mode->hdisplay > res->max_mixer_width)
+			mode->hdisplay > res->max_mixer_width) {
 		*num_lm = 2;
 		*num_lm = 2;
+		if ((mode_clock_hz >> 1) > max_mdp_clock_hz) {
+			SDE_DEBUG("[%s] clock %d exceeds max_mdp_clk %d\n",
+					mode->name, mode_clock_hz,
+					max_mdp_clock_hz);
+			return -EINVAL;
+		}
+	}
 	SDE_DEBUG("[%s] h=%d, v=%d, fps=%d, max_mdp_clk_hz=%llu, num_lm=%d\n",
 	SDE_DEBUG("[%s] h=%d, v=%d, fps=%d, max_mdp_clk_hz=%llu, num_lm=%d\n",
 			mode->name, mode->htotal, mode->vtotal, mode->vrefresh,
 			mode->name, mode->htotal, mode->vtotal, mode->vrefresh,
 			sde_kms->perf.max_core_clk_rate, *num_lm);
 			sde_kms->perf.max_core_clk_rate, *num_lm);