Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'drm-intel-fixes-2014-07-09' of git://anongit.freedesktop.org/drm-intel into drm-fixes

Fixes for regressions and black screens, cc: stable where applicapable
(the last minute rebase was to sprinkle missing stable tags). A bit more
than what I'd wish for, but excluding vlv and that the first 3 patches are
just quirks for 1 regression it looks much better.

There's still a "oops, lost dithering" issue on older platforms open. I'm
working on a fix for that now but didn't want to delay this pile.

* tag 'drm-intel-fixes-2014-07-09' of git://anongit.freedesktop.org/drm-intel:
drm/i915/vlv: T12 eDP panel timing enforcement during reboot
drm/i915: Only unbind vgacon, not other console drivers
drm/i915: Don't clobber the GTT when it's within stolen memory
drm/i915/vlv: Update the DSI ULPS entry/exit sequence
drm/i915/vlv: DPI FIFO empty check is not needed
drm/i915: Toshiba CB35 has a controllable backlight
drm/i915: Acer C720 and C720P have controllable backlights
drm/i915: quirk asserts controllable backlight presence, overriding VBT

+130 -24
+3 -2
drivers/gpu/drm/i915/i915_dma.c
··· 1464 1464 #else 1465 1465 static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv) 1466 1466 { 1467 - int ret; 1467 + int ret = 0; 1468 1468 1469 1469 DRM_INFO("Replacing VGA console driver\n"); 1470 1470 1471 1471 console_lock(); 1472 - ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1); 1472 + if (con_is_bound(&vga_con)) 1473 + ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1); 1473 1474 if (ret == 0) { 1474 1475 ret = do_unregister_con_driver(&vga_con); 1475 1476
+1
drivers/gpu/drm/i915/i915_drv.h
··· 656 656 #define QUIRK_PIPEA_FORCE (1<<0) 657 657 #define QUIRK_LVDS_SSC_DISABLE (1<<1) 658 658 #define QUIRK_INVERT_BRIGHTNESS (1<<2) 659 + #define QUIRK_BACKLIGHT_PRESENT (1<<3) 659 660 660 661 struct intel_fbdev; 661 662 struct intel_fbc_work;
+44
drivers/gpu/drm/i915/i915_gem_stolen.c
··· 74 74 if (base == 0) 75 75 return 0; 76 76 77 + /* make sure we don't clobber the GTT if it's within stolen memory */ 78 + if (INTEL_INFO(dev)->gen <= 4 && !IS_G33(dev) && !IS_G4X(dev)) { 79 + struct { 80 + u32 start, end; 81 + } stolen[2] = { 82 + { .start = base, .end = base + dev_priv->gtt.stolen_size, }, 83 + { .start = base, .end = base + dev_priv->gtt.stolen_size, }, 84 + }; 85 + u64 gtt_start, gtt_end; 86 + 87 + gtt_start = I915_READ(PGTBL_CTL); 88 + if (IS_GEN4(dev)) 89 + gtt_start = (gtt_start & PGTBL_ADDRESS_LO_MASK) | 90 + (gtt_start & PGTBL_ADDRESS_HI_MASK) << 28; 91 + else 92 + gtt_start &= PGTBL_ADDRESS_LO_MASK; 93 + gtt_end = gtt_start + gtt_total_entries(dev_priv->gtt) * 4; 94 + 95 + if (gtt_start >= stolen[0].start && gtt_start < stolen[0].end) 96 + stolen[0].end = gtt_start; 97 + if (gtt_end > stolen[1].start && gtt_end <= stolen[1].end) 98 + stolen[1].start = gtt_end; 99 + 100 + /* pick the larger of the two chunks */ 101 + if (stolen[0].end - stolen[0].start > 102 + stolen[1].end - stolen[1].start) { 103 + base = stolen[0].start; 104 + dev_priv->gtt.stolen_size = stolen[0].end - stolen[0].start; 105 + } else { 106 + base = stolen[1].start; 107 + dev_priv->gtt.stolen_size = stolen[1].end - stolen[1].start; 108 + } 109 + 110 + if (stolen[0].start != stolen[1].start || 111 + stolen[0].end != stolen[1].end) { 112 + DRM_DEBUG_KMS("GTT within stolen memory at 0x%llx-0x%llx\n", 113 + (unsigned long long) gtt_start, 114 + (unsigned long long) gtt_end - 1); 115 + DRM_DEBUG_KMS("Stolen memory adjusted to 0x%x-0x%x\n", 116 + base, base + (u32) dev_priv->gtt.stolen_size - 1); 117 + } 118 + } 119 + 120 + 77 121 /* Verify that nothing else uses this physical address. Stolen 78 122 * memory should be reserved by the BIOS and hidden from the 79 123 * kernel. So if the region is already marked as busy, something
+3
drivers/gpu/drm/i915/i915_reg.h
··· 942 942 /* 943 943 * Instruction and interrupt control regs 944 944 */ 945 + #define PGTBL_CTL 0x02020 946 + #define PGTBL_ADDRESS_LO_MASK 0xfffff000 /* bits [31:12] */ 947 + #define PGTBL_ADDRESS_HI_MASK 0x000000f0 /* bits [35:32] (gen4) */ 945 948 #define PGTBL_ER 0x02024 946 949 #define RENDER_RING_BASE 0x02000 947 950 #define BSD_RING_BASE 0x04000
+14
drivers/gpu/drm/i915/intel_display.c
··· 11591 11591 DRM_INFO("applying inverted panel brightness quirk\n"); 11592 11592 } 11593 11593 11594 + /* Some VBT's incorrectly indicate no backlight is present */ 11595 + static void quirk_backlight_present(struct drm_device *dev) 11596 + { 11597 + struct drm_i915_private *dev_priv = dev->dev_private; 11598 + dev_priv->quirks |= QUIRK_BACKLIGHT_PRESENT; 11599 + DRM_INFO("applying backlight present quirk\n"); 11600 + } 11601 + 11594 11602 struct intel_quirk { 11595 11603 int device; 11596 11604 int subsystem_vendor; ··· 11667 11659 11668 11660 /* Acer Aspire 5336 */ 11669 11661 { 0x2a42, 0x1025, 0x048a, quirk_invert_brightness }, 11662 + 11663 + /* Acer C720 and C720P Chromebooks (Celeron 2955U) have backlights */ 11664 + { 0x0a06, 0x1025, 0x0a11, quirk_backlight_present }, 11665 + 11666 + /* Toshiba CB35 Chromebook (Celeron 2955U) */ 11667 + { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present }, 11670 11668 }; 11671 11669 11672 11670 static void intel_init_quirks(struct drm_device *dev)
+42
drivers/gpu/drm/i915/intel_dp.c
··· 28 28 #include <linux/i2c.h> 29 29 #include <linux/slab.h> 30 30 #include <linux/export.h> 31 + #include <linux/notifier.h> 32 + #include <linux/reboot.h> 31 33 #include <drm/drmP.h> 32 34 #include <drm/drm_crtc.h> 33 35 #include <drm/drm_crtc_helper.h> ··· 336 334 return PCH_PP_STATUS; 337 335 else 338 336 return VLV_PIPE_PP_STATUS(vlv_power_sequencer_pipe(intel_dp)); 337 + } 338 + 339 + /* Reboot notifier handler to shutdown panel power to guarantee T12 timing 340 + This function only applicable when panel PM state is not to be tracked */ 341 + static int edp_notify_handler(struct notifier_block *this, unsigned long code, 342 + void *unused) 343 + { 344 + struct intel_dp *intel_dp = container_of(this, typeof(* intel_dp), 345 + edp_notifier); 346 + struct drm_device *dev = intel_dp_to_dev(intel_dp); 347 + struct drm_i915_private *dev_priv = dev->dev_private; 348 + u32 pp_div; 349 + u32 pp_ctrl_reg, pp_div_reg; 350 + enum pipe pipe = vlv_power_sequencer_pipe(intel_dp); 351 + 352 + if (!is_edp(intel_dp) || code != SYS_RESTART) 353 + return 0; 354 + 355 + if (IS_VALLEYVIEW(dev)) { 356 + pp_ctrl_reg = VLV_PIPE_PP_CONTROL(pipe); 357 + pp_div_reg = VLV_PIPE_PP_DIVISOR(pipe); 358 + pp_div = I915_READ(pp_div_reg); 359 + pp_div &= PP_REFERENCE_DIVIDER_MASK; 360 + 361 + /* 0x1F write to PP_DIV_REG sets max cycle delay */ 362 + I915_WRITE(pp_div_reg, pp_div | 0x1F); 363 + I915_WRITE(pp_ctrl_reg, PANEL_UNLOCK_REGS | PANEL_POWER_OFF); 364 + msleep(intel_dp->panel_power_cycle_delay); 365 + } 366 + 367 + return 0; 339 368 } 340 369 341 370 static bool edp_have_panel_power(struct intel_dp *intel_dp) ··· 3740 3707 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); 3741 3708 edp_panel_vdd_off_sync(intel_dp); 3742 3709 drm_modeset_unlock(&dev->mode_config.connection_mutex); 3710 + if (intel_dp->edp_notifier.notifier_call) { 3711 + unregister_reboot_notifier(&intel_dp->edp_notifier); 3712 + intel_dp->edp_notifier.notifier_call = NULL; 3713 + } 3743 3714 } 3744 3715 kfree(intel_dig_port); 3745 3716 } ··· 4220 4183 fixed_mode->type |= DRM_MODE_TYPE_PREFERRED; 4221 4184 } 4222 4185 mutex_unlock(&dev->mode_config.mutex); 4186 + 4187 + if (IS_VALLEYVIEW(dev)) { 4188 + intel_dp->edp_notifier.notifier_call = edp_notify_handler; 4189 + register_reboot_notifier(&intel_dp->edp_notifier); 4190 + } 4223 4191 4224 4192 intel_panel_init(&intel_connector->panel, fixed_mode, downclock_mode); 4225 4193 intel_panel_setup_backlight(connector);
+2
drivers/gpu/drm/i915/intel_drv.h
··· 538 538 unsigned long last_power_on; 539 539 unsigned long last_backlight_off; 540 540 bool psr_setup_done; 541 + struct notifier_block edp_notifier; 542 + 541 543 bool use_tps3; 542 544 struct intel_connector *attached_connector; 543 545
+15 -14
drivers/gpu/drm/i915/intel_dsi.c
··· 117 117 /* bandgap reset is needed after everytime we do power gate */ 118 118 band_gap_reset(dev_priv); 119 119 120 + I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_ENTER); 121 + usleep_range(2500, 3000); 122 + 120 123 val = I915_READ(MIPI_PORT_CTRL(pipe)); 121 124 I915_WRITE(MIPI_PORT_CTRL(pipe), val | LP_OUTPUT_HOLD); 122 125 usleep_range(1000, 1500); 123 - I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_EXIT); 124 - usleep_range(2000, 2500); 126 + 127 + I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_EXIT); 128 + usleep_range(2500, 3000); 129 + 125 130 I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY); 126 - usleep_range(2000, 2500); 127 - I915_WRITE(MIPI_DEVICE_READY(pipe), 0x00); 128 - usleep_range(2000, 2500); 129 - I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY); 130 - usleep_range(2000, 2500); 131 + usleep_range(2500, 3000); 131 132 } 132 133 133 134 static void intel_dsi_enable(struct intel_encoder *encoder) ··· 272 271 273 272 DRM_DEBUG_KMS("\n"); 274 273 275 - I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_ENTER); 274 + I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_ENTER); 276 275 usleep_range(2000, 2500); 277 276 278 - I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_EXIT); 277 + I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_EXIT); 279 278 usleep_range(2000, 2500); 280 279 281 - I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_ENTER); 280 + I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_ENTER); 282 281 usleep_range(2000, 2500); 283 - 284 - val = I915_READ(MIPI_PORT_CTRL(pipe)); 285 - I915_WRITE(MIPI_PORT_CTRL(pipe), val & ~LP_OUTPUT_HOLD); 286 - usleep_range(1000, 1500); 287 282 288 283 if (wait_for(((I915_READ(MIPI_PORT_CTRL(pipe)) & AFE_LATCHOUT) 289 284 == 0x00000), 30)) 290 285 DRM_ERROR("DSI LP not going Low\n"); 286 + 287 + val = I915_READ(MIPI_PORT_CTRL(pipe)); 288 + I915_WRITE(MIPI_PORT_CTRL(pipe), val & ~LP_OUTPUT_HOLD); 289 + usleep_range(1000, 1500); 291 290 292 291 I915_WRITE(MIPI_DEVICE_READY(pipe), 0x00); 293 292 usleep_range(2000, 2500);
-6
drivers/gpu/drm/i915/intel_dsi_cmd.c
··· 404 404 else 405 405 cmd |= DPI_LP_MODE; 406 406 407 - /* DPI virtual channel?! */ 408 - 409 - mask = DPI_FIFO_EMPTY; 410 - if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(pipe)) & mask) == mask, 50)) 411 - DRM_ERROR("Timeout waiting for DPI FIFO empty.\n"); 412 - 413 407 /* clear bit */ 414 408 I915_WRITE(MIPI_INTR_STAT(pipe), SPL_PKT_SENT_INTERRUPT); 415 409
+6 -2
drivers/gpu/drm/i915/intel_panel.c
··· 1118 1118 int ret; 1119 1119 1120 1120 if (!dev_priv->vbt.backlight.present) { 1121 - DRM_DEBUG_KMS("native backlight control not available per VBT\n"); 1122 - return 0; 1121 + if (dev_priv->quirks & QUIRK_BACKLIGHT_PRESENT) { 1122 + DRM_DEBUG_KMS("no backlight present per VBT, but present per quirk\n"); 1123 + } else { 1124 + DRM_DEBUG_KMS("no backlight present per VBT\n"); 1125 + return 0; 1126 + } 1123 1127 } 1124 1128 1125 1129 /* set level and max in panel struct */