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

Commit 2a6d3904 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drm/msm/dsi-staging: implement dynamic DSI clock" into dev/msm-4.14-display

parents aff4594f 25bda03e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -67,6 +67,8 @@ static void dsi_catalog_cmn_init(struct dsi_ctrl_hw *ctrl,
	ctrl->ops.error_intr_ctrl = dsi_ctrl_hw_cmn_error_intr_ctrl;
	ctrl->ops.get_error_mask = dsi_ctrl_hw_cmn_get_error_mask;
	ctrl->ops.get_hw_version = dsi_ctrl_hw_cmn_get_hw_version;
	ctrl->ops.wait_for_cmd_mode_mdp_idle =
		dsi_ctrl_hw_cmn_wait_for_cmd_mode_mdp_idle;

	switch (version) {
	case DSI_CTRL_VERSION_1_4:
+1 −0
Original line number Diff line number Diff line
@@ -202,6 +202,7 @@ void dsi_ctrl_hw_cmn_mask_error_intr(struct dsi_ctrl_hw *ctrl, u32 idx,
void dsi_ctrl_hw_cmn_error_intr_ctrl(struct dsi_ctrl_hw *ctrl, bool en);
u32 dsi_ctrl_hw_cmn_get_error_mask(struct dsi_ctrl_hw *ctrl);
u32 dsi_ctrl_hw_cmn_get_hw_version(struct dsi_ctrl_hw *ctrl);
int dsi_ctrl_hw_cmn_wait_for_cmd_mode_mdp_idle(struct dsi_ctrl_hw *ctrl);

/* Definitions specific to 1.4 DSI controller hardware */
int dsi_ctrl_hw_14_wait_for_lane_idle(struct dsi_ctrl_hw *ctrl, u32 lanes);
+10 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2018, 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
@@ -231,6 +231,15 @@ void *dsi_register_clk_handle(void *clk_mngr, char *client);
 */
int dsi_deregister_clk_handle(void *client);

/**
 * dsi_display_link_clk_force_update_ctrl() - force to set link clks
 * @handle:     Handle of desired DSI clock client.
 *
 * return: error code in case of failure or 0 for success.
 */

int dsi_display_link_clk_force_update_ctrl(void *handle);

/**
 * dsi_display_clk_ctrl() - set frequencies for link clks
 * @handle:     Handle of desired DSI clock client.
+71 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2018, 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
@@ -1071,6 +1071,76 @@ int dsi_clk_req_state(void *client, enum dsi_clk_type clk,

DEFINE_MUTEX(dsi_mngr_clk_mutex);

static int dsi_display_link_clk_force_update(void *client)
{
	int rc = 0;
	struct dsi_clk_client_info *c = client;
	struct dsi_clk_mngr *mngr;
	struct dsi_link_clks *l_clks;

	if (!client) {
		pr_err("%s: Invalid arg\n", __func__);
		return -EINVAL;
	}
	mngr = c->mngr;

	mutex_lock(&mngr->clk_mutex);

	l_clks = mngr->link_clks;

	/*
	 * When link_clk_state is DSI_CLK_OFF, don't change DSI clock rate
	 * since it is possible to be overwritten, and return -EAGAIN to
	 * dynamic DSI writing interface to defer the reenabling to the next
	 * drm commit.
	 */
	if (mngr->link_clk_state == DSI_CLK_OFF) {
		rc = -EAGAIN;
		goto error;
	}

	rc = dsi_display_link_clk_disable(l_clks,
		mngr->dsi_ctrl_count, mngr->master_ndx);
	if (rc) {
		pr_err("%s, failed to stop link clk, rc = %d\n",
			__func__, rc);
		goto error;
	}

	rc = dsi_display_link_clk_enable(l_clks,
		mngr->dsi_ctrl_count, mngr->master_ndx);
	if (rc) {
		pr_err("%s, failed to start link clk rc= %d\n",
			__func__, rc);
		goto error;
	}

error:
	mutex_unlock(&mngr->clk_mutex);
	return rc;

}

int dsi_display_link_clk_force_update_ctrl(void *handle)
{
	int rc = 0;

	if (!handle) {
		pr_err("%s: Invalid arg\n", __func__);
		return -EINVAL;
	}

	mutex_lock(&dsi_mngr_clk_mutex);

	rc = dsi_display_link_clk_force_update(handle);
	if (rc && (rc != -EAGAIN))
		pr_err("%s: failed set clk state, rc = %d\n", __func__, rc);

	mutex_unlock(&dsi_mngr_clk_mutex);

	return rc;
}

int dsi_display_clk_ctrl(void *handle,
	enum dsi_clk_type clk_type, enum dsi_clk_state clk_state)
{
+21 −0
Original line number Diff line number Diff line
@@ -921,6 +921,27 @@ static int dsi_ctrl_copy_and_pad_cmd(struct dsi_ctrl *dsi_ctrl,
	return rc;
}

int dsi_ctrl_wait_for_cmd_mode_mdp_idle(struct dsi_ctrl *dsi_ctrl)
{
	int rc = 0;

	if (!dsi_ctrl) {
		pr_err("Invalid params\n");
		return -EINVAL;
	}

	if (dsi_ctrl->host_config.panel_mode != DSI_OP_CMD_MODE)
		return -EINVAL;

	mutex_lock(&dsi_ctrl->ctrl_lock);

	rc = dsi_ctrl->hw.ops.wait_for_cmd_mode_mdp_idle(&dsi_ctrl->hw);

	mutex_unlock(&dsi_ctrl->ctrl_lock);

	return rc;
}

static void dsi_ctrl_wait_for_video_done(struct dsi_ctrl *dsi_ctrl)
{
	u32 v_total = 0, v_blank = 0, sleep_ms = 0, fps = 0, ret;
Loading