dt-bindings: mtd: ingenic: Use standard ecc-engine property
[linux/fpc-iii.git] / drivers / gpu / drm / hisilicon / hibmc / hibmc_drm_drv.h
blob3c168ae77b0cdf537222ae48c3c383b15533995a
1 /* Hisilicon Hibmc SoC drm driver
3 * Based on the bochs drm driver.
5 * Copyright (c) 2016 Huawei Limited.
7 * Author:
8 * Rongrong Zou <zourongrong@huawei.com>
9 * Rongrong Zou <zourongrong@gmail.com>
10 * Jianhua Li <lijianhua@huawei.com>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
19 #ifndef HIBMC_DRM_DRV_H
20 #define HIBMC_DRM_DRV_H
22 #include <drm/drmP.h>
23 #include <drm/drm_atomic.h>
24 #include <drm/drm_fb_helper.h>
25 #include <drm/drm_gem.h>
26 #include <drm/ttm/ttm_bo_driver.h>
28 struct hibmc_framebuffer {
29 struct drm_framebuffer fb;
30 struct drm_gem_object *obj;
33 struct hibmc_fbdev {
34 struct drm_fb_helper helper;
35 struct hibmc_framebuffer *fb;
36 int size;
39 struct hibmc_drm_private {
40 /* hw */
41 void __iomem *mmio;
42 void __iomem *fb_map;
43 unsigned long fb_base;
44 unsigned long fb_size;
45 bool msi_enabled;
47 /* drm */
48 struct drm_device *dev;
49 bool mode_config_initialized;
51 /* ttm */
52 struct ttm_bo_device bdev;
53 bool initialized;
55 /* fbdev */
56 struct hibmc_fbdev *fbdev;
57 bool mm_inited;
60 #define to_hibmc_framebuffer(x) container_of(x, struct hibmc_framebuffer, fb)
62 struct hibmc_bo {
63 struct ttm_buffer_object bo;
64 struct ttm_placement placement;
65 struct ttm_bo_kmap_obj kmap;
66 struct drm_gem_object gem;
67 struct ttm_place placements[3];
68 int pin_count;
71 static inline struct hibmc_bo *hibmc_bo(struct ttm_buffer_object *bo)
73 return container_of(bo, struct hibmc_bo, bo);
76 static inline struct hibmc_bo *gem_to_hibmc_bo(struct drm_gem_object *gem)
78 return container_of(gem, struct hibmc_bo, gem);
81 void hibmc_set_power_mode(struct hibmc_drm_private *priv,
82 unsigned int power_mode);
83 void hibmc_set_current_gate(struct hibmc_drm_private *priv,
84 unsigned int gate);
86 int hibmc_de_init(struct hibmc_drm_private *priv);
87 int hibmc_vdac_init(struct hibmc_drm_private *priv);
88 int hibmc_fbdev_init(struct hibmc_drm_private *priv);
89 void hibmc_fbdev_fini(struct hibmc_drm_private *priv);
91 int hibmc_gem_create(struct drm_device *dev, u32 size, bool iskernel,
92 struct drm_gem_object **obj);
93 struct hibmc_framebuffer *
94 hibmc_framebuffer_init(struct drm_device *dev,
95 const struct drm_mode_fb_cmd2 *mode_cmd,
96 struct drm_gem_object *obj);
98 int hibmc_mm_init(struct hibmc_drm_private *hibmc);
99 void hibmc_mm_fini(struct hibmc_drm_private *hibmc);
100 int hibmc_bo_pin(struct hibmc_bo *bo, u32 pl_flag, u64 *gpu_addr);
101 int hibmc_bo_unpin(struct hibmc_bo *bo);
102 void hibmc_gem_free_object(struct drm_gem_object *obj);
103 int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
104 struct drm_mode_create_dumb *args);
105 int hibmc_dumb_mmap_offset(struct drm_file *file, struct drm_device *dev,
106 u32 handle, u64 *offset);
107 int hibmc_mmap(struct file *filp, struct vm_area_struct *vma);
109 extern const struct drm_mode_config_funcs hibmc_mode_funcs;
111 #endif