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

Commit 5e51a9ec authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: mdss: Clean up histogram software state when FB device is released"

parents 0f3295e7 77084953
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -2609,11 +2609,10 @@ static int mdss_fb_release_all(struct fb_info *info, bool release_all)
		if (mfd->mdp.release_fnc)
			mfd->mdp.release_fnc(mfd, NULL);

		if (mfd->mdp.ad_shutdown_cleanup) {
			ret = (*mfd->mdp.ad_shutdown_cleanup)(mfd);
		if (mfd->mdp.pp_release_fnc) {
			ret = (*mfd->mdp.pp_release_fnc)(mfd);
			if (ret)
				pr_err("AD shutdown cleanup failed ret %d\n",
				       ret);
				pr_err("PP release failed ret %d\n", ret);
		}

		ret = mdss_fb_blank_sub(FB_BLANK_POWERDOWN, info,
+1 −1
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ struct msm_mdp_interface {
	int (*configure_panel)(struct msm_fb_data_type *mfd, int mode,
				int dest_ctrl);
	int (*input_event_handler)(struct msm_fb_data_type *mfd);
	int (*ad_shutdown_cleanup)(struct msm_fb_data_type *mfd);
	int (*pp_release_fnc)(struct msm_fb_data_type *mfd);
	void *private1;
};

+50 −24
Original line number Diff line number Diff line
@@ -395,9 +395,10 @@ static void mdss_mdp_hist_intr_notify(u32 disp);
static int mdss_mdp_panel_default_dither_config(struct msm_fb_data_type *mfd,
					u32 panel_bpp);
static int mdss_mdp_limited_lut_igc_config(struct msm_fb_data_type *mfd);
static int pp_ad_shutdown_cleanup(struct msm_fb_data_type *mfd);
static inline int pp_validate_dspp_mfd_block(struct msm_fb_data_type *mfd,
					int block);
static int pp_mfd_release_all(struct msm_fb_data_type *mfd);
static int pp_mfd_ad_release_all(struct msm_fb_data_type *mfd);

static u32 last_sts, last_state;

@@ -2425,10 +2426,10 @@ int mdss_mdp_pp_overlay_init(struct msm_fb_data_type *mfd)
		pr_err("Invalid mfd %p mdata %p\n", mfd, mdata);
		return -EPERM;
	}
	if (mdata->nad_cfgs) {

	if (mdata->nad_cfgs)
		mfd->mdp.ad_calc_bl = pp_ad_calc_bl;
		mfd->mdp.ad_shutdown_cleanup = pp_ad_shutdown_cleanup;
	}
	mfd->mdp.pp_release_fnc = pp_mfd_release_all;
	return 0;
}

@@ -4069,12 +4070,11 @@ static u32 pp_hist_read(char __iomem *v_addr,

/* Assumes that relevant clocks are enabled */
static int pp_hist_enable(struct pp_hist_col_info *hist_info,
				struct mdp_histogram_start_req *req)
				struct mdp_histogram_start_req *req,
				struct mdss_mdp_ctl *ctl)
{
	unsigned long flag;
	int ret = 0;
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();
	u32 intr_mask = 1;

	mutex_lock(&hist_info->hist_mutex);
	/* check if it is idle */
@@ -4088,15 +4088,18 @@ static int pp_hist_enable(struct pp_hist_col_info *hist_info,
	}
	hist_info->col_state = HIST_IDLE;
	hist_info->col_en = true;
	spin_unlock_irqrestore(&hist_info->hist_lock, flag);
	hist_info->frame_cnt = req->frame_cnt;
	hist_info->hist_cnt_read = 0;
	hist_info->hist_cnt_sent = 0;
	hist_info->hist_cnt_time = 0;
	mdss_mdp_hist_intr_req(&mdata->hist_intr,
				intr_mask << hist_info->intr_shift, true);
	if (ctl && ctl->mfd) {
		hist_info->ctl = ctl;
		hist_info->disp_num =
			ctl->mfd->index + MDP_LOGICAL_BLOCK_DISP_0;
	}
	/* if hist v2, make sure HW is unlocked */
	writel_relaxed(0, hist_info->base);
	spin_unlock_irqrestore(&hist_info->hist_lock, flag);
exit:
	mutex_unlock(&hist_info->hist_mutex);
	return ret;
@@ -4109,7 +4112,7 @@ int mdss_mdp_hist_start(struct mdp_histogram_start_req *req)
	int i, ret = 0;
	u32 disp_num, dspp_num = 0;
	u32 mixer_cnt, mixer_id[MDSS_MDP_INTF_MAX_LAYERMIXER];
	u32 frame_size;
	u32 frame_size, intr_mask = 0;
	struct mdss_mdp_pipe *pipe;
	struct mdss_mdp_ctl *ctl;
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();
@@ -4157,7 +4160,10 @@ int mdss_mdp_hist_start(struct mdp_histogram_start_req *req)
				goto hist_stop_clk;
			}
			hist_info = &pipe->pp_res.hist;
			ret = pp_hist_enable(hist_info, req);
			ret = pp_hist_enable(hist_info, req, NULL);
			intr_mask = 1 << hist_info->intr_shift;
			mdss_mdp_hist_intr_req(&mdata->hist_intr, intr_mask,
					       true);
			mdss_mdp_pipe_unmap(pipe);
		}
	} else if (PP_LOCAT(req->block) == MDSS_PP_DSPP_CFG) {
@@ -4201,17 +4207,18 @@ int mdss_mdp_hist_start(struct mdp_histogram_start_req *req)
				goto hist_stop_clk;
			}
			hist_info = &mdss_pp_res->dspp_hist[dspp_num];
			hist_info->disp_num = PP_BLOCK(req->block);
			hist_info->ctl = ctl;
			ret = pp_hist_enable(hist_info, req);
			ret = pp_hist_enable(hist_info, req, ctl);
			if (ret) {
				pr_err("failed to enable histogram dspp_num %d ret %d\n",
				       dspp_num, ret);
				goto hist_stop_clk;
			}
			intr_mask |= 1 << hist_info->intr_shift;
			mdss_pp_res->pp_disp_flags[disp_num] |=
							PP_FLAGS_DIRTY_HIST_COL;
		}
		mdss_mdp_hist_intr_req(&mdata->hist_intr, intr_mask,
					   true);
	}
hist_stop_clk:
	mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF);
@@ -4236,11 +4243,13 @@ static int pp_hist_disable(struct pp_hist_col_info *hist_info)
	}
	hist_info->col_en = false;
	hist_info->col_state = HIST_UNKNOWN;
	hist_info->disp_num = 0;
	hist_info->ctl = NULL;
	/* make sure HW is unlocked */
	writel_relaxed(0, hist_info->base);
	spin_unlock_irqrestore(&hist_info->hist_lock, flag);
	mdss_mdp_hist_intr_req(&mdata->hist_intr,
				intr_mask << hist_info->intr_shift, false);
	/* make sure HW is unlocked */
	writel_relaxed(0, hist_info->base);
	ret = 0;
exit:
	mutex_unlock(&hist_info->hist_mutex);
@@ -4302,8 +4311,6 @@ int mdss_mdp_hist_stop(u32 block)
			if (disp_num != hist_info->disp_num)
				continue;
			ret = pp_hist_disable(hist_info);
			hist_info->disp_num = 0;
			hist_info->ctl = NULL;
			if (ret)
				goto hist_stop_clk;
			mdss_pp_res->pp_disp_flags[i] |=
@@ -4835,7 +4842,7 @@ void mdss_mdp_hist_intr_done(u32 isr)
	u32 isr_blk, is_hist_done, isr_tmp;
	struct pp_hist_col_info *hist_info = NULL;
	u32 isr_mask = HIST_V2_INTR_BIT_MASK;
	u32 intr_mask = 1;
	u32 intr_mask = 1, disp_num = 0;

	if (pp_driver_ops.get_hist_isr_info)
		pp_driver_ops.get_hist_isr_info(&isr_mask);
@@ -4854,12 +4861,13 @@ void mdss_mdp_hist_intr_done(u32 isr)
		if (hist_info && is_hist_done && hist_info->col_en &&
			hist_info->col_state == HIST_IDLE) {
			hist_info->col_state = HIST_READY;
			disp_num = hist_info->disp_num;
			/* Clear the interrupt until next commit */
			mdss_mdp_hist_irq_clear_mask(intr_mask <<
						hist_info->intr_shift);
			writel_relaxed(1, hist_info->base);
			spin_unlock(&hist_info->hist_lock);
			mdss_mdp_hist_intr_notify(hist_info->disp_num);
			mdss_mdp_hist_intr_notify(disp_num);
		} else {
			spin_unlock(&hist_info->hist_lock);
		}
@@ -6457,14 +6465,14 @@ static void mdss_mdp_hist_intr_notify(u32 disp)

	for (i = 0; i < mdata->ndspp; i++) {
		hist_info = &mdss_pp_res->dspp_hist[i];
		spin_lock(&hist_info->hist_lock);
		if (hist_info->disp_num == disp) {
			disp_count++;
			ctl = hist_info->ctl;
			spin_lock(&hist_info->hist_lock);
			if (hist_info->col_state == HIST_READY)
				hist_count++;
			spin_unlock(&hist_info->hist_lock);
		}
		spin_unlock(&hist_info->hist_lock);
	}
	if (disp_count != hist_count || !ctl)
		return;
@@ -6591,7 +6599,25 @@ static int mdss_mdp_mfd_valid_ad(struct msm_fb_data_type *mfd)
	return valid_ad;
}

static int pp_ad_shutdown_cleanup(struct msm_fb_data_type *mfd)
static int pp_mfd_release_all(struct msm_fb_data_type *mfd)
{
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();
	int ret = 0;

	if (mdata->nad_cfgs) {
		ret = pp_mfd_ad_release_all(mfd);
		if (ret)
			pr_err("ad release all failed on disp %d, ret %d\n",
				mfd->index, ret);
	}

	if (mdss_mdp_mfd_valid_dspp(mfd))
		mdss_mdp_hist_stop(mfd->index + MDP_LOGICAL_BLOCK_DISP_0);

	return ret;
}

static int pp_mfd_ad_release_all(struct msm_fb_data_type *mfd)
{
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();
	struct mdss_mdp_ctl *ctl = NULL;