]>
Commit | Line | Data |
---|---|---|
1 | // SPDX-License-Identifier: GPL-2.0-or-later | |
2 | /* | |
3 | * Copyright 2015 Freescale Semiconductor, Inc. | |
4 | * | |
5 | * Freescale DCU drm device driver | |
6 | */ | |
7 | ||
8 | #include <drm/drmP.h> | |
9 | #include <drm/drm_atomic_helper.h> | |
10 | #include <drm/drm_fb_cma_helper.h> | |
11 | #include <drm/drm_gem_framebuffer_helper.h> | |
12 | #include <drm/drm_probe_helper.h> | |
13 | ||
14 | #include "fsl_dcu_drm_crtc.h" | |
15 | #include "fsl_dcu_drm_drv.h" | |
16 | ||
17 | static const struct drm_mode_config_funcs fsl_dcu_drm_mode_config_funcs = { | |
18 | .atomic_check = drm_atomic_helper_check, | |
19 | .atomic_commit = drm_atomic_helper_commit, | |
20 | .fb_create = drm_gem_fb_create, | |
21 | }; | |
22 | ||
23 | int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev) | |
24 | { | |
25 | int ret; | |
26 | ||
27 | drm_mode_config_init(fsl_dev->drm); | |
28 | ||
29 | fsl_dev->drm->mode_config.min_width = 0; | |
30 | fsl_dev->drm->mode_config.min_height = 0; | |
31 | fsl_dev->drm->mode_config.max_width = 2031; | |
32 | fsl_dev->drm->mode_config.max_height = 2047; | |
33 | fsl_dev->drm->mode_config.funcs = &fsl_dcu_drm_mode_config_funcs; | |
34 | ||
35 | ret = fsl_dcu_drm_crtc_create(fsl_dev); | |
36 | if (ret) | |
37 | goto err; | |
38 | ||
39 | ret = fsl_dcu_drm_encoder_create(fsl_dev, &fsl_dev->crtc); | |
40 | if (ret) | |
41 | goto err; | |
42 | ||
43 | ret = fsl_dcu_create_outputs(fsl_dev); | |
44 | if (ret) | |
45 | goto err; | |
46 | ||
47 | drm_mode_config_reset(fsl_dev->drm); | |
48 | drm_kms_helper_poll_init(fsl_dev->drm); | |
49 | ||
50 | return 0; | |
51 | ||
52 | err: | |
53 | drm_mode_config_cleanup(fsl_dev->drm); | |
54 | return ret; | |
55 | } |