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

Commit 8be26acb authored by Kalyan Thota's avatar Kalyan Thota
Browse files

msm: mdss: add support to configure bus scale vectors from dt



Add support to configure the bus scale vectors from
mdss device tree.
Use Levels instead of freq values for proper abstraction.

Change-Id: I28d9f77a801aa6970ba1280cc1b1b2c5cc7eaf4a
Signed-off-by: default avatarKalyan Thota <kalyant@codeaurora.org>
parent 422bb915
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -510,6 +510,11 @@ Fudge Factors: Fudge factors are used to boost demand for
- qcom,max-pipe-width:		This value specifies the maximum MDP SSPP width
				the device supports. If not specified, a default value
				of 2048 will be applied.
- qcom,mdss-reg-bus:		Property to provide Bus scaling for register access for
				MDP and DSI Blocks.

- qcom,mdss-rot-reg-bus:	Property to provide Bus scaling for register access for
				Rotator Block.

Optional subnodes:
- mdss_fb:		Child nodes representing the frame buffer virtual devices.
@@ -772,6 +777,19 @@ Example:
			qcom,mdss-dspp-pgc-off = <0x17C0>;
		};

		qcom,mdss-reg-bus {
		    /* Reg Bus Scale Settings */
		    qcom,msm-bus,name = "mdss_reg";
		    qcom,msm-bus,num-cases = <4>;
		    qcom,msm-bus,num-paths = <1>;
		    qcom,msm-bus,active-only;
		    qcom,msm-bus,vectors-KBps =
			    <1 590 0 0>,
			    <1 590 0 76800>,
			    <1 590 0 160000>,
			    <1 590 0 320000>;
		};

		smmu_mdp_sec: qcom,smmu_mdp_sec_cb {
			compatible = "qcom,smmu_mdp_sec";
			iommus = <&mdp_smmu 1>;
@@ -787,5 +805,16 @@ Example:
			qcom,mdss_pan_bpp = <24>;
			qcom,mdss-fb-map = <&mdss_fb1>;
		};

		qcom,mdss-rot-reg-bus {
		    /* Reg Bus Scale Settings */
		    qcom,msm-bus,name = "mdss_rot_reg";
		    qcom,msm-bus,num-cases = <2>;
		    qcom,msm-bus,num-paths = <1>;
		    qcom,msm-bus,active-only;
		    qcom,msm-bus,vectors-KBps =
			    <1 590 0 0>,
			    <1 590 0 76800>;
		};
	};
+4 −3
Original line number Diff line number Diff line
@@ -54,9 +54,9 @@ enum mdss_iommu_domain_type {

enum mdss_bus_vote_type {
	VOTE_INDEX_DISABLE,
	VOTE_INDEX_19_MHZ,
	VOTE_INDEX_40_MHZ,
	VOTE_INDEX_80_MHZ,
	VOTE_INDEX_LOW,
	VOTE_INDEX_MID,
	VOTE_INDEX_HIGH,
	VOTE_INDEX_MAX,
};

@@ -331,6 +331,7 @@ struct mdss_data_type {
	u32 curr_bw_uc_idx;
	u32 ao_bw_uc_idx; /* active only idx */
	struct msm_bus_scale_pdata *bus_scale_table;
	struct msm_bus_scale_pdata *reg_bus_scale_table;
	u32 max_bw_low;
	u32 max_bw_high;
	u32 max_bw_per_pipe;
+1 −1
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ static int dsi_core_clk_start(struct dsi_core_clks *c_clks)
		}
	}

	rc = mdss_update_reg_bus_vote(mngr->reg_bus_clt, VOTE_INDEX_19_MHZ);
	rc = mdss_update_reg_bus_vote(mngr->reg_bus_clt, VOTE_INDEX_LOW);
	if (rc) {
		pr_err("failed to vote for reg bus\n");
		goto disable_mmss_misc_clk;
+1 −1
Original line number Diff line number Diff line
@@ -3016,7 +3016,7 @@ static int hdmi_tx_enable_power(struct hdmi_tx_ctrl *hdmi_ctrl,
			goto disable_vreg;
		}
		mdss_update_reg_bus_vote(hdmi_ctrl->pdata.reg_bus_clt[module],
			VOTE_INDEX_19_MHZ);
			VOTE_INDEX_LOW);

		rc = msm_dss_clk_set_rate(power_data->clk_config,
			power_data->num_clk);
+33 −6
Original line number Diff line number Diff line
@@ -227,20 +227,24 @@ static int mdss_mdp_bus_scale_register(struct mdss_data_type *mdata)
		pr_debug("register bus_hdl=%x\n", mdata->bus_hdl);
	}

	if (!mdata->reg_bus_hdl) {
	if (!mdata->reg_bus_scale_table) {
		reg_bus_pdata = &mdp_reg_bus_scale_table;
		for (i = 0; i < reg_bus_pdata->num_usecases; i++) {
			mdp_reg_bus_usecases[i].num_paths = 1;
			mdp_reg_bus_usecases[i].vectors =
				&mdp_reg_bus_vectors[i];
		}
		mdata->reg_bus_scale_table = reg_bus_pdata;
	}

		mdata->reg_bus_hdl =
			msm_bus_scale_register_client(reg_bus_pdata);
	if (!mdata->reg_bus_hdl) {
		mdata->reg_bus_hdl =
			msm_bus_scale_register_client(
			      mdata->reg_bus_scale_table);
		if (!mdata->reg_bus_hdl)
			/* Continue without reg_bus scaling */
			pr_warn("reg_bus_client register failed\n");
		} else
		else
			pr_debug("register reg_bus_hdl=%x\n",
					mdata->reg_bus_hdl);
	}
@@ -746,7 +750,7 @@ static inline void __mdss_mdp_reg_access_clk_enable(
{
	if (enable) {
		mdss_update_reg_bus_vote(mdata->reg_bus_clt,
				VOTE_INDEX_19_MHZ);
				VOTE_INDEX_LOW);
		if (mdss_has_quirk(mdata, MDSS_QUIRK_MIN_BUS_VOTE))
				mdss_bus_scale_set_quota(MDSS_HW_RT,
					SZ_1M, SZ_1M);
@@ -1029,7 +1033,7 @@ void mdss_mdp_clk_ctrl(int enable)
			pm_runtime_get_sync(&mdata->pdev->dev);

			mdss_update_reg_bus_vote(mdata->reg_bus_clt,
				VOTE_INDEX_19_MHZ);
				VOTE_INDEX_LOW);

			rc = mdss_iommu_ctrl(1);
			if (IS_ERR_VALUE(rc))
@@ -3622,6 +3626,7 @@ static int mdss_mdp_parse_dt_ppb_off(struct platform_device *pdev)
static int mdss_mdp_parse_dt_bus_scale(struct platform_device *pdev)
{
	int rc, paths;
	struct device_node *node;
	struct mdss_data_type *mdata = platform_get_drvdata(pdev);

	rc = of_property_read_u32(pdev->dev.of_node,
@@ -3650,6 +3655,28 @@ static int mdss_mdp_parse_dt_bus_scale(struct platform_device *pdev)
			rc = -EINVAL;
		pr_err("msm_bus_cl_get_pdata failed. rc=%d\n", rc);
		mdata->bus_scale_table = NULL;
		return rc;
	}

	/*
	 * if mdss-reg-bus is not found then default table is picked
	 * hence below code wont return error.
	 */
	node = of_get_child_by_name(pdev->dev.of_node, "qcom,mdss-reg-bus");
	if (node) {
		mdata->reg_bus_scale_table =
			msm_bus_pdata_from_node(pdev, node);
		if (IS_ERR_OR_NULL(mdata->reg_bus_scale_table)) {
			rc = PTR_ERR(mdata->reg_bus_scale_table);
			if (!rc)
				pr_err("bus_pdata reg_bus failed rc=%d\n", rc);
			rc = 0;
			mdata->reg_bus_scale_table = NULL;
		}
	} else {
		rc = 0;
		mdata->reg_bus_scale_table = NULL;
		pr_debug("mdss-reg-bus not found\n");
	}

	return rc;
Loading