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

Commit dbcc41ca authored by Terence Hampson's avatar Terence Hampson
Browse files

msm: mdss: turn off the DSI clocks on command mode panel



On command mode panel, panel is refreshing itself using
its own internal memory. Shutting down the dsi clocks
when there is no display update will save power.

Change-Id: Ibce33bed8c5ed65581557089b6537b1a8d9428b4
Signed-off-by: default avatarXiaoming Zhou <zhoux@codeaurora.org>
Signed-off-by: default avatarTerence Hampson <thampson@codeaurora.org>
parent 1498b039
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -1085,6 +1085,27 @@ static struct device_node *dsi_find_panel_of_node(
	return dsi_pan_node;
}

static int msm_dsi_clk_ctrl(struct mdss_panel_data *pdata, int enable)
{
	u32 bitclk_rate = 0, byteclk_rate = 0, pclk_rate = 0, dsiclk_rate = 0;

	pr_debug("%s:\n", __func__);

	if (enable) {
		msm_dsi_ahb_ctrl(1);
		msm_dsi_cal_clk_rate(pdata, &bitclk_rate, &dsiclk_rate,
					&byteclk_rate, &pclk_rate);
		msm_dsi_clk_set_rate(DSI_ESC_CLK_RATE, dsiclk_rate,
					byteclk_rate, pclk_rate);
		msm_dsi_clk_enable();
	} else {
		msm_dsi_clk_set_rate(DSI_ESC_CLK_RATE, 0, 0, 0);
		msm_dsi_clk_disable();
		msm_dsi_ahb_ctrl(0);
	}
	return 0;
}

static int msm_dsi_probe(struct platform_device *pdev)
{
	struct dsi_interface intf;
@@ -1203,6 +1224,7 @@ static int msm_dsi_probe(struct platform_device *pdev)
	intf.on = msm_dsi_on;
	intf.off = msm_dsi_off;
	intf.cont_on = msm_dsi_cont_on;
	intf.clk_ctrl = msm_dsi_clk_ctrl;
	intf.op_mode_config = msm_dsi_op_mode_config;
	intf.tx = msm_dsi_cmds_tx;
	intf.rx = msm_dsi_cmds_rx;
+15 −0
Original line number Diff line number Diff line
@@ -104,6 +104,18 @@ static int dsi_splash_on(struct mdss_panel_data *pdata)
	return rc;
}

static int dsi_clk_ctrl(struct mdss_panel_data *pdata, int enable)
{
	int rc = 0;

	pr_debug("%s:\n", __func__);

	if (dsi_intf.clk_ctrl)
		rc = dsi_intf.clk_ctrl(pdata, enable);

	return rc;
}

static int dsi_event_handler(struct mdss_panel_data *pdata,
				int event, void *arg)
{
@@ -130,6 +142,9 @@ static int dsi_event_handler(struct mdss_panel_data *pdata,
	case MDSS_EVENT_CONT_SPLASH_BEGIN:
		rc = dsi_splash_on(pdata);
		break;
	case MDSS_EVENT_PANEL_CLK_CTRL:
		rc = dsi_clk_ctrl(pdata, (int)arg);
		break;
	default:
		pr_debug("%s: unhandled event=%d\n", __func__, event);
		break;
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ struct dsi_interface {
	int (*on)(struct mdss_panel_data *pdata);
	int (*off)(struct mdss_panel_data *pdata);
	int (*cont_on)(struct mdss_panel_data *pdata);
	int (*clk_ctrl)(struct mdss_panel_data *pdata, int enable);
	void (*op_mode_config)(int mode, struct mdss_panel_data *pdata);
	int (*tx)(struct mdss_panel_data *pdata,
		struct dsi_buf *tp, struct dsi_cmd_desc *cmds, int cnt);
+10 −0
Original line number Diff line number Diff line
@@ -1735,6 +1735,11 @@ static int mdp3_fb_mem_get_iommu_domain(void)
	return mdp3_res->domains[MDP3_DMA_IOMMU_DOMAIN].domain_idx;
}

int mdp3_get_cont_spash_en(void)
{
	return mdp3_res->cont_splash_en;
}

int mdp3_continuous_splash_copy(struct mdss_panel_data *pdata)
{
	unsigned long splash_phys;
@@ -1805,6 +1810,9 @@ static int mdp3_continuous_splash_on(struct mdss_panel_data *pdata)

	pr_debug("mdp3__continuous_splash_on\n");

	mdp3_clk_set_rate(MDP3_CLK_VSYNC, MDP_VSYNC_CLK_RATE,
			MDP3_CLIENT_DMA_P);

	rc = mdp3_clk_prepare();
	if (rc) {
		pr_err("fail to prepare clk\n");
@@ -1848,6 +1856,8 @@ static int mdp3_continuous_splash_on(struct mdss_panel_data *pdata)
		mdp3_res->intf[MDP3_DMA_OUTPUT_SEL_DSI_VIDEO].active = 1;
	else
		mdp3_res->intf[MDP3_DMA_OUTPUT_SEL_DSI_CMD].active = 1;

	mdp3_res->cont_splash_en = 1;
	return 0;

splash_on_err:
+4 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@
#include "mdp3_dma.h"
#include "mdss_fb.h"

#define MDP_VSYNC_CLK_RATE	19200000

enum  {
	MDP3_CLK_AHB,
	MDP3_CLK_CORE,
@@ -152,6 +154,7 @@ struct mdp3_hw_resource {
	struct mdss_panel_cfg pan_cfg;

	int clk_prepare_count;
	int cont_splash_en;
};

struct mdp3_img_data {
@@ -189,6 +192,7 @@ void mdp3_free(void);
int mdp3_parse_dt_splash(struct msm_fb_data_type *mfd);
void mdp3_release_splash_memory(void);
int mdp3_create_sysfs_link(struct device *dev);
int mdp3_get_cont_spash_en(void);

#define MDP3_REG_WRITE(addr, val) writel_relaxed(val, mdp3_res->mdp_base + addr)
#define MDP3_REG_READ(addr) readl_relaxed(mdp3_res->mdp_base + addr)
Loading