1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2019-2022 Bootlin
4  * Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
5  */
6 
7 #ifndef _LOGICVC_DRM_H_
8 #define _LOGICVC_DRM_H_
9 
10 #include <linux/regmap.h>
11 #include <linux/types.h>
12 #include <drm/drm_device.h>
13 
14 #define LOGICVC_DISPLAY_INTERFACE_RGB			0
15 #define LOGICVC_DISPLAY_INTERFACE_ITU656		1
16 #define LOGICVC_DISPLAY_INTERFACE_LVDS_4BITS		2
17 #define LOGICVC_DISPLAY_INTERFACE_LVDS_4BITS_CAMERA	3
18 #define LOGICVC_DISPLAY_INTERFACE_LVDS_3BITS		4
19 #define LOGICVC_DISPLAY_INTERFACE_DVI			5
20 
21 #define LOGICVC_DISPLAY_COLORSPACE_RGB		0
22 #define LOGICVC_DISPLAY_COLORSPACE_YUV422	1
23 #define LOGICVC_DISPLAY_COLORSPACE_YUV444	2
24 
25 #define logicvc_drm(d) \
26 	container_of(d, struct logicvc_drm, drm_dev)
27 
28 struct logicvc_crtc;
29 struct logicvc_interface;
30 
31 struct logicvc_drm_config {
32 	u32 display_interface;
33 	u32 display_colorspace;
34 	u32 display_depth;
35 	u32 row_stride;
36 	bool dithering;
37 	bool background_layer;
38 	bool layers_configurable;
39 	u32 layers_count;
40 };
41 
42 struct logicvc_drm_caps {
43 	unsigned int major;
44 	unsigned int minor;
45 	char level;
46 	bool layer_address;
47 };
48 
49 struct logicvc_drm {
50 	const struct logicvc_drm_caps *caps;
51 	struct logicvc_drm_config config;
52 
53 	struct drm_device drm_dev;
54 	phys_addr_t reserved_mem_base;
55 	struct regmap *regmap;
56 
57 	struct clk *vclk;
58 	struct clk *vclk2;
59 	struct clk *lvdsclk;
60 	struct clk *lvdsclkn;
61 
62 	struct list_head layers_list;
63 	struct logicvc_crtc *crtc;
64 	struct logicvc_interface *interface;
65 };
66 
67 #endif
68