2019-05-27 06:55:01 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2016-11-16 09:15:34 +00:00
|
|
|
/* Hisilicon Hibmc SoC drm driver
|
|
|
|
*
|
|
|
|
* Based on the bochs drm driver.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2016 Huawei Limited.
|
|
|
|
*
|
|
|
|
* Author:
|
|
|
|
* Rongrong Zou <zourongrong@huawei.com>
|
|
|
|
* Rongrong Zou <zourongrong@gmail.com>
|
|
|
|
* Jianhua Li <lijianhua@huawei.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HIBMC_DRM_DRV_H
|
|
|
|
#define HIBMC_DRM_DRV_H
|
|
|
|
|
2016-11-16 12:52:37 +00:00
|
|
|
#include <drm/drm_fb_helper.h>
|
2019-06-30 06:19:22 +00:00
|
|
|
#include <drm/drm_framebuffer.h>
|
|
|
|
|
|
|
|
struct drm_device;
|
|
|
|
struct drm_gem_object;
|
2016-11-16 09:15:34 +00:00
|
|
|
|
2016-11-16 12:52:37 +00:00
|
|
|
struct hibmc_framebuffer {
|
|
|
|
struct drm_framebuffer fb;
|
|
|
|
struct drm_gem_object *obj;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct hibmc_fbdev {
|
2019-03-26 13:19:57 +00:00
|
|
|
struct drm_fb_helper helper; /* must be first */
|
2016-11-16 12:52:37 +00:00
|
|
|
struct hibmc_framebuffer *fb;
|
|
|
|
int size;
|
|
|
|
};
|
|
|
|
|
2016-11-16 09:15:34 +00:00
|
|
|
struct hibmc_drm_private {
|
|
|
|
/* hw */
|
|
|
|
void __iomem *mmio;
|
|
|
|
void __iomem *fb_map;
|
|
|
|
unsigned long fb_base;
|
|
|
|
unsigned long fb_size;
|
2016-11-16 12:57:01 +00:00
|
|
|
bool msi_enabled;
|
2016-11-16 09:15:34 +00:00
|
|
|
|
|
|
|
/* drm */
|
|
|
|
struct drm_device *dev;
|
2016-11-16 12:54:52 +00:00
|
|
|
bool mode_config_initialized;
|
2016-11-16 09:15:34 +00:00
|
|
|
|
2016-11-16 12:52:37 +00:00
|
|
|
/* fbdev */
|
|
|
|
struct hibmc_fbdev *fbdev;
|
2016-11-16 13:31:51 +00:00
|
|
|
};
|
|
|
|
|
2016-11-16 12:52:37 +00:00
|
|
|
#define to_hibmc_framebuffer(x) container_of(x, struct hibmc_framebuffer, fb)
|
|
|
|
|
2016-11-16 09:15:34 +00:00
|
|
|
void hibmc_set_power_mode(struct hibmc_drm_private *priv,
|
|
|
|
unsigned int power_mode);
|
|
|
|
void hibmc_set_current_gate(struct hibmc_drm_private *priv,
|
|
|
|
unsigned int gate);
|
|
|
|
|
2016-11-16 12:54:52 +00:00
|
|
|
int hibmc_de_init(struct hibmc_drm_private *priv);
|
2016-11-16 12:55:55 +00:00
|
|
|
int hibmc_vdac_init(struct hibmc_drm_private *priv);
|
2016-11-16 12:52:37 +00:00
|
|
|
int hibmc_fbdev_init(struct hibmc_drm_private *priv);
|
|
|
|
void hibmc_fbdev_fini(struct hibmc_drm_private *priv);
|
|
|
|
|
2016-11-16 13:31:51 +00:00
|
|
|
int hibmc_gem_create(struct drm_device *dev, u32 size, bool iskernel,
|
|
|
|
struct drm_gem_object **obj);
|
2016-11-16 12:52:37 +00:00
|
|
|
struct hibmc_framebuffer *
|
|
|
|
hibmc_framebuffer_init(struct drm_device *dev,
|
|
|
|
const struct drm_mode_fb_cmd2 *mode_cmd,
|
|
|
|
struct drm_gem_object *obj);
|
|
|
|
|
2016-11-16 13:31:51 +00:00
|
|
|
int hibmc_mm_init(struct hibmc_drm_private *hibmc);
|
|
|
|
void hibmc_mm_fini(struct hibmc_drm_private *hibmc);
|
|
|
|
int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
|
|
|
|
struct drm_mode_create_dumb *args);
|
|
|
|
|
2016-11-16 12:54:52 +00:00
|
|
|
extern const struct drm_mode_config_funcs hibmc_mode_funcs;
|
|
|
|
|
2016-11-16 09:15:34 +00:00
|
|
|
#endif
|