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

Commit f712724b authored by Carl Vanderlip's avatar Carl Vanderlip
Browse files

msm: mdss: Define master Assertive Display hardware



Store and use the index of "master" hardware block for
Assertive Display calculations. Useful in implementation of dual pipe AD.

Change-Id: I748e88da3b4c5b05d418d152510b066a99137479
Signed-off-by: default avatarCarl Vanderlip <carlv@codeaurora.org>
parent 5f367de7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -284,6 +284,7 @@ struct mdss_mdp_ad {

struct mdss_ad_info {
	u8 num;
	u8 calc_hw_num;
	u32 sts;
	u32 reg_sts;
	u32 state;
+34 −3
Original line number Diff line number Diff line
@@ -203,6 +203,8 @@ static u32 igc_limited[IGC_LUT_ENTRIES] = {
#define PP_STS_PA_SIX_ZONE_VAL_MASK	0x800
#define PP_STS_PA_SAT_ZERO_EXP_EN	0x1000

#define PP_AD_BAD_HW_NUM 255

#define PP_AD_STATE_INIT	0x2
#define PP_AD_STATE_CFG		0x4
#define PP_AD_STATE_DATA	0x8
@@ -375,6 +377,8 @@ static void pp_ad_init_write(struct mdss_mdp_ad *ad_hw,
static void pp_ad_input_write(struct mdss_mdp_ad *ad_hw,
						struct mdss_ad_info *ad);
static void pp_ad_bypass_config(struct mdss_ad_info *ad, u32 *opmode);
static int pp_ad_setup_hw_nums(struct msm_fb_data_type *mfd,
						struct mdss_ad_info *ad);
static int mdss_mdp_ad_setup(struct msm_fb_data_type *mfd);
static void pp_ad_cfg_lut(char __iomem *addr, u32 *data);

@@ -3728,6 +3732,21 @@ static void pp_ad_bypass_config(struct mdss_ad_info *ad, u32 *opmode)
		*opmode = MDSS_PP_AD_BYPASS_DEF;
}

static int pp_ad_setup_hw_nums(struct msm_fb_data_type *mfd,
						struct mdss_ad_info *ad)
{
	u32 mixer_id[MDSS_MDP_INTF_MAX_LAYERMIXER];
	u32 mixer_num;

	mixer_num = mdss_mdp_get_ctl_mixers(mfd->index, mixer_id);
	if (!mixer_num)
		return -EINVAL;

	/* default to left mixer */
	ad->calc_hw_num = mixer_id[0];
	return 0;
}

static int mdss_mdp_ad_setup(struct msm_fb_data_type *mfd)
{
	int ret = 0;
@@ -3805,9 +3824,14 @@ static int mdss_mdp_ad_setup(struct msm_fb_data_type *mfd)
	}
	if (ad->sts & PP_AD_STS_DIRTY_INIT) {
		ad->sts &= ~PP_AD_STS_DIRTY_INIT;
		if (pp_ad_setup_hw_nums(mfd, ad)) {
			pr_warn("failed to setup ad master");
			ad->calc_hw_num = PP_AD_BAD_HW_NUM;
		} else {
			ad->state |= PP_AD_STATE_INIT;
			ad->reg_sts |= PP_AD_STS_DIRTY_INIT;
		}
	}

	/* update ad screen size if it has changed since last configuration */
	if (mfd->panel_info->type == WRITEBACK_PANEL &&
@@ -3848,6 +3872,7 @@ static int mdss_mdp_ad_setup(struct msm_fb_data_type *mfd)
			ad->ad_data_mode = 0;
			ad->last_bl = 0;
			ad->calc_itr = 0;
			ad->calc_hw_num = PP_AD_BAD_HW_NUM;
			memset(&ad->bl_lin, 0, sizeof(uint32_t) *
								AD_BL_LIN_LEN);
			memset(&ad->bl_lin_inv, 0, sizeof(uint32_t) *
@@ -3913,7 +3938,13 @@ static void pp_ad_calc_worker(struct work_struct *work)
	ctl = mfd_to_ctl(ad->mfd);
	mdata = mfd_to_mdata(ad->mfd);

	base = mdata->ad_off[ad->num].base;
	if (!mdata || ad->calc_hw_num > mdata->nad_cfgs) {
		mutex_unlock(&ad->lock);
		return;
	}


	base = mdata->ad_off[ad->calc_hw_num].base;

	if ((ad->cfg.mode == MDSS_AD_MODE_AUTO_STR) && (ad->last_bl == 0)) {
		mutex_unlock(&ad->lock);