Rev 4560 | Rev 5354 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4560 | Rev 5060 | ||
---|---|---|---|
Line 33... | Line 33... | ||
33 | #include "intel_dsi.h" |
33 | #include "intel_dsi.h" |
34 | #include "intel_dsi_cmd.h" |
34 | #include "intel_dsi_cmd.h" |
Line 35... | Line 35... | ||
35 | 35 | ||
36 | /* the sub-encoders aka panel drivers */ |
36 | /* the sub-encoders aka panel drivers */ |
- | 37 | static const struct intel_dsi_device intel_dsi_devices[] = { |
|
- | 38 | { |
|
- | 39 | .panel_id = MIPI_DSI_GENERIC_PANEL_ID, |
|
- | 40 | .name = "vbt-generic-dsi-vid-mode-display", |
|
- | 41 | .dev_ops = &vbt_generic_dsi_display_ops, |
|
37 | static const struct intel_dsi_device intel_dsi_devices[] = { |
42 | }, |
Line 38... | Line 43... | ||
38 | }; |
43 | }; |
39 | 44 | ||
40 | static void band_gap_reset(struct drm_i915_private *dev_priv) |
45 | static void band_gap_reset(struct drm_i915_private *dev_priv) |
Line 57... | Line 62... | ||
57 | struct intel_dsi, base); |
62 | struct intel_dsi, base); |
58 | } |
63 | } |
Line 59... | Line 64... | ||
59 | 64 | ||
60 | static inline bool is_vid_mode(struct intel_dsi *intel_dsi) |
65 | static inline bool is_vid_mode(struct intel_dsi *intel_dsi) |
61 | { |
66 | { |
62 | return intel_dsi->dev.type == INTEL_DSI_VIDEO_MODE; |
67 | return intel_dsi->operation_mode == INTEL_DSI_VIDEO_MODE; |
Line 63... | Line 68... | ||
63 | } |
68 | } |
64 | 69 | ||
65 | static inline bool is_cmd_mode(struct intel_dsi *intel_dsi) |
70 | static inline bool is_cmd_mode(struct intel_dsi *intel_dsi) |
66 | { |
71 | { |
Line 67... | Line 72... | ||
67 | return intel_dsi->dev.type == INTEL_DSI_COMMAND_MODE; |
72 | return intel_dsi->operation_mode == INTEL_DSI_COMMAND_MODE; |
68 | } |
73 | } |
69 | 74 | ||
Line 85... | Line 90... | ||
85 | DRM_DEBUG_KMS("\n"); |
90 | DRM_DEBUG_KMS("\n"); |
Line 86... | Line 91... | ||
86 | 91 | ||
87 | if (fixed_mode) |
92 | if (fixed_mode) |
Line -... | Line 93... | ||
- | 93 | intel_fixed_panel_mode(fixed_mode, adjusted_mode); |
|
- | 94 | ||
- | 95 | /* DSI uses short packets for sync events, so clear mode flags for DSI */ |
|
88 | intel_fixed_panel_mode(fixed_mode, adjusted_mode); |
96 | adjusted_mode->flags = 0; |
89 | 97 | ||
90 | if (intel_dsi->dev.dev_ops->mode_fixup) |
98 | if (intel_dsi->dev.dev_ops->mode_fixup) |
Line 91... | Line 99... | ||
91 | return intel_dsi->dev.dev_ops->mode_fixup(&intel_dsi->dev, |
99 | return intel_dsi->dev.dev_ops->mode_fixup(&intel_dsi->dev, |
92 | mode, adjusted_mode); |
100 | mode, adjusted_mode); |
Line 93... | Line -... | ||
93 | - | ||
94 | return true; |
- | |
95 | } |
- | |
96 | - | ||
97 | static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder) |
- | |
98 | { |
- | |
99 | DRM_DEBUG_KMS("\n"); |
- | |
100 | 101 | ||
101 | vlv_enable_dsi_pll(encoder); |
102 | return true; |
102 | } |
103 | } |
103 | 104 | ||
104 | static void intel_dsi_device_ready(struct intel_encoder *encoder) |
105 | static void intel_dsi_device_ready(struct intel_encoder *encoder) |
105 | { |
106 | { |
Line 106... | Line 107... | ||
106 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
107 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
Line -... | Line 108... | ||
- | 108 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); |
|
- | 109 | int pipe = intel_crtc->pipe; |
|
- | 110 | u32 val; |
|
- | 111 | ||
- | 112 | DRM_DEBUG_KMS("\n"); |
|
- | 113 | ||
- | 114 | mutex_lock(&dev_priv->dpio_lock); |
|
- | 115 | /* program rcomp for compliance, reduce from 50 ohms to 45 ohms |
|
- | 116 | * needed everytime after power gate */ |
|
- | 117 | vlv_flisdsi_write(dev_priv, 0x04, 0x0004); |
|
- | 118 | mutex_unlock(&dev_priv->dpio_lock); |
|
- | 119 | ||
107 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); |
120 | /* bandgap reset is needed after everytime we do power gate */ |
108 | int pipe = intel_crtc->pipe; |
121 | band_gap_reset(dev_priv); |
109 | u32 val; |
122 | |
110 | - | ||
111 | DRM_DEBUG_KMS("\n"); |
- | |
112 | - | ||
113 | val = I915_READ(MIPI_PORT_CTRL(pipe)); |
- | |
114 | I915_WRITE(MIPI_PORT_CTRL(pipe), val | LP_OUTPUT_HOLD); |
- | |
115 | usleep_range(1000, 1500); |
- | |
116 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_EXIT); |
- | |
117 | usleep_range(2000, 2500); |
- | |
118 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY); |
- | |
119 | usleep_range(2000, 2500); |
- | |
120 | I915_WRITE(MIPI_DEVICE_READY(pipe), 0x00); |
- | |
121 | usleep_range(2000, 2500); |
- | |
122 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY); |
- | |
123 | usleep_range(2000, 2500); |
- | |
Line 124... | Line -... | ||
124 | } |
- | |
125 | static void intel_dsi_pre_enable(struct intel_encoder *encoder) |
123 | I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_ENTER); |
126 | { |
- | |
127 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); |
- | |
128 | 124 | usleep_range(2500, 3000); |
|
Line 129... | Line 125... | ||
129 | DRM_DEBUG_KMS("\n"); |
125 | |
130 | 126 | val = I915_READ(MIPI_PORT_CTRL(pipe)); |
|
131 | if (intel_dsi->dev.dev_ops->panel_reset) |
127 | I915_WRITE(MIPI_PORT_CTRL(pipe), val | LP_OUTPUT_HOLD); |
Line 132... | Line 128... | ||
132 | intel_dsi->dev.dev_ops->panel_reset(&intel_dsi->dev); |
128 | usleep_range(1000, 1500); |
133 | 129 | ||
134 | /* put device in ready state */ |
130 | I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_EXIT); |
Line 151... | Line 147... | ||
151 | 147 | ||
152 | if (is_cmd_mode(intel_dsi)) |
148 | if (is_cmd_mode(intel_dsi)) |
153 | I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(pipe), 8 * 4); |
149 | I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(pipe), 8 * 4); |
154 | else { |
150 | else { |
155 | msleep(20); /* XXX */ |
151 | msleep(20); /* XXX */ |
156 | dpi_send_cmd(intel_dsi, TURN_ON); |
152 | dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN); |
Line -... | Line 153... | ||
- | 153 | msleep(100); |
|
- | 154 | ||
- | 155 | if (intel_dsi->dev.dev_ops->enable) |
|
- | 156 | intel_dsi->dev.dev_ops->enable(&intel_dsi->dev); |
|
- | 157 | ||
157 | msleep(100); |
158 | wait_for_dsi_fifo_empty(intel_dsi); |
158 | 159 | ||
159 | /* assert ip_tg_enable signal */ |
160 | /* assert ip_tg_enable signal */ |
160 | temp = I915_READ(MIPI_PORT_CTRL(pipe)) & ~LANE_CONFIGURATION_MASK; |
161 | temp = I915_READ(MIPI_PORT_CTRL(pipe)) & ~LANE_CONFIGURATION_MASK; |
161 | temp = temp | intel_dsi->port_bits; |
162 | temp = temp | intel_dsi->port_bits; |
162 | I915_WRITE(MIPI_PORT_CTRL(pipe), temp | DPI_ENABLE); |
163 | I915_WRITE(MIPI_PORT_CTRL(pipe), temp | DPI_ENABLE); |
- | 164 | POSTING_READ(MIPI_PORT_CTRL(pipe)); |
|
Line -... | Line 165... | ||
- | 165 | } |
|
- | 166 | } |
|
- | 167 | ||
- | 168 | static void intel_dsi_pre_enable(struct intel_encoder *encoder) |
|
- | 169 | { |
|
- | 170 | struct drm_device *dev = encoder->base.dev; |
|
- | 171 | struct drm_i915_private *dev_priv = dev->dev_private; |
|
- | 172 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); |
|
- | 173 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); |
|
- | 174 | enum pipe pipe = intel_crtc->pipe; |
|
- | 175 | u32 tmp; |
|
- | 176 | ||
- | 177 | DRM_DEBUG_KMS("\n"); |
|
- | 178 | ||
- | 179 | /* Disable DPOunit clock gating, can stall pipe |
|
- | 180 | * and we need DPLL REFA always enabled */ |
|
- | 181 | tmp = I915_READ(DPLL(pipe)); |
|
- | 182 | tmp |= DPLL_REFA_CLK_ENABLE_VLV; |
|
- | 183 | I915_WRITE(DPLL(pipe), tmp); |
|
- | 184 | ||
- | 185 | /* update the hw state for DPLL */ |
|
- | 186 | intel_crtc->config.dpll_hw_state.dpll = DPLL_INTEGRATED_CLOCK_VLV | |
|
- | 187 | DPLL_REFA_CLK_ENABLE_VLV; |
|
- | 188 | ||
- | 189 | tmp = I915_READ(DSPCLK_GATE_D); |
|
- | 190 | tmp |= DPOUNIT_CLOCK_GATE_DISABLE; |
|
- | 191 | I915_WRITE(DSPCLK_GATE_D, tmp); |
|
- | 192 | ||
- | 193 | /* put device in ready state */ |
|
- | 194 | intel_dsi_device_ready(encoder); |
|
163 | POSTING_READ(MIPI_PORT_CTRL(pipe)); |
195 | |
164 | } |
196 | msleep(intel_dsi->panel_on_delay); |
- | 197 | ||
- | 198 | if (intel_dsi->dev.dev_ops->panel_reset) |
|
- | 199 | intel_dsi->dev.dev_ops->panel_reset(&intel_dsi->dev); |
|
- | 200 | ||
- | 201 | if (intel_dsi->dev.dev_ops->send_otp_cmds) |
|
- | 202 | intel_dsi->dev.dev_ops->send_otp_cmds(&intel_dsi->dev); |
|
- | 203 | ||
- | 204 | wait_for_dsi_fifo_empty(intel_dsi); |
|
- | 205 | ||
- | 206 | /* Enable port in pre-enable phase itself because as per hw team |
|
- | 207 | * recommendation, port should be enabled befor plane & pipe */ |
|
- | 208 | intel_dsi_enable(encoder); |
|
- | 209 | } |
|
- | 210 | ||
- | 211 | static void intel_dsi_enable_nop(struct intel_encoder *encoder) |
|
- | 212 | { |
|
- | 213 | DRM_DEBUG_KMS("\n"); |
|
- | 214 | ||
- | 215 | /* for DSI port enable has to be done before pipe |
|
- | 216 | * and plane enable, so port enable is done in |
|
- | 217 | * pre_enable phase itself unlike other encoders |
|
- | 218 | */ |
|
- | 219 | } |
|
- | 220 | ||
- | 221 | static void intel_dsi_pre_disable(struct intel_encoder *encoder) |
|
- | 222 | { |
|
- | 223 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); |
|
- | 224 | ||
- | 225 | DRM_DEBUG_KMS("\n"); |
|
- | 226 | ||
- | 227 | if (is_vid_mode(intel_dsi)) { |
|
- | 228 | /* Send Shutdown command to the panel in LP mode */ |
|
165 | 229 | dpi_send_cmd(intel_dsi, SHUTDOWN, DPI_LP_MODE_EN); |
|
Line 166... | Line 230... | ||
166 | if (intel_dsi->dev.dev_ops->enable) |
230 | msleep(10); |
167 | intel_dsi->dev.dev_ops->enable(&intel_dsi->dev); |
231 | } |
168 | } |
232 | } |
Line 177... | Line 241... | ||
177 | u32 temp; |
241 | u32 temp; |
Line 178... | Line 242... | ||
178 | 242 | ||
Line 179... | Line 243... | ||
179 | DRM_DEBUG_KMS("\n"); |
243 | DRM_DEBUG_KMS("\n"); |
180 | 244 | ||
181 | if (is_vid_mode(intel_dsi)) { |
- | |
Line 182... | Line 245... | ||
182 | dpi_send_cmd(intel_dsi, SHUTDOWN); |
245 | if (is_vid_mode(intel_dsi)) { |
183 | msleep(10); |
246 | wait_for_dsi_fifo_empty(intel_dsi); |
184 | 247 | ||
185 | /* de-assert ip_tg_enable signal */ |
248 | /* de-assert ip_tg_enable signal */ |
Line 186... | Line 249... | ||
186 | temp = I915_READ(MIPI_PORT_CTRL(pipe)); |
249 | temp = I915_READ(MIPI_PORT_CTRL(pipe)); |
187 | I915_WRITE(MIPI_PORT_CTRL(pipe), temp & ~DPI_ENABLE); |
250 | I915_WRITE(MIPI_PORT_CTRL(pipe), temp & ~DPI_ENABLE); |
Line -... | Line 251... | ||
- | 251 | POSTING_READ(MIPI_PORT_CTRL(pipe)); |
|
- | 252 | ||
- | 253 | msleep(2); |
|
- | 254 | } |
|
- | 255 | ||
- | 256 | /* Panel commands can be sent when clock is in LP11 */ |
|
- | 257 | I915_WRITE(MIPI_DEVICE_READY(pipe), 0x0); |
|
- | 258 | ||
- | 259 | temp = I915_READ(MIPI_CTRL(pipe)); |
|
- | 260 | temp &= ~ESCAPE_CLOCK_DIVIDER_MASK; |
|
- | 261 | I915_WRITE(MIPI_CTRL(pipe), temp | |
|
- | 262 | intel_dsi->escape_clk_div << |
|
- | 263 | ESCAPE_CLOCK_DIVIDER_SHIFT); |
|
- | 264 | ||
- | 265 | I915_WRITE(MIPI_EOT_DISABLE(pipe), CLOCKSTOP); |
|
- | 266 | ||
- | 267 | temp = I915_READ(MIPI_DSI_FUNC_PRG(pipe)); |
|
188 | POSTING_READ(MIPI_PORT_CTRL(pipe)); |
268 | temp &= ~VID_MODE_FORMAT_MASK; |
189 | 269 | I915_WRITE(MIPI_DSI_FUNC_PRG(pipe), temp); |
|
190 | msleep(2); |
270 | |
191 | } |
271 | I915_WRITE(MIPI_DEVICE_READY(pipe), 0x1); |
- | 272 | ||
- | 273 | /* if disable packets are sent before sending shutdown packet then in |
|
192 | 274 | * some next enable sequence send turn on packet error is observed */ |
|
Line 193... | Line 275... | ||
193 | /* if disable packets are sent before sending shutdown packet then in |
275 | if (intel_dsi->dev.dev_ops->disable) |
194 | * some next enable sequence send turn on packet error is observed */ |
276 | intel_dsi->dev.dev_ops->disable(&intel_dsi->dev); |
195 | if (intel_dsi->dev.dev_ops->disable) |
277 | |
Line 203... | Line 285... | ||
203 | int pipe = intel_crtc->pipe; |
285 | int pipe = intel_crtc->pipe; |
204 | u32 val; |
286 | u32 val; |
Line 205... | Line 287... | ||
205 | 287 | ||
Line 206... | Line 288... | ||
206 | DRM_DEBUG_KMS("\n"); |
288 | DRM_DEBUG_KMS("\n"); |
207 | 289 | ||
Line 208... | Line 290... | ||
208 | I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_ENTER); |
290 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_ENTER); |
209 | usleep_range(2000, 2500); |
291 | usleep_range(2000, 2500); |
Line 210... | Line 292... | ||
210 | 292 | ||
211 | I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_EXIT); |
293 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_EXIT); |
Line 212... | Line -... | ||
212 | usleep_range(2000, 2500); |
- | |
213 | - | ||
214 | I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_ENTER); |
- | |
215 | usleep_range(2000, 2500); |
- | |
216 | 294 | usleep_range(2000, 2500); |
|
217 | val = I915_READ(MIPI_PORT_CTRL(pipe)); |
295 | |
218 | I915_WRITE(MIPI_PORT_CTRL(pipe), val & ~LP_OUTPUT_HOLD); |
296 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_ENTER); |
Line -... | Line 297... | ||
- | 297 | usleep_range(2000, 2500); |
|
- | 298 | ||
- | 299 | if (wait_for(((I915_READ(MIPI_PORT_CTRL(pipe)) & AFE_LATCHOUT) |
|
- | 300 | == 0x00000), 30)) |
|
219 | usleep_range(1000, 1500); |
301 | DRM_ERROR("DSI LP not going Low\n"); |
220 | 302 | ||
Line 221... | Line 303... | ||
221 | if (wait_for(((I915_READ(MIPI_PORT_CTRL(pipe)) & AFE_LATCHOUT) |
303 | val = I915_READ(MIPI_PORT_CTRL(pipe)); |
222 | == 0x00000), 30)) |
304 | I915_WRITE(MIPI_PORT_CTRL(pipe), val & ~LP_OUTPUT_HOLD); |
- | 305 | usleep_range(1000, 1500); |
|
223 | DRM_ERROR("DSI LP not going Low\n"); |
306 | |
224 | 307 | I915_WRITE(MIPI_DEVICE_READY(pipe), 0x00); |
|
- | 308 | usleep_range(2000, 2500); |
|
225 | I915_WRITE(MIPI_DEVICE_READY(pipe), 0x00); |
309 | |
- | 310 | vlv_disable_dsi_pll(encoder); |
|
Line 226... | Line 311... | ||
226 | usleep_range(2000, 2500); |
311 | } |
Line -... | Line 312... | ||
- | 312 | ||
- | 313 | static void intel_dsi_post_disable(struct intel_encoder *encoder) |
|
227 | 314 | { |
|
Line -... | Line 315... | ||
- | 315 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
|
- | 316 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); |
|
- | 317 | u32 val; |
|
- | 318 | ||
228 | vlv_disable_dsi_pll(encoder); |
319 | DRM_DEBUG_KMS("\n"); |
229 | } |
320 | |
- | 321 | intel_dsi_disable(encoder); |
|
- | 322 | ||
- | 323 | intel_dsi_clear_device_ready(encoder); |
|
230 | static void intel_dsi_post_disable(struct intel_encoder *encoder) |
324 | |
Line 231... | Line 325... | ||
231 | { |
325 | val = I915_READ(DSPCLK_GATE_D); |
232 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); |
326 | val &= ~DPOUNIT_CLOCK_GATE_DISABLE; |
233 | 327 | I915_WRITE(DSPCLK_GATE_D, val); |
|
234 | DRM_DEBUG_KMS("\n"); |
328 | |
- | 329 | if (intel_dsi->dev.dev_ops->disable_panel_power) |
|
235 | 330 | intel_dsi->dev.dev_ops->disable_panel_power(&intel_dsi->dev); |
|
236 | intel_dsi_clear_device_ready(encoder); |
331 | |
Line 237... | Line 332... | ||
237 | 332 | msleep(intel_dsi->panel_off_delay); |
|
Line -... | Line 333... | ||
- | 333 | msleep(intel_dsi->panel_pwr_cycle_delay); |
|
- | 334 | } |
|
- | 335 | ||
- | 336 | static bool intel_dsi_get_hw_state(struct intel_encoder *encoder, |
|
238 | if (intel_dsi->dev.dev_ops->disable_panel_power) |
337 | enum pipe *pipe) |
239 | intel_dsi->dev.dev_ops->disable_panel_power(&intel_dsi->dev); |
338 | { |
240 | } |
339 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
241 | 340 | enum intel_display_power_domain power_domain; |
|
Line 265... | Line 364... | ||
265 | } |
364 | } |
Line 266... | Line 365... | ||
266 | 365 | ||
267 | static void intel_dsi_get_config(struct intel_encoder *encoder, |
366 | static void intel_dsi_get_config(struct intel_encoder *encoder, |
268 | struct intel_crtc_config *pipe_config) |
367 | struct intel_crtc_config *pipe_config) |
- | 368 | { |
|
269 | { |
369 | u32 pclk; |
Line -... | Line 370... | ||
- | 370 | DRM_DEBUG_KMS("\n"); |
|
- | 371 | ||
- | 372 | /* |
|
- | 373 | * DPLL_MD is not used in case of DSI, reading will get some default value |
|
270 | DRM_DEBUG_KMS("\n"); |
374 | * set dpll_md = 0 |
- | 375 | */ |
|
- | 376 | pipe_config->dpll_hw_state.dpll_md = 0; |
|
- | 377 | ||
- | 378 | pclk = vlv_get_dsi_pclk(encoder, pipe_config->pipe_bpp); |
|
- | 379 | if (!pclk) |
|
- | 380 | return; |
|
- | 381 | ||
271 | 382 | pipe_config->adjusted_mode.crtc_clock = pclk; |
|
Line 272... | Line 383... | ||
272 | /* XXX: read flags, set to adjusted_mode */ |
383 | pipe_config->port_clock = pclk; |
273 | } |
384 | } |
274 | 385 | ||
Line 357... | Line 468... | ||
357 | I915_WRITE(MIPI_VFP_COUNT(pipe), vfp); |
468 | I915_WRITE(MIPI_VFP_COUNT(pipe), vfp); |
358 | I915_WRITE(MIPI_VSYNC_PADDING_COUNT(pipe), vsync); |
469 | I915_WRITE(MIPI_VSYNC_PADDING_COUNT(pipe), vsync); |
359 | I915_WRITE(MIPI_VBP_COUNT(pipe), vbp); |
470 | I915_WRITE(MIPI_VBP_COUNT(pipe), vbp); |
360 | } |
471 | } |
Line 361... | Line 472... | ||
361 | 472 | ||
362 | static void intel_dsi_mode_set(struct intel_encoder *intel_encoder) |
473 | static void intel_dsi_prepare(struct intel_encoder *intel_encoder) |
363 | { |
474 | { |
364 | struct drm_encoder *encoder = &intel_encoder->base; |
475 | struct drm_encoder *encoder = &intel_encoder->base; |
365 | struct drm_device *dev = encoder->dev; |
476 | struct drm_device *dev = encoder->dev; |
366 | struct drm_i915_private *dev_priv = dev->dev_private; |
477 | struct drm_i915_private *dev_priv = dev->dev_private; |
Line 372... | Line 483... | ||
372 | unsigned int bpp = intel_crtc->config.pipe_bpp; |
483 | unsigned int bpp = intel_crtc->config.pipe_bpp; |
373 | u32 val, tmp; |
484 | u32 val, tmp; |
Line 374... | Line 485... | ||
374 | 485 | ||
Line 375... | Line -... | ||
375 | DRM_DEBUG_KMS("pipe %c\n", pipe_name(pipe)); |
- | |
376 | - | ||
377 | /* XXX: Location of the call */ |
- | |
378 | band_gap_reset(dev_priv); |
486 | DRM_DEBUG_KMS("pipe %c\n", pipe_name(pipe)); |
379 | 487 | ||
380 | /* escape clock divider, 20MHz, shared for A and C. device ready must be |
488 | /* escape clock divider, 20MHz, shared for A and C. device ready must be |
381 | * off when doing this! txclkesc? */ |
489 | * off when doing this! txclkesc? */ |
382 | tmp = I915_READ(MIPI_CTRL(0)); |
490 | tmp = I915_READ(MIPI_CTRL(0)); |
Line 445... | Line 553... | ||
445 | I915_WRITE(MIPI_DEVICE_RESET_TIMER(pipe), intel_dsi->rst_timer_val); |
553 | I915_WRITE(MIPI_DEVICE_RESET_TIMER(pipe), intel_dsi->rst_timer_val); |
Line 446... | Line 554... | ||
446 | 554 | ||
Line 447... | Line 555... | ||
447 | /* dphy stuff */ |
555 | /* dphy stuff */ |
448 | 556 | ||
- | 557 | /* in terms of low power clock */ |
|
- | 558 | I915_WRITE(MIPI_INIT_COUNT(pipe), txclkesc(intel_dsi->escape_clk_div, 100)); |
|
- | 559 | ||
- | 560 | val = 0; |
|
- | 561 | if (intel_dsi->eotp_pkt == 0) |
|
- | 562 | val |= EOT_DISABLE; |
|
- | 563 | ||
Line 449... | Line 564... | ||
449 | /* in terms of low power clock */ |
564 | if (intel_dsi->clock_stop) |
- | 565 | val |= CLOCKSTOP; |
|
- | 566 | ||
- | 567 | /* recovery disables */ |
|
450 | I915_WRITE(MIPI_INIT_COUNT(pipe), txclkesc(ESCAPE_CLOCK_DIVIDER_1, 100)); |
568 | I915_WRITE(MIPI_EOT_DISABLE(pipe), val); |
Line 451... | Line 569... | ||
451 | 569 | ||
452 | /* recovery disables */ |
570 | /* in terms of low power clock */ |
453 | I915_WRITE(MIPI_EOT_DISABLE(pipe), intel_dsi->eot_disable); |
571 | I915_WRITE(MIPI_INIT_COUNT(pipe), intel_dsi->init_count); |
454 | 572 | ||
Line 477... | Line 595... | ||
477 | I915_WRITE(MIPI_CLK_LANE_SWITCH_TIME_CNT(pipe), |
595 | I915_WRITE(MIPI_CLK_LANE_SWITCH_TIME_CNT(pipe), |
478 | intel_dsi->clk_lp_to_hs_count << LP_HS_SSW_CNT_SHIFT | |
596 | intel_dsi->clk_lp_to_hs_count << LP_HS_SSW_CNT_SHIFT | |
479 | intel_dsi->clk_hs_to_lp_count << HS_LP_PWR_SW_CNT_SHIFT); |
597 | intel_dsi->clk_hs_to_lp_count << HS_LP_PWR_SW_CNT_SHIFT); |
Line 480... | Line 598... | ||
480 | 598 | ||
- | 599 | if (is_vid_mode(intel_dsi)) |
|
- | 600 | /* Some panels might have resolution which is not a multiple of |
|
- | 601 | * 64 like 1366 x 768. Enable RANDOM resolution support for such |
|
481 | if (is_vid_mode(intel_dsi)) |
602 | * panels by default */ |
482 | I915_WRITE(MIPI_VIDEO_MODE_FORMAT(pipe), |
603 | I915_WRITE(MIPI_VIDEO_MODE_FORMAT(pipe), |
483 | intel_dsi->video_frmt_cfg_bits | |
604 | intel_dsi->video_frmt_cfg_bits | |
- | 605 | intel_dsi->video_mode_format | |
|
- | 606 | IP_TG_CONFIG | |
|
- | 607 | RANDOM_DPI_DISPLAY_RESOLUTION); |
|
- | 608 | } |
|
- | 609 | ||
- | 610 | static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder) |
|
- | 611 | { |
|
- | 612 | DRM_DEBUG_KMS("\n"); |
|
- | 613 | ||
- | 614 | intel_dsi_prepare(encoder); |
|
- | 615 | ||
484 | intel_dsi->video_mode_format); |
616 | vlv_enable_dsi_pll(encoder); |
Line 485... | Line 617... | ||
485 | } |
617 | } |
486 | 618 | ||
487 | static enum drm_connector_status |
619 | static enum drm_connector_status |
488 | intel_dsi_detect(struct drm_connector *connector, bool force) |
620 | intel_dsi_detect(struct drm_connector *connector, bool force) |
- | 621 | { |
|
- | 622 | struct intel_dsi *intel_dsi = intel_attached_dsi(connector); |
|
- | 623 | struct intel_encoder *intel_encoder = &intel_dsi->base; |
|
- | 624 | enum intel_display_power_domain power_domain; |
|
- | 625 | enum drm_connector_status connector_status; |
|
489 | { |
626 | struct drm_i915_private *dev_priv = intel_encoder->base.dev->dev_private; |
- | 627 | ||
- | 628 | DRM_DEBUG_KMS("\n"); |
|
- | 629 | power_domain = intel_display_port_power_domain(intel_encoder); |
|
490 | struct intel_dsi *intel_dsi = intel_attached_dsi(connector); |
630 | |
- | 631 | intel_display_power_get(dev_priv, power_domain); |
|
- | 632 | connector_status = intel_dsi->dev.dev_ops->detect(&intel_dsi->dev); |
|
- | 633 | intel_display_power_put(dev_priv, power_domain); |
|
491 | DRM_DEBUG_KMS("\n"); |
634 | |
Line 492... | Line 635... | ||
492 | return intel_dsi->dev.dev_ops->detect(&intel_dsi->dev); |
635 | return connector_status; |
493 | } |
636 | } |
494 | 637 | ||
Line 540... | Line 683... | ||
540 | .detect = intel_dsi_detect, |
683 | .detect = intel_dsi_detect, |
541 | .destroy = intel_dsi_destroy, |
684 | .destroy = intel_dsi_destroy, |
542 | .fill_modes = drm_helper_probe_single_connector_modes, |
685 | .fill_modes = drm_helper_probe_single_connector_modes, |
543 | }; |
686 | }; |
Line 544... | Line 687... | ||
544 | 687 | ||
545 | bool intel_dsi_init(struct drm_device *dev) |
688 | void intel_dsi_init(struct drm_device *dev) |
546 | { |
689 | { |
547 | struct intel_dsi *intel_dsi; |
690 | struct intel_dsi *intel_dsi; |
548 | struct intel_encoder *intel_encoder; |
691 | struct intel_encoder *intel_encoder; |
549 | struct drm_encoder *encoder; |
692 | struct drm_encoder *encoder; |
550 | struct intel_connector *intel_connector; |
693 | struct intel_connector *intel_connector; |
551 | struct drm_connector *connector; |
694 | struct drm_connector *connector; |
- | 695 | struct drm_display_mode *fixed_mode = NULL; |
|
552 | struct drm_display_mode *fixed_mode = NULL; |
696 | struct drm_i915_private *dev_priv = dev->dev_private; |
553 | const struct intel_dsi_device *dsi; |
697 | const struct intel_dsi_device *dsi; |
Line 554... | Line 698... | ||
554 | unsigned int i; |
698 | unsigned int i; |
Line -... | Line 699... | ||
- | 699 | ||
- | 700 | DRM_DEBUG_KMS("\n"); |
|
- | 701 | ||
- | 702 | /* There is no detection method for MIPI so rely on VBT */ |
|
- | 703 | if (!dev_priv->vbt.has_mipi) |
|
- | 704 | return; |
|
- | 705 | ||
- | 706 | if (IS_VALLEYVIEW(dev)) { |
|
- | 707 | dev_priv->mipi_mmio_base = VLV_MIPI_BASE; |
|
- | 708 | } else { |
|
- | 709 | DRM_ERROR("Unsupported Mipi device to reg base"); |
|
555 | 710 | return; |
|
556 | DRM_DEBUG_KMS("\n"); |
711 | } |
557 | 712 | ||
Line 558... | Line 713... | ||
558 | intel_dsi = kzalloc(sizeof(*intel_dsi), GFP_KERNEL); |
713 | intel_dsi = kzalloc(sizeof(*intel_dsi), GFP_KERNEL); |
559 | if (!intel_dsi) |
714 | if (!intel_dsi) |
560 | return false; |
715 | return; |
561 | 716 | ||
562 | intel_connector = kzalloc(sizeof(*intel_connector), GFP_KERNEL); |
717 | intel_connector = kzalloc(sizeof(*intel_connector), GFP_KERNEL); |
Line 563... | Line 718... | ||
563 | if (!intel_connector) { |
718 | if (!intel_connector) { |
564 | kfree(intel_dsi); |
719 | kfree(intel_dsi); |
565 | return false; |
720 | return; |
Line 576... | Line 731... | ||
576 | /* XXX: very likely not all of these are needed */ |
731 | /* XXX: very likely not all of these are needed */ |
577 | intel_encoder->hot_plug = intel_dsi_hot_plug; |
732 | intel_encoder->hot_plug = intel_dsi_hot_plug; |
578 | intel_encoder->compute_config = intel_dsi_compute_config; |
733 | intel_encoder->compute_config = intel_dsi_compute_config; |
579 | intel_encoder->pre_pll_enable = intel_dsi_pre_pll_enable; |
734 | intel_encoder->pre_pll_enable = intel_dsi_pre_pll_enable; |
580 | intel_encoder->pre_enable = intel_dsi_pre_enable; |
735 | intel_encoder->pre_enable = intel_dsi_pre_enable; |
581 | intel_encoder->enable = intel_dsi_enable; |
736 | intel_encoder->enable = intel_dsi_enable_nop; |
582 | intel_encoder->mode_set = intel_dsi_mode_set; |
- | |
583 | intel_encoder->disable = intel_dsi_disable; |
737 | intel_encoder->disable = intel_dsi_pre_disable; |
584 | intel_encoder->post_disable = intel_dsi_post_disable; |
738 | intel_encoder->post_disable = intel_dsi_post_disable; |
585 | intel_encoder->get_hw_state = intel_dsi_get_hw_state; |
739 | intel_encoder->get_hw_state = intel_dsi_get_hw_state; |
586 | intel_encoder->get_config = intel_dsi_get_config; |
740 | intel_encoder->get_config = intel_dsi_get_config; |
Line 587... | Line 741... | ||
587 | 741 | ||
- | 742 | intel_connector->get_hw_state = intel_connector_get_hw_state; |
|
Line 588... | Line 743... | ||
588 | intel_connector->get_hw_state = intel_connector_get_hw_state; |
743 | intel_connector->unregister = intel_connector_unregister; |
589 | 744 | ||
590 | for (i = 0; i < ARRAY_SIZE(intel_dsi_devices); i++) { |
745 | for (i = 0; i < ARRAY_SIZE(intel_dsi_devices); i++) { |
Line 601... | Line 756... | ||
601 | } |
756 | } |
Line 602... | Line 757... | ||
602 | 757 | ||
603 | intel_encoder->type = INTEL_OUTPUT_DSI; |
758 | intel_encoder->type = INTEL_OUTPUT_DSI; |
Line 604... | Line 759... | ||
604 | intel_encoder->crtc_mask = (1 << 0); /* XXX */ |
759 | intel_encoder->crtc_mask = (1 << 0); /* XXX */ |
605 | 760 | ||
606 | intel_encoder->cloneable = false; |
761 | intel_encoder->cloneable = 0; |
Line 607... | Line 762... | ||
607 | drm_connector_init(dev, connector, &intel_dsi_connector_funcs, |
762 | drm_connector_init(dev, connector, &intel_dsi_connector_funcs, |
Line 613... | Line 768... | ||
613 | connector->interlace_allowed = false; |
768 | connector->interlace_allowed = false; |
614 | connector->doublescan_allowed = false; |
769 | connector->doublescan_allowed = false; |
Line 615... | Line 770... | ||
615 | 770 | ||
Line 616... | Line 771... | ||
616 | intel_connector_attach_encoder(intel_connector, intel_encoder); |
771 | intel_connector_attach_encoder(intel_connector, intel_encoder); |
Line 617... | Line 772... | ||
617 | 772 | ||
618 | drm_sysfs_connector_add(connector); |
773 | drm_connector_register(connector); |
619 | 774 | ||
620 | fixed_mode = dsi->dev_ops->get_modes(&intel_dsi->dev); |
775 | fixed_mode = dsi->dev_ops->get_modes(&intel_dsi->dev); |
621 | if (!fixed_mode) { |
776 | if (!fixed_mode) { |
Line 622... | Line 777... | ||
622 | DRM_DEBUG_KMS("no fixed mode\n"); |
777 | DRM_DEBUG_KMS("no fixed mode\n"); |
623 | goto err; |
778 | goto err; |
Line 624... | Line 779... | ||
624 | } |
779 | } |
Line 625... | Line 780... | ||
625 | 780 | ||
626 | fixed_mode->type |= DRM_MODE_TYPE_PREFERRED; |
781 | fixed_mode->type |= DRM_MODE_TYPE_PREFERRED; |
627 | intel_panel_init(&intel_connector->panel, fixed_mode); |
782 | intel_panel_init(&intel_connector->panel, fixed_mode, NULL); |
628 | 783 | ||
629 | return true; |
- | |
630 | - | ||
631 | err: |
784 | return; |