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