diff options
Diffstat (limited to 'drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h')
-rw-r--r-- | drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h | 131 |
1 files changed, 45 insertions, 86 deletions
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h index 5bf340dd0f00..dd69c77c0d64 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h | |||
@@ -21,25 +21,9 @@ | |||
21 | #include "msm_drv.h" | 21 | #include "msm_drv.h" |
22 | #include "msm_kms.h" | 22 | #include "msm_kms.h" |
23 | #include "mdp/mdp_kms.h" | 23 | #include "mdp/mdp_kms.h" |
24 | /* dynamic offsets used by mdp5.xml.h (initialized in mdp5_kms.c) */ | 24 | #include "mdp5_cfg.h" /* must be included before mdp5.xml.h */ |
25 | #define MDP5_MAX_BASES 8 | ||
26 | struct mdp5_sub_block { | ||
27 | int count; | ||
28 | uint32_t base[MDP5_MAX_BASES]; | ||
29 | }; | ||
30 | struct mdp5_config { | ||
31 | char *name; | ||
32 | struct mdp5_sub_block ctl; | ||
33 | struct mdp5_sub_block pipe_vig; | ||
34 | struct mdp5_sub_block pipe_rgb; | ||
35 | struct mdp5_sub_block pipe_dma; | ||
36 | struct mdp5_sub_block lm; | ||
37 | struct mdp5_sub_block dspp; | ||
38 | struct mdp5_sub_block ad; | ||
39 | struct mdp5_sub_block intf; | ||
40 | }; | ||
41 | extern const struct mdp5_config *mdp5_cfg; | ||
42 | #include "mdp5.xml.h" | 25 | #include "mdp5.xml.h" |
26 | #include "mdp5_ctl.h" | ||
43 | #include "mdp5_smp.h" | 27 | #include "mdp5_smp.h" |
44 | 28 | ||
45 | struct mdp5_kms { | 29 | struct mdp5_kms { |
@@ -47,17 +31,14 @@ struct mdp5_kms { | |||
47 | 31 | ||
48 | struct drm_device *dev; | 32 | struct drm_device *dev; |
49 | 33 | ||
50 | int rev; | 34 | struct mdp5_cfg_handler *cfg; |
51 | const struct mdp5_config *hw_cfg; | ||
52 | 35 | ||
53 | /* mapper-id used to request GEM buffer mapped for scanout: */ | 36 | /* mapper-id used to request GEM buffer mapped for scanout: */ |
54 | int id; | 37 | int id; |
55 | struct msm_mmu *mmu; | 38 | struct msm_mmu *mmu; |
56 | 39 | ||
57 | /* for tracking smp allocation amongst pipes: */ | 40 | struct mdp5_smp *smp; |
58 | mdp5_smp_state_t smp_state; | 41 | struct mdp5_ctl_manager *ctlm; |
59 | struct mdp5_client_smp_state smp_client_state[CID_MAX]; | ||
60 | int smp_blk_cnt; | ||
61 | 42 | ||
62 | /* io/register spaces: */ | 43 | /* io/register spaces: */ |
63 | void __iomem *mmio, *vbif; | 44 | void __iomem *mmio, *vbif; |
@@ -71,18 +52,47 @@ struct mdp5_kms { | |||
71 | struct clk *lut_clk; | 52 | struct clk *lut_clk; |
72 | struct clk *vsync_clk; | 53 | struct clk *vsync_clk; |
73 | 54 | ||
74 | struct hdmi *hdmi; | 55 | /* |
56 | * lock to protect access to global resources: ie., following register: | ||
57 | * - REG_MDP5_DISP_INTF_SEL | ||
58 | */ | ||
59 | spinlock_t resource_lock; | ||
75 | 60 | ||
76 | struct mdp_irq error_handler; | 61 | struct mdp_irq error_handler; |
62 | |||
63 | struct { | ||
64 | volatile unsigned long enabled_mask; | ||
65 | struct irq_domain *domain; | ||
66 | } irqcontroller; | ||
77 | }; | 67 | }; |
78 | #define to_mdp5_kms(x) container_of(x, struct mdp5_kms, base) | 68 | #define to_mdp5_kms(x) container_of(x, struct mdp5_kms, base) |
79 | 69 | ||
80 | /* platform config data (ie. from DT, or pdata) */ | 70 | struct mdp5_plane_state { |
81 | struct mdp5_platform_config { | 71 | struct drm_plane_state base; |
82 | struct iommu_domain *iommu; | 72 | |
83 | uint32_t max_clk; | 73 | /* "virtual" zpos.. we calculate actual mixer-stage at runtime |
84 | int smp_blk_cnt; | 74 | * by sorting the attached planes by zpos and then assigning |
75 | * mixer stage lowest to highest. Private planes get default | ||
76 | * zpos of zero, and public planes a unique value that is | ||
77 | * greater than zero. This way, things work out if a naive | ||
78 | * userspace assigns planes to a crtc without setting zpos. | ||
79 | */ | ||
80 | int zpos; | ||
81 | |||
82 | /* the actual mixer stage, calculated in crtc->atomic_check() | ||
83 | * NOTE: this should move to mdp5_crtc_state, when that exists | ||
84 | */ | ||
85 | enum mdp_mixer_stage_id stage; | ||
86 | |||
87 | /* some additional transactional status to help us know in the | ||
88 | * apply path whether we need to update SMP allocation, and | ||
89 | * whether current update is still pending: | ||
90 | */ | ||
91 | bool mode_changed : 1; | ||
92 | bool pending : 1; | ||
85 | }; | 93 | }; |
94 | #define to_mdp5_plane_state(x) \ | ||
95 | container_of(x, struct mdp5_plane_state, base) | ||
86 | 96 | ||
87 | static inline void mdp5_write(struct mdp5_kms *mdp5_kms, u32 reg, u32 data) | 97 | static inline void mdp5_write(struct mdp5_kms *mdp5_kms, u32 reg, u32 data) |
88 | { | 98 | { |
@@ -107,23 +117,6 @@ static inline const char *pipe2name(enum mdp5_pipe pipe) | |||
107 | return names[pipe]; | 117 | return names[pipe]; |
108 | } | 118 | } |
109 | 119 | ||
110 | static inline uint32_t pipe2flush(enum mdp5_pipe pipe) | ||
111 | { | ||
112 | switch (pipe) { | ||
113 | case SSPP_VIG0: return MDP5_CTL_FLUSH_VIG0; | ||
114 | case SSPP_VIG1: return MDP5_CTL_FLUSH_VIG1; | ||
115 | case SSPP_VIG2: return MDP5_CTL_FLUSH_VIG2; | ||
116 | case SSPP_RGB0: return MDP5_CTL_FLUSH_RGB0; | ||
117 | case SSPP_RGB1: return MDP5_CTL_FLUSH_RGB1; | ||
118 | case SSPP_RGB2: return MDP5_CTL_FLUSH_RGB2; | ||
119 | case SSPP_DMA0: return MDP5_CTL_FLUSH_DMA0; | ||
120 | case SSPP_DMA1: return MDP5_CTL_FLUSH_DMA1; | ||
121 | case SSPP_VIG3: return MDP5_CTL_FLUSH_VIG3; | ||
122 | case SSPP_RGB3: return MDP5_CTL_FLUSH_RGB3; | ||
123 | default: return 0; | ||
124 | } | ||
125 | } | ||
126 | |||
127 | static inline int pipe2nclients(enum mdp5_pipe pipe) | 120 | static inline int pipe2nclients(enum mdp5_pipe pipe) |
128 | { | 121 | { |
129 | switch (pipe) { | 122 | switch (pipe) { |
@@ -137,34 +130,6 @@ static inline int pipe2nclients(enum mdp5_pipe pipe) | |||
137 | } | 130 | } |
138 | } | 131 | } |
139 | 132 | ||
140 | static inline enum mdp5_client_id pipe2client(enum mdp5_pipe pipe, int plane) | ||
141 | { | ||
142 | WARN_ON(plane >= pipe2nclients(pipe)); | ||
143 | switch (pipe) { | ||
144 | case SSPP_VIG0: return CID_VIG0_Y + plane; | ||
145 | case SSPP_VIG1: return CID_VIG1_Y + plane; | ||
146 | case SSPP_VIG2: return CID_VIG2_Y + plane; | ||
147 | case SSPP_RGB0: return CID_RGB0; | ||
148 | case SSPP_RGB1: return CID_RGB1; | ||
149 | case SSPP_RGB2: return CID_RGB2; | ||
150 | case SSPP_DMA0: return CID_DMA0_Y + plane; | ||
151 | case SSPP_DMA1: return CID_DMA1_Y + plane; | ||
152 | case SSPP_VIG3: return CID_VIG3_Y + plane; | ||
153 | case SSPP_RGB3: return CID_RGB3; | ||
154 | default: return CID_UNUSED; | ||
155 | } | ||
156 | } | ||
157 | |||
158 | static inline uint32_t mixer2flush(int lm) | ||
159 | { | ||
160 | switch (lm) { | ||
161 | case 0: return MDP5_CTL_FLUSH_LM0; | ||
162 | case 1: return MDP5_CTL_FLUSH_LM1; | ||
163 | case 2: return MDP5_CTL_FLUSH_LM2; | ||
164 | default: return 0; | ||
165 | } | ||
166 | } | ||
167 | |||
168 | static inline uint32_t intf2err(int intf) | 133 | static inline uint32_t intf2err(int intf) |
169 | { | 134 | { |
170 | switch (intf) { | 135 | switch (intf) { |
@@ -197,6 +162,8 @@ void mdp5_irq_uninstall(struct msm_kms *kms); | |||
197 | irqreturn_t mdp5_irq(struct msm_kms *kms); | 162 | irqreturn_t mdp5_irq(struct msm_kms *kms); |
198 | int mdp5_enable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); | 163 | int mdp5_enable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); |
199 | void mdp5_disable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); | 164 | void mdp5_disable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); |
165 | int mdp5_irq_domain_init(struct mdp5_kms *mdp5_kms); | ||
166 | void mdp5_irq_domain_fini(struct mdp5_kms *mdp5_kms); | ||
200 | 167 | ||
201 | static inline | 168 | static inline |
202 | uint32_t mdp5_get_formats(enum mdp5_pipe pipe, uint32_t *pixel_formats, | 169 | uint32_t mdp5_get_formats(enum mdp5_pipe pipe, uint32_t *pixel_formats, |
@@ -210,26 +177,18 @@ uint32_t mdp5_get_formats(enum mdp5_pipe pipe, uint32_t *pixel_formats, | |||
210 | 177 | ||
211 | void mdp5_plane_install_properties(struct drm_plane *plane, | 178 | void mdp5_plane_install_properties(struct drm_plane *plane, |
212 | struct drm_mode_object *obj); | 179 | struct drm_mode_object *obj); |
213 | void mdp5_plane_set_scanout(struct drm_plane *plane, | 180 | uint32_t mdp5_plane_get_flush(struct drm_plane *plane); |
214 | struct drm_framebuffer *fb); | ||
215 | int mdp5_plane_mode_set(struct drm_plane *plane, | ||
216 | struct drm_crtc *crtc, struct drm_framebuffer *fb, | ||
217 | int crtc_x, int crtc_y, | ||
218 | unsigned int crtc_w, unsigned int crtc_h, | ||
219 | uint32_t src_x, uint32_t src_y, | ||
220 | uint32_t src_w, uint32_t src_h); | ||
221 | void mdp5_plane_complete_flip(struct drm_plane *plane); | 181 | void mdp5_plane_complete_flip(struct drm_plane *plane); |
222 | enum mdp5_pipe mdp5_plane_pipe(struct drm_plane *plane); | 182 | enum mdp5_pipe mdp5_plane_pipe(struct drm_plane *plane); |
223 | struct drm_plane *mdp5_plane_init(struct drm_device *dev, | 183 | struct drm_plane *mdp5_plane_init(struct drm_device *dev, |
224 | enum mdp5_pipe pipe, bool private_plane); | 184 | enum mdp5_pipe pipe, bool private_plane, uint32_t reg_offset); |
225 | 185 | ||
226 | uint32_t mdp5_crtc_vblank(struct drm_crtc *crtc); | 186 | uint32_t mdp5_crtc_vblank(struct drm_crtc *crtc); |
227 | 187 | ||
188 | int mdp5_crtc_get_lm(struct drm_crtc *crtc); | ||
228 | void mdp5_crtc_cancel_pending_flip(struct drm_crtc *crtc, struct drm_file *file); | 189 | void mdp5_crtc_cancel_pending_flip(struct drm_crtc *crtc, struct drm_file *file); |
229 | void mdp5_crtc_set_intf(struct drm_crtc *crtc, int intf, | 190 | void mdp5_crtc_set_intf(struct drm_crtc *crtc, int intf, |
230 | enum mdp5_intf intf_id); | 191 | enum mdp5_intf intf_id); |
231 | void mdp5_crtc_attach(struct drm_crtc *crtc, struct drm_plane *plane); | ||
232 | void mdp5_crtc_detach(struct drm_crtc *crtc, struct drm_plane *plane); | ||
233 | struct drm_crtc *mdp5_crtc_init(struct drm_device *dev, | 192 | struct drm_crtc *mdp5_crtc_init(struct drm_device *dev, |
234 | struct drm_plane *plane, int id); | 193 | struct drm_plane *plane, int id); |
235 | 194 | ||