root/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   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 struct drm_gem_object;
  22 
  23 struct hibmc_framebuffer {
  24         struct drm_framebuffer fb;
  25         struct drm_gem_object *obj;
  26 };
  27 
  28 struct hibmc_fbdev {
  29         struct drm_fb_helper helper; /* must be first */
  30         struct hibmc_framebuffer *fb;
  31         int size;
  32 };
  33 
  34 struct hibmc_drm_private {
  35         /* hw */
  36         void __iomem   *mmio;
  37         void __iomem   *fb_map;
  38         unsigned long  fb_base;
  39         unsigned long  fb_size;
  40         bool msi_enabled;
  41 
  42         /* drm */
  43         struct drm_device  *dev;
  44         bool mode_config_initialized;
  45 
  46         /* fbdev */
  47         struct hibmc_fbdev *fbdev;
  48 };
  49 
  50 #define to_hibmc_framebuffer(x) container_of(x, struct hibmc_framebuffer, fb)
  51 
  52 void hibmc_set_power_mode(struct hibmc_drm_private *priv,
  53                           unsigned int power_mode);
  54 void hibmc_set_current_gate(struct hibmc_drm_private *priv,
  55                             unsigned int gate);
  56 
  57 int hibmc_de_init(struct hibmc_drm_private *priv);
  58 int hibmc_vdac_init(struct hibmc_drm_private *priv);
  59 int hibmc_fbdev_init(struct hibmc_drm_private *priv);
  60 void hibmc_fbdev_fini(struct hibmc_drm_private *priv);
  61 
  62 int hibmc_gem_create(struct drm_device *dev, u32 size, bool iskernel,
  63                      struct drm_gem_object **obj);
  64 struct hibmc_framebuffer *
  65 hibmc_framebuffer_init(struct drm_device *dev,
  66                        const struct drm_mode_fb_cmd2 *mode_cmd,
  67                        struct drm_gem_object *obj);
  68 
  69 int hibmc_mm_init(struct hibmc_drm_private *hibmc);
  70 void hibmc_mm_fini(struct hibmc_drm_private *hibmc);
  71 int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
  72                       struct drm_mode_create_dumb *args);
  73 
  74 extern const struct drm_mode_config_funcs hibmc_mode_funcs;
  75 
  76 #endif

/* [<][>][^][v][top][bottom][index][help] */