Skip to content

Commit

Permalink
staging: imx-drm: Fix probe failure
Browse files Browse the repository at this point in the history
Since commit b5dc0d1 (drm/imx: kill firstopen callback) the following probe
failure is seen:

[drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
[drm] No driver support for vblank timestamp query.
[drm] Initialized imx-drm 1.0.0 20120507 on minor 0
imx-ldb ldb.10: adding encoder failed with -16
imx-ldb: probe of ldb.10 failed with error -16
imx-ipuv3 2400000.ipu: IPUv3H probed
imx-ipuv3 2800000.ipu: IPUv3H probed
imx-ipuv3-crtc imx-ipuv3-crtc.0: adding crtc failed with -16.
imx-ipuv3-crtc: probe of imx-ipuv3-crtc.0 failed with error -16
imx-ipuv3-crtc imx-ipuv3-crtc.1: adding crtc failed with -16.
imx-ipuv3-crtc: probe of imx-ipuv3-crtc.1 failed with error -16
imx-ipuv3-crtc imx-ipuv3-crtc.2: adding crtc failed with -16.
imx-ipuv3-crtc: probe of imx-ipuv3-crtc.2 failed with error -16
imx-ipuv3-crtc imx-ipuv3-crtc.3: adding crtc failed with -16.
imx-ipuv3-crtc: probe of imx-ipuv3-crtc.3 failed with error -16

The reason for the probe failure is that now 'imxdrm->references' is incremented
early in imx_drm_driver_load(), so the following checks in imx_drm_add_crtc()
and imx_drm_add_encoder():

	if (imxdrm->references) {
		ret = -EBUSY;
		goto err_busy;
	}

,will always fail.

Instead of manually keeping the references in the imx-drm driver, let's use
drm->open_count.

After this patch, lvds panel is functional on a mx6qsabrelite board.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Fabio Estevam authored and Greg Kroah-Hartman committed Sep 25, 2013
1 parent 5e8c3d3 commit 099326d
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions drivers/staging/imx-drm/imx-drm-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ struct imx_drm_device {
struct list_head encoder_list;
struct list_head connector_list;
struct mutex mutex;
int references;
int pipes;
struct drm_fbdev_cma *fbhelper;
};
Expand Down Expand Up @@ -241,8 +240,6 @@ struct drm_device *imx_drm_device_get(void)
}
}

imxdrm->references++;

return imxdrm->drm;

unwind_crtc:
Expand Down Expand Up @@ -280,8 +277,6 @@ void imx_drm_device_put(void)
list_for_each_entry(enc, &imxdrm->encoder_list, list)
module_put(enc->owner);

imxdrm->references--;

mutex_unlock(&imxdrm->mutex);
}
EXPORT_SYMBOL_GPL(imx_drm_device_put);
Expand Down Expand Up @@ -485,7 +480,7 @@ int imx_drm_add_crtc(struct drm_crtc *crtc,

mutex_lock(&imxdrm->mutex);

if (imxdrm->references) {
if (imxdrm->drm->open_count) {
ret = -EBUSY;
goto err_busy;
}
Expand Down Expand Up @@ -564,7 +559,7 @@ int imx_drm_add_encoder(struct drm_encoder *encoder,

mutex_lock(&imxdrm->mutex);

if (imxdrm->references) {
if (imxdrm->drm->open_count) {
ret = -EBUSY;
goto err_busy;
}
Expand Down Expand Up @@ -709,7 +704,7 @@ int imx_drm_add_connector(struct drm_connector *connector,

mutex_lock(&imxdrm->mutex);

if (imxdrm->references) {
if (imxdrm->drm->open_count) {
ret = -EBUSY;
goto err_busy;
}
Expand Down

0 comments on commit 099326d

Please sign in to comment.