drm/msm/hdmi: Enable HPD after HDMI IRQ is set up
[linux/fpc-iii.git] / drivers / gpu / drm / fsl-dcu / fsl_dcu_drm_kms.c
blobddc68e476a4db81ed32259cb9b27e8d58f74e2d6
1 /*
2 * Copyright 2015 Freescale Semiconductor, Inc.
4 * Freescale DCU drm device driver
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
12 #include <drm/drmP.h>
13 #include <drm/drm_atomic_helper.h>
14 #include <drm/drm_crtc_helper.h>
15 #include <drm/drm_fb_cma_helper.h>
16 #include <drm/drm_gem_framebuffer_helper.h>
18 #include "fsl_dcu_drm_crtc.h"
19 #include "fsl_dcu_drm_drv.h"
21 static const struct drm_mode_config_funcs fsl_dcu_drm_mode_config_funcs = {
22 .atomic_check = drm_atomic_helper_check,
23 .atomic_commit = drm_atomic_helper_commit,
24 .fb_create = drm_gem_fb_create,
27 int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev)
29 int ret;
31 drm_mode_config_init(fsl_dev->drm);
33 fsl_dev->drm->mode_config.min_width = 0;
34 fsl_dev->drm->mode_config.min_height = 0;
35 fsl_dev->drm->mode_config.max_width = 2031;
36 fsl_dev->drm->mode_config.max_height = 2047;
37 fsl_dev->drm->mode_config.funcs = &fsl_dcu_drm_mode_config_funcs;
39 ret = fsl_dcu_drm_crtc_create(fsl_dev);
40 if (ret)
41 goto err;
43 ret = fsl_dcu_drm_encoder_create(fsl_dev, &fsl_dev->crtc);
44 if (ret)
45 goto err;
47 ret = fsl_dcu_create_outputs(fsl_dev);
48 if (ret)
49 goto err;
51 drm_mode_config_reset(fsl_dev->drm);
52 drm_kms_helper_poll_init(fsl_dev->drm);
54 return 0;
56 err:
57 drm_mode_config_cleanup(fsl_dev->drm);
58 return ret;