OSDN Git Service

Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm...
[uclinux-h8/linux.git] / include / drm / tinydrm / tinydrm.h
1 /*
2  * Copyright (C) 2016 Noralf Trønnes
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  */
9
10 #ifndef __LINUX_TINYDRM_H
11 #define __LINUX_TINYDRM_H
12
13 #include <drm/drm_simple_kms_helper.h>
14
15 struct drm_driver;
16
17 /**
18  * struct tinydrm_device - tinydrm device
19  */
20 struct tinydrm_device {
21         /**
22          * @drm: DRM device
23          */
24         struct drm_device *drm;
25
26         /**
27          * @pipe: Display pipe structure
28          */
29         struct drm_simple_display_pipe pipe;
30 };
31
32 static inline struct tinydrm_device *
33 pipe_to_tinydrm(struct drm_simple_display_pipe *pipe)
34 {
35         return container_of(pipe, struct tinydrm_device, pipe);
36 }
37
38 /**
39  * TINYDRM_MODE - tinydrm display mode
40  * @hd: Horizontal resolution, width
41  * @vd: Vertical resolution, height
42  * @hd_mm: Display width in millimeters
43  * @vd_mm: Display height in millimeters
44  *
45  * This macro creates a &drm_display_mode for use with tinydrm.
46  */
47 #define TINYDRM_MODE(hd, vd, hd_mm, vd_mm) \
48         .hdisplay = (hd), \
49         .hsync_start = (hd), \
50         .hsync_end = (hd), \
51         .htotal = (hd), \
52         .vdisplay = (vd), \
53         .vsync_start = (vd), \
54         .vsync_end = (vd), \
55         .vtotal = (vd), \
56         .width_mm = (hd_mm), \
57         .height_mm = (vd_mm), \
58         .type = DRM_MODE_TYPE_DRIVER, \
59         .clock = 1 /* pass validation */
60
61 int devm_tinydrm_init(struct device *parent, struct tinydrm_device *tdev,
62                       struct drm_driver *driver);
63 int devm_tinydrm_register(struct tinydrm_device *tdev);
64 void tinydrm_shutdown(struct tinydrm_device *tdev);
65
66 int
67 tinydrm_display_pipe_init(struct tinydrm_device *tdev,
68                           const struct drm_simple_display_pipe_funcs *funcs,
69                           int connector_type,
70                           const uint32_t *formats,
71                           unsigned int format_count,
72                           const struct drm_display_mode *mode,
73                           unsigned int rotation);
74
75 #endif /* __LINUX_TINYDRM_H */