drm/i915/dsi: Respect power cycle delay on icl+
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 8 Jun 2023 20:30:50 +0000 (23:30 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 13 Jun 2023 16:05:07 +0000 (19:05 +0300)
Handle the DSI panel power cycle delay on icl+.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230608203057.23759-7-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/display/icl_dsi.c
drivers/gpu/drm/i915/display/intel_dsi.c
drivers/gpu/drm/i915/display/intel_dsi.h
drivers/gpu/drm/i915/display/vlv_dsi.c

index 973215bec3c1e14c14b239b45c721279e9578c2a..a89a45fc0468020a0e07e37f1f63dae1449e57fe 100644 (file)
@@ -1166,6 +1166,8 @@ static void gen11_dsi_pre_pll_enable(struct intel_atomic_state *state,
 {
        struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
 
+       intel_dsi_wait_panel_power_cycle(intel_dsi);
+
        intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_POWER_ON);
        msleep(intel_dsi->panel_on_delay);
        intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_DEASSERT_RESET);
@@ -1292,6 +1294,8 @@ static void gen11_dsi_powerdown_panel(struct intel_encoder *encoder)
        intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_ASSERT_RESET);
        intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_POWER_OFF);
 
+       intel_dsi->panel_power_off_time = ktime_get_boottime();
+
        /* ensure cmds dispatched to panel */
        wait_for_cmds_dispatched_to_panel(encoder);
 }
@@ -1986,6 +1990,8 @@ void icl_dsi_init(struct drm_i915_private *dev_priv)
        /* attach connector to encoder */
        intel_connector_attach_encoder(intel_connector, encoder);
 
+       intel_dsi->panel_power_off_time = ktime_get_boottime();
+
        encoder->devdata = intel_bios_encoder_data_lookup(dev_priv, port);
        intel_bios_init_panel_late(dev_priv, &intel_connector->panel, encoder->devdata, NULL);
 
index 5efdd471ac2b500d597760d74e1cca66836cc61c..e8a596a7c28afb6e545a494f26cc2b3a0f32645f 100644 (file)
@@ -9,6 +9,19 @@
 #include "intel_dsi.h"
 #include "intel_panel.h"
 
+void intel_dsi_wait_panel_power_cycle(struct intel_dsi *intel_dsi)
+{
+       ktime_t panel_power_on_time;
+       s64 panel_power_off_duration;
+
+       panel_power_on_time = ktime_get_boottime();
+       panel_power_off_duration = ktime_ms_delta(panel_power_on_time,
+                                                 intel_dsi->panel_power_off_time);
+
+       if (panel_power_off_duration < (s64)intel_dsi->panel_pwr_cycle_delay)
+               msleep(intel_dsi->panel_pwr_cycle_delay - panel_power_off_duration);
+}
+
 int intel_dsi_bitrate(const struct intel_dsi *intel_dsi)
 {
        int bpp = mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format);
index ce80bd8be5194c30f05a7fdd275a1a3f3f75922f..b690e0fcd9069a423fb5dbda40cb1a7e612f76c1 100644 (file)
@@ -173,5 +173,6 @@ enum drm_mode_status intel_dsi_mode_valid(struct drm_connector *connector,
 struct intel_dsi_host *intel_dsi_host_init(struct intel_dsi *intel_dsi,
                                           const struct mipi_dsi_host_ops *funcs,
                                           enum port port);
+void intel_dsi_wait_panel_power_cycle(struct intel_dsi *intel_dsi);
 
 #endif /* _INTEL_DSI_H */
index ae2f3ab3e73de82dabcb3c1d728ac1b37d13f58f..1e6f438a43d80adce135f994fb28d7ec531d0af1 100644 (file)
@@ -671,20 +671,6 @@ static void intel_dsi_port_disable(struct intel_encoder *encoder)
                intel_de_posting_read(dev_priv, port_ctrl);
        }
 }
-
-static void intel_dsi_wait_panel_power_cycle(struct intel_dsi *intel_dsi)
-{
-       ktime_t panel_power_on_time;
-       s64 panel_power_off_duration;
-
-       panel_power_on_time = ktime_get_boottime();
-       panel_power_off_duration = ktime_ms_delta(panel_power_on_time,
-                                                 intel_dsi->panel_power_off_time);
-
-       if (panel_power_off_duration < (s64)intel_dsi->panel_pwr_cycle_delay)
-               msleep(intel_dsi->panel_pwr_cycle_delay - panel_power_off_duration);
-}
-
 static void intel_dsi_prepare(struct intel_encoder *intel_encoder,
                              const struct intel_crtc_state *pipe_config);
 static void intel_dsi_unprepare(struct intel_encoder *encoder);