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 <linux/gpio/consumer.h> 18 #include <linux/i2c-algo-bit.h> 19 #include <linux/i2c.h> 20 21 #include <drm/drm_framebuffer.h> 22 23 struct hibmc_connector { 24 struct drm_connector base; 25 26 struct i2c_adapter adapter; 27 struct i2c_algo_bit_data bit_data; 28 }; 29 30 struct hibmc_drm_private { 31 /* hw */ 32 void __iomem *mmio; 33 34 /* drm */ 35 struct drm_device dev; 36 struct drm_plane primary_plane; 37 struct drm_crtc crtc; 38 struct drm_encoder encoder; 39 struct hibmc_connector connector; 40 }; 41 42 static inline struct hibmc_connector *to_hibmc_connector(struct drm_connector *connector) 43 { 44 return container_of(connector, struct hibmc_connector, base); 45 } 46 47 static inline struct hibmc_drm_private *to_hibmc_drm_private(struct drm_device *dev) 48 { 49 return container_of(dev, struct hibmc_drm_private, dev); 50 } 51 52 void hibmc_set_power_mode(struct hibmc_drm_private *priv, 53 u32 power_mode); 54 void hibmc_set_current_gate(struct hibmc_drm_private *priv, 55 u32 gate); 56 57 int hibmc_de_init(struct hibmc_drm_private *priv); 58 int hibmc_vdac_init(struct hibmc_drm_private *priv); 59 60 int hibmc_ddc_create(struct drm_device *drm_dev, struct hibmc_connector *connector); 61 62 #endif 63