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

Commit b6f7c6ff authored by Padmanabhan Komanduru's avatar Padmanabhan Komanduru Committed by Gerrit - the friendly Code Review server
Browse files

drm/msm/dp: add support to configure sink in power saving mode



Add support to send the PSM AUX command to the sink whenever
required during the Display Port power down sequence.

Change-Id: I7f3d3248de73c7c847a2c0915ba6732b426a5854
Signed-off-by: default avatarPadmanabhan Komanduru <pkomandu@codeaurora.org>
parent fdafc41a
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ struct dp_ctrl_private {
	struct completion idle_comp;
	struct completion video_comp;

	bool psm_enabled;
	bool orientation;
	atomic_t aborted;

@@ -992,7 +991,10 @@ static int dp_ctrl_setup_main_link(struct dp_ctrl_private *ctrl, bool train)

	ctrl->catalog->mainlink_ctrl(ctrl->catalog, true);

	drm_dp_link_power_up(ctrl->aux->drm_aux, &ctrl->panel->link_info);
	ret = ctrl->link->psm_config(ctrl->link,
		&ctrl->panel->link_info, false);
	if (ret)
		goto end;

	if (ctrl->link->sink_request & DP_TEST_LINK_PHY_TEST_PATTERN)
		goto end;
+0 −1
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@
#include "dp_catalog.h"

struct dp_ctrl {

	int (*init)(struct dp_ctrl *dp_ctrl, bool flip);
	void (*deinit)(struct dp_ctrl *dp_ctrl);
	int (*on)(struct dp_ctrl *dp_ctrl);
+12 −0
Original line number Diff line number Diff line
@@ -524,6 +524,9 @@ static int dp_display_process_hpd_high(struct dp_display_private *dp)

	dp->aux->init(dp->aux, dp->parser->aux_cfg);

	if (dp->link->psm_enabled)
		goto notify;

	rc = dp->panel->read_sink_caps(dp->panel, dp->dp_display.connector);
	if (rc)
		return rc;
@@ -547,6 +550,7 @@ static int dp_display_process_hpd_high(struct dp_display_private *dp)
	dp->dp_display.max_pclk_khz = min(max_pclk_from_edid,
		dp->parser->max_pclk_khz);

notify:
	dp_display_send_hpd_notification(dp, true);

end:
@@ -668,6 +672,10 @@ static int dp_display_usbpd_disconnect_cb(struct device *dev)

	rc = dp_display_send_hpd_notification(dp, false);

	/* if cable is disconnected, reset psm_enabled flag */
	if (!dp->usbpd->alt_mode_cfg_done)
		dp->link->psm_enabled = false;

	if ((rc < 0) && dp->power_on)
		dp_display_clean(dp);

@@ -955,6 +963,10 @@ static int dp_display_pre_disable(struct dp_display *dp_display)
			dp->hdcp.ops->off(dp->hdcp.data);
	}

	if (dp->usbpd->alt_mode_cfg_done && (dp->usbpd->hpd_high ||
		dp->usbpd->forced_disconnect))
		dp->link->psm_config(dp->link, &dp->panel->link_info, true);

	dp->ctrl->push_idle(dp->ctrl);
error:
	return rc;
+27 −0
Original line number Diff line number Diff line
@@ -999,6 +999,32 @@ static void dp_link_send_test_response(struct dp_link *dp_link)
			&dp_link->test_response, response_len);
}

static int dp_link_psm_config(struct dp_link *dp_link,
	struct drm_dp_link *link_info, bool enable)
{
	struct dp_link_private *link = NULL;
	int ret = 0;

	if (!dp_link) {
		pr_err("invalid params\n");
		return -EINVAL;
	}

	link = container_of(dp_link, struct dp_link_private, dp_link);

	if (enable)
		ret = drm_dp_link_power_down(link->aux->drm_aux, link_info);
	else
		ret = drm_dp_link_power_up(link->aux->drm_aux, link_info);

	if (ret)
		pr_err("Failed to %s low power mode\n",
			(enable ? "enter" : "exit"));
	else
		dp_link->psm_enabled = enable;

	return ret;
}

static int dp_link_parse_vx_px(struct dp_link_private *link)
{
@@ -1519,6 +1545,7 @@ struct dp_link *dp_link_get(struct device *dev, struct dp_aux *aux)
	dp_link->adjust_levels          = dp_link_adjust_levels;
	dp_link->send_psm_request       = dp_link_send_psm_request;
	dp_link->send_test_response     = dp_link_send_test_response;
	dp_link->psm_config             = dp_link_psm_config;

	return dp_link;
error:
+3 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ struct dp_link_params {
struct dp_link {
	u32 sink_request;
	u32 test_response;
	bool psm_enabled;

	struct dp_link_sink_count sink_count;
	struct dp_link_test_video test_video;
@@ -99,6 +100,8 @@ struct dp_link {
	int (*adjust_levels)(struct dp_link *dp_link, u8 *link_status);
	int (*send_psm_request)(struct dp_link *dp_link, bool req);
	void (*send_test_response)(struct dp_link *dp_link);
	int (*psm_config)(struct dp_link *dp_link,
		struct drm_dp_link *link_info, bool enable);
};

static inline char *dp_link_get_phy_test_pattern(u32 phy_test_pattern_sel)
Loading