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_CRTC_H__
88c2ecf20Sopenharmony_ci#define __TIDSS_CRTC_H__
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/completion.h>
118c2ecf20Sopenharmony_ci#include <linux/wait.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <drm/drm_crtc.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define to_tidss_crtc(c) container_of((c), struct tidss_crtc, crtc)
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_cistruct tidss_device;
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_cistruct tidss_crtc {
208c2ecf20Sopenharmony_ci	struct drm_crtc crtc;
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci	u32 hw_videoport;
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci	struct drm_pending_vblank_event *event;
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci	struct completion framedone_completion;
278c2ecf20Sopenharmony_ci};
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define to_tidss_crtc_state(x) container_of(x, struct tidss_crtc_state, base)
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_cistruct tidss_crtc_state {
328c2ecf20Sopenharmony_ci	/* Must be first. */
338c2ecf20Sopenharmony_ci	struct drm_crtc_state base;
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci	bool plane_pos_changed;
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	u32 bus_format;
388c2ecf20Sopenharmony_ci	u32 bus_flags;
398c2ecf20Sopenharmony_ci};
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_civoid tidss_crtc_vblank_irq(struct drm_crtc *crtc);
428c2ecf20Sopenharmony_civoid tidss_crtc_framedone_irq(struct drm_crtc *crtc);
438c2ecf20Sopenharmony_civoid tidss_crtc_error_irq(struct drm_crtc *crtc, u64 irqstatus);
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_cistruct tidss_crtc *tidss_crtc_create(struct tidss_device *tidss,
468c2ecf20Sopenharmony_ci				     u32 hw_videoport,
478c2ecf20Sopenharmony_ci				     struct drm_plane *primary);
488c2ecf20Sopenharmony_ci#endif
49