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

Commit 7ce5ba1a authored by Benet Clark's avatar Benet Clark
Browse files

msm: mdss: Fix error cases in AD config



The BL linearity LUT was not being copied correctly. This change allows
AD config to exit with errors correctly if the BL linearity LUT is not
passed correctly.

Change-Id: I491a7cc4b168b7691c65cbc2d2963f8a7a3f804d
Signed-off-by: default avatarBenet Clark <benetc@codeaurora.org>
parent 0023b20a
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -3600,7 +3600,6 @@ int mdss_mdp_ad_config(struct msm_fb_data_type *mfd,
			struct mdss_ad_init_cfg *init_cfg)
{
	struct mdss_ad_info *ad;
	struct mdss_mdp_ctl *ctl;
	struct msm_fb_data_type *bl_mfd;
	int lin_ret = -1, inv_ret = -1, ret = 0;
	u32 ratio_temp, shift = 0;
@@ -3623,10 +3622,12 @@ int mdss_mdp_ad_config(struct msm_fb_data_type *mfd,
		if (init_cfg->params.init.bl_lin_len == AD_BL_LIN_LEN) {
			lin_ret = copy_from_user(&ad->bl_lin,
				init_cfg->params.init.bl_lin,
				AD_BL_LIN_LEN * sizeof(uint32_t));
				init_cfg->params.init.bl_lin_len *
				sizeof(uint32_t));
			inv_ret = copy_from_user(&ad->bl_lin_inv,
				init_cfg->params.init.bl_lin_inv,
				AD_BL_LIN_LEN * sizeof(uint32_t));
				init_cfg->params.init.bl_lin_len *
				sizeof(uint32_t));
			if (lin_ret || inv_ret)
				ret = -ENOMEM;
			ratio_temp =  mfd->panel_info->bl_max / AD_BL_LIN_LEN;
@@ -3635,13 +3636,14 @@ int mdss_mdp_ad_config(struct msm_fb_data_type *mfd,
				shift++;
			}
			ad->bl_bright_shift = shift;
		} else if (init_cfg->params.init.bl_lin_len) {
		} else {
			ret = -EINVAL;
		}
		if (!lin_ret && !inv_ret)
		if (ret) {
			ad->state &= ~PP_AD_STATE_BL_LIN;
			goto ad_config_exit;
		} else
			ad->state |= PP_AD_STATE_BL_LIN;
		else
			ad->state &= !PP_AD_STATE_BL_LIN;

		ad->sts |= PP_AD_STS_DIRTY_INIT;
	} else if (init_cfg->ops & MDP_PP_AD_CFG) {
@@ -3667,8 +3669,8 @@ int mdss_mdp_ad_config(struct msm_fb_data_type *mfd,
		ad->mfd = mfd;
		ad->bl_mfd = bl_mfd;
	}
ad_config_exit:
	mutex_unlock(&ad->lock);
	ctl = mfd_to_ctl(mfd);
	return ret;
}