summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.h
blob: 58806c2a8f2bf9b2c99cefca45c3d414894749ac (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * RZ/G2L Display Unit DRM driver
 *
 * Copyright (C) 2023 Renesas Electronics Corporation
 *
 * Based on rcar_du_drv.h
 */

#ifndef __RZG2L_DU_DRV_H__
#define __RZG2L_DU_DRV_H__

#include <linux/kernel.h>

#include <drm/drm_device.h>

#include "rzg2l_du_crtc.h"
#include "rzg2l_du_vsp.h"

struct device;
struct drm_property;

enum rzg2l_du_output {
	RZG2L_DU_OUTPUT_DSI0,
	RZG2L_DU_OUTPUT_DPAD0,
	RZG2L_DU_OUTPUT_MAX,
};

/*
 * struct rzg2l_du_output_routing - Output routing specification
 * @possible_outputs: bitmask of possible outputs
 * @port: device tree port number corresponding to this output route
 *
 * The DU has 2 possible outputs (DPAD0, DSI0). Output routing data
 * specify the valid SoC outputs, which CRTC can drive the output, and the type
 * of in-SoC encoder for the output.
 */
struct rzg2l_du_output_routing {
	unsigned int possible_outputs;
	unsigned int port;
};

/*
 * struct rzg2l_du_device_info - DU model-specific information
 * @channels_mask: bit mask of available DU channels
 * @routes: array of CRTC to output routes, indexed by output (RZG2L_DU_OUTPUT_*)
 */
struct rzg2l_du_device_info {
	unsigned int channels_mask;
	struct rzg2l_du_output_routing routes[RZG2L_DU_OUTPUT_MAX];
};

#define RZG2L_DU_MAX_CRTCS		1
#define RZG2L_DU_MAX_VSPS		1
#define RZG2L_DU_MAX_DSI		1

struct rzg2l_du_device {
	struct device *dev;
	const struct rzg2l_du_device_info *info;

	void __iomem *mmio;

	struct drm_device ddev;

	struct rzg2l_du_crtc crtcs[RZG2L_DU_MAX_CRTCS];
	unsigned int num_crtcs;

	struct rzg2l_du_vsp vsps[RZG2L_DU_MAX_VSPS];
};

static inline struct rzg2l_du_device *to_rzg2l_du_device(struct drm_device *dev)
{
	return container_of(dev, struct rzg2l_du_device, ddev);
}

const char *rzg2l_du_output_name(enum rzg2l_du_output output);

#endif /* __RZG2L_DU_DRV_H__ */