xref: /linux/drivers/gpu/drm/tidss/tidss_drv.h (revision 2c1ed907520c50326b8f604907a8478b27881a2e)
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 #define TIDSS_MAX_PORTS 4
13 #define TIDSS_MAX_PLANES 4
14 
15 typedef u32 dispc_irq_t;
16 
17 struct tidss_device {
18 	struct drm_device ddev;		/* DRM device for DSS */
19 	struct device *dev;		/* Underlying DSS device */
20 
21 	const struct dispc_features *feat;
22 	struct dispc_device *dispc;
23 
24 	unsigned int num_crtcs;
25 	struct drm_crtc *crtcs[TIDSS_MAX_PORTS];
26 
27 	unsigned int num_planes;
28 	struct drm_plane *planes[TIDSS_MAX_PLANES];
29 
30 	unsigned int irq;
31 
32 	/* protects the irq masks field and irqenable/irqstatus registers */
33 	spinlock_t irq_lock;
34 	dispc_irq_t irq_mask;	/* enabled irqs */
35 };
36 
37 #define to_tidss(__dev) container_of(__dev, struct tidss_device, ddev)
38 
39 int tidss_runtime_get(struct tidss_device *tidss);
40 void tidss_runtime_put(struct tidss_device *tidss);
41 
42 #endif
43