xref: /openbmc/linux/drivers/gpu/drm/omapdrm/omap_drv.h (revision 8f762fe5)
1 /*
2  * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3  * Author: Rob Clark <rob@ti.com>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 as published by
7  * the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __OMAPDRM_DRV_H__
19 #define __OMAPDRM_DRV_H__
20 
21 #include <linux/module.h>
22 #include <linux/types.h>
23 #include <linux/workqueue.h>
24 
25 #include <drm/drmP.h>
26 #include <drm/drm_gem.h>
27 #include <drm/omap_drm.h>
28 
29 #include "dss/omapdss.h"
30 
31 #include "omap_connector.h"
32 #include "omap_crtc.h"
33 #include "omap_encoder.h"
34 #include "omap_fb.h"
35 #include "omap_fbdev.h"
36 #include "omap_gem.h"
37 #include "omap_irq.h"
38 #include "omap_plane.h"
39 
40 #define DBG(fmt, ...) DRM_DEBUG(fmt"\n", ##__VA_ARGS__)
41 #define VERB(fmt, ...) if (0) DRM_DEBUG(fmt, ##__VA_ARGS__) /* verbose debug */
42 
43 #define MODULE_NAME     "omapdrm"
44 
45 struct omap_drm_usergart;
46 
47 struct omap_drm_pipeline {
48 	struct drm_crtc *crtc;
49 	struct drm_encoder *encoder;
50 	struct drm_connector *connector;
51 	struct omap_dss_device *output;
52 	unsigned int alias_id;
53 };
54 
55 struct omap_drm_private {
56 	struct drm_device *ddev;
57 	struct device *dev;
58 	u32 omaprev;
59 
60 	struct dss_device *dss;
61 	struct dispc_device *dispc;
62 	const struct dispc_ops *dispc_ops;
63 
64 	unsigned int num_pipes;
65 	struct omap_drm_pipeline pipes[8];
66 	struct omap_drm_pipeline *channels[8];
67 
68 	unsigned int num_planes;
69 	struct drm_plane *planes[8];
70 
71 	struct drm_fb_helper *fbdev;
72 
73 	struct workqueue_struct *wq;
74 
75 	/* lock for obj_list below */
76 	struct mutex list_lock;
77 
78 	/* list of GEM objects: */
79 	struct list_head obj_list;
80 
81 	struct omap_drm_usergart *usergart;
82 	bool has_dmm;
83 
84 	/* properties: */
85 	struct drm_property *zorder_prop;
86 
87 	/* irq handling: */
88 	spinlock_t wait_lock;		/* protects the wait_list */
89 	struct list_head wait_list;	/* list of omap_irq_wait */
90 	u32 irq_mask;			/* enabled irqs in addition to wait_list */
91 
92 	/* memory bandwidth limit if it is needed on the platform */
93 	unsigned int max_bandwidth;
94 };
95 
96 
97 int omap_debugfs_init(struct drm_minor *minor);
98 
99 #endif /* __OMAPDRM_DRV_H__ */
100