aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/exynos/exynos_drm_drv.h
diff options
context:
space:
mode:
authorInki Dae <inki.dae@samsung.com>2011-10-04 06:19:01 -0400
committerDave Airlie <airlied@redhat.com>2011-10-05 05:27:31 -0400
commit1c248b7d2960faec3e1b8f3f9c5d9d0df28e0a3c (patch)
treedff45afe42d7f7bb5c2bece7a3a5830b49aaa60b /drivers/gpu/drm/exynos/exynos_drm_drv.h
parent5383053627afab973ffe582a4db9646317bec726 (diff)
DRM: add DRM Driver for Samsung SoC EXYNOS4210.
This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/exynos/exynos_drm_drv.h')
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.h242
1 files changed, 242 insertions, 0 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
new file mode 100644
index 000000000000..832b6508adbd
--- /dev/null
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -0,0 +1,242 @@
1/* exynos_drm_drv.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * Authors:
5 * Inki Dae <inki.dae@samsung.com>
6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */
28
29#ifndef _EXYNOS_DRM_DRV_H_
30#define _EXYNOS_DRM_DRV_H_
31
32#include "drm.h"
33
34#define MAX_CRTC 2
35
36struct drm_device;
37struct exynos_drm_overlay;
38struct drm_connector;
39
40/* this enumerates display type. */
41enum exynos_drm_output_type {
42 EXYNOS_DISPLAY_TYPE_NONE,
43 /* RGB or CPU Interface. */
44 EXYNOS_DISPLAY_TYPE_LCD,
45 /* HDMI Interface. */
46 EXYNOS_DISPLAY_TYPE_HDMI,
47};
48
49/*
50 * Exynos drm overlay ops structure.
51 *
52 * @mode_set: copy drm overlay info to hw specific overlay info.
53 * @commit: apply hardware specific overlay data to registers.
54 * @disable: disable hardware specific overlay.
55 */
56struct exynos_drm_overlay_ops {
57 void (*mode_set)(struct device *subdrv_dev,
58 struct exynos_drm_overlay *overlay);
59 void (*commit)(struct device *subdrv_dev);
60 void (*disable)(struct device *subdrv_dev);
61};
62
63/*
64 * Exynos drm common overlay structure.
65 *
66 * @offset_x: offset to x position.
67 * @offset_y: offset to y position.
68 * @width: window width.
69 * @height: window height.
70 * @bpp: pixel size.(in bit)
71 * @paddr: bus(accessed by dma) physical memory address to this overlay
72 * and this is physically continuous.
73 * @vaddr: virtual memory addresss to this overlay.
74 * @buf_off: start offset of framebuffer to be displayed.
75 * @buf_offsize: this value has result from
76 * (framebuffer width - display width) * bpp.
77 * @line_size: line size to this overlay memory in bytes.
78 * @default_win: a window to be enabled.
79 * @color_key: color key on or off.
80 * @index_color: if using color key feature then this value would be used
81 * as index color.
82 * @local_path: in case of lcd type, local path mode on or off.
83 * @transparency: transparency on or off.
84 * @activated: activated or not.
85 *
86 * this structure is common to exynos SoC and its contents would be copied
87 * to hardware specific overlay info.
88 */
89struct exynos_drm_overlay {
90 unsigned int offset_x;
91 unsigned int offset_y;
92 unsigned int width;
93 unsigned int height;
94 unsigned int bpp;
95 dma_addr_t paddr;
96 void __iomem *vaddr;
97 unsigned int buf_off;
98 unsigned int buf_offsize;
99 unsigned int line_size;
100
101 bool default_win;
102 bool color_key;
103 unsigned int index_color;
104 bool local_path;
105 bool transparency;
106 bool activated;
107};
108
109/*
110 * Exynos DRM Display Structure.
111 * - this structure is common to analog tv, digital tv and lcd panel.
112 *
113 * @type: one of exynos_DISPLAY_TYPE_LCD and HDMI.
114 * @is_connected: check for that display is connected or not.
115 * @get_edid: get edid modes from display driver.
116 * @get_timing: get timing object from display driver.
117 * @check_timing: check if timing is valid or not.
118 * @power_on: display device on or off.
119 */
120struct exynos_drm_display {
121 enum exynos_drm_output_type type;
122 bool (*is_connected)(struct device *dev);
123 int (*get_edid)(struct device *dev, struct drm_connector *connector,
124 u8 *edid, int len);
125 void *(*get_timing)(struct device *dev);
126 int (*check_timing)(struct device *dev, void *timing);
127 int (*power_on)(struct device *dev, int mode);
128};
129
130/*
131 * Exynos drm manager ops
132 *
133 * @mode_set: convert drm_display_mode to hw specific display mode and
134 * would be called by encoder->mode_set().
135 * @commit: set current hw specific display mode to hw.
136 * @enable_vblank: specific driver callback for enabling vblank interrupt.
137 * @disable_vblank: specific driver callback for disabling vblank interrupt.
138 */
139struct exynos_drm_manager_ops {
140 void (*mode_set)(struct device *subdrv_dev, void *mode);
141 void (*commit)(struct device *subdrv_dev);
142 int (*enable_vblank)(struct device *subdrv_dev);
143 void (*disable_vblank)(struct device *subdrv_dev);
144};
145
146/*
147 * Exynos drm common manager structure.
148 *
149 * @dev: pointer to device object for subdrv device driver.
150 * sub drivers such as display controller or hdmi driver,
151 * have their own device object.
152 * @ops: pointer to callbacks for exynos drm specific framebuffer.
153 * these callbacks should be set by specific drivers such fimd
154 * or hdmi driver and are used to control hardware global registers.
155 * @overlay_ops: pointer to callbacks for exynos drm specific framebuffer.
156 * these callbacks should be set by specific drivers such fimd
157 * or hdmi driver and are used to control hardware overlay reigsters.
158 * @display: pointer to callbacks for exynos drm specific framebuffer.
159 * these callbacks should be set by specific drivers such fimd
160 * or hdmi driver and are used to control display devices such as
161 * analog tv, digital tv and lcd panel and also get timing data for them.
162 */
163struct exynos_drm_manager {
164 struct device *dev;
165 int pipe;
166 struct exynos_drm_manager_ops *ops;
167 struct exynos_drm_overlay_ops *overlay_ops;
168 struct exynos_drm_display *display;
169};
170
171/*
172 * Exynos drm private structure.
173 */
174struct exynos_drm_private {
175 struct drm_fb_helper *fb_helper;
176
177 /* for pageflip */
178 struct list_head pageflip_event_list;
179 bool pageflip_event;
180
181 /*
182 * created crtc object would be contained at this array and
183 * this array is used to be aware of which crtc did it request vblank.
184 */
185 struct drm_crtc *crtc[MAX_CRTC];
186};
187
188/*
189 * Exynos drm sub driver structure.
190 *
191 * @list: sub driver has its own list object to register to exynos drm driver.
192 * @drm_dev: pointer to drm_device and this pointer would be set
193 * when sub driver calls exynos_drm_subdrv_register().
194 * @probe: this callback would be called by exynos drm driver after
195 * subdrv is registered to it.
196 * @remove: this callback is used to release resources created
197 * by probe callback.
198 * @manager: subdrv has its own manager to control a hardware appropriately
199 * and we can access a hardware drawing on this manager.
200 * @encoder: encoder object owned by this sub driver.
201 * @connector: connector object owned by this sub driver.
202 */
203struct exynos_drm_subdrv {
204 struct list_head list;
205 struct drm_device *drm_dev;
206
207 int (*probe)(struct drm_device *dev);
208 void (*remove)(struct drm_device *dev);
209
210 struct exynos_drm_manager manager;
211 struct drm_encoder *encoder;
212 struct drm_connector *connector;
213};
214
215/*
216 * this function calls a probe callback registered to sub driver list and
217 * create its own encoder and connector and then set drm_device object
218 * to global one.
219 */
220int exynos_drm_device_register(struct drm_device *dev);
221/*
222 * this function calls a remove callback registered to sub driver list and
223 * destroy its own encoder and connetor.
224 */
225int exynos_drm_device_unregister(struct drm_device *dev);
226
227/*
228 * this function would be called by sub drivers such as display controller
229 * or hdmi driver to register this sub driver object to exynos drm driver
230 * and when a sub driver is registered to exynos drm driver a probe callback
231 * of the sub driver is called and creates its own encoder and connector
232 * and then fb helper and drm mode group would be re-initialized.
233 */
234int exynos_drm_subdrv_register(struct exynos_drm_subdrv *drm_subdrv);
235
236/*
237 * this function removes subdrv list from exynos drm driver and fb helper
238 * and drm mode group would be re-initialized.
239 */
240int exynos_drm_subdrv_unregister(struct exynos_drm_subdrv *drm_subdrv);
241
242#endif