diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-08-15 08:59:49 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-10-12 05:13:40 -0400 |
commit | 96f60e37dc66091bde8d5de136ff6fda09f2d799 (patch) | |
tree | 2c2cc30a5ac7339730430369e27d33d4a8dd21ef /drivers/gpu/drm/armada/armada_drm.h | |
parent | 15c03dd4859ab16f9212238f29dd315654aa94f6 (diff) |
DRM: Armada: Add Armada DRM driver
This patch adds support for the pair of LCD controllers on the Marvell
Armada 510 SoCs. This driver supports:
- multiple contiguous scanout buffers for video and graphics
- shm backed cacheable buffer objects for X pixmaps for Vivante GPU
acceleration
- dual lcd0 and lcd1 crt operation
- video overlay on each LCD crt via DRM planes
- page flipping of the main scanout buffers
- DRM prime for buffer export/import
This driver is trivial to extend to other Armada SoCs.
Included in this commit is the core driver with no output support; output
support is platform and encoder driver dependent.
Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/gpu/drm/armada/armada_drm.h')
-rw-r--r-- | drivers/gpu/drm/armada/armada_drm.h | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/drivers/gpu/drm/armada/armada_drm.h b/drivers/gpu/drm/armada/armada_drm.h new file mode 100644 index 000000000000..e8c4f80c61d4 --- /dev/null +++ b/drivers/gpu/drm/armada/armada_drm.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 Russell King | ||
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 version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef ARMADA_DRM_H | ||
9 | #define ARMADA_DRM_H | ||
10 | |||
11 | #include <linux/kfifo.h> | ||
12 | #include <linux/io.h> | ||
13 | #include <linux/workqueue.h> | ||
14 | #include <drm/drmP.h> | ||
15 | |||
16 | struct armada_crtc; | ||
17 | struct armada_gem_object; | ||
18 | struct clk; | ||
19 | struct drm_fb_helper; | ||
20 | |||
21 | static inline void | ||
22 | armada_updatel(uint32_t val, uint32_t mask, void __iomem *ptr) | ||
23 | { | ||
24 | uint32_t ov, v; | ||
25 | |||
26 | ov = v = readl_relaxed(ptr); | ||
27 | v = (v & ~mask) | val; | ||
28 | if (ov != v) | ||
29 | writel_relaxed(v, ptr); | ||
30 | } | ||
31 | |||
32 | static inline uint32_t armada_pitch(uint32_t width, uint32_t bpp) | ||
33 | { | ||
34 | uint32_t pitch = bpp != 4 ? width * ((bpp + 7) / 8) : width / 2; | ||
35 | |||
36 | /* 88AP510 spec recommends pitch be a multiple of 128 */ | ||
37 | return ALIGN(pitch, 128); | ||
38 | } | ||
39 | |||
40 | struct armada_vbl_event { | ||
41 | struct list_head node; | ||
42 | void *data; | ||
43 | void (*fn)(struct armada_crtc *, void *); | ||
44 | }; | ||
45 | void armada_drm_vbl_event_add(struct armada_crtc *, | ||
46 | struct armada_vbl_event *); | ||
47 | void armada_drm_vbl_event_remove(struct armada_crtc *, | ||
48 | struct armada_vbl_event *); | ||
49 | void armada_drm_vbl_event_remove_unlocked(struct armada_crtc *, | ||
50 | struct armada_vbl_event *); | ||
51 | #define armada_drm_vbl_event_init(_e, _f, _d) do { \ | ||
52 | struct armada_vbl_event *__e = _e; \ | ||
53 | INIT_LIST_HEAD(&__e->node); \ | ||
54 | __e->data = _d; \ | ||
55 | __e->fn = _f; \ | ||
56 | } while (0) | ||
57 | |||
58 | |||
59 | struct armada_private; | ||
60 | |||
61 | struct armada_variant { | ||
62 | bool has_spu_adv_reg; | ||
63 | int (*init)(struct armada_private *, struct device *); | ||
64 | int (*crtc_init)(struct armada_crtc *); | ||
65 | int (*crtc_compute_clock)(struct armada_crtc *, | ||
66 | const struct drm_display_mode *, | ||
67 | uint32_t *); | ||
68 | }; | ||
69 | |||
70 | /* Variant ops */ | ||
71 | extern const struct armada_variant armada510_ops; | ||
72 | |||
73 | struct armada_private { | ||
74 | const struct armada_variant *variant; | ||
75 | struct work_struct fb_unref_work; | ||
76 | DECLARE_KFIFO(fb_unref, struct drm_framebuffer *, 8); | ||
77 | struct drm_fb_helper *fbdev; | ||
78 | struct armada_crtc *dcrtc[2]; | ||
79 | struct drm_mm linear; | ||
80 | struct clk *extclk[2]; | ||
81 | struct drm_property *csc_yuv_prop; | ||
82 | struct drm_property *csc_rgb_prop; | ||
83 | struct drm_property *colorkey_prop; | ||
84 | struct drm_property *colorkey_min_prop; | ||
85 | struct drm_property *colorkey_max_prop; | ||
86 | struct drm_property *colorkey_val_prop; | ||
87 | struct drm_property *colorkey_alpha_prop; | ||
88 | struct drm_property *colorkey_mode_prop; | ||
89 | struct drm_property *brightness_prop; | ||
90 | struct drm_property *contrast_prop; | ||
91 | struct drm_property *saturation_prop; | ||
92 | #ifdef CONFIG_DEBUG_FS | ||
93 | struct dentry *de; | ||
94 | #endif | ||
95 | }; | ||
96 | |||
97 | void __armada_drm_queue_unref_work(struct drm_device *, | ||
98 | struct drm_framebuffer *); | ||
99 | void armada_drm_queue_unref_work(struct drm_device *, | ||
100 | struct drm_framebuffer *); | ||
101 | |||
102 | extern const struct drm_mode_config_funcs armada_drm_mode_config_funcs; | ||
103 | |||
104 | int armada_fbdev_init(struct drm_device *); | ||
105 | void armada_fbdev_fini(struct drm_device *); | ||
106 | |||
107 | int armada_overlay_plane_create(struct drm_device *, unsigned long); | ||
108 | |||
109 | int armada_drm_debugfs_init(struct drm_minor *); | ||
110 | void armada_drm_debugfs_cleanup(struct drm_minor *); | ||
111 | |||
112 | #endif | ||