Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2013 Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice (including the next |
| 12 | * paragraph) shall be included in all copies or substantial portions of the |
| 13 | * Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 21 | * DEALINGS IN THE SOFTWARE. |
| 22 | * |
| 23 | * Author: Jani Nikula <jani.nikula@intel.com> |
| 24 | */ |
| 25 | |
| 26 | #include <drm/drmP.h> |
| 27 | #include <drm/drm_crtc.h> |
| 28 | #include <drm/drm_edid.h> |
| 29 | #include <drm/i915_drm.h> |
| 30 | #include <linux/slab.h> |
| 31 | #include "i915_drv.h" |
| 32 | #include "intel_drv.h" |
| 33 | #include "intel_dsi.h" |
| 34 | #include "intel_dsi_cmd.h" |
| 35 | |
| 36 | /* the sub-encoders aka panel drivers */ |
| 37 | static const struct intel_dsi_device intel_dsi_devices[] = { |
Shobhit Kumar | 2ab8b45 | 2014-05-23 21:35:27 +0530 | [diff] [blame] | 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, |
| 42 | }, |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 43 | }; |
| 44 | |
Shobhit Kumar | e9fe51c | 2013-12-10 12:14:55 +0530 | [diff] [blame] | 45 | static void band_gap_reset(struct drm_i915_private *dev_priv) |
Shobhit Kumar | 4ce8c9a | 2013-08-27 15:12:24 +0300 | [diff] [blame] | 46 | { |
| 47 | mutex_lock(&dev_priv->dpio_lock); |
| 48 | |
Shobhit Kumar | e9fe51c | 2013-12-10 12:14:55 +0530 | [diff] [blame] | 49 | vlv_flisdsi_write(dev_priv, 0x08, 0x0001); |
| 50 | vlv_flisdsi_write(dev_priv, 0x0F, 0x0005); |
| 51 | vlv_flisdsi_write(dev_priv, 0x0F, 0x0025); |
| 52 | udelay(150); |
| 53 | vlv_flisdsi_write(dev_priv, 0x0F, 0x0000); |
| 54 | vlv_flisdsi_write(dev_priv, 0x08, 0x0000); |
Shobhit Kumar | 4ce8c9a | 2013-08-27 15:12:24 +0300 | [diff] [blame] | 55 | |
| 56 | mutex_unlock(&dev_priv->dpio_lock); |
Shobhit Kumar | 4ce8c9a | 2013-08-27 15:12:24 +0300 | [diff] [blame] | 57 | } |
| 58 | |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 59 | static struct intel_dsi *intel_attached_dsi(struct drm_connector *connector) |
| 60 | { |
| 61 | return container_of(intel_attached_encoder(connector), |
| 62 | struct intel_dsi, base); |
| 63 | } |
| 64 | |
| 65 | static inline bool is_vid_mode(struct intel_dsi *intel_dsi) |
| 66 | { |
Shobhit Kumar | dfba2e2 | 2014-04-14 11:18:24 +0530 | [diff] [blame] | 67 | return intel_dsi->operation_mode == INTEL_DSI_VIDEO_MODE; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | static inline bool is_cmd_mode(struct intel_dsi *intel_dsi) |
| 71 | { |
Shobhit Kumar | dfba2e2 | 2014-04-14 11:18:24 +0530 | [diff] [blame] | 72 | return intel_dsi->operation_mode == INTEL_DSI_COMMAND_MODE; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | static void intel_dsi_hot_plug(struct intel_encoder *encoder) |
| 76 | { |
| 77 | DRM_DEBUG_KMS("\n"); |
| 78 | } |
| 79 | |
| 80 | static bool intel_dsi_compute_config(struct intel_encoder *encoder, |
| 81 | struct intel_crtc_config *config) |
| 82 | { |
| 83 | struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi, |
| 84 | base); |
| 85 | struct intel_connector *intel_connector = intel_dsi->attached_connector; |
| 86 | struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode; |
| 87 | struct drm_display_mode *adjusted_mode = &config->adjusted_mode; |
| 88 | struct drm_display_mode *mode = &config->requested_mode; |
| 89 | |
| 90 | DRM_DEBUG_KMS("\n"); |
| 91 | |
| 92 | if (fixed_mode) |
| 93 | intel_fixed_panel_mode(fixed_mode, adjusted_mode); |
| 94 | |
Shobhit Kumar | f573de5 | 2014-07-30 20:32:37 +0530 | [diff] [blame] | 95 | /* DSI uses short packets for sync events, so clear mode flags for DSI */ |
| 96 | adjusted_mode->flags = 0; |
| 97 | |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 98 | if (intel_dsi->dev.dev_ops->mode_fixup) |
| 99 | return intel_dsi->dev.dev_ops->mode_fixup(&intel_dsi->dev, |
| 100 | mode, adjusted_mode); |
| 101 | |
| 102 | return true; |
| 103 | } |
| 104 | |
Gaurav K Singh | 5505a24 | 2014-12-04 10:58:47 +0530 | [diff] [blame] | 105 | static void intel_dsi_port_enable(struct intel_encoder *encoder) |
| 106 | { |
| 107 | struct drm_device *dev = encoder->base.dev; |
| 108 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 109 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); |
| 110 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); |
Gaurav K Singh | 369602d | 2014-12-05 14:09:28 +0530 | [diff] [blame] | 111 | enum port port; |
Gaurav K Singh | 5505a24 | 2014-12-04 10:58:47 +0530 | [diff] [blame] | 112 | u32 temp; |
| 113 | |
Gaurav K Singh | a9da9bc | 2014-12-05 14:13:41 +0530 | [diff] [blame] | 114 | if (intel_dsi->dual_link == DSI_DUAL_LINK_FRONT_BACK) { |
| 115 | temp = I915_READ(VLV_CHICKEN_3); |
| 116 | temp &= ~PIXEL_OVERLAP_CNT_MASK | |
| 117 | intel_dsi->pixel_overlap << |
| 118 | PIXEL_OVERLAP_CNT_SHIFT; |
| 119 | I915_WRITE(VLV_CHICKEN_3, temp); |
| 120 | } |
| 121 | |
Gaurav K Singh | 369602d | 2014-12-05 14:09:28 +0530 | [diff] [blame] | 122 | for_each_dsi_port(port, intel_dsi->ports) { |
| 123 | temp = I915_READ(MIPI_PORT_CTRL(port)); |
| 124 | temp &= ~LANE_CONFIGURATION_MASK; |
| 125 | temp &= ~DUAL_LINK_MODE_MASK; |
| 126 | |
| 127 | if (intel_dsi->ports == ((1 << PORT_A) | (1 << PORT_C))) { |
| 128 | temp |= (intel_dsi->dual_link - 1) |
| 129 | << DUAL_LINK_MODE_SHIFT; |
| 130 | temp |= intel_crtc->pipe ? |
| 131 | LANE_CONFIGURATION_DUAL_LINK_B : |
| 132 | LANE_CONFIGURATION_DUAL_LINK_A; |
| 133 | } |
| 134 | /* assert ip_tg_enable signal */ |
| 135 | I915_WRITE(MIPI_PORT_CTRL(port), temp | DPI_ENABLE); |
| 136 | POSTING_READ(MIPI_PORT_CTRL(port)); |
| 137 | } |
Gaurav K Singh | 5505a24 | 2014-12-04 10:58:47 +0530 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | static void intel_dsi_port_disable(struct intel_encoder *encoder) |
| 141 | { |
| 142 | struct drm_device *dev = encoder->base.dev; |
| 143 | struct drm_i915_private *dev_priv = dev->dev_private; |
Gaurav K Singh | 369602d | 2014-12-05 14:09:28 +0530 | [diff] [blame] | 144 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); |
| 145 | enum port port; |
Gaurav K Singh | 5505a24 | 2014-12-04 10:58:47 +0530 | [diff] [blame] | 146 | u32 temp; |
| 147 | |
Gaurav K Singh | 369602d | 2014-12-05 14:09:28 +0530 | [diff] [blame] | 148 | for_each_dsi_port(port, intel_dsi->ports) { |
| 149 | /* de-assert ip_tg_enable signal */ |
| 150 | temp = I915_READ(MIPI_PORT_CTRL(port)); |
| 151 | I915_WRITE(MIPI_PORT_CTRL(port), temp & ~DPI_ENABLE); |
| 152 | POSTING_READ(MIPI_PORT_CTRL(port)); |
| 153 | } |
Gaurav K Singh | 5505a24 | 2014-12-04 10:58:47 +0530 | [diff] [blame] | 154 | } |
| 155 | |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 156 | static void intel_dsi_device_ready(struct intel_encoder *encoder) |
| 157 | { |
| 158 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
| 159 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 160 | enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe); |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 161 | u32 val; |
| 162 | |
| 163 | DRM_DEBUG_KMS("\n"); |
| 164 | |
Shobhit Kumar | 2095f9f | 2014-04-09 13:59:30 +0530 | [diff] [blame] | 165 | mutex_lock(&dev_priv->dpio_lock); |
| 166 | /* program rcomp for compliance, reduce from 50 ohms to 45 ohms |
| 167 | * needed everytime after power gate */ |
| 168 | vlv_flisdsi_write(dev_priv, 0x04, 0x0004); |
| 169 | mutex_unlock(&dev_priv->dpio_lock); |
| 170 | |
| 171 | /* bandgap reset is needed after everytime we do power gate */ |
| 172 | band_gap_reset(dev_priv); |
| 173 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 174 | I915_WRITE(MIPI_DEVICE_READY(port), ULPS_STATE_ENTER); |
Shobhit Kumar | aceb365 | 2014-07-03 16:35:41 +0530 | [diff] [blame] | 175 | usleep_range(2500, 3000); |
| 176 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 177 | val = I915_READ(MIPI_PORT_CTRL(port)); |
| 178 | I915_WRITE(MIPI_PORT_CTRL(port), val | LP_OUTPUT_HOLD); |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 179 | usleep_range(1000, 1500); |
Shobhit Kumar | aceb365 | 2014-07-03 16:35:41 +0530 | [diff] [blame] | 180 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 181 | I915_WRITE(MIPI_DEVICE_READY(port), ULPS_STATE_EXIT); |
Shobhit Kumar | aceb365 | 2014-07-03 16:35:41 +0530 | [diff] [blame] | 182 | usleep_range(2500, 3000); |
| 183 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 184 | I915_WRITE(MIPI_DEVICE_READY(port), DEVICE_READY); |
Shobhit Kumar | aceb365 | 2014-07-03 16:35:41 +0530 | [diff] [blame] | 185 | usleep_range(2500, 3000); |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 186 | } |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 187 | |
| 188 | static void intel_dsi_enable(struct intel_encoder *encoder) |
| 189 | { |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 190 | struct drm_device *dev = encoder->base.dev; |
| 191 | struct drm_i915_private *dev_priv = dev->dev_private; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 192 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); |
| 193 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 194 | enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 195 | |
| 196 | DRM_DEBUG_KMS("\n"); |
| 197 | |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 198 | if (is_cmd_mode(intel_dsi)) |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 199 | I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(port), 8 * 4); |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 200 | else { |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 201 | msleep(20); /* XXX */ |
Shobhit Kumar | e104702 | 2014-04-09 13:59:35 +0530 | [diff] [blame] | 202 | dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 203 | msleep(100); |
| 204 | |
Shobhit Kumar | 2634fd7 | 2014-04-09 13:59:31 +0530 | [diff] [blame] | 205 | if (intel_dsi->dev.dev_ops->enable) |
| 206 | intel_dsi->dev.dev_ops->enable(&intel_dsi->dev); |
| 207 | |
Shobhit Kumar | 1381308 | 2014-07-12 17:17:22 +0530 | [diff] [blame] | 208 | wait_for_dsi_fifo_empty(intel_dsi); |
| 209 | |
Gaurav K Singh | 5505a24 | 2014-12-04 10:58:47 +0530 | [diff] [blame] | 210 | intel_dsi_port_enable(encoder); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 211 | } |
Shobhit Kumar | 2634fd7 | 2014-04-09 13:59:31 +0530 | [diff] [blame] | 212 | } |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 213 | |
Shobhit Kumar | 2634fd7 | 2014-04-09 13:59:31 +0530 | [diff] [blame] | 214 | static void intel_dsi_pre_enable(struct intel_encoder *encoder) |
| 215 | { |
Shobhit Kumar | 20e5bf6 | 2014-04-09 13:59:32 +0530 | [diff] [blame] | 216 | struct drm_device *dev = encoder->base.dev; |
| 217 | struct drm_i915_private *dev_priv = dev->dev_private; |
Shobhit Kumar | 2634fd7 | 2014-04-09 13:59:31 +0530 | [diff] [blame] | 218 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); |
Shobhit Kumar | 20e5bf6 | 2014-04-09 13:59:32 +0530 | [diff] [blame] | 219 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); |
| 220 | enum pipe pipe = intel_crtc->pipe; |
| 221 | u32 tmp; |
Shobhit Kumar | 2634fd7 | 2014-04-09 13:59:31 +0530 | [diff] [blame] | 222 | |
| 223 | DRM_DEBUG_KMS("\n"); |
| 224 | |
Shobhit Kumar | 20e5bf6 | 2014-04-09 13:59:32 +0530 | [diff] [blame] | 225 | /* Disable DPOunit clock gating, can stall pipe |
| 226 | * and we need DPLL REFA always enabled */ |
| 227 | tmp = I915_READ(DPLL(pipe)); |
| 228 | tmp |= DPLL_REFA_CLK_ENABLE_VLV; |
| 229 | I915_WRITE(DPLL(pipe), tmp); |
| 230 | |
Shobhit Kumar | f573de5 | 2014-07-30 20:32:37 +0530 | [diff] [blame] | 231 | /* update the hw state for DPLL */ |
| 232 | intel_crtc->config.dpll_hw_state.dpll = DPLL_INTEGRATED_CLOCK_VLV | |
Daniel Vetter | 7f3de83 | 2014-07-30 22:34:27 +0200 | [diff] [blame] | 233 | DPLL_REFA_CLK_ENABLE_VLV; |
Shobhit Kumar | f573de5 | 2014-07-30 20:32:37 +0530 | [diff] [blame] | 234 | |
Shobhit Kumar | 20e5bf6 | 2014-04-09 13:59:32 +0530 | [diff] [blame] | 235 | tmp = I915_READ(DSPCLK_GATE_D); |
| 236 | tmp |= DPOUNIT_CLOCK_GATE_DISABLE; |
| 237 | I915_WRITE(DSPCLK_GATE_D, tmp); |
Shobhit Kumar | 2634fd7 | 2014-04-09 13:59:31 +0530 | [diff] [blame] | 238 | |
| 239 | /* put device in ready state */ |
| 240 | intel_dsi_device_ready(encoder); |
| 241 | |
Shobhit Kumar | df38e65 | 2014-04-14 11:18:26 +0530 | [diff] [blame] | 242 | msleep(intel_dsi->panel_on_delay); |
| 243 | |
Shobhit Kumar | 20e5bf6 | 2014-04-09 13:59:32 +0530 | [diff] [blame] | 244 | if (intel_dsi->dev.dev_ops->panel_reset) |
| 245 | intel_dsi->dev.dev_ops->panel_reset(&intel_dsi->dev); |
| 246 | |
Shobhit Kumar | 2634fd7 | 2014-04-09 13:59:31 +0530 | [diff] [blame] | 247 | if (intel_dsi->dev.dev_ops->send_otp_cmds) |
| 248 | intel_dsi->dev.dev_ops->send_otp_cmds(&intel_dsi->dev); |
| 249 | |
Shobhit Kumar | 1381308 | 2014-07-12 17:17:22 +0530 | [diff] [blame] | 250 | wait_for_dsi_fifo_empty(intel_dsi); |
| 251 | |
Shobhit Kumar | 2634fd7 | 2014-04-09 13:59:31 +0530 | [diff] [blame] | 252 | /* Enable port in pre-enable phase itself because as per hw team |
| 253 | * recommendation, port should be enabled befor plane & pipe */ |
| 254 | intel_dsi_enable(encoder); |
| 255 | } |
| 256 | |
| 257 | static void intel_dsi_enable_nop(struct intel_encoder *encoder) |
| 258 | { |
| 259 | DRM_DEBUG_KMS("\n"); |
| 260 | |
| 261 | /* for DSI port enable has to be done before pipe |
| 262 | * and plane enable, so port enable is done in |
| 263 | * pre_enable phase itself unlike other encoders |
| 264 | */ |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 265 | } |
| 266 | |
Imre Deak | c315faf | 2014-05-27 19:00:09 +0300 | [diff] [blame] | 267 | static void intel_dsi_pre_disable(struct intel_encoder *encoder) |
| 268 | { |
| 269 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); |
| 270 | |
| 271 | DRM_DEBUG_KMS("\n"); |
| 272 | |
| 273 | if (is_vid_mode(intel_dsi)) { |
| 274 | /* Send Shutdown command to the panel in LP mode */ |
| 275 | dpi_send_cmd(intel_dsi, SHUTDOWN, DPI_LP_MODE_EN); |
| 276 | msleep(10); |
| 277 | } |
| 278 | } |
| 279 | |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 280 | static void intel_dsi_disable(struct intel_encoder *encoder) |
| 281 | { |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 282 | struct drm_device *dev = encoder->base.dev; |
| 283 | struct drm_i915_private *dev_priv = dev->dev_private; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 284 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); |
| 285 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 286 | enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 287 | u32 temp; |
| 288 | |
| 289 | DRM_DEBUG_KMS("\n"); |
| 290 | |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 291 | if (is_vid_mode(intel_dsi)) { |
Shobhit Kumar | 1381308 | 2014-07-12 17:17:22 +0530 | [diff] [blame] | 292 | wait_for_dsi_fifo_empty(intel_dsi); |
| 293 | |
Gaurav K Singh | 5505a24 | 2014-12-04 10:58:47 +0530 | [diff] [blame] | 294 | intel_dsi_port_disable(encoder); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 295 | msleep(2); |
| 296 | } |
| 297 | |
Shobhit Kumar | 339023e | 2014-04-09 13:59:34 +0530 | [diff] [blame] | 298 | /* Panel commands can be sent when clock is in LP11 */ |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 299 | I915_WRITE(MIPI_DEVICE_READY(port), 0x0); |
Shobhit Kumar | 339023e | 2014-04-09 13:59:34 +0530 | [diff] [blame] | 300 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 301 | temp = I915_READ(MIPI_CTRL(port)); |
Shobhit Kumar | 339023e | 2014-04-09 13:59:34 +0530 | [diff] [blame] | 302 | temp &= ~ESCAPE_CLOCK_DIVIDER_MASK; |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 303 | I915_WRITE(MIPI_CTRL(port), temp | |
Daniel Vetter | 7f3de83 | 2014-07-30 22:34:27 +0200 | [diff] [blame] | 304 | intel_dsi->escape_clk_div << |
| 305 | ESCAPE_CLOCK_DIVIDER_SHIFT); |
Shobhit Kumar | 339023e | 2014-04-09 13:59:34 +0530 | [diff] [blame] | 306 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 307 | I915_WRITE(MIPI_EOT_DISABLE(port), CLOCKSTOP); |
Shobhit Kumar | 339023e | 2014-04-09 13:59:34 +0530 | [diff] [blame] | 308 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 309 | temp = I915_READ(MIPI_DSI_FUNC_PRG(port)); |
Shobhit Kumar | 339023e | 2014-04-09 13:59:34 +0530 | [diff] [blame] | 310 | temp &= ~VID_MODE_FORMAT_MASK; |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 311 | I915_WRITE(MIPI_DSI_FUNC_PRG(port), temp); |
Shobhit Kumar | 339023e | 2014-04-09 13:59:34 +0530 | [diff] [blame] | 312 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 313 | I915_WRITE(MIPI_DEVICE_READY(port), 0x1); |
Shobhit Kumar | 339023e | 2014-04-09 13:59:34 +0530 | [diff] [blame] | 314 | |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 315 | /* if disable packets are sent before sending shutdown packet then in |
| 316 | * some next enable sequence send turn on packet error is observed */ |
| 317 | if (intel_dsi->dev.dev_ops->disable) |
| 318 | intel_dsi->dev.dev_ops->disable(&intel_dsi->dev); |
Shobhit Kumar | 1381308 | 2014-07-12 17:17:22 +0530 | [diff] [blame] | 319 | |
| 320 | wait_for_dsi_fifo_empty(intel_dsi); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 321 | } |
| 322 | |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 323 | static void intel_dsi_clear_device_ready(struct intel_encoder *encoder) |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 324 | { |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 325 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
| 326 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 327 | enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe); |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 328 | u32 val; |
| 329 | |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 330 | DRM_DEBUG_KMS("\n"); |
ymohanma | be4fc04 | 2013-08-27 23:40:56 +0300 | [diff] [blame] | 331 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 332 | I915_WRITE(MIPI_DEVICE_READY(port), DEVICE_READY | ULPS_STATE_ENTER); |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 333 | usleep_range(2000, 2500); |
| 334 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 335 | I915_WRITE(MIPI_DEVICE_READY(port), DEVICE_READY | ULPS_STATE_EXIT); |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 336 | usleep_range(2000, 2500); |
| 337 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 338 | I915_WRITE(MIPI_DEVICE_READY(port), DEVICE_READY | ULPS_STATE_ENTER); |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 339 | usleep_range(2000, 2500); |
| 340 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 341 | if (wait_for(((I915_READ(MIPI_PORT_CTRL(port)) & AFE_LATCHOUT) |
Daniel Vetter | 7f3de83 | 2014-07-30 22:34:27 +0200 | [diff] [blame] | 342 | == 0x00000), 30)) |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 343 | DRM_ERROR("DSI LP not going Low\n"); |
| 344 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 345 | val = I915_READ(MIPI_PORT_CTRL(port)); |
| 346 | I915_WRITE(MIPI_PORT_CTRL(port), val & ~LP_OUTPUT_HOLD); |
Shobhit Kumar | aceb365 | 2014-07-03 16:35:41 +0530 | [diff] [blame] | 347 | usleep_range(1000, 1500); |
| 348 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 349 | I915_WRITE(MIPI_DEVICE_READY(port), 0x00); |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 350 | usleep_range(2000, 2500); |
| 351 | |
ymohanma | be4fc04 | 2013-08-27 23:40:56 +0300 | [diff] [blame] | 352 | vlv_disable_dsi_pll(encoder); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 353 | } |
Shobhit Kumar | 20e5bf6 | 2014-04-09 13:59:32 +0530 | [diff] [blame] | 354 | |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 355 | static void intel_dsi_post_disable(struct intel_encoder *encoder) |
| 356 | { |
Shobhit Kumar | 20e5bf6 | 2014-04-09 13:59:32 +0530 | [diff] [blame] | 357 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 358 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); |
Shobhit Kumar | 20e5bf6 | 2014-04-09 13:59:32 +0530 | [diff] [blame] | 359 | u32 val; |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 360 | |
| 361 | DRM_DEBUG_KMS("\n"); |
| 362 | |
Imre Deak | c315faf | 2014-05-27 19:00:09 +0300 | [diff] [blame] | 363 | intel_dsi_disable(encoder); |
| 364 | |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 365 | intel_dsi_clear_device_ready(encoder); |
| 366 | |
Shobhit Kumar | 20e5bf6 | 2014-04-09 13:59:32 +0530 | [diff] [blame] | 367 | val = I915_READ(DSPCLK_GATE_D); |
| 368 | val &= ~DPOUNIT_CLOCK_GATE_DISABLE; |
| 369 | I915_WRITE(DSPCLK_GATE_D, val); |
| 370 | |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 371 | if (intel_dsi->dev.dev_ops->disable_panel_power) |
| 372 | intel_dsi->dev.dev_ops->disable_panel_power(&intel_dsi->dev); |
Shobhit Kumar | df38e65 | 2014-04-14 11:18:26 +0530 | [diff] [blame] | 373 | |
| 374 | msleep(intel_dsi->panel_off_delay); |
| 375 | msleep(intel_dsi->panel_pwr_cycle_delay); |
Shobhit Kumar | 1dbd7cb | 2013-12-11 17:52:05 +0530 | [diff] [blame] | 376 | } |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 377 | |
| 378 | static bool intel_dsi_get_hw_state(struct intel_encoder *encoder, |
| 379 | enum pipe *pipe) |
| 380 | { |
| 381 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
Imre Deak | 6d129be | 2014-03-05 16:20:54 +0200 | [diff] [blame] | 382 | enum intel_display_power_domain power_domain; |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 383 | u32 port_ctl, func; |
| 384 | enum port port; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 385 | |
| 386 | DRM_DEBUG_KMS("\n"); |
| 387 | |
Imre Deak | 6d129be | 2014-03-05 16:20:54 +0200 | [diff] [blame] | 388 | power_domain = intel_display_port_power_domain(encoder); |
Daniel Vetter | f458ebb | 2014-09-30 10:56:39 +0200 | [diff] [blame] | 389 | if (!intel_display_power_is_enabled(dev_priv, power_domain)) |
Imre Deak | 6d129be | 2014-03-05 16:20:54 +0200 | [diff] [blame] | 390 | return false; |
| 391 | |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 392 | /* XXX: this only works for one DSI output */ |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 393 | for_each_dsi_port(port, (1 << PORT_A) | (1 << PORT_C)) { |
| 394 | port_ctl = I915_READ(MIPI_PORT_CTRL(port)); |
| 395 | func = I915_READ(MIPI_DSI_FUNC_PRG(port)); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 396 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 397 | if ((port_ctl & DPI_ENABLE) || (func & CMD_MODE_DATA_WIDTH_MASK)) { |
| 398 | if (I915_READ(MIPI_DEVICE_READY(port)) & DEVICE_READY) { |
| 399 | *pipe = port == PORT_A ? PIPE_A : PIPE_C; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 400 | return true; |
| 401 | } |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | return false; |
| 406 | } |
| 407 | |
| 408 | static void intel_dsi_get_config(struct intel_encoder *encoder, |
| 409 | struct intel_crtc_config *pipe_config) |
| 410 | { |
Shobhit Kumar | f573de5 | 2014-07-30 20:32:37 +0530 | [diff] [blame] | 411 | u32 pclk; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 412 | DRM_DEBUG_KMS("\n"); |
| 413 | |
Shobhit Kumar | f573de5 | 2014-07-30 20:32:37 +0530 | [diff] [blame] | 414 | /* |
| 415 | * DPLL_MD is not used in case of DSI, reading will get some default value |
| 416 | * set dpll_md = 0 |
| 417 | */ |
| 418 | pipe_config->dpll_hw_state.dpll_md = 0; |
| 419 | |
| 420 | pclk = vlv_get_dsi_pclk(encoder, pipe_config->pipe_bpp); |
| 421 | if (!pclk) |
| 422 | return; |
| 423 | |
| 424 | pipe_config->adjusted_mode.crtc_clock = pclk; |
| 425 | pipe_config->port_clock = pclk; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 426 | } |
| 427 | |
Damien Lespiau | c19de8e | 2013-11-28 15:29:18 +0000 | [diff] [blame] | 428 | static enum drm_mode_status |
| 429 | intel_dsi_mode_valid(struct drm_connector *connector, |
| 430 | struct drm_display_mode *mode) |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 431 | { |
| 432 | struct intel_connector *intel_connector = to_intel_connector(connector); |
| 433 | struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode; |
| 434 | struct intel_dsi *intel_dsi = intel_attached_dsi(connector); |
| 435 | |
| 436 | DRM_DEBUG_KMS("\n"); |
| 437 | |
| 438 | if (mode->flags & DRM_MODE_FLAG_DBLSCAN) { |
| 439 | DRM_DEBUG_KMS("MODE_NO_DBLESCAN\n"); |
| 440 | return MODE_NO_DBLESCAN; |
| 441 | } |
| 442 | |
| 443 | if (fixed_mode) { |
| 444 | if (mode->hdisplay > fixed_mode->hdisplay) |
| 445 | return MODE_PANEL; |
| 446 | if (mode->vdisplay > fixed_mode->vdisplay) |
| 447 | return MODE_PANEL; |
| 448 | } |
| 449 | |
| 450 | return intel_dsi->dev.dev_ops->mode_valid(&intel_dsi->dev, mode); |
| 451 | } |
| 452 | |
| 453 | /* return txclkesc cycles in terms of divider and duration in us */ |
| 454 | static u16 txclkesc(u32 divider, unsigned int us) |
| 455 | { |
| 456 | switch (divider) { |
| 457 | case ESCAPE_CLOCK_DIVIDER_1: |
| 458 | default: |
| 459 | return 20 * us; |
| 460 | case ESCAPE_CLOCK_DIVIDER_2: |
| 461 | return 10 * us; |
| 462 | case ESCAPE_CLOCK_DIVIDER_4: |
| 463 | return 5 * us; |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | /* return pixels in terms of txbyteclkhs */ |
Shobhit Kumar | 7f0c860 | 2014-07-30 20:34:57 +0530 | [diff] [blame] | 468 | static u16 txbyteclkhs(u16 pixels, int bpp, int lane_count, |
| 469 | u16 burst_mode_ratio) |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 470 | { |
Shobhit Kumar | 7f0c860 | 2014-07-30 20:34:57 +0530 | [diff] [blame] | 471 | return DIV_ROUND_UP(DIV_ROUND_UP(pixels * bpp * burst_mode_ratio, |
Daniel Vetter | 7f3de83 | 2014-07-30 22:34:27 +0200 | [diff] [blame] | 472 | 8 * 100), lane_count); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 473 | } |
| 474 | |
| 475 | static void set_dsi_timings(struct drm_encoder *encoder, |
| 476 | const struct drm_display_mode *mode) |
| 477 | { |
| 478 | struct drm_device *dev = encoder->dev; |
| 479 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 480 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
| 481 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder); |
Gaurav K Singh | aa102d2 | 2014-12-04 10:58:54 +0530 | [diff] [blame^] | 482 | enum port port; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 483 | unsigned int bpp = intel_crtc->config.pipe_bpp; |
| 484 | unsigned int lane_count = intel_dsi->lane_count; |
| 485 | |
| 486 | u16 hactive, hfp, hsync, hbp, vfp, vsync, vbp; |
| 487 | |
| 488 | hactive = mode->hdisplay; |
| 489 | hfp = mode->hsync_start - mode->hdisplay; |
| 490 | hsync = mode->hsync_end - mode->hsync_start; |
| 491 | hbp = mode->htotal - mode->hsync_end; |
| 492 | |
Gaurav K Singh | aa102d2 | 2014-12-04 10:58:54 +0530 | [diff] [blame^] | 493 | if (intel_dsi->dual_link) { |
| 494 | hactive /= 2; |
| 495 | if (intel_dsi->dual_link == DSI_DUAL_LINK_FRONT_BACK) |
| 496 | hactive += intel_dsi->pixel_overlap; |
| 497 | hfp /= 2; |
| 498 | hsync /= 2; |
| 499 | hbp /= 2; |
| 500 | } |
| 501 | |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 502 | vfp = mode->vsync_start - mode->vdisplay; |
| 503 | vsync = mode->vsync_end - mode->vsync_start; |
| 504 | vbp = mode->vtotal - mode->vsync_end; |
| 505 | |
| 506 | /* horizontal values are in terms of high speed byte clock */ |
Shobhit Kumar | 7f0c860 | 2014-07-30 20:34:57 +0530 | [diff] [blame] | 507 | hactive = txbyteclkhs(hactive, bpp, lane_count, |
Daniel Vetter | 7f3de83 | 2014-07-30 22:34:27 +0200 | [diff] [blame] | 508 | intel_dsi->burst_mode_ratio); |
Shobhit Kumar | 7f0c860 | 2014-07-30 20:34:57 +0530 | [diff] [blame] | 509 | hfp = txbyteclkhs(hfp, bpp, lane_count, intel_dsi->burst_mode_ratio); |
| 510 | hsync = txbyteclkhs(hsync, bpp, lane_count, |
Daniel Vetter | 7f3de83 | 2014-07-30 22:34:27 +0200 | [diff] [blame] | 511 | intel_dsi->burst_mode_ratio); |
Shobhit Kumar | 7f0c860 | 2014-07-30 20:34:57 +0530 | [diff] [blame] | 512 | hbp = txbyteclkhs(hbp, bpp, lane_count, intel_dsi->burst_mode_ratio); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 513 | |
Gaurav K Singh | aa102d2 | 2014-12-04 10:58:54 +0530 | [diff] [blame^] | 514 | for_each_dsi_port(port, intel_dsi->ports) { |
| 515 | I915_WRITE(MIPI_HACTIVE_AREA_COUNT(port), hactive); |
| 516 | I915_WRITE(MIPI_HFP_COUNT(port), hfp); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 517 | |
Gaurav K Singh | aa102d2 | 2014-12-04 10:58:54 +0530 | [diff] [blame^] | 518 | /* meaningful for video mode non-burst sync pulse mode only, |
| 519 | * can be zero for non-burst sync events and burst modes */ |
| 520 | I915_WRITE(MIPI_HSYNC_PADDING_COUNT(port), hsync); |
| 521 | I915_WRITE(MIPI_HBP_COUNT(port), hbp); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 522 | |
Gaurav K Singh | aa102d2 | 2014-12-04 10:58:54 +0530 | [diff] [blame^] | 523 | /* vertical values are in terms of lines */ |
| 524 | I915_WRITE(MIPI_VFP_COUNT(port), vfp); |
| 525 | I915_WRITE(MIPI_VSYNC_PADDING_COUNT(port), vsync); |
| 526 | I915_WRITE(MIPI_VBP_COUNT(port), vbp); |
| 527 | } |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 528 | } |
| 529 | |
Daniel Vetter | 07e4fb9 | 2014-04-24 23:54:59 +0200 | [diff] [blame] | 530 | static void intel_dsi_prepare(struct intel_encoder *intel_encoder) |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 531 | { |
| 532 | struct drm_encoder *encoder = &intel_encoder->base; |
| 533 | struct drm_device *dev = encoder->dev; |
| 534 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 535 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
| 536 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder); |
| 537 | struct drm_display_mode *adjusted_mode = |
| 538 | &intel_crtc->config.adjusted_mode; |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 539 | enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 540 | unsigned int bpp = intel_crtc->config.pipe_bpp; |
| 541 | u32 val, tmp; |
| 542 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 543 | DRM_DEBUG_KMS("pipe %c\n", pipe_name(intel_crtc->pipe)); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 544 | |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 545 | /* escape clock divider, 20MHz, shared for A and C. device ready must be |
| 546 | * off when doing this! txclkesc? */ |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 547 | tmp = I915_READ(MIPI_CTRL(PORT_A)); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 548 | tmp &= ~ESCAPE_CLOCK_DIVIDER_MASK; |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 549 | I915_WRITE(MIPI_CTRL(PORT_A), tmp | ESCAPE_CLOCK_DIVIDER_1); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 550 | |
| 551 | /* read request priority is per pipe */ |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 552 | tmp = I915_READ(MIPI_CTRL(port)); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 553 | tmp &= ~READ_REQUEST_PRIORITY_MASK; |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 554 | I915_WRITE(MIPI_CTRL(port), tmp | READ_REQUEST_PRIORITY_HIGH); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 555 | |
| 556 | /* XXX: why here, why like this? handling in irq handler?! */ |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 557 | I915_WRITE(MIPI_INTR_STAT(port), 0xffffffff); |
| 558 | I915_WRITE(MIPI_INTR_EN(port), 0xffffffff); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 559 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 560 | I915_WRITE(MIPI_DPHY_PARAM(port), intel_dsi->dphy_reg); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 561 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 562 | I915_WRITE(MIPI_DPI_RESOLUTION(port), |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 563 | adjusted_mode->vdisplay << VERTICAL_ADDRESS_SHIFT | |
| 564 | adjusted_mode->hdisplay << HORIZONTAL_ADDRESS_SHIFT); |
| 565 | |
| 566 | set_dsi_timings(encoder, adjusted_mode); |
| 567 | |
| 568 | val = intel_dsi->lane_count << DATA_LANES_PRG_REG_SHIFT; |
| 569 | if (is_cmd_mode(intel_dsi)) { |
| 570 | val |= intel_dsi->channel << CMD_MODE_CHANNEL_NUMBER_SHIFT; |
| 571 | val |= CMD_MODE_DATA_WIDTH_8_BIT; /* XXX */ |
| 572 | } else { |
| 573 | val |= intel_dsi->channel << VID_MODE_CHANNEL_NUMBER_SHIFT; |
| 574 | |
| 575 | /* XXX: cross-check bpp vs. pixel format? */ |
| 576 | val |= intel_dsi->pixel_format; |
| 577 | } |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 578 | I915_WRITE(MIPI_DSI_FUNC_PRG(port), val); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 579 | |
| 580 | /* timeouts for recovery. one frame IIUC. if counter expires, EOT and |
| 581 | * stop state. */ |
| 582 | |
| 583 | /* |
| 584 | * In burst mode, value greater than one DPI line Time in byte clock |
| 585 | * (txbyteclkhs) To timeout this timer 1+ of the above said value is |
| 586 | * recommended. |
| 587 | * |
| 588 | * In non-burst mode, Value greater than one DPI frame time in byte |
| 589 | * clock(txbyteclkhs) To timeout this timer 1+ of the above said value |
| 590 | * is recommended. |
| 591 | * |
| 592 | * In DBI only mode, value greater than one DBI frame time in byte |
| 593 | * clock(txbyteclkhs) To timeout this timer 1+ of the above said value |
| 594 | * is recommended. |
| 595 | */ |
| 596 | |
| 597 | if (is_vid_mode(intel_dsi) && |
| 598 | intel_dsi->video_mode_format == VIDEO_MODE_BURST) { |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 599 | I915_WRITE(MIPI_HS_TX_TIMEOUT(port), |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 600 | txbyteclkhs(adjusted_mode->htotal, bpp, |
Shobhit Kumar | 7f0c860 | 2014-07-30 20:34:57 +0530 | [diff] [blame] | 601 | intel_dsi->lane_count, |
| 602 | intel_dsi->burst_mode_ratio) + 1); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 603 | } else { |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 604 | I915_WRITE(MIPI_HS_TX_TIMEOUT(port), |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 605 | txbyteclkhs(adjusted_mode->vtotal * |
| 606 | adjusted_mode->htotal, |
Shobhit Kumar | 7f0c860 | 2014-07-30 20:34:57 +0530 | [diff] [blame] | 607 | bpp, intel_dsi->lane_count, |
| 608 | intel_dsi->burst_mode_ratio) + 1); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 609 | } |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 610 | I915_WRITE(MIPI_LP_RX_TIMEOUT(port), intel_dsi->lp_rx_timeout); |
| 611 | I915_WRITE(MIPI_TURN_AROUND_TIMEOUT(port), intel_dsi->turn_arnd_val); |
| 612 | I915_WRITE(MIPI_DEVICE_RESET_TIMER(port), intel_dsi->rst_timer_val); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 613 | |
| 614 | /* dphy stuff */ |
| 615 | |
| 616 | /* in terms of low power clock */ |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 617 | I915_WRITE(MIPI_INIT_COUNT(port), txclkesc(intel_dsi->escape_clk_div, 100)); |
Shobhit Kumar | f1c79f1 | 2014-04-09 13:59:33 +0530 | [diff] [blame] | 618 | |
| 619 | val = 0; |
| 620 | if (intel_dsi->eotp_pkt == 0) |
| 621 | val |= EOT_DISABLE; |
| 622 | |
| 623 | if (intel_dsi->clock_stop) |
| 624 | val |= CLOCKSTOP; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 625 | |
| 626 | /* recovery disables */ |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 627 | I915_WRITE(MIPI_EOT_DISABLE(port), val); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 628 | |
Shobhit Kumar | cf4dbd2 | 2014-04-14 11:18:25 +0530 | [diff] [blame] | 629 | /* in terms of low power clock */ |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 630 | I915_WRITE(MIPI_INIT_COUNT(port), intel_dsi->init_count); |
Shobhit Kumar | cf4dbd2 | 2014-04-14 11:18:25 +0530 | [diff] [blame] | 631 | |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 632 | /* in terms of txbyteclkhs. actual high to low switch + |
| 633 | * MIPI_STOP_STATE_STALL * MIPI_LP_BYTECLK. |
| 634 | * |
| 635 | * XXX: write MIPI_STOP_STATE_STALL? |
| 636 | */ |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 637 | I915_WRITE(MIPI_HIGH_LOW_SWITCH_COUNT(port), |
Daniel Vetter | 7f3de83 | 2014-07-30 22:34:27 +0200 | [diff] [blame] | 638 | intel_dsi->hs_to_lp_count); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 639 | |
| 640 | /* XXX: low power clock equivalence in terms of byte clock. the number |
| 641 | * of byte clocks occupied in one low power clock. based on txbyteclkhs |
| 642 | * and txclkesc. txclkesc time / txbyteclk time * (105 + |
| 643 | * MIPI_STOP_STATE_STALL) / 105.??? |
| 644 | */ |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 645 | I915_WRITE(MIPI_LP_BYTECLK(port), intel_dsi->lp_byte_clk); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 646 | |
| 647 | /* the bw essential for transmitting 16 long packets containing 252 |
| 648 | * bytes meant for dcs write memory command is programmed in this |
| 649 | * register in terms of byte clocks. based on dsi transfer rate and the |
| 650 | * number of lanes configured the time taken to transmit 16 long packets |
| 651 | * in a dsi stream varies. */ |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 652 | I915_WRITE(MIPI_DBI_BW_CTRL(port), intel_dsi->bw_timer); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 653 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 654 | I915_WRITE(MIPI_CLK_LANE_SWITCH_TIME_CNT(port), |
Shobhit Kumar | f6da284 | 2013-12-10 12:15:00 +0530 | [diff] [blame] | 655 | intel_dsi->clk_lp_to_hs_count << LP_HS_SSW_CNT_SHIFT | |
| 656 | intel_dsi->clk_hs_to_lp_count << HS_LP_PWR_SW_CNT_SHIFT); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 657 | |
| 658 | if (is_vid_mode(intel_dsi)) |
Shobhit Kumar | 24d9c40 | 2014-04-09 13:59:36 +0530 | [diff] [blame] | 659 | /* Some panels might have resolution which is not a multiple of |
| 660 | * 64 like 1366 x 768. Enable RANDOM resolution support for such |
| 661 | * panels by default */ |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 662 | I915_WRITE(MIPI_VIDEO_MODE_FORMAT(port), |
Daniel Vetter | 7f3de83 | 2014-07-30 22:34:27 +0200 | [diff] [blame] | 663 | intel_dsi->video_frmt_cfg_bits | |
| 664 | intel_dsi->video_mode_format | |
| 665 | IP_TG_CONFIG | |
| 666 | RANDOM_DPI_DISPLAY_RESOLUTION); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 667 | } |
| 668 | |
Daniel Vetter | 07e4fb9 | 2014-04-24 23:54:59 +0200 | [diff] [blame] | 669 | static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder) |
| 670 | { |
| 671 | DRM_DEBUG_KMS("\n"); |
| 672 | |
| 673 | intel_dsi_prepare(encoder); |
| 674 | |
| 675 | vlv_enable_dsi_pll(encoder); |
| 676 | } |
| 677 | |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 678 | static enum drm_connector_status |
| 679 | intel_dsi_detect(struct drm_connector *connector, bool force) |
| 680 | { |
| 681 | struct intel_dsi *intel_dsi = intel_attached_dsi(connector); |
Imre Deak | 671dedd | 2014-03-05 16:20:53 +0200 | [diff] [blame] | 682 | struct intel_encoder *intel_encoder = &intel_dsi->base; |
| 683 | enum intel_display_power_domain power_domain; |
| 684 | enum drm_connector_status connector_status; |
| 685 | struct drm_i915_private *dev_priv = intel_encoder->base.dev->dev_private; |
| 686 | |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 687 | DRM_DEBUG_KMS("\n"); |
Imre Deak | 671dedd | 2014-03-05 16:20:53 +0200 | [diff] [blame] | 688 | power_domain = intel_display_port_power_domain(intel_encoder); |
| 689 | |
| 690 | intel_display_power_get(dev_priv, power_domain); |
| 691 | connector_status = intel_dsi->dev.dev_ops->detect(&intel_dsi->dev); |
| 692 | intel_display_power_put(dev_priv, power_domain); |
| 693 | |
| 694 | return connector_status; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 695 | } |
| 696 | |
| 697 | static int intel_dsi_get_modes(struct drm_connector *connector) |
| 698 | { |
| 699 | struct intel_connector *intel_connector = to_intel_connector(connector); |
| 700 | struct drm_display_mode *mode; |
| 701 | |
| 702 | DRM_DEBUG_KMS("\n"); |
| 703 | |
| 704 | if (!intel_connector->panel.fixed_mode) { |
| 705 | DRM_DEBUG_KMS("no fixed mode\n"); |
| 706 | return 0; |
| 707 | } |
| 708 | |
| 709 | mode = drm_mode_duplicate(connector->dev, |
| 710 | intel_connector->panel.fixed_mode); |
| 711 | if (!mode) { |
| 712 | DRM_DEBUG_KMS("drm_mode_duplicate failed\n"); |
| 713 | return 0; |
| 714 | } |
| 715 | |
| 716 | drm_mode_probed_add(connector, mode); |
| 717 | return 1; |
| 718 | } |
| 719 | |
| 720 | static void intel_dsi_destroy(struct drm_connector *connector) |
| 721 | { |
| 722 | struct intel_connector *intel_connector = to_intel_connector(connector); |
| 723 | |
| 724 | DRM_DEBUG_KMS("\n"); |
| 725 | intel_panel_fini(&intel_connector->panel); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 726 | drm_connector_cleanup(connector); |
| 727 | kfree(connector); |
| 728 | } |
| 729 | |
| 730 | static const struct drm_encoder_funcs intel_dsi_funcs = { |
| 731 | .destroy = intel_encoder_destroy, |
| 732 | }; |
| 733 | |
| 734 | static const struct drm_connector_helper_funcs intel_dsi_connector_helper_funcs = { |
| 735 | .get_modes = intel_dsi_get_modes, |
| 736 | .mode_valid = intel_dsi_mode_valid, |
| 737 | .best_encoder = intel_best_encoder, |
| 738 | }; |
| 739 | |
| 740 | static const struct drm_connector_funcs intel_dsi_connector_funcs = { |
| 741 | .dpms = intel_connector_dpms, |
| 742 | .detect = intel_dsi_detect, |
| 743 | .destroy = intel_dsi_destroy, |
| 744 | .fill_modes = drm_helper_probe_single_connector_modes, |
| 745 | }; |
| 746 | |
Damien Lespiau | 4328633d | 2014-05-28 12:30:56 +0100 | [diff] [blame] | 747 | void intel_dsi_init(struct drm_device *dev) |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 748 | { |
| 749 | struct intel_dsi *intel_dsi; |
| 750 | struct intel_encoder *intel_encoder; |
| 751 | struct drm_encoder *encoder; |
| 752 | struct intel_connector *intel_connector; |
| 753 | struct drm_connector *connector; |
| 754 | struct drm_display_mode *fixed_mode = NULL; |
Shashank Sharma | b6fdd0f | 2014-05-19 20:54:03 +0530 | [diff] [blame] | 755 | struct drm_i915_private *dev_priv = dev->dev_private; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 756 | const struct intel_dsi_device *dsi; |
| 757 | unsigned int i; |
| 758 | |
| 759 | DRM_DEBUG_KMS("\n"); |
| 760 | |
Shobhit Kumar | 3e6bd01 | 2014-05-27 19:33:59 +0530 | [diff] [blame] | 761 | /* There is no detection method for MIPI so rely on VBT */ |
| 762 | if (!dev_priv->vbt.has_mipi) |
Damien Lespiau | 4328633d | 2014-05-28 12:30:56 +0100 | [diff] [blame] | 763 | return; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 764 | |
Shashank Sharma | b6fdd0f | 2014-05-19 20:54:03 +0530 | [diff] [blame] | 765 | if (IS_VALLEYVIEW(dev)) { |
| 766 | dev_priv->mipi_mmio_base = VLV_MIPI_BASE; |
| 767 | } else { |
| 768 | DRM_ERROR("Unsupported Mipi device to reg base"); |
Christoph Jaeger | 868d665 | 2014-06-13 21:51:22 +0200 | [diff] [blame] | 769 | return; |
Shashank Sharma | b6fdd0f | 2014-05-19 20:54:03 +0530 | [diff] [blame] | 770 | } |
| 771 | |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 772 | intel_dsi = kzalloc(sizeof(*intel_dsi), GFP_KERNEL); |
| 773 | if (!intel_dsi) |
Damien Lespiau | 4328633d | 2014-05-28 12:30:56 +0100 | [diff] [blame] | 774 | return; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 775 | |
| 776 | intel_connector = kzalloc(sizeof(*intel_connector), GFP_KERNEL); |
| 777 | if (!intel_connector) { |
| 778 | kfree(intel_dsi); |
Damien Lespiau | 4328633d | 2014-05-28 12:30:56 +0100 | [diff] [blame] | 779 | return; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 780 | } |
| 781 | |
| 782 | intel_encoder = &intel_dsi->base; |
| 783 | encoder = &intel_encoder->base; |
| 784 | intel_dsi->attached_connector = intel_connector; |
| 785 | |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 786 | connector = &intel_connector->base; |
| 787 | |
| 788 | drm_encoder_init(dev, encoder, &intel_dsi_funcs, DRM_MODE_ENCODER_DSI); |
| 789 | |
| 790 | /* XXX: very likely not all of these are needed */ |
| 791 | intel_encoder->hot_plug = intel_dsi_hot_plug; |
| 792 | intel_encoder->compute_config = intel_dsi_compute_config; |
| 793 | intel_encoder->pre_pll_enable = intel_dsi_pre_pll_enable; |
| 794 | intel_encoder->pre_enable = intel_dsi_pre_enable; |
Shobhit Kumar | 2634fd7 | 2014-04-09 13:59:31 +0530 | [diff] [blame] | 795 | intel_encoder->enable = intel_dsi_enable_nop; |
Imre Deak | c315faf | 2014-05-27 19:00:09 +0300 | [diff] [blame] | 796 | intel_encoder->disable = intel_dsi_pre_disable; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 797 | intel_encoder->post_disable = intel_dsi_post_disable; |
| 798 | intel_encoder->get_hw_state = intel_dsi_get_hw_state; |
| 799 | intel_encoder->get_config = intel_dsi_get_config; |
| 800 | |
| 801 | intel_connector->get_hw_state = intel_connector_get_hw_state; |
Imre Deak | 4932e2c | 2014-02-11 17:12:48 +0200 | [diff] [blame] | 802 | intel_connector->unregister = intel_connector_unregister; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 803 | |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 804 | /* Pipe A maps to MIPI DSI port A, pipe B maps to MIPI DSI port C */ |
Jani Nikula | 17af40a | 2014-11-14 16:54:22 +0200 | [diff] [blame] | 805 | if (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA) { |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 806 | intel_encoder->crtc_mask = (1 << PIPE_A); |
Jani Nikula | 17af40a | 2014-11-14 16:54:22 +0200 | [diff] [blame] | 807 | intel_dsi->ports = (1 << PORT_A); |
| 808 | } else if (dev_priv->vbt.dsi.port == DVO_PORT_MIPIC) { |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 809 | intel_encoder->crtc_mask = (1 << PIPE_B); |
Jani Nikula | 17af40a | 2014-11-14 16:54:22 +0200 | [diff] [blame] | 810 | intel_dsi->ports = (1 << PORT_C); |
| 811 | } |
Jani Nikula | e7d7cad | 2014-11-14 16:54:21 +0200 | [diff] [blame] | 812 | |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 813 | for (i = 0; i < ARRAY_SIZE(intel_dsi_devices); i++) { |
| 814 | dsi = &intel_dsi_devices[i]; |
| 815 | intel_dsi->dev = *dsi; |
| 816 | |
| 817 | if (dsi->dev_ops->init(&intel_dsi->dev)) |
| 818 | break; |
| 819 | } |
| 820 | |
| 821 | if (i == ARRAY_SIZE(intel_dsi_devices)) { |
| 822 | DRM_DEBUG_KMS("no device found\n"); |
| 823 | goto err; |
| 824 | } |
| 825 | |
| 826 | intel_encoder->type = INTEL_OUTPUT_DSI; |
Ville Syrjälä | bc079e8 | 2014-03-03 16:15:28 +0200 | [diff] [blame] | 827 | intel_encoder->cloneable = 0; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 828 | drm_connector_init(dev, connector, &intel_dsi_connector_funcs, |
| 829 | DRM_MODE_CONNECTOR_DSI); |
| 830 | |
| 831 | drm_connector_helper_add(connector, &intel_dsi_connector_helper_funcs); |
| 832 | |
| 833 | connector->display_info.subpixel_order = SubPixelHorizontalRGB; /*XXX*/ |
| 834 | connector->interlace_allowed = false; |
| 835 | connector->doublescan_allowed = false; |
| 836 | |
| 837 | intel_connector_attach_encoder(intel_connector, intel_encoder); |
| 838 | |
Thomas Wood | 34ea3d3 | 2014-05-29 16:57:41 +0100 | [diff] [blame] | 839 | drm_connector_register(connector); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 840 | |
| 841 | fixed_mode = dsi->dev_ops->get_modes(&intel_dsi->dev); |
| 842 | if (!fixed_mode) { |
| 843 | DRM_DEBUG_KMS("no fixed mode\n"); |
| 844 | goto err; |
| 845 | } |
| 846 | |
| 847 | fixed_mode->type |= DRM_MODE_TYPE_PREFERRED; |
Vandana Kannan | 4b6ed68 | 2014-02-11 14:26:36 +0530 | [diff] [blame] | 848 | intel_panel_init(&intel_connector->panel, fixed_mode, NULL); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 849 | |
Damien Lespiau | 4328633d | 2014-05-28 12:30:56 +0100 | [diff] [blame] | 850 | return; |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 851 | |
| 852 | err: |
| 853 | drm_encoder_cleanup(&intel_encoder->base); |
| 854 | kfree(intel_dsi); |
| 855 | kfree(intel_connector); |
Jani Nikula | 4e64649 | 2013-08-27 15:12:20 +0300 | [diff] [blame] | 856 | } |