Skip to content

Commit

Permalink
imx-drm: remove separate imx-fbdev
Browse files Browse the repository at this point in the history
Now that we know when the components of the imx-drm subsystem will be
initialised, we can move the fbdev helper initialisation and teardown
into imx-drm-core.  This gives us the required ordering that DRM wants
in both driver load and unload methods.

We can also stop exporting the imx_drm_device_get() and
imx_drm_device_put() methods; nothing but the fbdev helper was making
use of these.

Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Russell King committed Feb 24, 2014
1 parent e355e7d commit 8acba02
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 90 deletions.
1 change: 0 additions & 1 deletion drivers/staging/imx-drm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ obj-$(CONFIG_DRM_IMX) += imxdrm.o
obj-$(CONFIG_DRM_IMX_PARALLEL_DISPLAY) += parallel-display.o
obj-$(CONFIG_DRM_IMX_TVE) += imx-tve.o
obj-$(CONFIG_DRM_IMX_LDB) += imx-ldb.o
obj-$(CONFIG_DRM_IMX_FB_HELPER) += imx-fbdev.o
obj-$(CONFIG_DRM_IMX_IPUV3_CORE) += ipu-v3/

imx-ipuv3-crtc-objs := ipuv3-crtc.o ipuv3-plane.o
Expand Down
43 changes: 31 additions & 12 deletions drivers/staging/imx-drm/imx-drm-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ struct imx_drm_connector {
struct module *owner;
};

static int legacyfb_depth = 16;
module_param(legacyfb_depth, int, 0444);

static void imx_drm_device_put(void);
static struct imx_drm_device *__imx_drm_device(void);

int imx_drm_crtc_id(struct imx_drm_crtc *crtc)
Expand All @@ -80,16 +84,23 @@ EXPORT_SYMBOL_GPL(imx_drm_crtc_id);

static void imx_drm_driver_lastclose(struct drm_device *drm)
{
#if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
struct imx_drm_device *imxdrm = drm->dev_private;

if (imxdrm->fbhelper)
drm_fbdev_cma_restore_mode(imxdrm->fbhelper);
#endif
}

static int imx_drm_driver_unload(struct drm_device *drm)
{
#if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
struct imx_drm_device *imxdrm = drm->dev_private;

if (imxdrm->fbhelper)
drm_fbdev_cma_fini(imxdrm->fbhelper);
#endif

component_unbind_all(drm->dev, drm);

imx_drm_device_put();
Expand Down Expand Up @@ -225,7 +236,7 @@ static struct imx_drm_device *__imx_drm_device(void)
return imx_drm_device;
}

struct drm_device *imx_drm_device_get(void)
static struct drm_device *imx_drm_device_get(void)
{
struct imx_drm_device *imxdrm = __imx_drm_device();
struct imx_drm_encoder *enc;
Expand Down Expand Up @@ -273,9 +284,8 @@ struct drm_device *imx_drm_device_get(void)
return NULL;

}
EXPORT_SYMBOL_GPL(imx_drm_device_get);

void imx_drm_device_put(void)
static void imx_drm_device_put(void)
{
struct imx_drm_device *imxdrm = __imx_drm_device();
struct imx_drm_encoder *enc;
Expand All @@ -295,7 +305,6 @@ void imx_drm_device_put(void)

mutex_unlock(&imxdrm->mutex);
}
EXPORT_SYMBOL_GPL(imx_drm_device_put);

static int drm_mode_group_reinit(struct drm_device *dev)
{
Expand Down Expand Up @@ -450,6 +459,24 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
}
}

/*
* All components are now initialised, so setup the fb helper.
* The fb helper takes copies of key hardware information, so the
* crtcs/connectors/encoders must not change after this point.
*/
#if IS_ENABLED(CONFIG_DRM_IMX_FB_HELPER)
if (legacyfb_depth != 16 && legacyfb_depth != 32) {
dev_warn(drm->dev, "Invalid legacyfb_depth. Defaulting to 16bpp\n");
legacyfb_depth = 16;
}
imxdrm->fbhelper = drm_fbdev_cma_init(drm, legacyfb_depth,
drm->mode_config.num_crtc, MAX_CRTC);
if (IS_ERR(imxdrm->fbhelper)) {
ret = PTR_ERR(imxdrm->fbhelper);
imxdrm->fbhelper = NULL;
goto err_unbind;
}
#endif
return 0;

err_unbind:
Expand Down Expand Up @@ -767,14 +794,6 @@ int imx_drm_add_connector(struct drm_connector *connector,
}
EXPORT_SYMBOL_GPL(imx_drm_add_connector);

void imx_drm_fb_helper_set(struct drm_fbdev_cma *fbdev_helper)
{
struct imx_drm_device *imxdrm = __imx_drm_device();

imxdrm->fbhelper = fbdev_helper;
}
EXPORT_SYMBOL_GPL(imx_drm_fb_helper_set);

/*
* imx_drm_remove_connector - remove a connector
*/
Expand Down
3 changes: 0 additions & 3 deletions drivers/staging/imx-drm/imx-drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,10 @@ void imx_drm_mode_config_init(struct drm_device *drm);

struct drm_gem_cma_object *imx_drm_fb_get_obj(struct drm_framebuffer *fb);

struct drm_device *imx_drm_device_get(void);
void imx_drm_device_put(void);
int imx_drm_panel_format_pins(struct drm_encoder *encoder,
u32 interface_pix_fmt, int hsync_pin, int vsync_pin);
int imx_drm_panel_format(struct drm_encoder *encoder,
u32 interface_pix_fmt);
void imx_drm_fb_helper_set(struct drm_fbdev_cma *fbdev_helper);

struct device_node;

Expand Down
74 changes: 0 additions & 74 deletions drivers/staging/imx-drm/imx-fbdev.c

This file was deleted.

0 comments on commit 8acba02

Please sign in to comment.