2019-05-27 14:55:01 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2016-11-16 17:15:34 +08: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
|
|
|
|
|
2020-09-22 20:44:29 +08:00
|
|
|
#include <linux/gpio/consumer.h>
|
|
|
|
#include <linux/i2c-algo-bit.h>
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
|
|
|
|
#include <drm/drm_edid.h>
|
2016-11-16 20:52:37 +08:00
|
|
|
#include <drm/drm_fb_helper.h>
|
2019-06-30 14:19:22 +08:00
|
|
|
#include <drm/drm_framebuffer.h>
|
|
|
|
|
2020-09-22 20:44:29 +08:00
|
|
|
struct hibmc_connector {
|
|
|
|
struct drm_connector base;
|
|
|
|
|
|
|
|
struct i2c_adapter adapter;
|
|
|
|
struct i2c_algo_bit_data bit_data;
|
|
|
|
};
|
|
|
|
|
2016-11-16 17:15:34 +08:00
|
|
|
struct hibmc_drm_private {
|
|
|
|
/* hw */
|
|
|
|
void __iomem *mmio;
|
|
|
|
void __iomem *fb_map;
|
2020-10-16 08:38:31 +08:00
|
|
|
resource_size_t fb_base;
|
|
|
|
resource_size_t fb_size;
|
2016-11-16 17:15:34 +08:00
|
|
|
|
|
|
|
/* drm */
|
|
|
|
struct drm_device *dev;
|
2020-08-12 15:42:59 +08:00
|
|
|
struct drm_plane primary_plane;
|
|
|
|
struct drm_crtc crtc;
|
2020-07-02 16:54:41 +08:00
|
|
|
struct drm_encoder encoder;
|
2020-09-22 20:44:29 +08:00
|
|
|
struct hibmc_connector connector;
|
2016-11-16 20:54:52 +08:00
|
|
|
bool mode_config_initialized;
|
2016-11-16 21:31:51 +08:00
|
|
|
};
|
|
|
|
|
2020-09-22 20:44:29 +08:00
|
|
|
static inline struct hibmc_connector *to_hibmc_connector(struct drm_connector *connector)
|
|
|
|
{
|
|
|
|
return container_of(connector, struct hibmc_connector, base);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct hibmc_drm_private *to_hibmc_drm_private(struct drm_device *dev)
|
|
|
|
{
|
|
|
|
return dev->dev_private;
|
|
|
|
}
|
|
|
|
|
2016-11-16 17:15:34 +08:00
|
|
|
void hibmc_set_power_mode(struct hibmc_drm_private *priv,
|
2020-10-16 08:38:31 +08:00
|
|
|
u32 power_mode);
|
2016-11-16 17:15:34 +08:00
|
|
|
void hibmc_set_current_gate(struct hibmc_drm_private *priv,
|
2020-10-16 08:38:31 +08:00
|
|
|
u32 gate);
|
2016-11-16 17:15:34 +08:00
|
|
|
|
2016-11-16 20:54:52 +08:00
|
|
|
int hibmc_de_init(struct hibmc_drm_private *priv);
|
2016-11-16 20:55:55 +08:00
|
|
|
int hibmc_vdac_init(struct hibmc_drm_private *priv);
|
2016-11-16 20:52:37 +08:00
|
|
|
|
2016-11-16 21:31:51 +08: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);
|
2020-09-22 20:44:29 +08:00
|
|
|
int hibmc_ddc_create(struct drm_device *drm_dev, struct hibmc_connector *connector);
|
2016-11-16 21:31:51 +08:00
|
|
|
|
2016-11-16 20:54:52 +08:00
|
|
|
extern const struct drm_mode_config_funcs hibmc_mode_funcs;
|
|
|
|
|
2016-11-16 17:15:34 +08:00
|
|
|
#endif
|