drm/i915/vlv: T12 eDP panel timing enforcement during reboot.
Subsystems (2)
PATCH 1/1 drm/i915/vlv: T12 eDP panel timing enforcement during reboot.
From: Clint Taylor <[email protected]>
The panel power sequencer on vlv doesn't appear to accept changes to its T12 power down duration during warm reboots. This change forces a delay for warm reboots to the T12 panel timing as defined in the VBT table for the connected panel.
Ver2: removed redundant pr_crit(), commented magic value for pp_div_reg
Ver3: moved SYS_RESTART check earlier, new name for pp_div.
Ver4: Minor issue changes
--- drivers/gpu/drm/i915/intel_dp.c | 42 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 44 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +42 -0
@@ -28,6 +28,8 @@#include <linux/i2c.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/notifier.h> +#include <linux/reboot.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h>
@@ -302,6 +304,38 @@ static u32 _pp_stat_reg(struct intel_dp *intel_dp)return VLV_PIPE_PP_STATUS (vlv_power_sequencer_pipe (intel_dp)); } +/* Reboot notifier handler to shutdown panel power to guarantee T12 timing */ +static int edp_notify_handler (struct notifier_block *this,unsigned long code, +void *unused) +{ +struct intel_dp *intel_dp =container_of (this,typeof (* intel_dp), + edp_notifier); +struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp); +struct drm_device *dev = intel_dig_port->base.base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; +u32 pp_div; +u32 pp_ctrl_reg, pp_div_reg; +enum pipe pipe =vlv_power_sequencer_pipe (intel_dp); + +if (!is_edp (intel_dp) || code !=SYS_RESTART ) +return 0 ; + +if (IS_VALLEYVIEW (dev)) { + pp_ctrl_reg =VLV_PIPE_PP_CONTROL (pipe); + pp_div_reg =VLV_PIPE_PP_DIVISOR (pipe); + pp_div =I915_READ (VLV_PIPE_PP_DIVISOR (pipe)); + pp_div &=PP_REFERENCE_DIVIDER_MASK ; + +/* 0x1F write to PP_DIV_REG sets max cycle delay */ +I915_WRITE (pp_div_reg, pp_div |0x1F ); +I915_WRITE (pp_ctrl_reg, +PANEL_UNLOCK_REGS |PANEL_POWER_OFF ); +msleep (intel_dp->panel_power_cycle_delay); + } + +return 0 ; +} +static bool edp_have_panel_power (struct intel_dp *intel_dp) {struct drm_device *dev =intel_dp_to_dev (intel_dp);
@@ -3344,6 +3378,10 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)mutex_lock (&dev->mode_config.mutex);edp_panel_vdd_off_sync (intel_dp);mutex_unlock (&dev->mode_config.mutex); +if (intel_dp->edp_notifier.notifier_call) { +unregister_reboot_notifier (&intel_dp->edp_notifier); + intel_dp->edp_notifier.notifier_call =NULL ; + } }kfree (intel_dig_port); }
@@ -3782,6 +3820,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,if (is_edp (intel_dp)) {intel_dp_init_panel_power_timestamps (intel_dp);intel_dp_init_panel_power_sequencer (dev, intel_dp, &power_seq); +if (IS_VALLEYVIEW (dev)) { + intel_dp->edp_notifier.notifier_call = edp_notify_handler; +register_reboot_notifier (&intel_dp->edp_notifier); + } }intel_dp_aux_init (intel_dp, intel_connector);
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -510,6 +510,8 @@ struct intel_dp {unsigned long last_power_on;unsigned long last_backlight_off;bool psr_setup_done; +struct notifier_block edp_notifier; +bool use_tps3;struct intel_connector *attached_connector;
Signature · 1 line
1.7.9.5
Quoted 7 lines · On Tue, 03 Jun 2014, [email protected] wrote:
From: Clint Taylor <[email protected]>
The panel power sequencer on vlv doesn't appear to accept changes to its T12 power down duration during warm reboots. This change forces a delay for warm reboots to the T12 panel timing as defined in the VBT table for the connected panel.
Quoted 6 lines
Ver2: removed redundant
pr_crit(), commented magic value forpp_div_regVer3: moved
SYS_RESTARTcheck earlier, new name forpp_div.Ver4: Minor issue changes
Quoted 100 lines
Signed-off-by Clint Taylor <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 42 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 44 insertions(+)drivers/gpu/drm/i915/intel_dp.c +42
-0@@ -28,6 +28,8 @@#include <linux/i2c.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/notifier.h> +#include <linux/reboot.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> @@ -302,6 +304,38 @@ static u32 _pp_stat_reg(struct intel_dp *intel_dp)return VLV_PIPE_PP_STATUS (vlv_power_sequencer_pipe (intel_dp)); } +/* Reboot notifier handler to shutdown panel power to guarantee T12 timing */ +static int edp_notify_handler (struct notifier_block *this,unsigned long code, +void *unused) +{ +struct intel_dp *intel_dp =container_of (this,typeof (* intel_dp), + edp_notifier); +struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp); +struct drm_device *dev = intel_dig_port->base.base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; +u32 pp_div; +u32 pp_ctrl_reg, pp_div_reg; +enum pipe pipe =vlv_power_sequencer_pipe (intel_dp); + +if (!is_edp (intel_dp) || code !=SYS_RESTART ) +return 0 ; + +if (IS_VALLEYVIEW (dev)) { + pp_ctrl_reg =VLV_PIPE_PP_CONTROL (pipe); + pp_div_reg =VLV_PIPE_PP_DIVISOR (pipe); + pp_div =I915_READ (VLV_PIPE_PP_DIVISOR (pipe)); + pp_div &=PP_REFERENCE_DIVIDER_MASK ; + +/* 0x1F write to PP_DIV_REG sets max cycle delay */ +I915_WRITE (pp_div_reg, pp_div |0x1F ); +I915_WRITE (pp_ctrl_reg, +PANEL_UNLOCK_REGS |PANEL_POWER_OFF ); +msleep (intel_dp->panel_power_cycle_delay); + } + +return 0 ; +} +static bool edp_have_panel_power (struct intel_dp *intel_dp) {struct drm_device *dev =intel_dp_to_dev (intel_dp);@@ -3344,6 +3378,10 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)mutex_lock (&dev->mode_config.mutex);edp_panel_vdd_off_sync (intel_dp);mutex_unlock (&dev->mode_config.mutex); +if (intel_dp->edp_notifier.notifier_call) { +unregister_reboot_notifier (&intel_dp->edp_notifier); + intel_dp->edp_notifier.notifier_call =NULL ; + } }kfree (intel_dig_port); }@@ -3782,6 +3820,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,if (is_edp (intel_dp)) {intel_dp_init_panel_power_timestamps (intel_dp);intel_dp_init_panel_power_sequencer (dev, intel_dp, &power_seq); +if (IS_VALLEYVIEW (dev)) { + intel_dp->edp_notifier.notifier_call = edp_notify_handler; +register_reboot_notifier (&intel_dp->edp_notifier); + } }intel_dp_aux_init (intel_dp, intel_connector);drivers/gpu/drm/i915/intel_drv.h +2
-0@@ -510,6 +510,8 @@ struct intel_dp {unsigned long last_power_on;unsigned long last_backlight_off;bool psr_setup_done; +struct notifier_block edp_notifier; +bool use_tps3;struct intel_connector *attached_connector;Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Jani Nikula
maintainerQuoted 7 lines · On Tue, 03 Jun 2014, [email protected] wrote:
From: Clint Taylor <[email protected]>
The panel power sequencer on vlv doesn't appear to accept changes to its T12 power down duration during warm reboots. This change forces a delay for warm reboots to the T12 panel timing as defined in the VBT table for the connected panel.
Quoted 7 lines
Ver2: removed redundant
pr_crit(), commented magic value forpp_div_regVer3: moved
SYS_RESTARTcheck earlier, new name forpp_div.Ver4: Minor issue changes
Signed-off-by Clint Taylor <[email protected]>
Clint, the patch no longer applies cleanly. Please submit a rebased version on top of current -nightly. Sorry for the extra trouble.
BR,
Jani.
Quoted 99 lines
--- drivers/gpu/drm/i915/intel_dp.c | 42 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 44 insertions(+)drivers/gpu/drm/i915/intel_dp.c +42
-0@@ -28,6 +28,8 @@#include <linux/i2c.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/notifier.h> +#include <linux/reboot.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> @@ -302,6 +304,38 @@ static u32 _pp_stat_reg(struct intel_dp *intel_dp)return VLV_PIPE_PP_STATUS (vlv_power_sequencer_pipe (intel_dp)); } +/* Reboot notifier handler to shutdown panel power to guarantee T12 timing */ +static int edp_notify_handler (struct notifier_block *this,unsigned long code, +void *unused) +{ +struct intel_dp *intel_dp =container_of (this,typeof (* intel_dp), + edp_notifier); +struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp); +struct drm_device *dev = intel_dig_port->base.base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; +u32 pp_div; +u32 pp_ctrl_reg, pp_div_reg; +enum pipe pipe =vlv_power_sequencer_pipe (intel_dp); + +if (!is_edp (intel_dp) || code !=SYS_RESTART ) +return 0 ; + +if (IS_VALLEYVIEW (dev)) { + pp_ctrl_reg =VLV_PIPE_PP_CONTROL (pipe); + pp_div_reg =VLV_PIPE_PP_DIVISOR (pipe); + pp_div =I915_READ (VLV_PIPE_PP_DIVISOR (pipe)); + pp_div &=PP_REFERENCE_DIVIDER_MASK ; + +/* 0x1F write to PP_DIV_REG sets max cycle delay */ +I915_WRITE (pp_div_reg, pp_div |0x1F ); +I915_WRITE (pp_ctrl_reg, +PANEL_UNLOCK_REGS |PANEL_POWER_OFF ); +msleep (intel_dp->panel_power_cycle_delay); + } + +return 0 ; +} +static bool edp_have_panel_power (struct intel_dp *intel_dp) {struct drm_device *dev =intel_dp_to_dev (intel_dp);@@ -3344,6 +3378,10 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)mutex_lock (&dev->mode_config.mutex);edp_panel_vdd_off_sync (intel_dp);mutex_unlock (&dev->mode_config.mutex); +if (intel_dp->edp_notifier.notifier_call) { +unregister_reboot_notifier (&intel_dp->edp_notifier); + intel_dp->edp_notifier.notifier_call =NULL ; + } }kfree (intel_dig_port); }@@ -3782,6 +3820,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,if (is_edp (intel_dp)) {intel_dp_init_panel_power_timestamps (intel_dp);intel_dp_init_panel_power_sequencer (dev, intel_dp, &power_seq); +if (IS_VALLEYVIEW (dev)) { + intel_dp->edp_notifier.notifier_call = edp_notify_handler; +register_reboot_notifier (&intel_dp->edp_notifier); + } }intel_dp_aux_init (intel_dp, intel_connector);drivers/gpu/drm/i915/intel_drv.h +2
-0@@ -510,6 +510,8 @@ struct intel_dp {unsigned long last_power_on;unsigned long last_backlight_off;bool psr_setup_done; +struct notifier_block edp_notifier; +bool use_tps3;struct intel_connector *attached_connector;Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
PATCH 1/1 drm/i915/vlv: T12 eDP panel timing enforcement during reboot
From: Clint Taylor <[email protected]>
The panel power sequencer on vlv doesn't appear to accept changes to its T12 power down duration during warm reboots. This change forces a delay for warm reboots to the T12 panel timing as defined in the VBT table for the connected panel.
Ver2: removed redundant pr_crit(), commented magic value for pp_div_reg
Ver3: moved SYS_RESTART check earlier, new name for pp_div.
Ver4: Minor issue changes
---
I ended up doing the rebase myself, but I'd like to have a quick review before pushing.
Thanks,
Jani.
--- drivers/gpu/drm/i915/intel_dp.c | 40 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 42 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +40 -0
@@ -28,6 +28,8 @@#include <linux/i2c.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/notifier.h> +#include <linux/reboot.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h>
@@ -336,6 +338,36 @@ static u32 _pp_stat_reg(struct intel_dp *intel_dp)return VLV_PIPE_PP_STATUS (vlv_power_sequencer_pipe (intel_dp)); } +/* Reboot notifier handler to shutdown panel power to guarantee T12 timing */ +static int edp_notify_handler (struct notifier_block *this,unsigned long code, +void *unused) +{ +struct intel_dp *intel_dp =container_of (this,typeof (* intel_dp), + edp_notifier); +struct drm_device *dev =intel_dp_to_dev (intel_dp); +struct drm_i915_private *dev_priv = dev->dev_private; +u32 pp_div; +u32 pp_ctrl_reg, pp_div_reg; +enum pipe pipe =vlv_power_sequencer_pipe (intel_dp); + +if (!is_edp (intel_dp) || code !=SYS_RESTART ) +return 0 ; + +if (IS_VALLEYVIEW (dev)) { + pp_ctrl_reg =VLV_PIPE_PP_CONTROL (pipe); + pp_div_reg =VLV_PIPE_PP_DIVISOR (pipe); + pp_div =I915_READ (VLV_PIPE_PP_DIVISOR (pipe)); + pp_div &=PP_REFERENCE_DIVIDER_MASK ; + +/* 0x1F write to PP_DIV_REG sets max cycle delay */ +I915_WRITE (pp_div_reg, pp_div |0x1F ); +I915_WRITE (pp_ctrl_reg,PANEL_UNLOCK_REGS |PANEL_POWER_OFF ); +msleep (intel_dp->panel_power_cycle_delay); + } + +return 0 ; +} +static bool edp_have_panel_power (struct intel_dp *intel_dp) {struct drm_device *dev =intel_dp_to_dev (intel_dp);
@@ -3785,6 +3817,10 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)drm_modeset_lock (&dev->mode_config.connection_mutex,NULL );edp_panel_vdd_off_sync (intel_dp);drm_modeset_unlock (&dev->mode_config.connection_mutex); +if (intel_dp->edp_notifier.notifier_call) { +unregister_reboot_notifier (&intel_dp->edp_notifier); + intel_dp->edp_notifier.notifier_call =NULL ; + } }kfree (intel_dig_port); }
@@ -4353,6 +4389,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,if (is_edp (intel_dp)) {intel_dp_init_panel_power_timestamps (intel_dp);intel_dp_init_panel_power_sequencer (dev, intel_dp, &power_seq); +if (IS_VALLEYVIEW (dev)) { + intel_dp->edp_notifier.notifier_call = edp_notify_handler; +register_reboot_notifier (&intel_dp->edp_notifier); + } }intel_dp_aux_init (intel_dp, intel_connector);
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -541,6 +541,8 @@ struct intel_dp {unsigned long last_power_cycle;unsigned long last_power_on;unsigned long last_backlight_off; +struct notifier_block edp_notifier; +bool use_tps3;struct intel_connector *attached_connector;
Signature · 1 line
2.0.0
Re: [PATCH] drm/i915/vlv: T12 eDP panel timing enforcement during reboot
2014-07-02 5:35 GMT-03:00 Jani Nikula <[email protected]>:
Quoted 49 lines
From: Clint Taylor <[email protected]>
The panel power sequencer on vlv doesn't appear to accept changes to its T12 power down duration during warm reboots. This change forces a delay for warm reboots to the T12 panel timing as defined in the VBT table for the connected panel.
Ver2: removed redundant
pr_crit(), commented magic value forpp_div_regVer3: moved
SYS_RESTARTcheck earlier, new name forpp_div.Ver4: Minor issue changes
Signed-off-by Clint Taylor <[email protected]>[Jani: rebased on current -nightly.]Signed-off-by Jani Nikula <[email protected]>---
I ended up doing the rebase myself, but I'd like to have a quick review before pushing.
Thanks,
Jani.--- drivers/gpu/drm/i915/intel_dp.c | 40 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 42 insertions(+)drivers/gpu/drm/i915/intel_dp.c +5
-0@@ -28,6 +28,8 @@#include <linux/i2c.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/notifier.h> +#include <linux/reboot.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> @@ -336,6 +338,36 @@ static u32 _pp_stat_reg(struct intel_dp *intel_dp)return VLV_PIPE_PP_STATUS (vlv_power_sequencer_pipe (intel_dp)); } +/* Reboot notifier handler to shutdown panel power to guarantee T12 timing */ +static int edp_notify_handler (struct notifier_block *this,unsigned long code, +void *unused)
drivers/gpu/drm/i915/intel_dp.c static u32 _pp_stat_reg(struct intel_dp *intel_dp) · line 353
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10
-0+{ +struct intel_dp *intel_dp =container_of (this,typeof (* intel_dp), + edp_notifier); +struct drm_device *dev =intel_dp_to_dev (intel_dp); +struct drm_i915_private *dev_priv = dev->dev_private; +u32 pp_div; +u32 pp_ctrl_reg, pp_div_reg; +enum pipe pipe =vlv_power_sequencer_pipe (intel_dp); + +if (!is_edp (intel_dp) || code !=SYS_RESTART )
What if someone does a power off and _very quickly_ starts the system again? =P <insert same statement for the other "code" possibilities>
Also, depending based on the suggestions below, you may not need the is_edp() check (or you may want to convert it to a WARN).
drivers/gpu/drm/i915/intel_dp.c static u32 _pp_stat_reg(struct intel_dp *intel_dp) · line 356
Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0+return 0 ; + +if (IS_VALLEYVIEW (dev)) {
This check is not really needed. It could also be an early return or a WARN.
drivers/gpu/drm/i915/intel_dp.c static u32 _pp_stat_reg(struct intel_dp *intel_dp) · line 359
Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0+ pp_ctrl_reg =VLV_PIPE_PP_CONTROL (pipe); + pp_div_reg =VLV_PIPE_PP_DIVISOR (pipe); + pp_div =I915_READ (VLV_PIPE_PP_DIVISOR (pipe));
Or "pp_div = I915_READ(pp_div_reg);", since we just defined it :)
drivers/gpu/drm/i915/intel_dp.c static u32 _pp_stat_reg(struct intel_dp *intel_dp) · line 364
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +5
-0+ pp_div &=PP_REFERENCE_DIVIDER_MASK ; + +/* 0x1F write to PP_DIV_REG sets max cycle delay */ +I915_WRITE (pp_div_reg, pp_div |0x1F ); +I915_WRITE (pp_ctrl_reg,PANEL_UNLOCK_REGS |PANEL_POWER_OFF );
So this is basically turning the panel off and turning the "force VDD" bit off too, and we're not putting any power domain references back. Even though this might not be a big problem since we're shutting down the machine anyway, did we attach a serial cable and check if this won't print any WARNs while shutting down? Shouldn't we try to make this function call the other functions that shut down stuff instead of forcing the panel down here?
Quoted 21 lines
drivers/gpu/drm/i915/intel_dp.c +10
-0+msleep (intel_dp->panel_power_cycle_delay); + } + +return 0 ; +} +static bool edp_have_panel_power (struct intel_dp *intel_dp) {struct drm_device *dev =intel_dp_to_dev (intel_dp);@@ -3785,6 +3817,10 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)drm_modeset_lock (&dev->mode_config.connection_mutex,NULL );edp_panel_vdd_off_sync (intel_dp);drm_modeset_unlock (&dev->mode_config.connection_mutex); +if (intel_dp->edp_notifier.notifier_call) { +unregister_reboot_notifier (&intel_dp->edp_notifier); + intel_dp->edp_notifier.notifier_call =NULL ; + } }kfree (intel_dig_port); }
drivers/gpu/drm/i915/intel_dp.c intel_dp_init_connector(struct intel_digital_port *intel_dig_port, · line 4394
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0@@ -4353,6 +4389,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,if (is_edp (intel_dp)) {intel_dp_init_panel_power_timestamps (intel_dp);intel_dp_init_panel_power_sequencer (dev, intel_dp, &power_seq); +if (IS_VALLEYVIEW (dev)) { + intel_dp->edp_notifier.notifier_call = edp_notify_handler; +register_reboot_notifier (&intel_dp->edp_notifier);
Why not put this inside intel_edp_init_connector? If you keep it here, you also have to undo the notifier at the point intel_dp_init_connector returns false (a few lines below). If you move to the _edp version, then it depends on where inside _edp_init_connector you put this..
Quoted 24 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0+ } }intel_dp_aux_init (intel_dp, intel_connector);drivers/gpu/drm/i915/intel_drv.h +2
-1@@ -541,6 +541,8 @@ struct intel_dp {unsigned long last_power_cycle;unsigned long last_power_on;unsigned long last_backlight_off; +struct notifier_block edp_notifier; +bool use_tps3;struct intel_connector *attached_connector; --2.0.0
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Paulo Zanoni
Re: [PATCH] drm/i915/vlv: T12 eDP panel timing enforcement during reboot
Quoted 47 lines · Paulo Zanoni
2014-07-02 5:35 GMT-03:00 Jani Nikula <[email protected]>:
Quoted 46 lines
From: Clint Taylor <[email protected]>
The panel power sequencer on vlv doesn't appear to accept changes to its T12 power down duration during warm reboots. This change forces a delay for warm reboots to the T12 panel timing as defined in the VBT table for the connected panel.
Ver2: removed redundant
pr_crit(), commented magic value forpp_div_regVer3: moved
SYS_RESTARTcheck earlier, new name forpp_div.Ver4: Minor issue changes
Signed-off-by Clint Taylor <[email protected]>[Jani: rebased on current -nightly.]Signed-off-by Jani Nikula <[email protected]>---
I ended up doing the rebase myself, but I'd like to have a quick review before pushing.
Thanks,
Jani.--- drivers/gpu/drm/i915/intel_dp.c | 40 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 42 insertions(+)drivers/gpu/drm/i915/intel_dp.c +2
-0@@ -28,6 +28,8 @@#include <linux/i2c.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/notifier.h> +#include <linux/reboot.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> @@ -336,6 +338,36 @@ static u32 _pp_stat_reg(struct intel_dp *intel_dp)return VLV_PIPE_PP_STATUS (vlv_power_sequencer_pipe (intel_dp)); }
Quoted 17 lines
drivers/gpu/drm/i915/intel_dp.c static u32 _pp_stat_reg(struct intel_dp *intel_dp) · line 353
Quoted 13 lines
drivers/gpu/drm/i915/intel_dp.c +13
-0+/* Reboot notifier handler to shutdown panel power to guarantee T12 timing */ +static int edp_notify_handler (struct notifier_block *this,unsigned long code, +void *unused) +{ +struct intel_dp *intel_dp =container_of (this,typeof (* intel_dp), + edp_notifier); +struct drm_device *dev =intel_dp_to_dev (intel_dp); +struct drm_i915_private *dev_priv = dev->dev_private; +u32 pp_div; +u32 pp_ctrl_reg, pp_div_reg; +enum pipe pipe =vlv_power_sequencer_pipe (intel_dp); + +if (!is_edp (intel_dp) || code !=SYS_RESTART )What if someone does a power off and
_veryquickly_starts the system again? =P <insert same statement for the other "code" possibilities>
If someone removes and applies power within ~300ms this W/A will break down and the power sequence will not meet the eDP T12 timing. Since the PPS sequencer does not allow modifications to the default time intervals during the initial sequence the only way to guarantee we meet T12 time would be to delay display block power ungate for 300ms. Further delay of the boot time was not an acceptable solution for the customers.
Quoted 8 lines
Also, depending based on the suggestions below, you may not need the
is_edp()check (or you may want to convert it to a WARN).drivers/gpu/drm/i915/intel_dp.c static u32 _pp_stat_reg(struct intel_dp *intel_dp) · line 356
Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0+return 0 ; + +if (IS_VALLEYVIEW (dev)) {This check is not really needed. It could also be an early return or a WARN.
Since we currently don't handle PCH offsets this was a safe way to allowing adding of the PCH functionality later if necessary.
Quoted 7 lines
drivers/gpu/drm/i915/intel_dp.c static u32 _pp_stat_reg(struct intel_dp *intel_dp) · line 359
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0+ pp_ctrl_reg =VLV_PIPE_PP_CONTROL (pipe); + pp_div_reg =VLV_PIPE_PP_DIVISOR (pipe); + pp_div =I915_READ (VLV_PIPE_PP_DIVISOR (pipe));Or "
pp_div=I915_READ(pp_div_reg);", since we just defined it :)
Agreed that's another way to do the same thing.
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c static u32 _pp_stat_reg(struct intel_dp *intel_dp) · line 364
Quoted 7 lines
drivers/gpu/drm/i915/intel_dp.c +5
-0+ pp_div &=PP_REFERENCE_DIVIDER_MASK ; + +/* 0x1F write to PP_DIV_REG sets max cycle delay */ +I915_WRITE (pp_div_reg, pp_div |0x1F ); +I915_WRITE (pp_ctrl_reg,PANEL_UNLOCK_REGS |PANEL_POWER_OFF );
Quoted 7 lines
So this is basically turning the panel off and turning the "force VDD" bit off too, and we're not putting any power domain references back. Even though this might not be a big problem since we're shutting down the machine anyway, did we attach a serial cable and check if this won't print any WARNs while shutting down? Shouldn't we try to make this function call the other functions that shut down stuff instead of forcing the panel down here?
Development of this W/A was done with serial port attached. This function is the last method called in the I915 driver before power is removed. At reboot notifier time there is no error handling possible calling the normal shutdown functions does more housekeeping then we need for a system that will not have power in < 2 ms.
Quoted 27 lines
Quoted 27 lines
drivers/gpu/drm/i915/intel_dp.c +11
-0+msleep (intel_dp->panel_power_cycle_delay); + } + +return 0 ; +} +static bool edp_have_panel_power (struct intel_dp *intel_dp) {struct drm_device *dev =intel_dp_to_dev (intel_dp);@@ -3785,6 +3817,10 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)drm_modeset_lock (&dev->mode_config.connection_mutex,NULL );edp_panel_vdd_off_sync (intel_dp);drm_modeset_unlock (&dev->mode_config.connection_mutex); +if (intel_dp->edp_notifier.notifier_call) { +unregister_reboot_notifier (&intel_dp->edp_notifier); + intel_dp->edp_notifier.notifier_call =NULL ; + } }kfree (intel_dig_port); }@@ -4353,6 +4389,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,if (is_edp (intel_dp)) {intel_dp_init_panel_power_timestamps (intel_dp);intel_dp_init_panel_power_sequencer (dev, intel_dp, &power_seq); +if (IS_VALLEYVIEW (dev)) {
Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c intel_dp_init_connector(struct intel_digital_port *intel_dig_port, · line 4394
Quoted 2 lines
drivers/gpu/drm/i915/intel_dp.c +2
-0+ intel_dp->edp_notifier.notifier_call = edp_notify_handler; +register_reboot_notifier (&intel_dp->edp_notifier);Why not put this inside
intel_edp_init_connector? If you keep it here, you also have to undo the notifier at the pointintel_dp_init_connectorreturns false (a few lines below). If you move to the_edpversion, then it depends on where inside_edp_init_connectoryou put this..
Agreed that if the device does not have DPCD and a ghost is created this notifier would need to be unregistered.
Quoted 28 lines
Quoted 25 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0+ } }intel_dp_aux_init (intel_dp, intel_connector);drivers/gpu/drm/i915/intel_drv.h +2
-1@@ -541,6 +541,8 @@ struct intel_dp {unsigned long last_power_cycle;unsigned long last_power_on;unsigned long last_backlight_off; +struct notifier_block edp_notifier; +bool use_tps3;struct intel_connector *attached_connector; --2.0.0
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/vlv: T12 eDP panel timing enforcement during reboot
2014-07-03 19:07 GMT-03:00 Clint Taylor <[email protected]>:
Quoted 75 lines · Paulo Zanoni
Quoted 65 lines
2014-07-02 5:35 GMT-03:00 Jani Nikula <[email protected]>:
Quoted 63 lines
From: Clint Taylor <[email protected]>
The panel power sequencer on vlv doesn't appear to accept changes to its T12 power down duration during warm reboots. This change forces a delay for warm reboots to the T12 panel timing as defined in the VBT table for the connected panel.
Ver2: removed redundant
pr_crit(), commented magic value forpp_div_regVer3: moved
SYS_RESTARTcheck earlier, new name forpp_div.Ver4: Minor issue changes
Signed-off-by Clint Taylor <[email protected]>[Jani: rebased on current -nightly.]Signed-off-by Jani Nikula <[email protected]>---
I ended up doing the rebase myself, but I'd like to have a quick review before pushing.
Thanks,
Jani.--- drivers/gpu/drm/i915/intel_dp.c | 40 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 42 insertions(+)drivers/gpu/drm/i915/intel_dp.c +3
-0@@ -28,6 +28,8 @@#include <linux/i2c.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/notifier.h> +#include <linux/reboot.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> @@ -336,6 +338,36 @@ static u32 _pp_stat_reg(struct intel_dp *intel_dp)return VLV_PIPE_PP_STATUS (vlv_power_sequencer_pipe (intel_dp)); } +/* Reboot notifier handler to shutdown panel power to guarantee T12 timing */
+static int edp_notify_handler(structnotifier_block*this, unsigned long code,drivers/gpu/drm/i915/intel_dp.c +3
-0+ void *unused) +{ + struct intel_dp *intel_dp = container_of(this, typeof(*
intel_dp),drivers/gpu/drm/i915/intel_dp.c +5
-0+ edp_notifier); +struct drm_device *dev =intel_dp_to_dev (intel_dp); +struct drm_i915_private *dev_priv = dev->dev_private; +u32 pp_div; +u32 pp_ctrl_reg, pp_div_reg;Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c static u32 _pp_stat_reg(struct intel_dp *intel_dp) · line 353
Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0+enum pipe pipe =vlv_power_sequencer_pipe (intel_dp); + +if (!is_edp (intel_dp) || code !=SYS_RESTART )What if someone does a power off and
_veryquickly_starts the system again? =P
<insert same statement for the other "code" possibilities>
Quoted 7 lines
If someone removes and applies power within ~300ms this W/A will break down and the power sequence will not meet the eDP T12 timing. Since the PPS sequencer does not allow modifications to the default time intervals during the initial sequence the only way to guarantee we meet T12 time would be to delay display block power ungate for 300ms. Further delay of the boot time was not an acceptable solution for the customers.
My suggestion here was just to not-return in more cases, instead of only SYS_RESTART.
Quoted 48 lines
Quoted 11 lines
Also, depending based on the suggestions below, you may not need the
is_edp()check (or you may want to convert it to a WARN).drivers/gpu/drm/i915/intel_dp.c static u32 _pp_stat_reg(struct intel_dp *intel_dp) · line 356
Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0+return 0 ; + +if (IS_VALLEYVIEW (dev)) {This check is not really needed. It could also be an early return or a WARN.
Since we currently don't handle PCH offsets this was a safe way to allowing adding of the PCH functionality later if necessary.
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c static u32 _pp_stat_reg(struct intel_dp *intel_dp) · line 359
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0+ pp_ctrl_reg =VLV_PIPE_PP_CONTROL (pipe); + pp_div_reg =VLV_PIPE_PP_DIVISOR (pipe); + pp_div =I915_READ (VLV_PIPE_PP_DIVISOR (pipe));Or "
pp_div=I915_READ(pp_div_reg);", since we just defined it :)Agreed that's another way to do the same thing.
Quoted 10 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +5
-0+ pp_div &=PP_REFERENCE_DIVIDER_MASK ; + +/* 0x1F write to PP_DIV_REG sets max cycle delay */ +I915_WRITE (pp_div_reg, pp_div |0x1F ); + I915_WRITE(pp_ctrl_reg, PANEL_UNLOCK_REGS |
PANEL_POWER_OFF);Quoted 7 lines
So this is basically turning the panel off and turning the "force VDD" bit off too, and we're not putting any power domain references back. Even though this might not be a big problem since we're shutting down the machine anyway, did we attach a serial cable and check if this won't print any WARNs while shutting down? Shouldn't we try to make this function call the other functions that shut down stuff instead of forcing the panel down here?
Quoted 5 lines
Development of this W/A was done with serial port attached. This function is the last method called in the I915 driver before power is removed. At reboot notifier time there is no error handling possible calling the normal shutdown functions does more housekeeping then we need for a system that will not have power in < 2 ms.
For this code, even if we don't change it, I think we should at least put a comment here describing this is an "acceptable" solution for a machine shutdown, but that this code should not be reused in other cases since we're forcing a panel shutdown without respecting the PM references or using the standard ways of waiting for the timers. Programmers from the future love code refactors, and I fear they may start using this function for more cases than the current one, so the comment may prevent future bugs.
Quoted 81 lines
Quoted 37 lines
Quoted 37 lines
drivers/gpu/drm/i915/intel_dp.c +10
-0+msleep (intel_dp->panel_power_cycle_delay); + } + +return 0 ; +} +static bool edp_have_panel_power (struct intel_dp *intel_dp) {struct drm_device *dev =intel_dp_to_dev (intel_dp);@@ -3785,6 +3817,10 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)drm_modeset_lock (&dev->mode_config.connection_mutex,NULL );edp_panel_vdd_off_sync (intel_dp);drm_modeset_unlock (&dev->mode_config.connection_mutex); +if (intel_dp->edp_notifier.notifier_call) { +unregister_reboot_notifier (&intel_dp->edp_notifier); + intel_dp->edp_notifier.notifier_call =NULL ; + }} kfree(intel_dig_port);}
drivers/gpu/drm/i915/intel_dp.c +3
-0@@ -4353,6 +4389,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, if (is_edp(intel_dp)) {intel_dp_init_panel_power_timestamps (intel_dp);intel_dp_init_panel_power_sequencer (dev, intel_dp, &power_seq); +if (IS_VALLEYVIEW (dev)) { + intel_dp->edp_notifier.notifier_call = edp_notify_handler; +Quoted 9 lines
Quoted 1 line
register_reboot_notifier(&intel_dp->edp_notifier);Why not put this inside
intel_edp_init_connector? If you keep it here, you also have to undo the notifier at the pointintel_dp_init_connectorreturns false (a few lines below). If you move to the_edpversion, then it depends on where inside_edp_init_connectoryou put this..Agreed that if the device does not have DPCD and a ghost is created this notifier would need to be unregistered.
Quoted 30 lines
Quoted 26 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0+ } }intel_dp_aux_init (intel_dp, intel_connector);drivers/gpu/drm/i915/intel_drv.h +2
-1@@ -541,6 +541,8 @@ struct intel_dp {unsigned long last_power_cycle;unsigned long last_power_on;unsigned long last_backlight_off; +struct notifier_block edp_notifier; +bool use_tps3;struct intel_connector *attached_connector; --2.0.0
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Paulo Zanoni
Re: [PATCH] drm/i915/vlv: T12 eDP panel timing enforcement during reboot
Quoted 84 lines · Paulo Zanoni
2014-07-03 19:07 GMT-03:00 Clint Taylor <[email protected]>:
Quoted 75 lines · Paulo Zanoni
Quoted 65 lines
2014-07-02 5:35 GMT-03:00 Jani Nikula <[email protected]>:
Quoted 63 lines
From: Clint Taylor <[email protected]>
The panel power sequencer on vlv doesn't appear to accept changes to its T12 power down duration during warm reboots. This change forces a delay for warm reboots to the T12 panel timing as defined in the VBT table for the connected panel.
Ver2: removed redundant
pr_crit(), commented magic value forpp_div_regVer3: moved
SYS_RESTARTcheck earlier, new name forpp_div.Ver4: Minor issue changes
Signed-off-by Clint Taylor <[email protected]>[Jani: rebased on current -nightly.]Signed-off-by Jani Nikula <[email protected]>---
I ended up doing the rebase myself, but I'd like to have a quick review before pushing.
Thanks,
Jani.--- drivers/gpu/drm/i915/intel_dp.c | 40 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 42 insertions(+)drivers/gpu/drm/i915/intel_dp.c +3
-0@@ -28,6 +28,8 @@#include <linux/i2c.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/notifier.h> +#include <linux/reboot.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> @@ -336,6 +338,36 @@ static u32 _pp_stat_reg(struct intel_dp *intel_dp)return VLV_PIPE_PP_STATUS (vlv_power_sequencer_pipe (intel_dp)); } +/* Reboot notifier handler to shutdown panel power to guarantee T12 timing */
+static int edp_notify_handler(structnotifier_block*this, unsigned long code,drivers/gpu/drm/i915/intel_dp.c +3
-0+ void *unused) +{ + struct intel_dp *intel_dp = container_of(this, typeof(*
intel_dp),drivers/gpu/drm/i915/intel_dp.c +5
-0+ edp_notifier); +struct drm_device *dev =intel_dp_to_dev (intel_dp); +struct drm_i915_private *dev_priv = dev->dev_private; +u32 pp_div; +u32 pp_ctrl_reg, pp_div_reg;Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c static u32 _pp_stat_reg(struct intel_dp *intel_dp) · line 353
Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0+enum pipe pipe =vlv_power_sequencer_pipe (intel_dp); + +if (!is_edp (intel_dp) || code !=SYS_RESTART )What if someone does a power off and
_veryquickly_starts the system again? =P
<insert same statement for the other "code" possibilities>Quoted 7 lines
If someone removes and applies power within ~300ms this W/A will break down and the power sequence will not meet the eDP T12 timing. Since the PPS sequencer does not allow modifications to the default time intervals during the initial sequence the only way to guarantee we meet T12 time would be to delay display block power ungate for 300ms. Further delay of the boot time was not an acceptable solution for the customers.
Quoted 2 lines
My suggestion here was just to not-return in more cases, instead of only
SYS_RESTART.
#define SYS_DOWN 0x0001 /* Notify of system down */
#define SYS_RESTART SYS_DOWN
#define SYS_HALT 0x0002 /* Notify of system halt */
#define SYS_POWER_OFF 0x0003 /* Notify of system power off */
The only real option would be just to ignore the code parameter as the only other values are full power offs.
Quoted 150 lines
Quoted 50 lines
Quoted 6 lines
Also, depending based on the suggestions below, you may not need the
is_edp()check (or you may want to convert it to a WARN).Quoted 7 lines
drivers/gpu/drm/i915/intel_dp.c static u32 _pp_stat_reg(struct intel_dp *intel_dp) · line 356
Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0+return 0 ; + +if (IS_VALLEYVIEW (dev)) {This check is not really needed. It could also be an early return or a WARN.
Since we currently don't handle PCH offsets this was a safe way to allowing adding of the PCH functionality later if necessary.
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c static u32 _pp_stat_reg(struct intel_dp *intel_dp) · line 359
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0+ pp_ctrl_reg =VLV_PIPE_PP_CONTROL (pipe); + pp_div_reg =VLV_PIPE_PP_DIVISOR (pipe); + pp_div =I915_READ (VLV_PIPE_PP_DIVISOR (pipe));Or "
pp_div=I915_READ(pp_div_reg);", since we just defined it :)Agreed that's another way to do the same thing.
Quoted 10 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +5
-0+ pp_div &=PP_REFERENCE_DIVIDER_MASK ; + +/* 0x1F write to PP_DIV_REG sets max cycle delay */ +I915_WRITE (pp_div_reg, pp_div |0x1F ); + I915_WRITE(pp_ctrl_reg, PANEL_UNLOCK_REGS |
PANEL_POWER_OFF);Quoted 7 lines
So this is basically turning the panel off and turning the "force VDD" bit off too, and we're not putting any power domain references back. Even though this might not be a big problem since we're shutting down the machine anyway, did we attach a serial cable and check if this won't print any WARNs while shutting down? Shouldn't we try to make this function call the other functions that shut down stuff instead of forcing the panel down here?
Quoted 5 lines
Development of this W/A was done with serial port attached. This function is the last method called in the I915 driver before power is removed. At reboot notifier time there is no error handling possible calling the normal shutdown functions does more housekeeping then we need for a system that will not have power in < 2 ms.
For this code, even if we don't change it, I think we should at least put a comment here describing this is an "acceptable" solution for a machine shutdown, but that this code should not be reused in other cases since we're forcing a panel shutdown without respecting the PM references or using the standard ways of waiting for the timers. Programmers from the future love code refactors, and I fear they may start using this function for more cases than the current one, so the comment may prevent future bugs.
Quoted 81 lines
Quoted 37 lines
Quoted 37 lines
drivers/gpu/drm/i915/intel_dp.c +10
-0+msleep (intel_dp->panel_power_cycle_delay); + } + +return 0 ; +} +static bool edp_have_panel_power (struct intel_dp *intel_dp) {struct drm_device *dev =intel_dp_to_dev (intel_dp);@@ -3785,6 +3817,10 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)drm_modeset_lock (&dev->mode_config.connection_mutex,NULL );edp_panel_vdd_off_sync (intel_dp);drm_modeset_unlock (&dev->mode_config.connection_mutex); +if (intel_dp->edp_notifier.notifier_call) { +unregister_reboot_notifier (&intel_dp->edp_notifier); + intel_dp->edp_notifier.notifier_call =NULL ; + }} kfree(intel_dig_port);}
drivers/gpu/drm/i915/intel_dp.c +3
-0@@ -4353,6 +4389,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, if (is_edp(intel_dp)) {intel_dp_init_panel_power_timestamps (intel_dp);intel_dp_init_panel_power_sequencer (dev, intel_dp, &power_seq); +if (IS_VALLEYVIEW (dev)) { + intel_dp->edp_notifier.notifier_call = edp_notify_handler; +Quoted 9 lines
Quoted 1 line
register_reboot_notifier(&intel_dp->edp_notifier);Why not put this inside
intel_edp_init_connector? If you keep it here, you also have to undo the notifier at the pointintel_dp_init_connectorreturns false (a few lines below). If you move to the_edpversion, then it depends on where inside_edp_init_connectoryou put this..Agreed that if the device does not have DPCD and a ghost is created this notifier would need to be unregistered.
Quoted 30 lines
Quoted 26 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0+ } }intel_dp_aux_init (intel_dp, intel_connector);drivers/gpu/drm/i915/intel_drv.h +2
-1@@ -541,6 +541,8 @@ struct intel_dp {unsigned long last_power_cycle;unsigned long last_power_on;unsigned long last_backlight_off; +struct notifier_block edp_notifier; +bool use_tps3;struct intel_connector *attached_connector; --2.0.0
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915/vlv: T12 eDP panel timing enforcement during reboot
In reply to Jani NikulaQuoted 13 lines · Jani Nikula
From: Clint Taylor <[email protected]>
The panel power sequencer on vlv doesn't appear to accept changes to its T12 power down duration during warm reboots. This change forces a delay for warm reboots to the T12 panel timing as defined in the VBT table for the connected panel.
Ver2: removed redundant
pr_crit(), commented magic value forpp_div_regVer3: moved
SYS_RESTARTcheck earlier, new name forpp_div.Ver4: Minor issue changes
Quoted 8 lines
Signed-off-by Clint Taylor <[email protected]>[Jani: rebased on current -nightly.]Signed-off-by Jani Nikula <[email protected]>---
I ended up doing the rebase myself, but I'd like to have a quick review before pushing.
Quick review complete. Everything appears OK.
Quoted 94 lines
Thanks,
Jani.--- drivers/gpu/drm/i915/intel_dp.c | 40 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 42 insertions(+)drivers/gpu/drm/i915/intel_dp.c +40
-0@@ -28,6 +28,8 @@#include <linux/i2c.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/notifier.h> +#include <linux/reboot.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> @@ -336,6 +338,36 @@ static u32 _pp_stat_reg(struct intel_dp *intel_dp)return VLV_PIPE_PP_STATUS (vlv_power_sequencer_pipe (intel_dp)); } +/* Reboot notifier handler to shutdown panel power to guarantee T12 timing */ +static int edp_notify_handler (struct notifier_block *this,unsigned long code, +void *unused) +{ +struct intel_dp *intel_dp =container_of (this,typeof (* intel_dp), + edp_notifier); +struct drm_device *dev =intel_dp_to_dev (intel_dp); +struct drm_i915_private *dev_priv = dev->dev_private; +u32 pp_div; +u32 pp_ctrl_reg, pp_div_reg; +enum pipe pipe =vlv_power_sequencer_pipe (intel_dp); + +if (!is_edp (intel_dp) || code !=SYS_RESTART ) +return 0 ; + +if (IS_VALLEYVIEW (dev)) { + pp_ctrl_reg =VLV_PIPE_PP_CONTROL (pipe); + pp_div_reg =VLV_PIPE_PP_DIVISOR (pipe); + pp_div =I915_READ (VLV_PIPE_PP_DIVISOR (pipe)); + pp_div &=PP_REFERENCE_DIVIDER_MASK ; + +/* 0x1F write to PP_DIV_REG sets max cycle delay */ +I915_WRITE (pp_div_reg, pp_div |0x1F ); +I915_WRITE (pp_ctrl_reg,PANEL_UNLOCK_REGS |PANEL_POWER_OFF ); +msleep (intel_dp->panel_power_cycle_delay); + } + +return 0 ; +} +static bool edp_have_panel_power (struct intel_dp *intel_dp) {struct drm_device *dev =intel_dp_to_dev (intel_dp);@@ -3785,6 +3817,10 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)drm_modeset_lock (&dev->mode_config.connection_mutex,NULL );edp_panel_vdd_off_sync (intel_dp);drm_modeset_unlock (&dev->mode_config.connection_mutex); +if (intel_dp->edp_notifier.notifier_call) { +unregister_reboot_notifier (&intel_dp->edp_notifier); + intel_dp->edp_notifier.notifier_call =NULL ; + } }kfree (intel_dig_port); }@@ -4353,6 +4389,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,if (is_edp (intel_dp)) {intel_dp_init_panel_power_timestamps (intel_dp);intel_dp_init_panel_power_sequencer (dev, intel_dp, &power_seq); +if (IS_VALLEYVIEW (dev)) { + intel_dp->edp_notifier.notifier_call = edp_notify_handler; +register_reboot_notifier (&intel_dp->edp_notifier); + } }intel_dp_aux_init (intel_dp, intel_connector);drivers/gpu/drm/i915/intel_drv.h +2
-0@@ -541,6 +541,8 @@ struct intel_dp {unsigned long last_power_cycle;unsigned long last_power_on;unsigned long last_backlight_off; +struct notifier_block edp_notifier; +bool use_tps3;struct intel_connector *attached_connector;
Re: [PATCH] drm/i915/vlv: T12 eDP panel timing enforcement during reboot
Quoted 18 lines · Clint Taylor
Quoted 17 lines · Jani Nikula
From: Clint Taylor <[email protected]>
The panel power sequencer on vlv doesn't appear to accept changes to its T12 power down duration during warm reboots. This change forces a delay for warm reboots to the T12 panel timing as defined in the VBT table for the connected panel.
Ver2: removed redundant
pr_crit(), commented magic value forpp_div_regVer3: moved
SYS_RESTARTcheck earlier, new name forpp_div.Ver4: Minor issue changes
Signed-off-by Clint Taylor <[email protected]>[Jani: rebased on current -nightly.]Signed-off-by Jani Nikula <[email protected]>
Quoted 6 lines
Quoted 4 lines
---
I ended up doing the rebase myself, but I'd like to have a quick review before pushing.
Quick review complete. Everything appears OK.
See Paulo's review; want to take over?
Jani.
Quoted 97 lines
Quoted 96 lines
Thanks,
Jani.--- drivers/gpu/drm/i915/intel_dp.c | 40 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 42 insertions(+)drivers/gpu/drm/i915/intel_dp.c +40
-0@@ -28,6 +28,8 @@#include <linux/i2c.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/notifier.h> +#include <linux/reboot.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> @@ -336,6 +338,36 @@ static u32 _pp_stat_reg(struct intel_dp *intel_dp)return VLV_PIPE_PP_STATUS (vlv_power_sequencer_pipe (intel_dp)); } +/* Reboot notifier handler to shutdown panel power to guarantee T12 timing */ +static int edp_notify_handler (struct notifier_block *this,unsigned long code, +void *unused) +{ +struct intel_dp *intel_dp =container_of (this,typeof (* intel_dp), + edp_notifier); +struct drm_device *dev =intel_dp_to_dev (intel_dp); +struct drm_i915_private *dev_priv = dev->dev_private; +u32 pp_div; +u32 pp_ctrl_reg, pp_div_reg; +enum pipe pipe =vlv_power_sequencer_pipe (intel_dp); + +if (!is_edp (intel_dp) || code !=SYS_RESTART ) +return 0 ; + +if (IS_VALLEYVIEW (dev)) { + pp_ctrl_reg =VLV_PIPE_PP_CONTROL (pipe); + pp_div_reg =VLV_PIPE_PP_DIVISOR (pipe); + pp_div =I915_READ (VLV_PIPE_PP_DIVISOR (pipe)); + pp_div &=PP_REFERENCE_DIVIDER_MASK ; + +/* 0x1F write to PP_DIV_REG sets max cycle delay */ +I915_WRITE (pp_div_reg, pp_div |0x1F ); +I915_WRITE (pp_ctrl_reg,PANEL_UNLOCK_REGS |PANEL_POWER_OFF ); +msleep (intel_dp->panel_power_cycle_delay); + } + +return 0 ; +} +static bool edp_have_panel_power (struct intel_dp *intel_dp) {struct drm_device *dev =intel_dp_to_dev (intel_dp);@@ -3785,6 +3817,10 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)drm_modeset_lock (&dev->mode_config.connection_mutex,NULL );edp_panel_vdd_off_sync (intel_dp);drm_modeset_unlock (&dev->mode_config.connection_mutex); +if (intel_dp->edp_notifier.notifier_call) { +unregister_reboot_notifier (&intel_dp->edp_notifier); + intel_dp->edp_notifier.notifier_call =NULL ; + } }kfree (intel_dig_port); }@@ -4353,6 +4389,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,if (is_edp (intel_dp)) {intel_dp_init_panel_power_timestamps (intel_dp);intel_dp_init_panel_power_sequencer (dev, intel_dp, &power_seq); +if (IS_VALLEYVIEW (dev)) { + intel_dp->edp_notifier.notifier_call = edp_notify_handler; +register_reboot_notifier (&intel_dp->edp_notifier); + } }intel_dp_aux_init (intel_dp, intel_connector);drivers/gpu/drm/i915/intel_drv.h +2
-0@@ -541,6 +541,8 @@ struct intel_dp {unsigned long last_power_cycle;unsigned long last_power_on;unsigned long last_backlight_off; +struct notifier_block edp_notifier; +bool use_tps3;struct intel_connector *attached_connector;
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Re: [PATCH] drm/i915/vlv: T12 eDP panel timing enforcement during reboot
Quoted 19 lines · Jani Nikula
Quoted 18 lines · Clint Taylor
Quoted 17 lines · Jani Nikula
From: Clint Taylor <[email protected]>
The panel power sequencer on vlv doesn't appear to accept changes to its T12 power down duration during warm reboots. This change forces a delay for warm reboots to the T12 panel timing as defined in the VBT table for the connected panel.
Ver2: removed redundant
pr_crit(), commented magic value forpp_div_regVer3: moved
SYS_RESTARTcheck earlier, new name forpp_div.Ver4: Minor issue changes
Signed-off-by Clint Taylor <[email protected]>[Jani: rebased on current -nightly.]Signed-off-by Jani Nikula <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
---
I ended up doing the rebase myself, but I'd like to have a quick review before pushing.
Quick review complete. Everything appears OK.
See Paulo's review; want to take over?
Imo this is -fixes material, but it looks like it's not yet complete. I'll wait for a resend safe when someone yells at me that the current patch is ok-ish (maybe just needs a pimped commit message or a comment somewhere to address Paulo's concerns).
-Daniel
Quoted 108 lines
Jani.
Quoted 97 lines
Quoted 96 lines
Thanks,
Jani.--- drivers/gpu/drm/i915/intel_dp.c | 40 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 42 insertions(+)drivers/gpu/drm/i915/intel_dp.c +40
-0@@ -28,6 +28,8 @@#include <linux/i2c.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/notifier.h> +#include <linux/reboot.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> @@ -336,6 +338,36 @@ static u32 _pp_stat_reg(struct intel_dp *intel_dp)return VLV_PIPE_PP_STATUS (vlv_power_sequencer_pipe (intel_dp)); } +/* Reboot notifier handler to shutdown panel power to guarantee T12 timing */ +static int edp_notify_handler (struct notifier_block *this,unsigned long code, +void *unused) +{ +struct intel_dp *intel_dp =container_of (this,typeof (* intel_dp), + edp_notifier); +struct drm_device *dev =intel_dp_to_dev (intel_dp); +struct drm_i915_private *dev_priv = dev->dev_private; +u32 pp_div; +u32 pp_ctrl_reg, pp_div_reg; +enum pipe pipe =vlv_power_sequencer_pipe (intel_dp); + +if (!is_edp (intel_dp) || code !=SYS_RESTART ) +return 0 ; + +if (IS_VALLEYVIEW (dev)) { + pp_ctrl_reg =VLV_PIPE_PP_CONTROL (pipe); + pp_div_reg =VLV_PIPE_PP_DIVISOR (pipe); + pp_div =I915_READ (VLV_PIPE_PP_DIVISOR (pipe)); + pp_div &=PP_REFERENCE_DIVIDER_MASK ; + +/* 0x1F write to PP_DIV_REG sets max cycle delay */ +I915_WRITE (pp_div_reg, pp_div |0x1F ); +I915_WRITE (pp_ctrl_reg,PANEL_UNLOCK_REGS |PANEL_POWER_OFF ); +msleep (intel_dp->panel_power_cycle_delay); + } + +return 0 ; +} +static bool edp_have_panel_power (struct intel_dp *intel_dp) {struct drm_device *dev =intel_dp_to_dev (intel_dp);@@ -3785,6 +3817,10 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)drm_modeset_lock (&dev->mode_config.connection_mutex,NULL );edp_panel_vdd_off_sync (intel_dp);drm_modeset_unlock (&dev->mode_config.connection_mutex); +if (intel_dp->edp_notifier.notifier_call) { +unregister_reboot_notifier (&intel_dp->edp_notifier); + intel_dp->edp_notifier.notifier_call =NULL ; + } }kfree (intel_dig_port); }@@ -4353,6 +4389,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,if (is_edp (intel_dp)) {intel_dp_init_panel_power_timestamps (intel_dp);intel_dp_init_panel_power_sequencer (dev, intel_dp, &power_seq); +if (IS_VALLEYVIEW (dev)) { + intel_dp->edp_notifier.notifier_call = edp_notify_handler; +register_reboot_notifier (&intel_dp->edp_notifier); + } }intel_dp_aux_init (intel_dp, intel_connector);drivers/gpu/drm/i915/intel_drv.h +2
-0@@ -541,6 +541,8 @@ struct intel_dp {unsigned long last_power_cycle;unsigned long last_power_on;unsigned long last_backlight_off; +struct notifier_block edp_notifier; +bool use_tps3;struct intel_connector *attached_connector;Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch