Commit | Line | Data |
---|---|---|
96f60e37 RK |
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_frame_work; | |
42e62ba7 | 35 | struct armada_variant; |
96f60e37 RK |
36 | |
37 | struct armada_crtc { | |
38 | struct drm_crtc crtc; | |
42e62ba7 | 39 | const struct armada_variant *variant; |
96f60e37 RK |
40 | unsigned num; |
41 | void __iomem *base; | |
42 | struct clk *clk; | |
3ecea269 | 43 | struct clk *extclk[2]; |
96f60e37 RK |
44 | struct { |
45 | uint32_t spu_v_h_total; | |
46 | uint32_t spu_v_porch; | |
47 | uint32_t spu_adv_reg; | |
48 | } v[2]; | |
49 | bool interlaced; | |
662af0d8 | 50 | bool cursor_update; |
96f60e37 RK |
51 | uint8_t csc_yuv_mode; |
52 | uint8_t csc_rgb_mode; | |
53 | ||
54 | struct drm_plane *plane; | |
55 | ||
662af0d8 RK |
56 | struct armada_gem_object *cursor_obj; |
57 | int cursor_x; | |
58 | int cursor_y; | |
59 | uint32_t cursor_hw_pos; | |
60 | uint32_t cursor_hw_sz; | |
61 | uint32_t cursor_w; | |
62 | uint32_t cursor_h; | |
63 | ||
96f60e37 RK |
64 | int dpms; |
65 | uint32_t cfg_dumb_ctrl; | |
66 | uint32_t dumb_ctrl; | |
67 | uint32_t spu_iopad_ctrl; | |
68 | ||
69 | wait_queue_head_t frame_wait; | |
70 | struct armada_frame_work *frame_work; | |
71 | ||
72 | spinlock_t irq_lock; | |
73 | uint32_t irq_ena; | |
74 | struct list_head vbl_list; | |
75 | }; | |
76 | #define drm_to_armada_crtc(c) container_of(c, struct armada_crtc, crtc) | |
77 | ||
7c8f7e1a RK |
78 | struct armada_vbl_event { |
79 | struct list_head node; | |
80 | void *data; | |
81 | void (*fn)(struct armada_crtc *, void *); | |
82 | }; | |
83 | ||
84 | void armada_drm_vbl_event_add(struct armada_crtc *, | |
85 | struct armada_vbl_event *); | |
86 | void armada_drm_vbl_event_remove(struct armada_crtc *, | |
87 | struct armada_vbl_event *); | |
88 | #define armada_drm_vbl_event_init(_e, _f, _d) do { \ | |
89 | struct armada_vbl_event *__e = _e; \ | |
90 | INIT_LIST_HEAD(&__e->node); \ | |
91 | __e->data = _d; \ | |
92 | __e->fn = _f; \ | |
93 | } while (0) | |
94 | ||
96f60e37 RK |
95 | void armada_drm_crtc_gamma_set(struct drm_crtc *, u16, u16, u16, int); |
96 | void armada_drm_crtc_gamma_get(struct drm_crtc *, u16 *, u16 *, u16 *, int); | |
96f60e37 RK |
97 | void armada_drm_crtc_disable_irq(struct armada_crtc *, u32); |
98 | void armada_drm_crtc_enable_irq(struct armada_crtc *, u32); | |
99 | void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *); | |
100 | ||
d8c96083 RK |
101 | extern struct platform_driver armada_lcd_platform_driver; |
102 | ||
96f60e37 | 103 | #endif |