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

Commit f0771ae2 authored by Sandeep Panda's avatar Sandeep Panda
Browse files

msm: mdss: update PHY timing calculation logic for resolution change



In current implementation we are always overriding the PHY read
from dt entry with the ones we are calculating in driver. Update
the PHY timing only when there is a change in resolution.

Change-Id: I2ba936af6e55b27c7b28d38990b32e896c877e08
Signed-off-by: default avatarSandeep Panda <spanda@codeaurora.org>
parent 1468823d
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -2379,13 +2379,20 @@ static int mdss_dsi_event_handler(struct mdss_panel_data *pdata,
	case MDSS_EVENT_CHECK_PARAMS:
		pr_debug("%s:Entered Case MDSS_EVENT_CHECK_PARAMS\n", __func__);
		if (mdss_dsi_check_params(ctrl_pdata, arg)) {
			ctrl_pdata->refresh_clk_rate = true;
			ctrl_pdata->update_phy_timing = true;
			/*
			 * Call to MDSS_EVENT_CHECK_PARAMS expects
			 * the return value of 1, if there is a change
			 * in panel timing parameters.
			 */
			rc = 1;
		}
		ctrl_pdata->refresh_clk_rate = true;
		break;
	case MDSS_EVENT_LINK_READY:
		if (ctrl_pdata->refresh_clk_rate)
			rc = mdss_dsi_clk_refresh(pdata);
			rc = mdss_dsi_clk_refresh(pdata,
				ctrl_pdata->update_phy_timing);

		mdss_dsi_get_hw_revision(ctrl_pdata);
		mdss_dsi_get_phy_revision(ctrl_pdata);
+3 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -532,6 +532,7 @@ struct mdss_dsi_ctrl_pdata {
	struct workqueue_struct *workq;
	struct delayed_work dba_work;
	bool timing_db_mode;
	bool update_phy_timing; /* flag to recalculate PHY timings */
};

struct dsi_status_data {
@@ -574,7 +575,7 @@ void mdss_dsi_irq_handler_config(struct mdss_dsi_ctrl_pdata *ctrl_pdata);
void mdss_dsi_set_tx_power_mode(int mode, struct mdss_panel_data *pdata);
int mdss_dsi_clk_div_config(struct mdss_panel_info *panel_info,
			    int frame_rate);
int mdss_dsi_clk_refresh(struct mdss_panel_data *pdata);
int mdss_dsi_clk_refresh(struct mdss_panel_data *pdata, bool update_phy);
int mdss_dsi_link_clk_init(struct platform_device *pdev,
		      struct mdss_dsi_ctrl_pdata *ctrl_pdata);
void mdss_dsi_link_clk_deinit(struct device *dev,
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1836,7 +1836,7 @@ int mdss_dsi_panel_timing_switch(struct mdss_dsi_ctrl_pdata *ctrl,
	ctrl->panel_data.current_timing = timing;
	if (!timing->clk_rate)
		ctrl->refresh_clk_rate = true;
	mdss_dsi_clk_refresh(&ctrl->panel_data);
	mdss_dsi_clk_refresh(&ctrl->panel_data, ctrl->update_phy_timing);

	return 0;
}
+16 −11
Original line number Diff line number Diff line
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1105,7 +1105,7 @@ void mdss_dsi_core_clk_deinit(struct device *dev, struct dsi_shared_data *sdata)
		devm_clk_put(dev, sdata->mdp_core_clk);
}

int mdss_dsi_clk_refresh(struct mdss_panel_data *pdata)
int mdss_dsi_clk_refresh(struct mdss_panel_data *pdata, bool update_phy)
{
	struct mdss_dsi_ctrl_pdata *ctrl_pdata = NULL;
	struct mdss_panel_info *pinfo = NULL;
@@ -1125,9 +1125,11 @@ int mdss_dsi_clk_refresh(struct mdss_panel_data *pdata)
		return -EINVAL;
	}

	/* Re-calculate frame rate before clk config */
	if (update_phy) {
		pinfo->mipi.frame_rate = mdss_panel_calc_frame_rate(pinfo);
	pr_debug("%s: new frame rate %d\n", __func__, pinfo->mipi.frame_rate);
		pr_debug("%s: new frame rate %d\n",
				__func__, pinfo->mipi.frame_rate);
	}

	rc = mdss_dsi_clk_div_config(&pdata->panel_info,
			pdata->panel_info.mipi.frame_rate);
@@ -1160,13 +1162,16 @@ int mdss_dsi_clk_refresh(struct mdss_panel_data *pdata)
		return rc;
	}

	if (update_phy) {
		/* phy panel timing calaculation */
		rc = mdss_dsi_phy_calc_timing_param(pinfo,
		ctrl_pdata->shared_data->phy_rev, pinfo->mipi.frame_rate);
				ctrl_pdata->shared_data->phy_rev,
				pinfo->mipi.frame_rate);
		if (rc) {
		pr_err("%s: unable to calculate phy timings\n", __func__);
			pr_err("Error in calculating phy timings\n");
			return rc;
		}
	}

	return rc;
}