xref: /linux/drivers/gpu/drm/mediatek/mtk_drm_drv.h (revision ad30469a841b50dbb541df4d6971d891f703c297)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2015 MediaTek Inc.
4  */
5 
6 #ifndef MTK_DRM_DRV_H
7 #define MTK_DRM_DRV_H
8 
9 #include <linux/io.h>
10 #include "mtk_drm_ddp_comp.h"
11 
12 #define MAX_CONNECTOR	2
13 #define DDP_COMPONENT_DRM_OVL_ADAPTOR (DDP_COMPONENT_ID_MAX + 1)
14 #define DDP_COMPONENT_DRM_ID_MAX (DDP_COMPONENT_DRM_OVL_ADAPTOR + 1)
15 
16 enum mtk_drm_crtc_path {
17 	CRTC_MAIN,
18 	CRTC_EXT,
19 	CRTC_THIRD,
20 	MAX_CRTC,
21 };
22 
23 struct device;
24 struct device_node;
25 struct drm_crtc;
26 struct drm_device;
27 struct drm_fb_helper;
28 struct drm_property;
29 struct regmap;
30 
31 struct mtk_drm_route {
32 	const unsigned int crtc_id;
33 	const unsigned int route_ddp;
34 };
35 
36 struct mtk_mmsys_driver_data {
37 	const unsigned int *main_path;
38 	unsigned int main_len;
39 	const unsigned int *ext_path;
40 	unsigned int ext_len;
41 	const unsigned int *third_path;
42 	unsigned int third_len;
43 	const struct mtk_drm_route *conn_routes;
44 	unsigned int num_conn_routes;
45 
46 	bool shadow_register;
47 	unsigned int mmsys_id;
48 	unsigned int mmsys_dev_num;
49 };
50 
51 struct mtk_drm_private {
52 	struct drm_device *drm;
53 	struct device *dma_dev;
54 	bool mtk_drm_bound;
55 	bool drm_master;
56 	struct device *dev;
57 	struct device_node *mutex_node;
58 	struct device *mutex_dev;
59 	struct device *mmsys_dev;
60 	struct device_node *comp_node[DDP_COMPONENT_DRM_ID_MAX];
61 	struct mtk_ddp_comp ddp_comp[DDP_COMPONENT_DRM_ID_MAX];
62 	const struct mtk_mmsys_driver_data *data;
63 	struct drm_atomic_state *suspend_state;
64 	unsigned int mbox_index;
65 	struct mtk_drm_private **all_drm_private;
66 };
67 
68 extern struct platform_driver mtk_disp_aal_driver;
69 extern struct platform_driver mtk_disp_ccorr_driver;
70 extern struct platform_driver mtk_disp_color_driver;
71 extern struct platform_driver mtk_disp_gamma_driver;
72 extern struct platform_driver mtk_disp_merge_driver;
73 extern struct platform_driver mtk_disp_ovl_adaptor_driver;
74 extern struct platform_driver mtk_disp_ovl_driver;
75 extern struct platform_driver mtk_disp_rdma_driver;
76 extern struct platform_driver mtk_dpi_driver;
77 extern struct platform_driver mtk_dsi_driver;
78 extern struct platform_driver mtk_ethdr_driver;
79 extern struct platform_driver mtk_mdp_rdma_driver;
80 
81 #endif /* MTK_DRM_DRV_H */
82