18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2018 Texas Instruments Incorporated - https://www.ti.com/
48c2ecf20Sopenharmony_ci * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef __TIDSS_DRV_H__
88c2ecf20Sopenharmony_ci#define __TIDSS_DRV_H__
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/spinlock.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#define TIDSS_MAX_PORTS 4
138c2ecf20Sopenharmony_ci#define TIDSS_MAX_PLANES 4
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_citypedef u32 dispc_irq_t;
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_cistruct tidss_device {
188c2ecf20Sopenharmony_ci	struct drm_device ddev;		/* DRM device for DSS */
198c2ecf20Sopenharmony_ci	struct device *dev;		/* Underlying DSS device */
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci	const struct dispc_features *feat;
228c2ecf20Sopenharmony_ci	struct dispc_device *dispc;
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci	unsigned int num_crtcs;
258c2ecf20Sopenharmony_ci	struct drm_crtc *crtcs[TIDSS_MAX_PORTS];
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci	unsigned int num_planes;
288c2ecf20Sopenharmony_ci	struct drm_plane *planes[TIDSS_MAX_PLANES];
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci	spinlock_t wait_lock;	/* protects the irq masks */
318c2ecf20Sopenharmony_ci	dispc_irq_t irq_mask;	/* enabled irqs in addition to wait_list */
328c2ecf20Sopenharmony_ci};
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define to_tidss(__dev) container_of(__dev, struct tidss_device, ddev)
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciint tidss_runtime_get(struct tidss_device *tidss);
378c2ecf20Sopenharmony_civoid tidss_runtime_put(struct tidss_device *tidss);
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#endif
40