2 * rcar_du_crtc.h -- R-Car Display Unit CRTCs
4 * Copyright (C) 2013-2015 Renesas Electronics Corporation
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
14 #ifndef __RCAR_DU_CRTC_H__
15 #define __RCAR_DU_CRTC_H__
17 #include <linux/mutex.h>
18 #include <linux/spinlock.h>
19 #include <linux/wait.h>
22 #include <drm/drm_crtc.h>
24 #include <media/vsp1.h>
30 * struct rcar_du_crtc - the CRTC, representing a DU superposition processor
31 * @crtc: base DRM CRTC
32 * @clock: the CRTC functional clock
33 * @extclock: external pixel dot clock (optional)
34 * @mmio_offset: offset of the CRTC registers in the DU MMIO block
35 * @index: CRTC software and hardware index
36 * @initialized: whether the CRTC has been initialized and clocks enabled
37 * @vblank_enable: whether vblank events are enabled on this CRTC
38 * @event: event to post when the pending page flip completes
39 * @flip_wait: wait queue used to signal page flip completion
40 * @vblank_lock: protects vblank_wait and vblank_count
41 * @vblank_wait: wait queue used to signal vertical blanking
42 * @vblank_count: number of vertical blanking interrupts to wait for
43 * @outputs: bitmask of the outputs (enum rcar_du_output) driven by this CRTC
44 * @group: CRTC group this CRTC belongs to
45 * @vsp: VSP feeding video to this CRTC
46 * @vsp_pipe: index of the VSP pipeline feeding video to this CRTC
53 unsigned int mmio_offset
;
58 struct drm_pending_vblank_event
*event
;
59 wait_queue_head_t flip_wait
;
61 spinlock_t vblank_lock
;
62 wait_queue_head_t vblank_wait
;
63 unsigned int vblank_count
;
67 struct rcar_du_group
*group
;
68 struct rcar_du_vsp
*vsp
;
69 unsigned int vsp_pipe
;
72 #define to_rcar_crtc(c) container_of(c, struct rcar_du_crtc, crtc)
75 * struct rcar_du_crtc_state - Driver-specific CRTC state
76 * @state: base DRM CRTC state
77 * @crc: CRC computation configuration
79 struct rcar_du_crtc_state
{
80 struct drm_crtc_state state
;
82 struct vsp1_du_crc_config crc
;
85 #define to_rcar_crtc_state(s) container_of(s, struct rcar_du_crtc_state, state)
98 int rcar_du_crtc_create(struct rcar_du_group
*rgrp
, unsigned int swindex
,
99 unsigned int hwindex
);
100 void rcar_du_crtc_suspend(struct rcar_du_crtc
*rcrtc
);
101 void rcar_du_crtc_resume(struct rcar_du_crtc
*rcrtc
);
103 void rcar_du_crtc_route_output(struct drm_crtc
*crtc
,
104 enum rcar_du_output output
);
105 void rcar_du_crtc_finish_page_flip(struct rcar_du_crtc
*rcrtc
);
107 #endif /* __RCAR_DU_CRTC_H__ */