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