xref: /linux/drivers/gpu/drm/rockchip/rockchip_drm_drv.h (revision 2048e3286f347db5667708e47448176b5329e8d8)
1*2048e328SMark Yao /*
2*2048e328SMark Yao  * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
3*2048e328SMark Yao  * Author:Mark Yao <mark.yao@rock-chips.com>
4*2048e328SMark Yao  *
5*2048e328SMark Yao  * based on exynos_drm_drv.h
6*2048e328SMark Yao  *
7*2048e328SMark Yao  * This software is licensed under the terms of the GNU General Public
8*2048e328SMark Yao  * License version 2, as published by the Free Software Foundation, and
9*2048e328SMark Yao  * may be copied, distributed, and modified under those terms.
10*2048e328SMark Yao  *
11*2048e328SMark Yao  * This program is distributed in the hope that it will be useful,
12*2048e328SMark Yao  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13*2048e328SMark Yao  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*2048e328SMark Yao  * GNU General Public License for more details.
15*2048e328SMark Yao  */
16*2048e328SMark Yao 
17*2048e328SMark Yao #ifndef _ROCKCHIP_DRM_DRV_H
18*2048e328SMark Yao #define _ROCKCHIP_DRM_DRV_H
19*2048e328SMark Yao 
20*2048e328SMark Yao #include <drm/drm_fb_helper.h>
21*2048e328SMark Yao #include <drm/drm_gem.h>
22*2048e328SMark Yao 
23*2048e328SMark Yao #include <linux/module.h>
24*2048e328SMark Yao #include <linux/component.h>
25*2048e328SMark Yao 
26*2048e328SMark Yao #define ROCKCHIP_MAX_FB_BUFFER	3
27*2048e328SMark Yao #define ROCKCHIP_MAX_CONNECTOR	2
28*2048e328SMark Yao #define ROCKCHIP_MAX_CRTC	2
29*2048e328SMark Yao 
30*2048e328SMark Yao struct drm_device;
31*2048e328SMark Yao struct drm_connector;
32*2048e328SMark Yao 
33*2048e328SMark Yao /*
34*2048e328SMark Yao  * Rockchip drm private crtc funcs.
35*2048e328SMark Yao  * @enable_vblank: enable crtc vblank irq.
36*2048e328SMark Yao  * @disable_vblank: disable crtc vblank irq.
37*2048e328SMark Yao  */
38*2048e328SMark Yao struct rockchip_crtc_funcs {
39*2048e328SMark Yao 	int (*enable_vblank)(struct drm_crtc *crtc);
40*2048e328SMark Yao 	void (*disable_vblank)(struct drm_crtc *crtc);
41*2048e328SMark Yao };
42*2048e328SMark Yao 
43*2048e328SMark Yao /*
44*2048e328SMark Yao  * Rockchip drm private structure.
45*2048e328SMark Yao  *
46*2048e328SMark Yao  * @crtc: array of enabled CRTCs, used to map from "pipe" to drm_crtc.
47*2048e328SMark Yao  * @num_pipe: number of pipes for this device.
48*2048e328SMark Yao  */
49*2048e328SMark Yao struct rockchip_drm_private {
50*2048e328SMark Yao 	struct drm_fb_helper fbdev_helper;
51*2048e328SMark Yao 	struct drm_gem_object *fbdev_bo;
52*2048e328SMark Yao 	const struct rockchip_crtc_funcs *crtc_funcs[ROCKCHIP_MAX_CRTC];
53*2048e328SMark Yao };
54*2048e328SMark Yao 
55*2048e328SMark Yao int rockchip_register_crtc_funcs(struct drm_device *dev,
56*2048e328SMark Yao 				 const struct rockchip_crtc_funcs *crtc_funcs,
57*2048e328SMark Yao 				 int pipe);
58*2048e328SMark Yao void rockchip_unregister_crtc_funcs(struct drm_device *dev, int pipe);
59*2048e328SMark Yao int rockchip_drm_encoder_get_mux_id(struct device_node *node,
60*2048e328SMark Yao 				    struct drm_encoder *encoder);
61*2048e328SMark Yao int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc, int connector_type,
62*2048e328SMark Yao 				  int out_mode);
63*2048e328SMark Yao int rockchip_drm_dma_attach_device(struct drm_device *drm_dev,
64*2048e328SMark Yao 				   struct device *dev);
65*2048e328SMark Yao void rockchip_drm_dma_detach_device(struct drm_device *drm_dev,
66*2048e328SMark Yao 				    struct device *dev);
67*2048e328SMark Yao 
68*2048e328SMark Yao #endif /* _ROCKCHIP_DRM_DRV_H_ */
69