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

Commit 587ae26f authored by Adrian Salido-Moreno's avatar Adrian Salido-Moreno Committed by Gerrit - the friendly Code Review server
Browse files

msm: mdss: configure panel split based on configuration



Current code assumes when Dual DSI configuration is used that width will
be twice the left panel resolution. This may not always be the case and
should instead look at the configuration to get this information.

Change-Id: I5c2ac608f46d7c0ce1acbffe002d69fca44afaf7
Signed-off-by: default avatarAdrian Salido-Moreno <adrianm@codeaurora.org>
parent 6f536079
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -274,16 +274,27 @@ static ssize_t mdss_fb_get_type(struct device *dev,
	return ret;
}

static int mdss_fb_get_panel_xres(struct mdss_panel_info *pinfo)
{
	struct mdss_panel_data *pdata;
	int xres;

	pdata = container_of(pinfo, struct mdss_panel_data, panel_info);

	xres = pinfo->xres;
	if (pdata->next)
		xres += mdss_fb_get_panel_xres(&pdata->next->panel_info);

	return xres;
}

static inline int mdss_fb_validate_split(int left, int right,
			struct msm_fb_data_type *mfd)
{
	int rc = -EINVAL;
	u32 panel_xres = mfd->panel_info->xres;
	u32 panel_xres = mdss_fb_get_panel_xres(mfd->panel_info);
	/* more validate condition could be added if needed */
	if (left && right) {
		if (is_panel_split(mfd))
			panel_xres *= 2;

		if (panel_xres == left + right) {
			mfd->split_fb_left = left;
			mfd->split_fb_right = right;
@@ -291,7 +302,8 @@ static inline int mdss_fb_validate_split(int left, int right,
		}
	} else {
		if (is_split_lm(mfd)) {
			mfd->split_fb_left = mfd->split_fb_right = panel_xres;
			mfd->split_fb_left = mfd->panel_info->xres;
			mfd->split_fb_right = panel_xres - mfd->split_fb_left;
			rc = 0;
		} else {
			mfd->split_fb_left = mfd->split_fb_right = 0;
@@ -1767,9 +1779,7 @@ static int mdss_fb_register(struct msm_fb_data_type *mfd)
		return ret;
	}

	var->xres = panel_info->xres;
	if (is_panel_split(mfd))
		var->xres *= 2;
	var->xres = mdss_fb_get_panel_xres(panel_info);

	fix->type = panel_info->is_3d_panel;
	if (mfd->mdp.fb_stride)