drm/rockchip: dw_hdmi: add power domain control
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / rockchip / rockchip_drm_rga.h
1 #ifndef __ROCKCHIP_DRM_RGA__
2 #define __ROCKCHIP_DRM_RGA__
3
4 #define RGA_CMDBUF_SIZE                 14
5 #define RGA_CMDLIST_SIZE                0x20
6 #define RGA_CMDLIST_NUM                 64
7
8 /* cmdlist data structure */
9 struct rga_cmdlist {
10         u32             head;
11         u32             data[(RGA_CMDLIST_SIZE + RGA_CMDBUF_SIZE) * 2];
12         u32             last;   /* last data offset */
13         void            *src_mmu_pages;
14         void            *dst_mmu_pages;
15         void            *src1_mmu_pages;
16         struct dma_buf_attachment *src_attach;
17         struct dma_buf_attachment *src1_attach;
18         struct dma_buf_attachment *dst_attach;
19 };
20
21 struct rga_cmdlist_node {
22         struct list_head        list;
23         struct rga_cmdlist      cmdlist;
24 };
25
26 struct rga_runqueue_node {
27         struct list_head        list;
28
29         struct drm_device       *drm_dev;
30         struct device           *dev;
31         pid_t                   pid;
32         struct drm_file         *file;
33         struct completion       complete;
34
35         struct list_head        run_cmdlist;
36
37         int                     cmdlist_cnt;
38         void                    *cmdlist_pool_virt;
39         dma_addr_t              cmdlist_pool;
40         struct dma_attrs        cmdlist_dma_attrs;
41 };
42
43 struct rockchip_rga_version {
44         u32                     major;
45         u32                     minor;
46 };
47
48 struct rockchip_rga {
49         struct drm_device       *drm_dev;
50         struct device           *dev;
51         struct regmap           *grf;
52         void __iomem            *regs;
53         struct clk              *sclk;
54         struct clk              *aclk;
55         struct clk              *hclk;
56
57         bool                            suspended;
58         struct rockchip_rga_version     version;
59         struct drm_rockchip_subdrv      subdrv;
60         struct workqueue_struct         *rga_workq;
61         struct work_struct              runqueue_work;
62
63         /* rga command list pool */
64         struct rga_cmdlist_node         cmdlist_node[RGA_CMDLIST_NUM];
65         struct mutex                    cmdlist_mutex;
66
67         struct list_head                free_cmdlist;
68
69         /* rga runqueue */
70         struct rga_runqueue_node        *runqueue_node;
71         struct list_head                runqueue_list;
72         struct mutex                    runqueue_mutex;
73         struct kmem_cache               *runqueue_slab;
74 };
75
76 struct rockchip_drm_rga_private {
77         struct device           *dev;
78         struct list_head        inuse_cmdlist;
79         struct list_head        userptr_list;
80 };
81
82 #ifdef CONFIG_ROCKCHIP_DRM_RGA
83 int rockchip_rga_get_ver_ioctl(struct drm_device *dev, void *data,
84                                struct drm_file *file_priv);
85 int rockchip_rga_set_cmdlist_ioctl(struct drm_device *dev, void *data,
86                                    struct drm_file *file_priv);
87 int rockchip_rga_exec_ioctl(struct drm_device *dev, void *data,
88                             struct drm_file *file_priv);
89 #else
90 static inline int rockchip_rga_get_ver_ioctl(struct drm_device *dev, void *data,
91                                              struct drm_file *file_priv)
92 {
93         return -ENODEV;
94 }
95
96 static inline int rockchip_rga_set_cmdlist_ioctl(struct drm_device *dev,
97                                                  void *data,
98                                                  struct drm_file *file_priv)
99 {
100         return -ENODEV;
101 }
102
103 static inline int rockchip_rga_exec_ioctl(struct drm_device *dev, void *data,
104                                           struct drm_file *file_priv)
105 {
106         return -ENODEV;
107 }
108 #endif
109
110 #endif /* __ROCKCHIP_DRM_RGA__ */