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 	struct drm_encoder encoder;
33 	struct drm_connector connector;
34 	bool mode_config_initialized;
35 };
36 
37 void hibmc_set_power_mode(struct hibmc_drm_private *priv,
38 			  unsigned int power_mode);
39 void hibmc_set_current_gate(struct hibmc_drm_private *priv,
40 			    unsigned int gate);
41 
42 int hibmc_de_init(struct hibmc_drm_private *priv);
43 int hibmc_vdac_init(struct hibmc_drm_private *priv);
44 
45 int hibmc_mm_init(struct hibmc_drm_private *hibmc);
46 void hibmc_mm_fini(struct hibmc_drm_private *hibmc);
47 int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
48 		      struct drm_mode_create_dumb *args);
49 
50 extern const struct drm_mode_config_funcs hibmc_mode_funcs;
51 
52 #endif
53