Merge tag 'soc-ep93xx-dt-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
[linux-block.git] / drivers / gpu / drm / omapdrm / omap_drv.h
CommitLineData
caab277b 1/* SPDX-License-Identifier: GPL-2.0-only */
cd5351f4 2/*
1b409fda 3 * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
cd5351f4 4 * Author: Rob Clark <rob@ti.com>
cd5351f4
RC
5 */
6
b5561412
LP
7#ifndef __OMAPDRM_DRV_H__
8#define __OMAPDRM_DRV_H__
cd5351f4 9
cd5351f4
RC
10#include <linux/module.h>
11#include <linux/types.h>
a9e6f9f7 12#include <linux/workqueue.h>
2d278f54 13
81f6156c 14#include "dss/omapdss.h"
dac62bca 15#include "dss/dss.h"
81f6156c 16
6e42201b 17#include <drm/drm_atomic.h>
d9fc9413 18#include <drm/drm_gem.h>
2d278f54 19#include <drm/omap_drm.h>
f5f9454c 20
b5561412
LP
21#include "omap_crtc.h"
22#include "omap_encoder.h"
23#include "omap_fb.h"
b5561412
LP
24#include "omap_gem.h"
25#include "omap_irq.h"
26#include "omap_plane.h"
c8fa1e73 27#include "omap_overlay.h"
b5561412 28
81f2ca24
SR
29#define DBG(fmt, ...) DRM_DEBUG_DRIVER(fmt"\n", ##__VA_ARGS__)
30#define VERB(fmt, ...) if (0) DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__) /* verbose debug */
cd5351f4
RC
31
32#define MODULE_NAME "omapdrm"
33
f4302747
LP
34struct omap_drm_usergart;
35
2ee76792
LP
36struct omap_drm_pipeline {
37 struct drm_crtc *crtc;
38 struct drm_encoder *encoder;
39 struct drm_connector *connector;
511afb44 40 struct omap_dss_device *output;
de9225a9 41 unsigned int alias_id;
2ee76792
LP
42};
43
6e42201b
BP
44/*
45 * Global private object state for tracking resources that are shared across
46 * multiple kms objects (planes/crtcs/etc).
47 */
48#define to_omap_global_state(x) container_of(x, struct omap_global_state, base)
49
50struct omap_global_state {
51 struct drm_private_state base;
2e54ff0e
BP
52
53 /* global atomic state of assignment between overlays and planes */
54 struct drm_plane *hwoverlay_to_plane[8];
6e42201b
BP
55};
56
cd5351f4 57struct omap_drm_private {
a82f0347
LP
58 struct drm_device *ddev;
59 struct device *dev;
dfe9cfcc 60 u32 omaprev;
5e3b0874 61
72877cf3 62 struct dss_device *dss;
50638ae5 63 struct dispc_device *dispc;
9f759225 64
daea7501
TZ
65 bool irq_enabled;
66
2ee76792
LP
67 unsigned int num_pipes;
68 struct omap_drm_pipeline pipes[8];
e48f9f16 69 struct omap_drm_pipeline *channels[8];
f6b6036e 70
bb5c2d9a
RC
71 unsigned int num_planes;
72 struct drm_plane *planes[8];
f6b6036e 73
c8fa1e73
BP
74 unsigned int num_ovls;
75 struct omap_hw_overlay *overlays[8];
76
6e42201b
BP
77 struct drm_private_obj glob_obj;
78
5609f7fe
RC
79 struct workqueue_struct *wq;
80
76c4055f 81 /* lock for obj_list below */
5117bd89 82 struct mutex list_lock;
76c4055f 83
f5f9454c 84 /* list of GEM objects: */
f6b6036e
RC
85 struct list_head obj_list;
86
f4302747 87 struct omap_drm_usergart *usergart;
a6a91827 88 bool has_dmm;
3c810c61
RC
89
90 /* properties: */
8451b5ad 91 struct drm_property *zorder_prop;
f5f9454c
RC
92
93 /* irq handling: */
84e1d457
LP
94 spinlock_t wait_lock; /* protects the wait_list */
95 struct list_head wait_list; /* list of omap_irq_wait */
dfe9cfcc 96 u32 irq_mask; /* enabled irqs in addition to wait_list */
a7631c4b
PU
97
98 /* memory bandwidth limit if it is needed on the platform */
99 unsigned int max_bandwidth;
3c810c61
RC
100};
101
3c810c61 102
7ce84471 103void omap_debugfs_init(struct drm_minor *minor);
b5561412 104
6e42201b
BP
105struct omap_global_state * __must_check omap_get_global_state(struct drm_atomic_state *s);
106
107struct omap_global_state *omap_get_existing_global_state(struct omap_drm_private *priv);
108
b5561412 109#endif /* __OMAPDRM_DRV_H__ */