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 28 unsigned int num_crtcs; 29 struct drm_crtc *crtcs[TIDSS_MAX_PORTS]; 30 31 unsigned int num_planes; 32 struct drm_plane *planes[TIDSS_MAX_PLANES]; 33 34 unsigned int num_oldis; 35 struct tidss_oldi *oldis[TIDSS_MAX_OLDI_TXES]; 36 37 unsigned int irq; 38 39 /* protects the irq masks field and irqenable/irqstatus registers */ 40 spinlock_t irq_lock; 41 dispc_irq_t irq_mask; /* enabled irqs */ 42 }; 43 44 #define to_tidss(__dev) container_of(__dev, struct tidss_device, ddev) 45 46 int tidss_runtime_get(struct tidss_device *tidss); 47 void tidss_runtime_put(struct tidss_device *tidss); 48 49 #endif 50