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

Commit 7d6f4c43 authored by Ingrid Gallardo's avatar Ingrid Gallardo
Browse files

msm: mdss: release ahb clocks when mdp clocks are released.



This change makes sure that all the clocks held by
the display driver gets disabled when the mdp clock
is also released and will switch the ahb vote to
active-only context, so the bus driver can also
free all the unneeded clocks when cpu is not active.

Change-Id: Id7ee92fdc6e5e91832e4dec61fb151ed20411ef1
Signed-off-by: default avatarIngrid Gallardo <ingridg@codeaurora.org>
parent 409b52ab
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ static struct msm_bus_scale_pdata mdp_reg_bus_scale_table = {
	.usecase = mdp_reg_bus_usecases,
	.num_usecases = ARRAY_SIZE(mdp_reg_bus_usecases),
	.name = "mdss_reg",
	.active_only = true,
};

static void mdss_mdp_footswitch_ctrl(struct mdss_data_type *mdata, int on);
@@ -857,6 +858,7 @@ void mdss_mdp_clk_ctrl(int enable)
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();
	static int mdp_clk_cnt;
	int changed = 0;
	int rc = 0;

	mutex_lock(&mdp_clk_lock);
	if (enable) {
@@ -887,6 +889,10 @@ void mdss_mdp_clk_ctrl(int enable)
			mdss_update_reg_bus_vote(mdata->reg_bus_clt,
				VOTE_INDEX_19_MHZ);

			rc = mdss_iommu_ctrl(1);
			if (IS_ERR_VALUE(rc))
				pr_err("IOMMU attach failed\n");

			/* Active+Sleep */
			msm_bus_scale_client_update_context(mdata->bus_hdl,
				false, mdata->curr_bw_uc_idx);
@@ -901,6 +907,8 @@ void mdss_mdp_clk_ctrl(int enable)
			mdss_mdp_clk_update(MDSS_CLK_MDP_VSYNC, enable);

		if (!enable) {
			/* release iommu control */
			mdss_iommu_ctrl(0);

			/* Active-Only */
			msm_bus_scale_client_update_context(mdata->bus_hdl,
+17 −9
Original line number Diff line number Diff line
@@ -534,6 +534,11 @@ int mdss_mdp_resource_control(struct mdss_mdp_ctl *ctl, u32 sw_event)
		/* Transition OFF->ON (enable resources)*/
		if (mdp5_data->resources_state ==
				MDP_RSRC_CTL_STATE_OFF) {

			/* Add an extra vote for the ahb bus */
			mdss_update_reg_bus_vote(mdata->reg_bus_clt,
				VOTE_INDEX_19_MHZ);

			/* Enable MDP resources */
			mdss_mdp_cmd_clk_on(ctx);
			if (sctx)
@@ -651,6 +656,11 @@ int mdss_mdp_resource_control(struct mdss_mdp_ctl *ctl, u32 sw_event)
			/* Now Power off master DSI */
			mdss_mdp_cmd_clk_off(ctx);

			/* Remove extra vote for the ahb bus */
			mdss_update_reg_bus_vote(mdata->reg_bus_clt,
				VOTE_INDEX_DISABLE);


			/* we are done accessing the resources */
			mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF);

@@ -671,7 +681,6 @@ exit:
static inline void mdss_mdp_cmd_clk_on(struct mdss_mdp_cmd_ctx *ctx)
{
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();
	int rc;

	if (__mdss_mdp_cmd_is_panel_power_off(ctx))
		return;
@@ -681,10 +690,6 @@ static inline void mdss_mdp_cmd_clk_on(struct mdss_mdp_cmd_ctx *ctx)

	mdss_bus_bandwidth_ctrl(true);

	rc = mdss_iommu_ctrl(1);
	if (IS_ERR_VALUE(rc))
		pr_err("IOMMU attach failed\n");

	mdss_mdp_hist_intr_setup(&mdata->hist_intr, MDSS_IRQ_RESUME);

	mutex_unlock(&ctx->clk_mtx);
@@ -713,7 +718,6 @@ static inline void mdss_mdp_cmd_clk_off(struct mdss_mdp_cmd_ctx *ctx)
		pr_err("OFF with ctl:NULL\n");
	}

	mdss_iommu_ctrl(0);
	mdss_bus_bandwidth_ctrl(false);

	mutex_unlock(&ctx->clk_mtx);
@@ -926,6 +930,10 @@ static void clk_ctrl_delayed_off_work(struct work_struct *work)
	/* now power off the master DSI */
	mdss_mdp_cmd_clk_off(ctx);

	/* Remove extra vote for the ahb bus */
	mdss_update_reg_bus_vote(mdata->reg_bus_clt,
		VOTE_INDEX_DISABLE);

	mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF);

	/* update state machine that power off transition is done */