diff options
| -rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 42 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 2 |
2 files changed, 44 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 52fda950fd2a..075170d1844f 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
| @@ -28,6 +28,8 @@ | |||
| 28 | #include <linux/i2c.h> | 28 | #include <linux/i2c.h> |
| 29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
| 30 | #include <linux/export.h> | 30 | #include <linux/export.h> |
| 31 | #include <linux/notifier.h> | ||
| 32 | #include <linux/reboot.h> | ||
| 31 | #include <drm/drmP.h> | 33 | #include <drm/drmP.h> |
| 32 | #include <drm/drm_crtc.h> | 34 | #include <drm/drm_crtc.h> |
| 33 | #include <drm/drm_crtc_helper.h> | 35 | #include <drm/drm_crtc_helper.h> |
| @@ -336,6 +338,37 @@ static u32 _pp_stat_reg(struct intel_dp *intel_dp) | |||
| 336 | return VLV_PIPE_PP_STATUS(vlv_power_sequencer_pipe(intel_dp)); | 338 | return VLV_PIPE_PP_STATUS(vlv_power_sequencer_pipe(intel_dp)); |
| 337 | } | 339 | } |
| 338 | 340 | ||
| 341 | /* Reboot notifier handler to shutdown panel power to guarantee T12 timing | ||
| 342 | This function only applicable when panel PM state is not to be tracked */ | ||
| 343 | static int edp_notify_handler(struct notifier_block *this, unsigned long code, | ||
| 344 | void *unused) | ||
| 345 | { | ||
| 346 | struct intel_dp *intel_dp = container_of(this, typeof(* intel_dp), | ||
| 347 | edp_notifier); | ||
| 348 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | ||
| 349 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 350 | u32 pp_div; | ||
| 351 | u32 pp_ctrl_reg, pp_div_reg; | ||
| 352 | enum pipe pipe = vlv_power_sequencer_pipe(intel_dp); | ||
| 353 | |||
| 354 | if (!is_edp(intel_dp) || code != SYS_RESTART) | ||
| 355 | return 0; | ||
| 356 | |||
| 357 | if (IS_VALLEYVIEW(dev)) { | ||
| 358 | pp_ctrl_reg = VLV_PIPE_PP_CONTROL(pipe); | ||
| 359 | pp_div_reg = VLV_PIPE_PP_DIVISOR(pipe); | ||
| 360 | pp_div = I915_READ(pp_div_reg); | ||
| 361 | pp_div &= PP_REFERENCE_DIVIDER_MASK; | ||
| 362 | |||
| 363 | /* 0x1F write to PP_DIV_REG sets max cycle delay */ | ||
| 364 | I915_WRITE(pp_div_reg, pp_div | 0x1F); | ||
| 365 | I915_WRITE(pp_ctrl_reg, PANEL_UNLOCK_REGS | PANEL_POWER_OFF); | ||
| 366 | msleep(intel_dp->panel_power_cycle_delay); | ||
| 367 | } | ||
| 368 | |||
| 369 | return 0; | ||
| 370 | } | ||
| 371 | |||
| 339 | static bool edp_have_panel_power(struct intel_dp *intel_dp) | 372 | static bool edp_have_panel_power(struct intel_dp *intel_dp) |
| 340 | { | 373 | { |
| 341 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | 374 | struct drm_device *dev = intel_dp_to_dev(intel_dp); |
| @@ -3707,6 +3740,10 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder) | |||
| 3707 | drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); | 3740 | drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); |
| 3708 | edp_panel_vdd_off_sync(intel_dp); | 3741 | edp_panel_vdd_off_sync(intel_dp); |
| 3709 | drm_modeset_unlock(&dev->mode_config.connection_mutex); | 3742 | drm_modeset_unlock(&dev->mode_config.connection_mutex); |
| 3743 | if (intel_dp->edp_notifier.notifier_call) { | ||
| 3744 | unregister_reboot_notifier(&intel_dp->edp_notifier); | ||
| 3745 | intel_dp->edp_notifier.notifier_call = NULL; | ||
| 3746 | } | ||
| 3710 | } | 3747 | } |
| 3711 | kfree(intel_dig_port); | 3748 | kfree(intel_dig_port); |
| 3712 | } | 3749 | } |
| @@ -4184,6 +4221,11 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, | |||
| 4184 | } | 4221 | } |
| 4185 | mutex_unlock(&dev->mode_config.mutex); | 4222 | mutex_unlock(&dev->mode_config.mutex); |
| 4186 | 4223 | ||
| 4224 | if (IS_VALLEYVIEW(dev)) { | ||
| 4225 | intel_dp->edp_notifier.notifier_call = edp_notify_handler; | ||
| 4226 | register_reboot_notifier(&intel_dp->edp_notifier); | ||
| 4227 | } | ||
| 4228 | |||
| 4187 | intel_panel_init(&intel_connector->panel, fixed_mode, downclock_mode); | 4229 | intel_panel_init(&intel_connector->panel, fixed_mode, downclock_mode); |
| 4188 | intel_panel_setup_backlight(connector); | 4230 | intel_panel_setup_backlight(connector); |
| 4189 | 4231 | ||
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index eaa27ee9e367..f67340ed2c12 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
| @@ -538,6 +538,8 @@ struct intel_dp { | |||
| 538 | unsigned long last_power_on; | 538 | unsigned long last_power_on; |
| 539 | unsigned long last_backlight_off; | 539 | unsigned long last_backlight_off; |
| 540 | bool psr_setup_done; | 540 | bool psr_setup_done; |
| 541 | struct notifier_block edp_notifier; | ||
| 542 | |||
| 541 | bool use_tps3; | 543 | bool use_tps3; |
| 542 | struct intel_connector *attached_connector; | 544 | struct intel_connector *attached_connector; |
| 543 | 545 | ||
