1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * rcar_du_group.c -- R-Car Display Unit Planes and CRTCs Group 4 * 5 * Copyright (C) 2013-2014 Renesas Electronics Corporation 6 * 7 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) 8 */ 9 10 #ifndef __RCAR_DU_GROUP_H__ 11 #define __RCAR_DU_GROUP_H__ 12 13 #include <linux/mutex.h> 14 15 #include "rcar_du_plane.h" 16 17 struct rcar_du_device; 18 19 /* 20 * struct rcar_du_group - CRTCs and planes group 21 * @dev: the DU device 22 * @mmio_offset: registers offset in the device memory map 23 * @index: group index 24 * @channels_mask: bitmask of populated DU channels in this group 25 * @cmms_mask: bitmask of available CMMs in this group 26 * @num_crtcs: number of CRTCs in this group (1 or 2) 27 * @use_count: number of users of the group (rcar_du_group_(get|put)) 28 * @used_crtcs: number of CRTCs currently in use 29 * @lock: protects the dptsr_planes field and the DPTSR register 30 * @dptsr_planes: bitmask of planes driven by dot-clock and timing generator 1 31 * @num_planes: number of planes in the group 32 * @planes: planes handled by the group 33 * @need_restart: the group needs to be restarted due to a configuration change 34 */ 35 struct rcar_du_group { 36 struct rcar_du_device *dev; 37 unsigned int mmio_offset; 38 unsigned int index; 39 40 unsigned int channels_mask; 41 unsigned int cmms_mask; 42 unsigned int num_crtcs; 43 unsigned int use_count; 44 unsigned int used_crtcs; 45 46 struct mutex lock; 47 unsigned int dptsr_planes; 48 49 unsigned int num_planes; 50 struct rcar_du_plane planes[RCAR_DU_NUM_KMS_PLANES]; 51 bool need_restart; 52 }; 53 54 u32 rcar_du_group_read(struct rcar_du_group *rgrp, u32 reg); 55 void rcar_du_group_write(struct rcar_du_group *rgrp, u32 reg, u32 data); 56 57 int rcar_du_group_get(struct rcar_du_group *rgrp); 58 void rcar_du_group_put(struct rcar_du_group *rgrp); 59 void rcar_du_group_start_stop(struct rcar_du_group *rgrp, bool start); 60 void rcar_du_group_restart(struct rcar_du_group *rgrp); 61 int rcar_du_group_set_routing(struct rcar_du_group *rgrp); 62 63 int rcar_du_set_dpad0_vsp1_routing(struct rcar_du_device *rcdu); 64 65 #endif /* __RCAR_DU_GROUP_H__ */ 66