90 lines · c
1/* SPDX-License-Identifier: GPL-2.0+ */2/*3 * RZ/G2L Display Unit CRTCs4 *5 * Copyright (C) 2023 Renesas Electronics Corporation6 *7 * Based on rcar_du_crtc.h8 */9 10#ifndef __RZG2L_DU_CRTC_H__11#define __RZG2L_DU_CRTC_H__12 13#include <linux/container_of.h>14#include <linux/mutex.h>15#include <linux/spinlock.h>16#include <linux/wait.h>17 18#include <drm/drm_crtc.h>19#include <drm/drm_writeback.h>20 21#include <media/vsp1.h>22 23struct clk;24struct reset_control;25struct rzg2l_du_vsp;26struct rzg2l_du_format_info;27 28/**29 * struct rzg2l_du_crtc - the CRTC, representing a DU superposition processor30 * @crtc: base DRM CRTC31 * @dev: the DU device32 * @initialized: whether the CRTC has been initialized and clocks enabled33 * @vblank_enable: whether vblank events are enabled on this CRTC34 * @event: event to post when the pending page flip completes35 * @flip_wait: wait queue used to signal page flip completion36 * @vsp: VSP feeding video to this CRTC37 * @vsp_pipe: index of the VSP pipeline feeding video to this CRTC38 * @rstc: reset controller39 * @rzg2l_clocks: the bus, main and video clock40 */41struct rzg2l_du_crtc {42 struct drm_crtc crtc;43 44 struct rzg2l_du_device *dev;45 bool initialized;46 47 bool vblank_enable;48 struct drm_pending_vblank_event *event;49 wait_queue_head_t flip_wait;50 51 struct rzg2l_du_vsp *vsp;52 unsigned int vsp_pipe;53 54 const char *const *sources;55 unsigned int sources_count;56 57 struct reset_control *rstc;58 struct {59 struct clk *aclk;60 struct clk *pclk;61 struct clk *dclk;62 } rzg2l_clocks;63};64 65static inline struct rzg2l_du_crtc *to_rzg2l_crtc(struct drm_crtc *c)66{67 return container_of(c, struct rzg2l_du_crtc, crtc);68}69 70/**71 * struct rzg2l_du_crtc_state - Driver-specific CRTC state72 * @state: base DRM CRTC state73 * @outputs: bitmask of the outputs (enum rzg2l_du_output) driven by this CRTC74 */75struct rzg2l_du_crtc_state {76 struct drm_crtc_state state;77 unsigned int outputs;78};79 80static inline struct rzg2l_du_crtc_state *to_rzg2l_crtc_state(struct drm_crtc_state *s)81{82 return container_of(s, struct rzg2l_du_crtc_state, state);83}84 85int rzg2l_du_crtc_create(struct rzg2l_du_device *rcdu);86 87void rzg2l_du_crtc_finish_page_flip(struct rzg2l_du_crtc *rcrtc);88 89#endif /* __RZG2L_DU_CRTC_H__ */90