blob: 5e3adc6b31b56356a6fba3aea129bf9653829b7d [file] [log] [blame]
Laurent Pinchartcb2025d2013-06-16 21:01:02 +02001/*
2 * rcar_du_group.c -- R-Car Display Unit Planes and CRTCs Group
3 *
Laurent Pinchart36d50462014-02-06 18:13:52 +01004 * Copyright (C) 2013-2014 Renesas Electronics Corporation
Laurent Pinchartcb2025d2013-06-16 21:01:02 +02005 *
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 Pinchart5ee5a812015-02-25 18:27:19 +020017#include <linux/mutex.h>
18
Laurent Pinchartcb2025d2013-06-16 21:01:02 +020019#include "rcar_du_plane.h"
20
21struct 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 Pinchartfe6fbe92015-04-28 17:36:33 +030028 * @num_crtcs: number of CRTCs in this group (1 or 2)
Laurent Pinchartcb2025d2013-06-16 21:01:02 +020029 * @use_count: number of users of the group (rcar_du_group_(get|put))
30 * @used_crtcs: number of CRTCs currently in use
Laurent Pinchart2a57e9b2015-04-28 18:01:45 +030031 * @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 Pinchartd6aed572015-05-25 16:32:45 +030033 * @num_planes: number of planes in the group
Laurent Pinchartcb2025d2013-06-16 21:01:02 +020034 * @planes: planes handled by the group
Laurent Pinchart2af03942013-08-24 02:17:03 +020035 * @need_restart: the group needs to be restarted due to a configuration change
Laurent Pinchartcb2025d2013-06-16 21:01:02 +020036 */
37struct rcar_du_group {
38 struct rcar_du_device *dev;
39 unsigned int mmio_offset;
40 unsigned int index;
41
Laurent Pinchartfe6fbe92015-04-28 17:36:33 +030042 unsigned int num_crtcs;
Laurent Pinchartcb2025d2013-06-16 21:01:02 +020043 unsigned int use_count;
44 unsigned int used_crtcs;
45
Laurent Pinchart5ee5a812015-02-25 18:27:19 +020046 struct mutex lock;
Laurent Pinchart2a57e9b2015-04-28 18:01:45 +030047 unsigned int dptsr_planes;
Laurent Pinchart5ee5a812015-02-25 18:27:19 +020048
Laurent Pinchartd6aed572015-05-25 16:32:45 +030049 unsigned int num_planes;
Laurent Pinchart99caede2015-04-29 00:05:56 +030050 struct rcar_du_plane planes[RCAR_DU_NUM_KMS_PLANES];
Laurent Pinchart2af03942013-08-24 02:17:03 +020051 bool need_restart;
Laurent Pinchartcb2025d2013-06-16 21:01:02 +020052};
53
Laurent Pincharta5f0ef52013-06-17 00:29:25 +020054u32 rcar_du_group_read(struct rcar_du_group *rgrp, u32 reg);
55void rcar_du_group_write(struct rcar_du_group *rgrp, u32 reg, u32 data);
56
Laurent Pinchartcb2025d2013-06-16 21:01:02 +020057int rcar_du_group_get(struct rcar_du_group *rgrp);
58void rcar_du_group_put(struct rcar_du_group *rgrp);
59void rcar_du_group_start_stop(struct rcar_du_group *rgrp, bool start);
60void rcar_du_group_restart(struct rcar_du_group *rgrp);
Laurent Pinchart7cbc05c2013-06-17 03:20:08 +020061int rcar_du_group_set_routing(struct rcar_du_group *rgrp);
Laurent Pinchartcb2025d2013-06-16 21:01:02 +020062
Laurent Pinchart34a04f22013-06-21 17:54:50 +020063int rcar_du_set_dpad0_vsp1_routing(struct rcar_du_device *rcdu);
64
Laurent Pinchartcb2025d2013-06-16 21:01:02 +020065#endif /* __RCAR_DU_GROUP_H__ */