]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blame - drivers/gpu/drm/armada/armada_crtc.h
Merge remote-tracking branches 'asoc/topic/tas6424', 'asoc/topic/tfa9879', 'asoc...
[mirror_ubuntu-focal-kernel.git] / drivers / gpu / drm / armada / armada_crtc.h
CommitLineData
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
11struct armada_gem_object;
12
13struct 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
4b5dda82
RK
34struct armada_crtc;
35struct armada_plane;
42e62ba7 36struct armada_variant;
96f60e37 37
4b5dda82
RK
38struct armada_plane_work {
39 void (*fn)(struct armada_crtc *,
40 struct armada_plane *,
41 struct armada_plane_work *);
42};
43
8be523db 44struct armada_plane_state {
9c898c49
RK
45 u16 src_x;
46 u16 src_y;
8be523db
RK
47 u32 src_hw;
48 u32 dst_hw;
49 u32 dst_yx;
50 u32 ctrl0;
51};
52
561f60bc
RK
53struct armada_plane {
54 struct drm_plane base;
5740d27f 55 wait_queue_head_t frame_wait;
4b5dda82 56 struct armada_plane_work *work;
8be523db 57 struct armada_plane_state state;
561f60bc
RK
58};
59#define drm_to_armada_plane(p) container_of(p, struct armada_plane, base)
60
5740d27f 61int armada_drm_plane_init(struct armada_plane *plane);
4b5dda82
RK
62int armada_drm_plane_work_queue(struct armada_crtc *dcrtc,
63 struct armada_plane *plane, struct armada_plane_work *work);
64int armada_drm_plane_work_wait(struct armada_plane *plane, long timeout);
4a8506d2
RK
65struct armada_plane_work *armada_drm_plane_work_cancel(
66 struct armada_crtc *dcrtc, struct armada_plane *plane);
f0b24871
RK
67void armada_drm_plane_calc_addrs(u32 *addrs, struct drm_framebuffer *fb,
68 int x, int y);
5740d27f 69
96f60e37
RK
70struct armada_crtc {
71 struct drm_crtc crtc;
42e62ba7 72 const struct armada_variant *variant;
96f60e37
RK
73 unsigned num;
74 void __iomem *base;
75 struct clk *clk;
3ecea269 76 struct clk *extclk[2];
96f60e37
RK
77 struct {
78 uint32_t spu_v_h_total;
79 uint32_t spu_v_porch;
80 uint32_t spu_adv_reg;
81 } v[2];
82 bool interlaced;
662af0d8 83 bool cursor_update;
96f60e37
RK
84 uint8_t csc_yuv_mode;
85 uint8_t csc_rgb_mode;
86
87 struct drm_plane *plane;
88
662af0d8
RK
89 struct armada_gem_object *cursor_obj;
90 int cursor_x;
91 int cursor_y;
92 uint32_t cursor_hw_pos;
93 uint32_t cursor_hw_sz;
94 uint32_t cursor_w;
95 uint32_t cursor_h;
96
96f60e37
RK
97 int dpms;
98 uint32_t cfg_dumb_ctrl;
99 uint32_t dumb_ctrl;
100 uint32_t spu_iopad_ctrl;
101
96f60e37
RK
102 spinlock_t irq_lock;
103 uint32_t irq_ena;
96f60e37
RK
104};
105#define drm_to_armada_crtc(c) container_of(c, struct armada_crtc, crtc)
106
96f60e37
RK
107void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *);
108
58326803
RK
109void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc,
110 struct drm_plane *plane);
111
d8c96083
RK
112extern struct platform_driver armada_lcd_platform_driver;
113
96f60e37 114#endif