fdbfc4a90f22a6e965ba3c677764e2d201b485a6
[sfrench/cifs-2.6.git] / drivers / gpu / drm / hisilicon / kirin / kirin_drm_drv.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2016 Linaro Limited.
4  * Copyright (c) 2014-2016 Hisilicon Limited.
5  */
6
7 #ifndef __KIRIN_DRM_DRV_H__
8 #define __KIRIN_DRM_DRV_H__
9
10 #define MAX_CRTC        2
11
12 #define to_kirin_crtc(crtc) \
13         container_of(crtc, struct kirin_crtc, base)
14
15 #define to_kirin_plane(plane) \
16         container_of(plane, struct kirin_plane, base)
17
18 /* kirin-format translate table */
19 struct kirin_format {
20         u32 pixel_format;
21         u32 hw_format;
22 };
23
24 struct kirin_crtc {
25         struct drm_crtc base;
26         void *hw_ctx;
27         bool enable;
28 };
29
30 struct kirin_plane {
31         struct drm_plane base;
32         void *hw_ctx;
33         u32 ch;
34 };
35
36 /* display controller init/cleanup ops */
37 struct kirin_drm_data {
38         const u32 *channel_formats;
39         u32 channel_formats_cnt;
40         int config_max_width;
41         int config_max_height;
42         u32 num_planes;
43         u32 prim_plane;
44
45         struct drm_driver *driver;
46         const struct drm_crtc_helper_funcs *crtc_helper_funcs;
47         const struct drm_crtc_funcs *crtc_funcs;
48         const struct drm_plane_helper_funcs *plane_helper_funcs;
49         const struct drm_plane_funcs  *plane_funcs;
50         const struct drm_mode_config_funcs *mode_config_funcs;
51         int (*init)(struct platform_device *pdev);
52         void (*cleanup)(struct platform_device *pdev);
53 };
54
55 extern struct kirin_drm_data ade_driver_data;
56
57 #endif /* __KIRIN_DRM_DRV_H__ */