• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*sunxi_drm_drv.h
2  *
3  * Copyright (C) 2022 Allwinnertech Co., Ltd.
4  * Authors: zhengwanyu <zhengwanyu@allwinnertech.com>
5  * Authors: hongyaobin <hongyaobin@allwinnertech.com>
6  *
7  * This program is free software; you can redistribute  it and/or modify it
8  * under  the terms of  the GNU General  Public License as published by the
9  * Free Software Foundation;  either version 2 of the  License, or (at your
10  * option) any later version.
11  */
12 
13 #ifndef _SUNXI_DRM_DRV_H_
14 #define _SUNXI_DRM_DRV_H_
15 
16 #include <linux/of.h>
17 #include <drm/drm_crtc.h>
18 #include <drm/drm_fb_helper.h>
19 #include <drm/drm_atomic_helper.h>
20 #include "drm/sunxi_drm.h"
21 
22 #include "sunxi_drm_bootlogo.h"
23 
24 #include "sunxi_drm_connector.h"
25 
26 #ifdef CONFIG_DRM_KMS_CMA_HELPER
27 #include <drm/drm_fb_cma_helper.h>
28 #endif
29 
30 #include "sunxi_device/sunxi_common.h"
31 
32 #include "sunxi_device/sunxi_de.h"
33 #include "sunxi_device/sunxi_tcon.h"
34 #include "sunxi_device/sunxi_lcd.h"
35 
36 #ifdef CONFIG_AW_DRM_TV
37 #include "sunxi_device/sunxi_tv.h"
38 #endif
39 
40 #if defined(CONFIG_AW_DRM_HDMI14)
41 #include "sunxi_device/sunxi_hdmi14.h"
42 #elif defined(CONFIG_AW_DRM_HDMI20)
43 #include "sunxi_device/sunxi_hdmi20.h"
44 #endif
45 
46 struct sunxi_drm_private {
47 	struct platform_device *pdev;
48 	struct drm_device *drm_dev;
49 	unsigned int fb_base;
50 	char boot_fb[50];//used by bootGUI for bootlogo
51 
52 	unsigned char connector_num;
53 	unsigned int connector_type[MAX_CONNECTOR_COUNT];
54 	char connector_mode[MAX_CONNECTOR_COUNT][20];
55 
56 	//NOTE: Only surpport single display and dual display
57 	unsigned int connector0_type;
58 	char *connector0_mode;
59 
60 	unsigned int connector1_type;
61 	char *connector1_mode;
62 
63 #ifdef CONFIG_DRM_FBDEV_EMULATION
64 	bool boot_disp;
65 	struct bmp_header bootlogo_bmp_header;
66 	struct bootlogo_info bootlogo;
67 #endif
68 	void *mapping;
69 };
70 
71 #ifdef CONFIG_VIDEO_SUNXI_CAR_REVERSE
72 int sunxi_drm_get_force_plane_en(void);
73 int sunxi_drm_get_num_crtc(void);
74 int sunxi_drm_force_set_plane(int crtc_id,
75 		struct disp_layer_config *config,
76 		unsigned int plane_num);
77 void sunxi_drm_force_set_plane_exit(int crtc_id);
78 #endif
79 
80 #ifdef CONFIG_DRM_FBDEV_EMULATION
81 bool sunxi_drm_is_need_smooth_boot(void);
82 int sunxi_drm_copy_bootlogo(unsigned char *d_addr, unsigned int w,
83 			unsigned int h, struct bootlogo_info *bootlogo);
84 
85 #endif
86 
87 unsigned int sunxi_drm_get_init_bpp(void);
88 unsigned int sunxi_drm_get_init_width(void);
89 unsigned int sunxi_drm_get_init_height(void);
90 
91 unsigned int sunxi_drm_get_connector_type(int i);
92 char *sunxi_drm_get_connector_mode(int i);
93 unsigned int sunxi_drm_get_connector_count(void);
94 
95 struct drm_device *sunxi_drm_get_drm_device(void);
96 
97 #endif
98