Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 31ef399a authored by Abhijit Kulkarni's avatar Abhijit Kulkarni
Browse files

msm: sde: define max allowed rot clock rate



This change defines max clock rate for rotator clock on
sm8150, and does not allow the session if calclauted value of
clock is greater than max rate.

Change-Id: I2e158d8ab78acea3b3f83dc2eeec438e0ac103b8
Signed-off-by: default avatarAbhijit Kulkarni <kabhijit@codeaurora.org>
parent 7f16c781
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -1388,6 +1388,12 @@ static int sde_rotator_calc_perf(struct sde_rot_mgr *mgr,
	if (mgr->min_rot_clk > perf->clk_rate)
		perf->clk_rate = mgr->min_rot_clk;

	if (mgr->max_rot_clk && (perf->clk_rate > mgr->max_rot_clk)) {
		SDEROT_ERR("invalid clock:%ld exceeds max:%ld allowed\n",
				perf->clk_rate, mgr->max_rot_clk);
		return -EINVAL;
	}

	read_bw =  sde_rotator_calc_buf_bw(in_fmt, config->input.width,
				config->input.height, max_fps);

@@ -3130,6 +3136,15 @@ int sde_rotator_core_init(struct sde_rot_mgr **pmgr,
		mgr->ops_hw_init = sde_rotator_r3_init;
		mgr->min_rot_clk = ROT_MIN_ROT_CLK;

		/*
		 * on platforms where the maxlinewidth is greater than
		 * default we need to have a max clock rate check to
		 * ensure we do not cross the max allowed clock for rotator
		 */
		if (IS_SDE_MAJOR_SAME(mdata->mdss_version,
			SDE_MDP_HW_REV_500))
			mgr->max_rot_clk = ROT_R3_MAX_ROT_CLK;

		if (!IS_SDE_MAJOR_SAME(mdata->mdss_version,
					SDE_MDP_HW_REV_500) &&
				!sde_rotator_get_clk(mgr,
+2 −0
Original line number Diff line number Diff line
@@ -402,6 +402,7 @@ struct sde_rot_bus_data_type {
 * @fudge_factor: fudge factor for clock calculation
 * @overhead: software overhead for offline rotation in msec
 * @min_rot_clk: minimum rotator clock rate
 * @max_rot_clk: maximum allowed rotator clock rate
 * @sbuf_ctx: pointer to sbuf session context
 * @ops_xxx: function pointers of rotator HAL layer
 * @hw_data: private handle of rotator HAL layer
@@ -448,6 +449,7 @@ struct sde_rot_mgr {
	struct sde_mult_factor fudge_factor;
	struct sde_mult_factor overhead;
	unsigned long min_rot_clk;
	unsigned long max_rot_clk;

	struct sde_rot_file_private *sbuf_ctx;

+4 −1
Original line number Diff line number Diff line
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2018, 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
@@ -15,6 +15,9 @@

#include "sde_rotator_core.h"

/* Maximum allowed Rotator clock value */
#define ROT_R3_MAX_ROT_CLK			345000000

int sde_rotator_r3_init(struct sde_rot_mgr *mgr);

#endif /* __SDE_ROTATOR_R3_H__ */