xref: /linux/drivers/gpu/drm/mediatek/mtk_drm_drv.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
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_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_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 	u16 max_width;
51 	u16 min_width;
52 	u16 min_height;
53 };
54 
55 struct mtk_drm_private {
56 	struct drm_device *drm;
57 	struct device *dma_dev;
58 	bool mtk_drm_bound;
59 	bool drm_master;
60 	struct device *dev;
61 	struct device_node *mutex_node;
62 	struct device *mutex_dev;
63 	struct device *mmsys_dev;
64 	struct device_node *comp_node[DDP_COMPONENT_DRM_ID_MAX];
65 	struct mtk_ddp_comp ddp_comp[DDP_COMPONENT_DRM_ID_MAX];
66 	struct mtk_mmsys_driver_data *data;
67 	struct drm_atomic_state *suspend_state;
68 	unsigned int mbox_index;
69 	struct mtk_drm_private **all_drm_private;
70 };
71 
72 extern struct platform_driver mtk_disp_aal_driver;
73 extern struct platform_driver mtk_disp_ccorr_driver;
74 extern struct platform_driver mtk_disp_color_driver;
75 extern struct platform_driver mtk_disp_gamma_driver;
76 extern struct platform_driver mtk_disp_merge_driver;
77 extern struct platform_driver mtk_disp_ovl_adaptor_driver;
78 extern struct platform_driver mtk_disp_ovl_driver;
79 extern struct platform_driver mtk_disp_rdma_driver;
80 extern struct platform_driver mtk_dpi_driver;
81 extern struct platform_driver mtk_dsi_driver;
82 extern struct platform_driver mtk_ethdr_driver;
83 extern struct platform_driver mtk_mdp_rdma_driver;
84 extern struct platform_driver mtk_padding_driver;
85 #endif /* MTK_DRM_DRV_H */
86