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

Commit 886a5c0c authored by Tatenda Chipeperekwa's avatar Tatenda Chipeperekwa
Browse files

drm/msm/dp: add orientation support for simulation mode



Add support to specify the plug orientation during the connect
event in simulation mode. For example:
	"echo 1 > /d/drm_dp/hpd" for normal plug orientation
	"echo 5 > /d/drm_dp/hpd" for flip plug orientation
Furthermore, do not program the AUX switch device if we are in
simulation mode as this might cause unexpected behaviour for
USB functionality.

Change-Id: I932b011aee97e584f3206c98115161b4041a4803
Signed-off-by: default avatarTatenda Chipeperekwa <tatendac@codeaurora.org>
parent 387e9dc0
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -262,7 +262,10 @@ static ssize_t dp_debug_write_hpd(struct file *file,
	struct dp_debug_private *debug = file->private_data;
	struct dp_debug_private *debug = file->private_data;
	char buf[SZ_8];
	char buf[SZ_8];
	size_t len = 0;
	size_t len = 0;
	int hpd;
	int const orientation_mask = 0x4;
	int const hpd_data_mask = 0x7;
	int hpd = 0;
	int orientation = 0;


	if (!debug)
	if (!debug)
		return -ENODEV;
		return -ENODEV;
@@ -280,11 +283,14 @@ static ssize_t dp_debug_write_hpd(struct file *file,
	if (kstrtoint(buf, 10, &hpd) != 0)
	if (kstrtoint(buf, 10, &hpd) != 0)
		goto end;
		goto end;


	hpd &= 0x3;
	hpd &= hpd_data_mask;
	orientation = hpd & orientation_mask ?
		ORIENTATION_CC2 : ORIENTATION_CC1;


	debug->dp_debug.psm_enabled = !!(hpd & BIT(1));
	debug->dp_debug.psm_enabled = !!(hpd & BIT(1));


	debug->usbpd->simulate_connect(debug->usbpd, !!(hpd & BIT(0)));
	debug->usbpd->simulate_connect(debug->usbpd, !!(hpd & BIT(0)),
			orientation);
end:
end:
	return len;
	return len;
}
}
+5 −0
Original line number Original line Diff line number Diff line
@@ -658,6 +658,11 @@ static int dp_display_configure_aux_switch(struct dp_display_private *dp)
	int rc = 0;
	int rc = 0;
	enum fsa_function event = FSA_EVENT_MAX;
	enum fsa_function event = FSA_EVENT_MAX;


	if (dp->debug->sim_mode) {
		pr_debug("simulation mode, skipping AUX switch programming\n");
		return 0;
	}

	if (!dp->aux_switch_node) {
	if (!dp->aux_switch_node) {
		pr_debug("undefined fsa4480 handle\n");
		pr_debug("undefined fsa4480 handle\n");
		goto end;
		goto end;
+6 −1
Original line number Original line Diff line number Diff line
@@ -401,7 +401,8 @@ static void dp_usbpd_response_cb(struct usbpd_svid_handler *hdlr, u8 cmd,
	}
	}
}
}


static int dp_usbpd_simulate_connect(struct dp_usbpd *dp_usbpd, bool hpd)
static int dp_usbpd_simulate_connect(struct dp_usbpd *dp_usbpd, bool hpd,
		int orientation)
{
{
	int rc = 0;
	int rc = 0;
	struct dp_usbpd_private *pd;
	struct dp_usbpd_private *pd;
@@ -416,7 +417,11 @@ static int dp_usbpd_simulate_connect(struct dp_usbpd *dp_usbpd, bool hpd)


	dp_usbpd->hpd_high = hpd;
	dp_usbpd->hpd_high = hpd;
	pd->forced_disconnect = !hpd;
	pd->forced_disconnect = !hpd;
	pd->dp_usbpd.orientation = orientation;


	pr_debug("hpd_high=%d, forced_disconnect=%d, orientation=%d\n",
			dp_usbpd->hpd_high, pd->forced_disconnect,
			pd->dp_usbpd.orientation);
	if (hpd)
	if (hpd)
		pd->dp_cb->configure(pd->dev);
		pd->dp_cb->configure(pd->dev);
	else
	else
+2 −1
Original line number Original line Diff line number Diff line
@@ -65,7 +65,8 @@ struct dp_usbpd {
	bool alt_mode_cfg_done;
	bool alt_mode_cfg_done;
	bool debug_en;
	bool debug_en;


	int (*simulate_connect)(struct dp_usbpd *dp_usbpd, bool hpd);
	int (*simulate_connect)(struct dp_usbpd *dp_usbpd, bool hpd,
			int orientation);
	int (*simulate_attention)(struct dp_usbpd *dp_usbpd, int vdo);
	int (*simulate_attention)(struct dp_usbpd *dp_usbpd, int vdo);
};
};