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

Commit ba7779be authored by Chandan Uddaraju's avatar Chandan Uddaraju Committed by Gerrit - the friendly Code Review server
Browse files

mdss: display-port: add mutex logic and configure data lanes



Add locking mechanism for host init. Remove mainlink_reset
before configuring the link rates.

Depending on the USB plug orientation, configure the
lane mapping register to support display-port over
usb-type-c port.

Change-Id: I7bf3fc6e102df113611b9450c92ecd4e50b26fb4
Signed-off-by: default avatarChandan Uddaraju <chandanu@codeaurora.org>
parent 160151f7
Loading
Loading
Loading
Loading
+33 −2
Original line number Diff line number Diff line
@@ -878,6 +878,8 @@ int mdss_dp_on(struct mdss_panel_data *pdata)
{
	struct mdss_dp_drv_pdata *dp_drv = NULL;
	int ret = 0;
	enum plug_orientation orientation = ORIENTATION_NONE;
	struct lane_mapping ln_map;

	if (!pdata) {
		pr_err("Invalid input data\n");
@@ -887,7 +889,15 @@ int mdss_dp_on(struct mdss_panel_data *pdata)
	dp_drv = container_of(pdata, struct mdss_dp_drv_pdata,
			panel_data);

	pr_debug("++ cont_splash=%d\n", dp_drv->cont_splash);
	/* wait until link training is completed */
	mutex_lock(&dp_drv->host_mutex);

	pr_debug("Enter++ cont_splash=%d\n", dp_drv->cont_splash);
	/* Default lane mapping */
	ln_map.lane0 = 2;
	ln_map.lane1 = 3;
	ln_map.lane2 = 1;
	ln_map.lane3 = 0;

	if (!dp_drv->cont_splash) { /* vote for clocks */
		ret = mdss_dp_clk_ctrl(dp_drv, DP_CORE_PM, true);
@@ -897,10 +907,27 @@ int mdss_dp_on(struct mdss_panel_data *pdata)
		}
		mdss_dp_phy_reset(&dp_drv->ctrl_io);
		mdss_dp_aux_reset(&dp_drv->ctrl_io);
		mdss_dp_mainlink_reset(&dp_drv->ctrl_io);
		mdss_dp_aux_ctrl(&dp_drv->ctrl_io, true);
		mdss_dp_hpd_configure(&dp_drv->ctrl_io, true);

		orientation = usbpd_get_plug_orientation(dp_drv->pd);
		pr_debug("plug Orientation = %d\n", orientation);

		if (orientation == ORIENTATION_CC2) {
			/* update lane mapping */
			ln_map.lane0 = 1;
			ln_map.lane1 = 0;
			ln_map.lane2 = 2;
			ln_map.lane3 = 3;

			if (gpio_is_valid(dp_drv->usbplug_cc_gpio)) {
				gpio_set_value(
					dp_drv->usbplug_cc_gpio, 1);
				pr_debug("Configured cc gpio for new Orientation\n");
			}

		}

		mdss_dp_phy_aux_setup(&dp_drv->phy_io);

		mdss_dp_irq_enable(dp_drv);
@@ -935,6 +962,7 @@ int mdss_dp_on(struct mdss_panel_data *pdata)

		mdss_dp_mainlink_reset(&dp_drv->ctrl_io);

		mdss_dp_ctrl_lane_mapping(&dp_drv->ctrl_io, ln_map);
		reinit_completion(&dp_drv->idle_comp);
		mdss_dp_fill_link_cfg(dp_drv);
		mdss_dp_mainlink_ctrl(&dp_drv->ctrl_io, true);
@@ -956,7 +984,9 @@ int mdss_dp_on(struct mdss_panel_data *pdata)
	if (mdss_dp_mainlink_ready(dp_drv, BIT(0)))
		pr_debug("mainlink ready\n");

	mutex_unlock(&dp_drv->host_mutex);
	pr_debug("End-\n");

	return ret;
}

@@ -1533,6 +1563,7 @@ static int mdss_dp_probe(struct platform_device *pdev)
	dp_drv->mask1 = EDP_INTR_MASK1;
	dp_drv->mask2 = EDP_INTR_MASK2;
	mutex_init(&dp_drv->emutex);
	mutex_init(&dp_drv->host_mutex);
	mutex_init(&dp_drv->pd_msg_mutex);
	spin_lock_init(&dp_drv->lock);

+1 −0
Original line number Diff line number Diff line
@@ -400,6 +400,7 @@ struct mdss_dp_drv_pdata {
	struct completion video_comp;
	struct mutex aux_mutex;
	struct mutex train_mutex;
	struct mutex host_mutex;
	struct mutex pd_msg_mutex;
	bool cable_connected;
	u32 aux_cmd_busy;
+4 −3
Original line number Diff line number Diff line
@@ -219,9 +219,10 @@ void mdss_dp_ctrl_lane_mapping(struct dss_io_data *ctrl_io,
{
	u8 bits_per_lane = 2;
	u32 lane_map = ((l_map.lane0 << (bits_per_lane * 0))
			    || (l_map.lane1 << (bits_per_lane * 1))
			    || (l_map.lane2 << (bits_per_lane * 2))
			    || (l_map.lane3 << (bits_per_lane * 3)));
			    | (l_map.lane1 << (bits_per_lane * 1))
			    | (l_map.lane2 << (bits_per_lane * 2))
			    | (l_map.lane3 << (bits_per_lane * 3)));
	pr_debug("%s: lane mapping reg = 0x%x\n", __func__, lane_map);
	writel_relaxed(lane_map,
		ctrl_io->base + DP_LOGICAL2PHYSCIAL_LANE_MAPPING);
}
+2 −0
Original line number Diff line number Diff line
@@ -117,5 +117,7 @@ void mdss_dp_sw_mvid_nvid(struct dss_io_data *ctrl_io);
void mdss_dp_usbpd_ext_capabilities(struct usbpd_dp_capabilities *dp_cap);
void mdss_dp_usbpd_ext_dp_status(struct usbpd_dp_status *dp_status);
u32 mdss_dp_usbpd_gen_config_pkt(struct mdss_dp_drv_pdata *dp);
void mdss_dp_ctrl_lane_mapping(struct dss_io_data *ctrl_io,
					struct lane_mapping l_map);

#endif /* __DP_UTIL_H__ */