summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/gpu/drm/rcar-du/rcar_du_group.h
blob: d7318e1a6b005a0f13dda0ddb2b308ad076a0494 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 * rcar_du_group.c  --  R-Car Display Unit Planes and CRTCs Group
 *
 * Copyright (C) 2013-2014 Renesas Electronics Corporation
 *
 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#ifndef __RCAR_DU_GROUP_H__
#define __RCAR_DU_GROUP_H__

#include <linux/mutex.h>

#include "rcar_du_plane.h"

struct rcar_du_device;

/*
 * struct rcar_du_group - CRTCs and planes group
 * @dev: the DU device
 * @mmio_offset: registers offset in the device memory map
 * @index: group index
 * @num_crtcs: number of CRTCs in this group (1 or 2)
 * @use_count: number of users of the group (rcar_du_group_(get|put))
 * @used_crtcs: number of CRTCs currently in use
 * @lock: protects the dptsr_planes field and the DPTSR register
 * @dptsr_planes: bitmask of planes driven by dot-clock and timing generator 1
 * @num_planes: number of planes in the group
 * @planes: planes handled by the group
 */
struct rcar_du_group {
	struct rcar_du_device *dev;
	unsigned int mmio_offset;
	unsigned int index;

	unsigned int num_crtcs;
	unsigned int use_count;
	unsigned int used_crtcs;

	struct mutex lock;
	unsigned int dptsr_planes;

	unsigned int num_planes;
	struct rcar_du_plane planes[RCAR_DU_NUM_KMS_PLANES];
};

u32 rcar_du_group_read(struct rcar_du_group *rgrp, u32 reg);
void rcar_du_group_write(struct rcar_du_group *rgrp, u32 reg, u32 data);

int rcar_du_group_get(struct rcar_du_group *rgrp);
void rcar_du_group_put(struct rcar_du_group *rgrp);
void rcar_du_group_start_stop(struct rcar_du_group *rgrp, bool start);
void rcar_du_group_restart(struct rcar_du_group *rgrp);
int rcar_du_group_set_routing(struct rcar_du_group *rgrp);

#endif /* __RCAR_DU_GROUP_H__ */