forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
....@@ -1,28 +1,62 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (c) 2016 Linaro Limited.
34 * Copyright (c) 2014-2016 Hisilicon Limited.
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License version 2 as
7
- * published by the Free Software Foundation.
8
- *
95 */
106
117 #ifndef __KIRIN_DRM_DRV_H__
128 #define __KIRIN_DRM_DRV_H__
139
14
-#define MAX_CRTC 2
10
+#define to_kirin_crtc(crtc) \
11
+ container_of(crtc, struct kirin_crtc, base)
12
+
13
+#define to_kirin_plane(plane) \
14
+ container_of(plane, struct kirin_plane, base)
15
+
16
+/* kirin-format translate table */
17
+struct kirin_format {
18
+ u32 pixel_format;
19
+ u32 hw_format;
20
+};
21
+
22
+struct kirin_crtc {
23
+ struct drm_crtc base;
24
+ void *hw_ctx;
25
+ bool enable;
26
+};
27
+
28
+struct kirin_plane {
29
+ struct drm_plane base;
30
+ void *hw_ctx;
31
+ u32 ch;
32
+};
1533
1634 /* display controller init/cleanup ops */
17
-struct kirin_dc_ops {
18
- int (*init)(struct platform_device *pdev);
19
- void (*cleanup)(struct platform_device *pdev);
35
+struct kirin_drm_data {
36
+ const u32 *channel_formats;
37
+ u32 channel_formats_cnt;
38
+ int config_max_width;
39
+ int config_max_height;
40
+ u32 num_planes;
41
+ u32 prim_plane;
42
+
43
+ struct drm_driver *driver;
44
+ const struct drm_crtc_helper_funcs *crtc_helper_funcs;
45
+ const struct drm_crtc_funcs *crtc_funcs;
46
+ const struct drm_plane_helper_funcs *plane_helper_funcs;
47
+ const struct drm_plane_funcs *plane_funcs;
48
+ const struct drm_mode_config_funcs *mode_config_funcs;
49
+
50
+ void *(*alloc_hw_ctx)(struct platform_device *pdev,
51
+ struct drm_crtc *crtc);
52
+ void (*cleanup_hw_ctx)(void *hw_ctx);
2053 };
2154
22
-struct kirin_drm_private {
23
- struct drm_fbdev_cma *fbdev;
24
-};
25
-
26
-extern const struct kirin_dc_ops ade_dc_ops;
55
+#ifdef CONFIG_DRM_HISI_KIRIN620
56
+extern struct kirin_drm_data ade_driver_data;
57
+#endif
58
+#ifdef CONFIG_DRM_HISI_KIRIN960
59
+extern const struct kirin_drm_data dpe_driver_data;
60
+#endif
2761
2862 #endif /* __KIRIN_DRM_DRV_H__ */