|
@@ -40,17 +40,11 @@ struct imx_drm_component {
|
|
|
|
|
|
struct imx_drm_device {
|
|
|
struct drm_device *drm;
|
|
|
- struct imx_drm_crtc *crtc[MAX_CRTC];
|
|
|
unsigned int pipes;
|
|
|
struct drm_fbdev_cma *fbhelper;
|
|
|
struct drm_atomic_state *state;
|
|
|
};
|
|
|
|
|
|
-struct imx_drm_crtc {
|
|
|
- struct drm_crtc *crtc;
|
|
|
- struct imx_drm_crtc_helper_funcs imx_drm_helper_funcs;
|
|
|
-};
|
|
|
-
|
|
|
#if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION)
|
|
|
static int legacyfb_depth = 16;
|
|
|
module_param(legacyfb_depth, int, 0444);
|
|
@@ -63,38 +57,6 @@ static void imx_drm_driver_lastclose(struct drm_device *drm)
|
|
|
drm_fbdev_cma_restore_mode(imxdrm->fbhelper);
|
|
|
}
|
|
|
|
|
|
-static int imx_drm_enable_vblank(struct drm_device *drm, unsigned int pipe)
|
|
|
-{
|
|
|
- struct imx_drm_device *imxdrm = drm->dev_private;
|
|
|
- struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[pipe];
|
|
|
- int ret;
|
|
|
-
|
|
|
- if (!imx_drm_crtc)
|
|
|
- return -EINVAL;
|
|
|
-
|
|
|
- if (!imx_drm_crtc->imx_drm_helper_funcs.enable_vblank)
|
|
|
- return -ENOSYS;
|
|
|
-
|
|
|
- ret = imx_drm_crtc->imx_drm_helper_funcs.enable_vblank(
|
|
|
- imx_drm_crtc->crtc);
|
|
|
-
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
-static void imx_drm_disable_vblank(struct drm_device *drm, unsigned int pipe)
|
|
|
-{
|
|
|
- struct imx_drm_device *imxdrm = drm->dev_private;
|
|
|
- struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[pipe];
|
|
|
-
|
|
|
- if (!imx_drm_crtc)
|
|
|
- return;
|
|
|
-
|
|
|
- if (!imx_drm_crtc->imx_drm_helper_funcs.disable_vblank)
|
|
|
- return;
|
|
|
-
|
|
|
- imx_drm_crtc->imx_drm_helper_funcs.disable_vblank(imx_drm_crtc->crtc);
|
|
|
-}
|
|
|
-
|
|
|
static const struct file_operations imx_drm_driver_fops = {
|
|
|
.owner = THIS_MODULE,
|
|
|
.open = drm_open,
|
|
@@ -180,67 +142,6 @@ static struct drm_mode_config_helper_funcs imx_drm_mode_config_helpers = {
|
|
|
.atomic_commit_tail = imx_drm_atomic_commit_tail,
|
|
|
};
|
|
|
|
|
|
-/*
|
|
|
- * imx_drm_add_crtc - add a new crtc
|
|
|
- */
|
|
|
-int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc,
|
|
|
- struct imx_drm_crtc **new_crtc, struct drm_plane *primary_plane,
|
|
|
- const struct imx_drm_crtc_helper_funcs *imx_drm_helper_funcs,
|
|
|
- struct device_node *port)
|
|
|
-{
|
|
|
- struct imx_drm_device *imxdrm = drm->dev_private;
|
|
|
- struct imx_drm_crtc *imx_drm_crtc;
|
|
|
-
|
|
|
- /*
|
|
|
- * The vblank arrays are dimensioned by MAX_CRTC - we can't
|
|
|
- * pass IDs greater than this to those functions.
|
|
|
- */
|
|
|
- if (imxdrm->pipes >= MAX_CRTC)
|
|
|
- return -EINVAL;
|
|
|
-
|
|
|
- if (imxdrm->drm->open_count)
|
|
|
- return -EBUSY;
|
|
|
-
|
|
|
- imx_drm_crtc = kzalloc(sizeof(*imx_drm_crtc), GFP_KERNEL);
|
|
|
- if (!imx_drm_crtc)
|
|
|
- return -ENOMEM;
|
|
|
-
|
|
|
- imx_drm_crtc->imx_drm_helper_funcs = *imx_drm_helper_funcs;
|
|
|
- imx_drm_crtc->crtc = crtc;
|
|
|
-
|
|
|
- crtc->port = port;
|
|
|
-
|
|
|
- imxdrm->crtc[imxdrm->pipes++] = imx_drm_crtc;
|
|
|
-
|
|
|
- *new_crtc = imx_drm_crtc;
|
|
|
-
|
|
|
- drm_crtc_helper_add(crtc,
|
|
|
- imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs);
|
|
|
-
|
|
|
- drm_crtc_init_with_planes(drm, crtc, primary_plane, NULL,
|
|
|
- imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs, NULL);
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-EXPORT_SYMBOL_GPL(imx_drm_add_crtc);
|
|
|
-
|
|
|
-/*
|
|
|
- * imx_drm_remove_crtc - remove a crtc
|
|
|
- */
|
|
|
-int imx_drm_remove_crtc(struct imx_drm_crtc *imx_drm_crtc)
|
|
|
-{
|
|
|
- struct imx_drm_device *imxdrm = imx_drm_crtc->crtc->dev->dev_private;
|
|
|
- unsigned int pipe = drm_crtc_index(imx_drm_crtc->crtc);
|
|
|
-
|
|
|
- drm_crtc_cleanup(imx_drm_crtc->crtc);
|
|
|
-
|
|
|
- imxdrm->crtc[pipe] = NULL;
|
|
|
-
|
|
|
- kfree(imx_drm_crtc);
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-EXPORT_SYMBOL_GPL(imx_drm_remove_crtc);
|
|
|
|
|
|
int imx_drm_encoder_parse_of(struct drm_device *drm,
|
|
|
struct drm_encoder *encoder, struct device_node *np)
|
|
@@ -288,8 +189,6 @@ static struct drm_driver imx_drm_driver = {
|
|
|
.gem_prime_vmap = drm_gem_cma_prime_vmap,
|
|
|
.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
|
|
|
.gem_prime_mmap = drm_gem_cma_prime_mmap,
|
|
|
- .enable_vblank = imx_drm_enable_vblank,
|
|
|
- .disable_vblank = imx_drm_disable_vblank,
|
|
|
.ioctls = imx_drm_ioctls,
|
|
|
.num_ioctls = ARRAY_SIZE(imx_drm_ioctls),
|
|
|
.fops = &imx_drm_driver_fops,
|