riscv:linux:drm: fix double display bug
[platform/kernel/linux-starfive.git] / drivers / gpu / drm / verisilicon / vs_dc.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2020 VeriSilicon Holdings Co., Ltd.
4  */
5
6 #ifndef __VS_DC_H__
7 #define __VS_DC_H__
8
9 #include <linux/version.h>
10 #include <linux/mm_types.h>
11
12 #include <drm/drm_modes.h>
13 #if KERNEL_VERSION(5, 5, 0) > LINUX_VERSION_CODE
14 #include <drm/drmP.h>
15 #endif
16
17 #include "vs_plane.h"
18 #include "vs_crtc.h"
19 #include "vs_dc_hw.h"
20 #include "vs_dc_dec.h"
21 #ifdef CONFIG_VERISILICON_MMU
22 #include "vs_dc_mmu.h"
23 #endif
24
25 struct vs_dc_funcs {
26         void (*dump_enable)(struct device *dev, dma_addr_t addr,
27                                 unsigned int pitch);
28         void (*dump_disable)(struct device *dev);
29 };
30
31 struct vs_dc_plane {
32         enum dc_hw_plane_id id;
33 };
34
35 struct vs_dc {
36         struct vs_crtc          *crtc[DC_DISPLAY_NUM];
37         struct dc_hw            hw;
38 #ifdef CONFIG_VERISILICON_DEC
39         struct dc_dec400l       dec400l;
40 #endif
41
42         void __iomem    *pmu_base;
43
44         unsigned int     pix_clk_rate; /* in KHz */
45
46         struct reset_control *resets;
47         struct clk_bulk_data *clks;
48         int num_clks;
49
50
51         bool                    first_frame;
52
53         struct vs_dc_plane planes[PLANE_NUM];
54
55         const struct vs_dc_funcs *funcs;
56
57         struct clk *cpu_axi;
58         struct clk *axicfg0_axi;
59         struct clk *disp_axi;
60         struct clk *stg_axi;
61
62         struct clk *vout_src;
63         struct clk *vout_axi;
64         struct clk *ahb1;
65         struct clk *vout_ahb;
66         struct clk *hdmitx0_mclk;
67         struct clk *bclk_mst;
68
69         struct clk *dc8200_clk_pix0;
70         struct clk *dc8200_clk_pix1;
71         struct clk *dc8200_axi;
72         struct clk *dc8200_core;
73         struct clk *dc8200_ahb;
74
75         struct clk *vout_top_axi;
76         struct clk *vout_top_lcd;
77
78         struct clk *hdmitx0_pixelclk;
79         struct clk *dc8200_pix0;
80         struct clk *dc8200_clk_pix0_out;
81         struct clk *dc8200_clk_pix1_out;
82
83         struct reset_control *vout_resets;
84
85 //20221014
86         struct reset_control *dc8200_rst_axi;
87         struct reset_control *dc8200_rst_core;
88         struct reset_control *dc8200_rst_ahb;
89
90         struct reset_control *rst_vout_src;
91         struct reset_control *noc_disp;
92
93 //20221014
94
95         struct regmap *dss_regmap;
96
97         bool init_finished;
98
99 };
100
101 extern struct platform_driver dc_platform_driver;
102 extern struct platform_driver starfive_dsi_platform_driver;
103 extern int init_seeed_panel(void);
104 extern void exit_seeed_panel(void);
105
106 #endif /* __VS_DC_H__ */