This source file includes following definitions.
- msm_kms_init
1
2
3
4
5
6
7
8 #ifndef __MSM_KMS_H__
9 #define __MSM_KMS_H__
10
11 #include <linux/clk.h>
12 #include <linux/regulator/consumer.h>
13
14 #include "msm_drv.h"
15
16 #define MAX_PLANE 4
17
18
19
20
21
22
23 struct msm_kms_funcs {
24
25 int (*hw_init)(struct msm_kms *kms);
26
27 void (*irq_preinstall)(struct msm_kms *kms);
28 int (*irq_postinstall)(struct msm_kms *kms);
29 void (*irq_uninstall)(struct msm_kms *kms);
30 irqreturn_t (*irq)(struct msm_kms *kms);
31 int (*enable_vblank)(struct msm_kms *kms, struct drm_crtc *crtc);
32 void (*disable_vblank)(struct msm_kms *kms, struct drm_crtc *crtc);
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 void (*enable_commit)(struct msm_kms *kms);
60 void (*disable_commit)(struct msm_kms *kms);
61
62
63
64
65
66
67
68 ktime_t (*vsync_time)(struct msm_kms *kms, struct drm_crtc *crtc);
69
70
71
72
73
74 void (*prepare_commit)(struct msm_kms *kms, struct drm_atomic_state *state);
75
76
77
78
79
80
81 void (*flush_commit)(struct msm_kms *kms, unsigned crtc_mask);
82
83
84
85
86
87
88
89
90 void (*wait_flush)(struct msm_kms *kms, unsigned crtc_mask);
91
92
93
94
95
96
97 void (*complete_commit)(struct msm_kms *kms, unsigned crtc_mask);
98
99
100
101
102
103
104 const struct msm_format *(*get_format)(struct msm_kms *kms,
105 const uint32_t format,
106 const uint64_t modifiers);
107
108 int (*check_modified_format)(const struct msm_kms *kms,
109 const struct msm_format *msm_fmt,
110 const struct drm_mode_fb_cmd2 *cmd,
111 struct drm_gem_object **bos);
112
113
114 long (*round_pixclk)(struct msm_kms *kms, unsigned long rate,
115 struct drm_encoder *encoder);
116 int (*set_split_display)(struct msm_kms *kms,
117 struct drm_encoder *encoder,
118 struct drm_encoder *slave_encoder,
119 bool is_cmd_mode);
120 void (*set_encoder_mode)(struct msm_kms *kms,
121 struct drm_encoder *encoder,
122 bool cmd_mode);
123
124 void (*destroy)(struct msm_kms *kms);
125 #ifdef CONFIG_DEBUG_FS
126
127 int (*debugfs_init)(struct msm_kms *kms, struct drm_minor *minor);
128 #endif
129 };
130
131 struct msm_kms;
132
133
134
135
136
137 struct msm_pending_timer {
138 struct hrtimer timer;
139 struct work_struct work;
140 struct msm_kms *kms;
141 unsigned crtc_idx;
142 };
143
144 struct msm_kms {
145 const struct msm_kms_funcs *funcs;
146 struct drm_device *dev;
147
148
149 int irq;
150
151
152 struct msm_gem_address_space *aspace;
153
154
155
156
157
158 struct mutex commit_lock;
159 unsigned pending_crtc_mask;
160 struct msm_pending_timer pending_timers[MAX_CRTCS];
161 };
162
163 static inline void msm_kms_init(struct msm_kms *kms,
164 const struct msm_kms_funcs *funcs)
165 {
166 unsigned i;
167
168 mutex_init(&kms->commit_lock);
169 kms->funcs = funcs;
170
171 for (i = 0; i < ARRAY_SIZE(kms->pending_timers); i++)
172 msm_atomic_init_pending_timer(&kms->pending_timers[i], kms, i);
173 }
174
175 struct msm_kms *mdp4_kms_init(struct drm_device *dev);
176 struct msm_kms *mdp5_kms_init(struct drm_device *dev);
177 struct msm_kms *dpu_kms_init(struct drm_device *dev);
178
179 struct msm_mdss_funcs {
180 int (*enable)(struct msm_mdss *mdss);
181 int (*disable)(struct msm_mdss *mdss);
182 void (*destroy)(struct drm_device *dev);
183 };
184
185 struct msm_mdss {
186 struct drm_device *dev;
187 const struct msm_mdss_funcs *funcs;
188 };
189
190 int mdp5_mdss_init(struct drm_device *dev);
191 int dpu_mdss_init(struct drm_device *dev);
192
193 #define for_each_crtc_mask(dev, crtc, crtc_mask) \
194 drm_for_each_crtc(crtc, dev) \
195 for_each_if (drm_crtc_mask(crtc) & (crtc_mask))
196
197 #endif