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

Commit 7f3e6930 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: Fix AD backlight configuration"

parents 7a92acc4 47eadde7
Loading
Loading
Loading
Loading
+25 −17
Original line number Diff line number Diff line
@@ -3011,8 +3011,8 @@ static int pp_ad_calc_bl(struct msm_fb_data_type *mfd, int bl_in, int *bl_out,
	mutex_lock(&ad->lock);
	if (!mfd->ad_bl_level)
		mfd->ad_bl_level = bl_in;
	if (!(ad->state & PP_AD_STATE_RUN)) {
		pr_debug("AD is not running.\n");
	if (!(ad->sts & PP_STS_ENABLE)) {
		pr_debug("AD is not enabled.\n");
		mutex_unlock(&ad->lock);
		return -EPERM;
	}
@@ -3035,6 +3035,7 @@ static int pp_ad_calc_bl(struct msm_fb_data_type *mfd, int bl_in, int *bl_out,
		return ret;
	}

	if (ad->init.alpha > 0) {
		ret = pp_ad_attenuate_bl(ad, temp, &temp);
		if (ret) {
			pr_err("Failed to attenuate BL: %d\n", ret);
@@ -3043,14 +3044,18 @@ static int pp_ad_calc_bl(struct msm_fb_data_type *mfd, int bl_in, int *bl_out,
		}
		ad_bl_out = temp;

	ret = pp_ad_linearize_bl(ad, temp, &temp, MDP_PP_AD_BL_LINEAR_INV);
		ret = pp_ad_linearize_bl(ad, temp, &temp,
						MDP_PP_AD_BL_LINEAR_INV);
		if (ret) {
			pr_err("Failed to inverse linearize BL: %d\n", ret);
			mutex_unlock(&ad->lock);
			return ret;
		}

		*bl_out = temp;
	} else {
		ad_bl_out = temp;
	}

	if (pp_ad_bl_threshold_check(ad->init.al_thresh, ad->init.alpha_base,
					ad->last_bl, ad_bl_out)) {
		mfd->ad_bl_level = ad_bl_out;
@@ -6105,6 +6110,8 @@ static int mdss_mdp_ad_setup(struct msm_fb_data_type *mfd)
		ad->sts &= ~PP_AD_STS_DIRTY_DATA;
		ad->state |= PP_AD_STATE_DATA;
		pr_debug("dirty data, last_bl = %d\n", ad->last_bl);
		if (!bl_mfd->ad_bl_level)
			bl_mfd->ad_bl_level = bl_mfd->bl_level;
		bl = bl_mfd->ad_bl_level;

		if (ad->last_bl != bl) {
@@ -6192,6 +6199,7 @@ static int mdss_mdp_ad_setup(struct msm_fb_data_type *mfd)
			memset(&ad->cfg, 0, sizeof(struct mdss_ad_cfg));
			bl_mfd->ext_bl_ctrl = 0;
			bl_mfd->ext_ad_ctrl = -1;
			bl_mfd->ad_bl_level = 0;
		}
		ad->state &= ~PP_AD_STATE_RUN;
	}
@@ -7313,8 +7321,8 @@ static int pp_mfd_ad_release_all(struct msm_fb_data_type *mfd)
	ad->mfd = NULL;
	ad->bl_mfd = NULL;
	ad->state = 0;
	cancel_work_sync(&ad->calc_work);
	mutex_unlock(&ad->lock);
	cancel_work_sync(&ad->calc_work);

	ctl = mfd_to_ctl(mfd);
	if (ctl && ctl->ops.remove_vsync_handler)