xref: /OK3568_Linux_fs/kernel/drivers/gpu/drm/sti/sti_mixer.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright (C) STMicroelectronics SA 2014
4*4882a593Smuzhiyun  * Authors: Benjamin Gaignard <benjamin.gaignard@st.com>
5*4882a593Smuzhiyun  *          Fabien Dessenne <fabien.dessenne@st.com>
6*4882a593Smuzhiyun  *          for STMicroelectronics.
7*4882a593Smuzhiyun  */
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #ifndef _STI_MIXER_H_
10*4882a593Smuzhiyun #define _STI_MIXER_H_
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun #include <drm/drm_crtc.h>
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun #include <drm/drm_debugfs.h>
15*4882a593Smuzhiyun #include <drm/drm_file.h>
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun #include "sti_plane.h"
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun struct device;
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun #define to_sti_mixer(x) container_of(x, struct sti_mixer, drm_crtc)
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun enum sti_mixer_status {
24*4882a593Smuzhiyun 	STI_MIXER_READY,
25*4882a593Smuzhiyun 	STI_MIXER_DISABLING,
26*4882a593Smuzhiyun 	STI_MIXER_DISABLED,
27*4882a593Smuzhiyun };
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun /**
30*4882a593Smuzhiyun  * STI Mixer subdevice structure
31*4882a593Smuzhiyun  *
32*4882a593Smuzhiyun  * @dev: driver device
33*4882a593Smuzhiyun  * @regs: mixer registers
34*4882a593Smuzhiyun  * @id: id of the mixer
35*4882a593Smuzhiyun  * @drm_crtc: crtc object link to the mixer
36*4882a593Smuzhiyun  * @status: to know the status of the mixer
37*4882a593Smuzhiyun  */
38*4882a593Smuzhiyun struct sti_mixer {
39*4882a593Smuzhiyun 	struct device *dev;
40*4882a593Smuzhiyun 	void __iomem *regs;
41*4882a593Smuzhiyun 	int id;
42*4882a593Smuzhiyun 	struct drm_crtc drm_crtc;
43*4882a593Smuzhiyun 	enum sti_mixer_status status;
44*4882a593Smuzhiyun };
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun const char *sti_mixer_to_str(struct sti_mixer *mixer);
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun struct sti_mixer *sti_mixer_create(struct device *dev,
49*4882a593Smuzhiyun 				   struct drm_device *drm_dev,
50*4882a593Smuzhiyun 				   int id,
51*4882a593Smuzhiyun 				   void __iomem *baseaddr);
52*4882a593Smuzhiyun 
53*4882a593Smuzhiyun int sti_mixer_set_plane_status(struct sti_mixer *mixer,
54*4882a593Smuzhiyun 			       struct sti_plane *plane, bool status);
55*4882a593Smuzhiyun int sti_mixer_set_plane_depth(struct sti_mixer *mixer, struct sti_plane *plane);
56*4882a593Smuzhiyun int sti_mixer_active_video_area(struct sti_mixer *mixer,
57*4882a593Smuzhiyun 				struct drm_display_mode *mode);
58*4882a593Smuzhiyun 
59*4882a593Smuzhiyun void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable);
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun void sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor);
62*4882a593Smuzhiyun 
63*4882a593Smuzhiyun /* depth in Cross-bar control = z order */
64*4882a593Smuzhiyun #define GAM_MIXER_NB_DEPTH_LEVEL 6
65*4882a593Smuzhiyun 
66*4882a593Smuzhiyun #define STI_MIXER_MAIN 0
67*4882a593Smuzhiyun #define STI_MIXER_AUX  1
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun #endif
70