1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* Hisilicon Hibmc SoC drm driver
3  *
4  * Based on the bochs drm driver.
5  *
6  * Copyright (c) 2016 Huawei Limited.
7  *
8  * Author:
9  *	Rongrong Zou <zourongrong@huawei.com>
10  *	Rongrong Zou <zourongrong@gmail.com>
11  *	Jianhua Li <lijianhua@huawei.com>
12  */
13 
14 #ifndef HIBMC_DRM_DRV_H
15 #define HIBMC_DRM_DRV_H
16 
17 #include <drm/drm_fb_helper.h>
18 #include <drm/drm_framebuffer.h>
19 
20 struct drm_device;
21 
22 struct hibmc_drm_private {
23 	/* hw */
24 	void __iomem   *mmio;
25 	void __iomem   *fb_map;
26 	unsigned long  fb_base;
27 	unsigned long  fb_size;
28 	bool msi_enabled;
29 
30 	/* drm */
31 	struct drm_device  *dev;
32 	bool mode_config_initialized;
33 };
34 
35 void hibmc_set_power_mode(struct hibmc_drm_private *priv,
36 			  unsigned int power_mode);
37 void hibmc_set_current_gate(struct hibmc_drm_private *priv,
38 			    unsigned int gate);
39 
40 int hibmc_de_init(struct hibmc_drm_private *priv);
41 int hibmc_vdac_init(struct hibmc_drm_private *priv);
42 
43 int hibmc_mm_init(struct hibmc_drm_private *hibmc);
44 void hibmc_mm_fini(struct hibmc_drm_private *hibmc);
45 int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
46 		      struct drm_mode_create_dumb *args);
47 
48 extern const struct drm_mode_config_funcs hibmc_mode_funcs;
49 
50 #endif
51