summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/verisilicon/vs_dc.h
blob: d45c3dae4e9121d1dc00704a8adf287e853a780c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (C) 2020 VeriSilicon Holdings Co., Ltd.
 */

#ifndef __VS_DC_H__
#define __VS_DC_H__

#include <linux/version.h>
#include <linux/mm_types.h>

#include <drm/drm_modes.h>
#if KERNEL_VERSION(5, 5, 0) > LINUX_VERSION_CODE
#include <drm/drmP.h>
#endif

#include "vs_plane.h"
#include "vs_crtc.h"
#include "vs_dc_hw.h"
#include "vs_dc_dec.h"
#ifdef CONFIG_VERISILICON_MMU
#include "vs_dc_mmu.h"
#endif

struct vs_dc_funcs {
	void (*dump_enable)(struct device *dev, dma_addr_t addr,
				unsigned int pitch);
	void (*dump_disable)(struct device *dev);
};

struct vs_dc_plane {
	enum dc_hw_plane_id id;
};

struct vs_dc {
	struct vs_crtc		*crtc[DC_DISPLAY_NUM];
	struct dc_hw		hw;
#ifdef CONFIG_VERISILICON_DEC
	struct dc_dec400l	dec400l;
#endif

	bool			first_frame;

	struct vs_dc_plane planes[PLANE_NUM];

	const struct vs_dc_funcs *funcs;

	struct clk *cpu_axi;
	struct clk *axicfg0_axi;
	struct clk *disp_axi;
	struct clk *stg_axi;
	struct clk *vout_src;
	struct clk *vout_axi;
	struct clk *ahb1;
	struct clk *vout_ahb;
	struct clk *hdmitx0_mclk;
	struct clk *bclk_mst;
	struct clk *dc8200_clk_pix0;
	struct clk *dc8200_clk_pix1;
	struct clk *dc8200_axi;
	struct clk *dc8200_core;
	struct clk *dc8200_ahb;
	struct clk *vout_top_axi;
	struct clk *vout_top_lcd;
	struct clk *hdmitx0_pixelclk;
	struct clk *dc8200_pix0;
	struct clk *dc8200_clk_pix0_out;
	struct clk *dc8200_clk_pix1_out;
	struct reset_control *vout_resets;
	struct reset_control *dc8200_rst_axi;
	struct reset_control *dc8200_rst_core;
	struct reset_control *dc8200_rst_ahb;
	struct reset_control *rst_vout_src;
	struct reset_control *noc_disp;

	struct regmap *dss_regmap;

	int	init_count;
};

extern struct platform_driver dc_platform_driver;
extern void sifive_l2_flush64_range(unsigned long start, unsigned long len);

void vs_dc_update_cursor_plane(struct vs_dc *dc, struct vs_plane *plane,
			       struct drm_plane *drm_plane,
			       struct drm_atomic_state *drm_state);
void vs_dc_disable_cursor_plane(struct vs_dc *dc, struct vs_plane *plane,
				struct drm_plane_state *old_state);
int vs_dc_check_cursor_plane(struct vs_dc *dc, struct drm_plane *plane,
			     struct drm_atomic_state *state);


#endif /* __VS_DC_H__ */