]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blame - drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c
drm/fsl-dcu: add missing of_node_put after calling of_parse_phandle
[mirror_ubuntu-eoan-kernel.git] / drivers / gpu / drm / fsl-dcu / fsl_dcu_drm_kms.c
CommitLineData
109eee2f
JW
1/*
2 * Copyright 2015 Freescale Semiconductor, Inc.
3 *
4 * Freescale DCU drm device driver
5 *
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.
10 */
11
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
17#include "fsl_dcu_drm_crtc.h"
18#include "fsl_dcu_drm_drv.h"
19
20static const struct drm_mode_config_funcs fsl_dcu_drm_mode_config_funcs = {
21 .atomic_check = drm_atomic_helper_check,
22 .atomic_commit = drm_atomic_helper_commit,
23 .fb_create = drm_fb_cma_create,
24};
25
26int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev)
27{
7566e247
SA
28 int ret;
29
109eee2f
JW
30 drm_mode_config_init(fsl_dev->drm);
31
32 fsl_dev->drm->mode_config.min_width = 0;
33 fsl_dev->drm->mode_config.min_height = 0;
34 fsl_dev->drm->mode_config.max_width = 2031;
35 fsl_dev->drm->mode_config.max_height = 2047;
36 fsl_dev->drm->mode_config.funcs = &fsl_dcu_drm_mode_config_funcs;
37
7566e247
SA
38 ret = fsl_dcu_drm_crtc_create(fsl_dev);
39 if (ret)
b7868c68 40 goto err;
7566e247
SA
41
42 ret = fsl_dcu_drm_encoder_create(fsl_dev, &fsl_dev->crtc);
43 if (ret)
b7868c68 44 goto err;
7566e247
SA
45
46 ret = fsl_dcu_drm_connector_create(fsl_dev, &fsl_dev->encoder);
47 if (ret)
b7868c68 48 goto err;
7566e247 49
109eee2f 50 drm_mode_config_reset(fsl_dev->drm);
7566e247 51 drm_kms_helper_poll_init(fsl_dev->drm);
109eee2f
JW
52
53 return 0;
b7868c68
SA
54
55err:
56 drm_mode_config_cleanup(fsl_dev->drm);
7566e247 57 return ret;
109eee2f 58}