xref: /linux/drivers/gpu/drm/tidss/tidss_drv.h (revision d30c1683aaecb93d2ab95685dc4300a33d3cea7a)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2018 Texas Instruments Incorporated - https://www.ti.com/
4  * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
5  */
6 
7 #ifndef __TIDSS_DRV_H__
8 #define __TIDSS_DRV_H__
9 
10 #include <linux/spinlock.h>
11 
12 #include <drm/drm_device.h>
13 
14 #define TIDSS_MAX_PORTS 4
15 #define TIDSS_MAX_PLANES 4
16 #define TIDSS_MAX_OLDI_TXES 2
17 
18 typedef u32 dispc_irq_t;
19 struct tidss_oldi;
20 
21 struct tidss_device {
22 	struct drm_device ddev;		/* DRM device for DSS */
23 	struct device *dev;		/* Underlying DSS device */
24 
25 	const struct dispc_features *feat;
26 	struct dispc_device *dispc;
27 	bool is_ext_vp_clk[TIDSS_MAX_PORTS];
28 
29 
30 	unsigned int num_crtcs;
31 	struct drm_crtc *crtcs[TIDSS_MAX_PORTS];
32 
33 	unsigned int num_planes;
34 	struct drm_plane *planes[TIDSS_MAX_PLANES];
35 
36 	unsigned int num_oldis;
37 	struct tidss_oldi *oldis[TIDSS_MAX_OLDI_TXES];
38 
39 	unsigned int irq;
40 
41 	/* protects the irq masks field and irqenable/irqstatus registers */
42 	spinlock_t irq_lock;
43 	dispc_irq_t irq_mask;	/* enabled irqs */
44 };
45 
46 #define to_tidss(__dev) container_of(__dev, struct tidss_device, ddev)
47 
48 int tidss_runtime_get(struct tidss_device *tidss);
49 void tidss_runtime_put(struct tidss_device *tidss);
50 
51 #endif
52