xref: /openbmc/linux/drivers/gpu/drm/tidss/tidss_crtc.h (revision 165f2d28)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
4  * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
5  */
6 
7 #ifndef __TIDSS_CRTC_H__
8 #define __TIDSS_CRTC_H__
9 
10 #include <linux/completion.h>
11 #include <linux/wait.h>
12 
13 #include <drm/drm_crtc.h>
14 
15 #define to_tidss_crtc(c) container_of((c), struct tidss_crtc, crtc)
16 
17 struct tidss_device;
18 
19 struct tidss_crtc {
20 	struct drm_crtc crtc;
21 
22 	u32 hw_videoport;
23 
24 	struct drm_pending_vblank_event *event;
25 
26 	struct completion framedone_completion;
27 };
28 
29 #define to_tidss_crtc_state(x) container_of(x, struct tidss_crtc_state, base)
30 
31 struct tidss_crtc_state {
32 	/* Must be first. */
33 	struct drm_crtc_state base;
34 
35 	bool plane_pos_changed;
36 
37 	u32 bus_format;
38 	u32 bus_flags;
39 };
40 
41 void tidss_crtc_vblank_irq(struct drm_crtc *crtc);
42 void tidss_crtc_framedone_irq(struct drm_crtc *crtc);
43 void tidss_crtc_error_irq(struct drm_crtc *crtc, u64 irqstatus);
44 
45 struct tidss_crtc *tidss_crtc_create(struct tidss_device *tidss,
46 				     u32 hw_videoport,
47 				     struct drm_plane *primary);
48 #endif
49