Laurent Pinchart | cb2025d | 2013-06-16 21:01:02 +0200 | [diff] [blame] | 1 | /* |
| 2 | * rcar_du_group.c -- R-Car Display Unit Planes and CRTCs Group |
| 3 | * |
Laurent Pinchart | 36d5046 | 2014-02-06 18:13:52 +0100 | [diff] [blame] | 4 | * Copyright (C) 2013-2014 Renesas Electronics Corporation |
Laurent Pinchart | cb2025d | 2013-06-16 21:01:02 +0200 | [diff] [blame] | 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 | |
Laurent Pinchart | 5ee5a81 | 2015-02-25 18:27:19 +0200 | [diff] [blame] | 17 | #include <linux/mutex.h> |
| 18 | |
Laurent Pinchart | cb2025d | 2013-06-16 21:01:02 +0200 | [diff] [blame] | 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 |
Laurent Pinchart | fe6fbe9 | 2015-04-28 17:36:33 +0300 | [diff] [blame] | 28 | * @num_crtcs: number of CRTCs in this group (1 or 2) |
Laurent Pinchart | cb2025d | 2013-06-16 21:01:02 +0200 | [diff] [blame] | 29 | * @use_count: number of users of the group (rcar_du_group_(get|put)) |
| 30 | * @used_crtcs: number of CRTCs currently in use |
Laurent Pinchart | 2a57e9b | 2015-04-28 18:01:45 +0300 | [diff] [blame] | 31 | * @lock: protects the dptsr_planes field and the DPTSR register |
| 32 | * @dptsr_planes: bitmask of planes driven by dot-clock and timing generator 1 |
Laurent Pinchart | d6aed57 | 2015-05-25 16:32:45 +0300 | [diff] [blame] | 33 | * @num_planes: number of planes in the group |
Laurent Pinchart | cb2025d | 2013-06-16 21:01:02 +0200 | [diff] [blame] | 34 | * @planes: planes handled by the group |
Laurent Pinchart | 2af0394 | 2013-08-24 02:17:03 +0200 | [diff] [blame] | 35 | * @need_restart: the group needs to be restarted due to a configuration change |
Laurent Pinchart | cb2025d | 2013-06-16 21:01:02 +0200 | [diff] [blame] | 36 | */ |
| 37 | struct rcar_du_group { |
| 38 | struct rcar_du_device *dev; |
| 39 | unsigned int mmio_offset; |
| 40 | unsigned int index; |
| 41 | |
Laurent Pinchart | fe6fbe9 | 2015-04-28 17:36:33 +0300 | [diff] [blame] | 42 | unsigned int num_crtcs; |
Laurent Pinchart | cb2025d | 2013-06-16 21:01:02 +0200 | [diff] [blame] | 43 | unsigned int use_count; |
| 44 | unsigned int used_crtcs; |
| 45 | |
Laurent Pinchart | 5ee5a81 | 2015-02-25 18:27:19 +0200 | [diff] [blame] | 46 | struct mutex lock; |
Laurent Pinchart | 2a57e9b | 2015-04-28 18:01:45 +0300 | [diff] [blame] | 47 | unsigned int dptsr_planes; |
Laurent Pinchart | 5ee5a81 | 2015-02-25 18:27:19 +0200 | [diff] [blame] | 48 | |
Laurent Pinchart | d6aed57 | 2015-05-25 16:32:45 +0300 | [diff] [blame] | 49 | unsigned int num_planes; |
Laurent Pinchart | 99caede | 2015-04-29 00:05:56 +0300 | [diff] [blame] | 50 | struct rcar_du_plane planes[RCAR_DU_NUM_KMS_PLANES]; |
Laurent Pinchart | 2af0394 | 2013-08-24 02:17:03 +0200 | [diff] [blame] | 51 | bool need_restart; |
Laurent Pinchart | cb2025d | 2013-06-16 21:01:02 +0200 | [diff] [blame] | 52 | }; |
| 53 | |
Laurent Pinchart | a5f0ef5 | 2013-06-17 00:29:25 +0200 | [diff] [blame] | 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 | |
Laurent Pinchart | cb2025d | 2013-06-16 21:01:02 +0200 | [diff] [blame] | 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); |
Laurent Pinchart | 7cbc05c | 2013-06-17 03:20:08 +0200 | [diff] [blame] | 61 | int rcar_du_group_set_routing(struct rcar_du_group *rgrp); |
Laurent Pinchart | cb2025d | 2013-06-16 21:01:02 +0200 | [diff] [blame] | 62 | |
Laurent Pinchart | 34a04f2 | 2013-06-21 17:54:50 +0200 | [diff] [blame] | 63 | int rcar_du_set_dpad0_vsp1_routing(struct rcar_du_device *rcdu); |
| 64 | |
Laurent Pinchart | cb2025d | 2013-06-16 21:01:02 +0200 | [diff] [blame] | 65 | #endif /* __RCAR_DU_GROUP_H__ */ |