imx-drm.h revision 8d71de61526924f516548707a5f16ac9e564aeee
1#ifndef _IMX_DRM_H_
2#define _IMX_DRM_H_
3
4#include <linux/videodev2.h>
5
6#define IPU_PIX_FMT_GBR24	v4l2_fourcc('G', 'B', 'R', '3')
7
8struct drm_crtc;
9struct drm_connector;
10struct drm_device;
11struct drm_display_mode;
12struct drm_encoder;
13struct imx_drm_crtc;
14struct drm_fbdev_cma;
15struct drm_framebuffer;
16struct platform_device;
17
18int imx_drm_crtc_id(struct imx_drm_crtc *crtc);
19
20struct imx_drm_crtc_helper_funcs {
21	int (*enable_vblank)(struct drm_crtc *crtc);
22	void (*disable_vblank)(struct drm_crtc *crtc);
23	int (*set_interface_pix_fmt)(struct drm_crtc *crtc, u32 encoder_type,
24			u32 pix_fmt, int hsync_pin, int vsync_pin);
25	const struct drm_crtc_helper_funcs *crtc_helper_funcs;
26	const struct drm_crtc_funcs *crtc_funcs;
27};
28
29int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc,
30		struct imx_drm_crtc **new_crtc,
31		const struct imx_drm_crtc_helper_funcs *imx_helper_funcs,
32		void *cookie, int id);
33int imx_drm_remove_crtc(struct imx_drm_crtc *);
34int imx_drm_init_drm(struct platform_device *pdev,
35		int preferred_bpp);
36int imx_drm_exit_drm(void);
37
38int imx_drm_crtc_vblank_get(struct imx_drm_crtc *imx_drm_crtc);
39void imx_drm_crtc_vblank_put(struct imx_drm_crtc *imx_drm_crtc);
40void imx_drm_handle_vblank(struct imx_drm_crtc *imx_drm_crtc);
41
42void imx_drm_mode_config_init(struct drm_device *drm);
43
44struct drm_gem_cma_object *imx_drm_fb_get_obj(struct drm_framebuffer *fb);
45
46int imx_drm_panel_format_pins(struct drm_encoder *encoder,
47		u32 interface_pix_fmt, int hsync_pin, int vsync_pin);
48int imx_drm_panel_format(struct drm_encoder *encoder,
49		u32 interface_pix_fmt);
50
51struct device_node;
52
53int imx_drm_encoder_get_mux_id(struct drm_encoder *encoder);
54int imx_drm_encoder_parse_of(struct drm_device *drm,
55	struct drm_encoder *encoder, struct device_node *np);
56
57int imx_drm_connector_mode_valid(struct drm_connector *connector,
58	struct drm_display_mode *mode);
59void imx_drm_connector_destroy(struct drm_connector *connector);
60void imx_drm_encoder_destroy(struct drm_encoder *encoder);
61
62#endif /* _IMX_DRM_H_ */
63