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