OSDN Git Service

drm/armada: move plane works to overlay
[uclinux-h8/linux.git] / drivers / gpu / drm / armada / armada_crtc.h
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_CRTC_H
9 #define ARMADA_CRTC_H
10
11 struct armada_gem_object;
12
13 struct armada_regs {
14         uint32_t offset;
15         uint32_t mask;
16         uint32_t val;
17 };
18
19 #define armada_reg_queue_mod(_r, _i, _v, _m, _o)        \
20         do {                                    \
21                 struct armada_regs *__reg = _r; \
22                 __reg[_i].offset = _o;          \
23                 __reg[_i].mask = ~(_m);         \
24                 __reg[_i].val = _v;             \
25                 _i++;                           \
26         } while (0)
27
28 #define armada_reg_queue_set(_r, _i, _v, _o)    \
29         armada_reg_queue_mod(_r, _i, _v, ~0, _o)
30
31 #define armada_reg_queue_end(_r, _i)            \
32         armada_reg_queue_mod(_r, _i, 0, 0, ~0)
33
34 struct armada_crtc;
35 struct armada_plane;
36 struct armada_variant;
37
38 struct armada_plane_work {
39         void (*fn)(struct armada_crtc *, struct armada_plane_work *);
40         void (*cancel)(struct armada_crtc *, struct armada_plane_work *);
41         bool need_kfree;
42         struct drm_plane *plane;
43         struct drm_framebuffer *old_fb;
44         struct drm_pending_vblank_event *event;
45         struct armada_regs regs[14];
46 };
47
48 struct armada_plane {
49         struct drm_plane        base;
50         wait_queue_head_t       frame_wait;
51         struct armada_plane_work *work;
52 };
53 #define drm_to_armada_plane(p) container_of(p, struct armada_plane, base)
54
55 int armada_drm_plane_work_queue(struct armada_crtc *dcrtc,
56         struct armada_plane_work *work);
57 int armada_drm_plane_work_wait(struct armada_plane *plane, long timeout);
58 void armada_drm_plane_work_cancel(struct armada_crtc *dcrtc,
59         struct armada_plane *plane);
60
61 struct armada_crtc {
62         struct drm_crtc         crtc;
63         const struct armada_variant *variant;
64         unsigned                num;
65         void __iomem            *base;
66         struct clk              *clk;
67         struct clk              *extclk[2];
68         struct {
69                 uint32_t        spu_v_h_total;
70                 uint32_t        spu_v_porch;
71                 uint32_t        spu_adv_reg;
72         } v[2];
73         bool                    interlaced;
74         bool                    cursor_update;
75         uint8_t                 csc_yuv_mode;
76         uint8_t                 csc_rgb_mode;
77
78         struct drm_plane        *plane;
79
80         struct armada_gem_object        *cursor_obj;
81         int                     cursor_x;
82         int                     cursor_y;
83         uint32_t                cursor_hw_pos;
84         uint32_t                cursor_hw_sz;
85         uint32_t                cursor_w;
86         uint32_t                cursor_h;
87
88         int                     dpms;
89         uint32_t                cfg_dumb_ctrl;
90         uint32_t                dumb_ctrl;
91         uint32_t                spu_iopad_ctrl;
92
93         spinlock_t              irq_lock;
94         uint32_t                irq_ena;
95
96         struct armada_regs      atomic_regs[32];
97         struct armada_regs      *regs;
98         unsigned int            regs_idx;
99 };
100 #define drm_to_armada_crtc(c) container_of(c, struct armada_crtc, crtc)
101
102 void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *);
103
104 extern struct platform_driver armada_lcd_platform_driver;
105
106 #endif