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

Commit c8f6ff25 authored by Xiaowen Wu's avatar Xiaowen Wu
Browse files

drm/msm/dp: check drm driver status in configure_cb



When dp is connected during boot, there is a chance that
configure_cb is called before drm probe is finished and
cause host_init failure. Here we poll the value of
poll_enabled and wait until drm driver is ready.

Change-Id: I65b869a55e02ef5d4d958e7bef2a62f6823f9297
Signed-off-by: default avatarXiaowen Wu <wxiaowen@codeaurora.org>
parent 0170de9a
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -909,6 +909,27 @@ static int dp_display_usbpd_configure_cb(struct device *dev)
		goto end;
	}

	/*
	 * When dp is connected during boot, there is a chance that
	 * configure_cb is called before drm probe is finished and
	 * cause host_init failure. Here we poll the value of
	 * poll_enabled and wait until drm driver is ready.
	 */
	if (!dp->dp_display.drm_dev->mode_config.poll_enabled) {
		const int poll_timeout = 10000;
		int i;

		for (i = 0; !dp->dp_display.drm_dev->mode_config.poll_enabled &&
				i < poll_timeout; i++)
			usleep_range(1000, 1100);

		if (i == poll_timeout) {
			pr_err("driver is not loaded\n");
			rc = -ENODEV;
			goto end;
		}
	}

	if (!dp->debug->sim_mode && !dp->parser->no_aux_switch
	    && !dp->parser->gpio_aux_switch) {
		rc = dp->aux->aux_switch(dp->aux, true, dp->hpd->orientation);