| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0+ */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * rcar_du_crtc.h -- R-Car Display Unit CRTCs |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2013-2015 Renesas Electronics Corporation |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) |
|---|
| 7 | | - * |
|---|
| 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. |
|---|
| 12 | 8 | */ |
|---|
| 13 | 9 | |
|---|
| 14 | 10 | #ifndef __RCAR_DU_CRTC_H__ |
|---|
| .. | .. |
|---|
| 18 | 14 | #include <linux/spinlock.h> |
|---|
| 19 | 15 | #include <linux/wait.h> |
|---|
| 20 | 16 | |
|---|
| 21 | | -#include <drm/drmP.h> |
|---|
| 22 | 17 | #include <drm/drm_crtc.h> |
|---|
| 18 | +#include <drm/drm_writeback.h> |
|---|
| 23 | 19 | |
|---|
| 24 | 20 | #include <media/vsp1.h> |
|---|
| 25 | 21 | |
|---|
| .. | .. |
|---|
| 29 | 25 | /** |
|---|
| 30 | 26 | * struct rcar_du_crtc - the CRTC, representing a DU superposition processor |
|---|
| 31 | 27 | * @crtc: base DRM CRTC |
|---|
| 28 | + * @dev: the DU device |
|---|
| 32 | 29 | * @clock: the CRTC functional clock |
|---|
| 33 | 30 | * @extclock: external pixel dot clock (optional) |
|---|
| 34 | 31 | * @mmio_offset: offset of the CRTC registers in the DU MMIO block |
|---|
| 35 | | - * @index: CRTC software and hardware index |
|---|
| 32 | + * @index: CRTC hardware index |
|---|
| 36 | 33 | * @initialized: whether the CRTC has been initialized and clocks enabled |
|---|
| 34 | + * @dsysr: cached value of the DSYSR register |
|---|
| 37 | 35 | * @vblank_enable: whether vblank events are enabled on this CRTC |
|---|
| 38 | 36 | * @event: event to post when the pending page flip completes |
|---|
| 39 | 37 | * @flip_wait: wait queue used to signal page flip completion |
|---|
| 40 | 38 | * @vblank_lock: protects vblank_wait and vblank_count |
|---|
| 41 | 39 | * @vblank_wait: wait queue used to signal vertical blanking |
|---|
| 42 | 40 | * @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 | 41 | * @group: CRTC group this CRTC belongs to |
|---|
| 42 | + * @cmm: CMM associated with this CRTC |
|---|
| 45 | 43 | * @vsp: VSP feeding video to this CRTC |
|---|
| 46 | 44 | * @vsp_pipe: index of the VSP pipeline feeding video to this CRTC |
|---|
| 45 | + * @writeback: the writeback connector |
|---|
| 47 | 46 | */ |
|---|
| 48 | 47 | struct rcar_du_crtc { |
|---|
| 49 | 48 | struct drm_crtc crtc; |
|---|
| 50 | 49 | |
|---|
| 50 | + struct rcar_du_device *dev; |
|---|
| 51 | 51 | struct clk *clock; |
|---|
| 52 | 52 | struct clk *extclock; |
|---|
| 53 | 53 | unsigned int mmio_offset; |
|---|
| 54 | 54 | unsigned int index; |
|---|
| 55 | 55 | bool initialized; |
|---|
| 56 | + |
|---|
| 57 | + u32 dsysr; |
|---|
| 56 | 58 | |
|---|
| 57 | 59 | bool vblank_enable; |
|---|
| 58 | 60 | struct drm_pending_vblank_event *event; |
|---|
| .. | .. |
|---|
| 62 | 64 | wait_queue_head_t vblank_wait; |
|---|
| 63 | 65 | unsigned int vblank_count; |
|---|
| 64 | 66 | |
|---|
| 65 | | - unsigned int outputs; |
|---|
| 66 | | - |
|---|
| 67 | 67 | struct rcar_du_group *group; |
|---|
| 68 | + struct platform_device *cmm; |
|---|
| 68 | 69 | struct rcar_du_vsp *vsp; |
|---|
| 69 | 70 | unsigned int vsp_pipe; |
|---|
| 71 | + |
|---|
| 72 | + const char *const *sources; |
|---|
| 73 | + unsigned int sources_count; |
|---|
| 74 | + |
|---|
| 75 | + struct drm_writeback_connector writeback; |
|---|
| 70 | 76 | }; |
|---|
| 71 | 77 | |
|---|
| 72 | | -#define to_rcar_crtc(c) container_of(c, struct rcar_du_crtc, crtc) |
|---|
| 78 | +#define to_rcar_crtc(c) container_of(c, struct rcar_du_crtc, crtc) |
|---|
| 79 | +#define wb_to_rcar_crtc(c) container_of(c, struct rcar_du_crtc, writeback) |
|---|
| 73 | 80 | |
|---|
| 74 | 81 | /** |
|---|
| 75 | 82 | * struct rcar_du_crtc_state - Driver-specific CRTC state |
|---|
| 76 | 83 | * @state: base DRM CRTC state |
|---|
| 77 | 84 | * @crc: CRC computation configuration |
|---|
| 85 | + * @outputs: bitmask of the outputs (enum rcar_du_output) driven by this CRTC |
|---|
| 78 | 86 | */ |
|---|
| 79 | 87 | struct rcar_du_crtc_state { |
|---|
| 80 | 88 | struct drm_crtc_state state; |
|---|
| 81 | 89 | |
|---|
| 82 | 90 | struct vsp1_du_crc_config crc; |
|---|
| 91 | + unsigned int outputs; |
|---|
| 83 | 92 | }; |
|---|
| 84 | 93 | |
|---|
| 85 | 94 | #define to_rcar_crtc_state(s) container_of(s, struct rcar_du_crtc_state, state) |
|---|
| .. | .. |
|---|
| 97 | 106 | |
|---|
| 98 | 107 | int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int swindex, |
|---|
| 99 | 108 | 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); |
|---|
| 102 | 109 | |
|---|
| 103 | | -void rcar_du_crtc_route_output(struct drm_crtc *crtc, |
|---|
| 104 | | - enum rcar_du_output output); |
|---|
| 105 | 110 | void rcar_du_crtc_finish_page_flip(struct rcar_du_crtc *rcrtc); |
|---|
| 106 | 111 | |
|---|
| 112 | +void rcar_du_crtc_dsysr_clr_set(struct rcar_du_crtc *rcrtc, u32 clr, u32 set); |
|---|
| 113 | + |
|---|
| 107 | 114 | #endif /* __RCAR_DU_CRTC_H__ */ |
|---|