posix-clock: Fix return code on the poll method's error path
[linux/fpc-iii.git] / drivers / gpu / drm / vc4 / vc4_kms.c
blob2e5597d10cc629e08ccde726a64d6e36da69a48f
1 /*
2 * Copyright (C) 2015 Broadcom
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
9 /**
10 * DOC: VC4 KMS
12 * This is the general code for implementing KMS mode setting that
13 * doesn't clearly associate with any of the other objects (plane,
14 * crtc, HDMI encoder).
17 #include "drm_crtc.h"
18 #include "drm_atomic_helper.h"
19 #include "drm_crtc_helper.h"
20 #include "drm_plane_helper.h"
21 #include "drm_fb_cma_helper.h"
22 #include "vc4_drv.h"
24 static void vc4_output_poll_changed(struct drm_device *dev)
26 struct vc4_dev *vc4 = to_vc4_dev(dev);
28 if (vc4->fbdev)
29 drm_fbdev_cma_hotplug_event(vc4->fbdev);
32 static const struct drm_mode_config_funcs vc4_mode_funcs = {
33 .output_poll_changed = vc4_output_poll_changed,
34 .atomic_check = drm_atomic_helper_check,
35 .atomic_commit = drm_atomic_helper_commit,
36 .fb_create = drm_fb_cma_create,
39 int vc4_kms_load(struct drm_device *dev)
41 struct vc4_dev *vc4 = to_vc4_dev(dev);
42 int ret;
44 ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
45 if (ret < 0) {
46 dev_err(dev->dev, "failed to initialize vblank\n");
47 return ret;
50 dev->mode_config.max_width = 2048;
51 dev->mode_config.max_height = 2048;
52 dev->mode_config.funcs = &vc4_mode_funcs;
53 dev->mode_config.preferred_depth = 24;
54 dev->vblank_disable_allowed = true;
56 drm_mode_config_reset(dev);
58 vc4->fbdev = drm_fbdev_cma_init(dev, 32,
59 dev->mode_config.num_crtc,
60 dev->mode_config.num_connector);
61 if (IS_ERR(vc4->fbdev))
62 vc4->fbdev = NULL;
64 drm_kms_helper_poll_init(dev);
66 return 0;