Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / gpu / drm / hisilicon / hibmc / hibmc_drm_drv.h
blobf310a83d9c48d89c9d1160130f03c6e5bbbe4ff1
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* Hisilicon Hibmc SoC drm driver
4 * Based on the bochs drm driver.
6 * Copyright (c) 2016 Huawei Limited.
8 * Author:
9 * Rongrong Zou <zourongrong@huawei.com>
10 * Rongrong Zou <zourongrong@gmail.com>
11 * Jianhua Li <lijianhua@huawei.com>
14 #ifndef HIBMC_DRM_DRV_H
15 #define HIBMC_DRM_DRV_H
17 #include <linux/gpio/consumer.h>
18 #include <linux/i2c-algo-bit.h>
19 #include <linux/i2c.h>
21 #include <drm/drm_edid.h>
22 #include <drm/drm_fb_helper.h>
23 #include <drm/drm_framebuffer.h>
25 struct hibmc_connector {
26 struct drm_connector base;
28 struct i2c_adapter adapter;
29 struct i2c_algo_bit_data bit_data;
32 struct hibmc_drm_private {
33 /* hw */
34 void __iomem *mmio;
35 void __iomem *fb_map;
36 resource_size_t fb_base;
37 resource_size_t fb_size;
39 /* drm */
40 struct drm_device *dev;
41 struct drm_plane primary_plane;
42 struct drm_crtc crtc;
43 struct drm_encoder encoder;
44 struct hibmc_connector connector;
45 bool mode_config_initialized;
48 static inline struct hibmc_connector *to_hibmc_connector(struct drm_connector *connector)
50 return container_of(connector, struct hibmc_connector, base);
53 static inline struct hibmc_drm_private *to_hibmc_drm_private(struct drm_device *dev)
55 return dev->dev_private;
58 void hibmc_set_power_mode(struct hibmc_drm_private *priv,
59 u32 power_mode);
60 void hibmc_set_current_gate(struct hibmc_drm_private *priv,
61 u32 gate);
63 int hibmc_de_init(struct hibmc_drm_private *priv);
64 int hibmc_vdac_init(struct hibmc_drm_private *priv);
66 int hibmc_mm_init(struct hibmc_drm_private *hibmc);
67 void hibmc_mm_fini(struct hibmc_drm_private *hibmc);
68 int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
69 struct drm_mode_create_dumb *args);
70 int hibmc_ddc_create(struct drm_device *drm_dev, struct hibmc_connector *connector);
72 extern const struct drm_mode_config_funcs hibmc_mode_funcs;
74 #endif