drm/i915/dsi: Document the panel enable / disable sequences from the spec
Subsystems (2)
PATCH v2 1/10 drm/i915/dsi: Document the panel enable / disable sequences from the spec
Document the DSI panel enable / disable sequences from the spec, for easy comparison between the code and the spec.
---
Changes in v2:
-Make the comment a table with 3 columns for easier comparison of the
3 sequences
--- drivers/gpu/drm/i915/intel_dsi.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
drivers/gpu/drm/i915/intel_dsi.c +37 -0
@@ -554,6 +554,43 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder, struct intel_crtc_state *pipe_config);static void intel_dsi_unprepare (struct intel_encoder *encoder); +/* +* Panel enable/disable sequences from the VBT spec. +* +* Note the spec has AssertReset / DeassertReset swapped from their +* usual naming. We use the normal names to avoid confusion (so below +* they are swapped compared to the spec). +* +* Steps starting with MIPI refer to VBT sequences, note that for v2 +* VBTs several steps which have a VBT in v2 are expected to be handled +* directly by the driver, by directly driving gpios for example. +* +* v2 video mode seq v3 video mode seq command mode seq +* - power on - MIPIPanelPowerOn - power on +* - wait t1+t2 - wait t1+t2 +* - MIPIDeassertResetPin - MIPIDeassertResetPin - MIPIDeassertResetPin +* - io lines to lp-11 - io lines to lp-11 - io lines to lp-11 +* - MIPISendInitialDcsCmds - MIPISendInitialDcsCmds - MIPISendInitialDcsCmds +* - MIPITearOn +* - MIPIDisplayOn +* - turn on DPI - turn on DPI - set pipe to dsr mode +* - MIPIDisplayOn - MIPIDisplayOn +* - wait t5 - wait t5 +* - backlight on - MIPIBacklightOn - backlight on +* ... ... ... issue mem cmds ... +* - backlight off - MIPIBacklightOff - backlight off +* - wait t6 - wait t6 +* - MIPIDisplayOff +* - turn off DPI - turn off DPI - disable pipe dsr mode +* - MIPITearOff +* - MIPIDisplayOff - MIPIDisplayOff +* - io lines to lp-00 - io lines to lp-00 - io lines to lp-00 +* - MIPIAssertResetPin - MIPIAssertResetPin - MIPIAssertResetPin +* - wait t3 - wait t3 +* - power off - MIPIPanelPowerOff - power off +* - wait t4 - wait t4 +*/ +static void intel_dsi_pre_enable (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config,struct drm_connector_state *conn_state)
Signature · 6 lines
2.9.3 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/10 drm/i915/dsi: Drop bogus MIPI_SEQ_ASSERT_RESET before POWER_ON
intel_dsi_post_disable(), which does the MIPI_SEQ_ASSERT_RESET, will always be called at some point before intel_dsi_pre_enable() making the MIPI_SEQ_ASSERT_RESET in intel_dsi_pre_enable() redundant.
In addition, calling MIPI_SEQ_ASSERT_RESET in the enable path goes against the VBT spec.
---
Changes in v2:
-Reword commit msg
--- drivers/gpu/drm/i915/intel_dsi.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/i915/intel_dsi.c +0 -1
@@ -640,7 +640,6 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder,/* put device in ready state */ intel_dsi_device_ready (encoder); -intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_ASSERT_RESET );intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_POWER_ON );intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_DEASSERT_RESET );intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_INIT_OTP );
Signature · 6 lines
2.9.3 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/10 drm/i915/dsi: Move MIPI_SEQ_POWER_ON/OFF calls together with pmic gpio calls
In reply to Hans de GoedeNow that we are no longer bound to the drm_panel_ callbacks, call MIPI_SEQ_POWER_ON/OFF at the proper place.
--- drivers/gpu/drm/i915/intel_dsi.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +4 -6
@@ -622,10 +622,10 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder,intel_dsi_prepare (encoder, pipe_config); -/* Panel Enable over CRC PMIC */ +/* Power on, try both CRC pmic gpio and VBT */ if (intel_dsi->gpio_panel)gpiod_set_value_cansleep (intel_dsi->gpio_panel,1 ); - +intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_POWER_ON );msleep (intel_dsi->panel_on_delay);if (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) {
@@ -640,7 +640,6 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder,/* put device in ready state */ intel_dsi_device_ready (encoder); -intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_POWER_ON );intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_DEASSERT_RESET );intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_INIT_OTP );
@@ -758,11 +757,10 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder, }intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_ASSERT_RESET ); -intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_POWER_OFF ); +/* Power off, try both CRC pmic gpio and VBT */ msleep (intel_dsi->panel_off_delay); - -/* Panel Disable over CRC PMIC */ +intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_POWER_OFF );if (intel_dsi->gpio_panel)gpiod_set_value_cansleep (intel_dsi->gpio_panel,0 );
Signature · 6 lines
2.9.3 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 4/10 drm/i915/dsi: Group DPOunit clock gate workaround with PLL enable
In reply to Hans de GoedeMove the DPOunit clock gate workaround to directly after the PLL enable.
The exact location of the workaround does not matter and there are 2 reasons to group it with the PLL enable:
1) This moves it out of the middle of the init sequence from the spec, making it easier to follow the init sequence / compare it to the spec
2) It is grouped with the pll disable call in intel_dsi_post_disable, so for consistency it should be grouped with the pll enable in intel_dsi_pre_enable
--- drivers/gpu/drm/i915/intel_dsi.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +8 -8
@@ -620,14 +620,6 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder,I915_WRITE (BXT_P_DSI_REGULATOR_TX_CTRL ,0 ); } -intel_dsi_prepare (encoder, pipe_config); - -/* Power on, try both CRC pmic gpio and VBT */ -if (intel_dsi->gpio_panel) -gpiod_set_value_cansleep (intel_dsi->gpio_panel,1 ); -intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_POWER_ON ); -msleep (intel_dsi->panel_on_delay); -if (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) {u32 val;
@@ -637,6 +629,14 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder,I915_WRITE (DSPCLK_GATE_D , val); } +intel_dsi_prepare (encoder, pipe_config); + +/* Power on, try both CRC pmic gpio and VBT */ +if (intel_dsi->gpio_panel) +gpiod_set_value_cansleep (intel_dsi->gpio_panel,1 ); +intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_POWER_ON ); +msleep (intel_dsi->panel_on_delay); +/* put device in ready state */ intel_dsi_device_ready (encoder);
Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 5/10 drm/i915/dsi: Execute MIPI_SEQ_DEASSERT_RESET before calling device_ready()
In reply to Hans de GoedeExecute MIPI_SEQ_DEASSERT_RESET before putting the device in ready state (LP-11), this is the sequence in which things should be done according to the spec.
--- drivers/gpu/drm/i915/intel_dsi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +7 -2
@@ -637,10 +637,13 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder,intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_POWER_ON );msleep (intel_dsi->panel_on_delay); -/* put device in ready state */ +/* Deassert reset */ +intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_DEASSERT_RESET ); + +/* Put device in ready state (LP-11) */ intel_dsi_device_ready (encoder); -intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_DEASSERT_RESET ); +/* Send initialization commands in LP mode */ intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_INIT_OTP );/* Enable port in pre-enable phase itself because as per hw team
@@ -733,6 +736,7 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder,intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_BACKLIGHT_OFF );intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_DISPLAY_OFF ); +/* Transition to LP-00 */ intel_dsi_clear_device_ready (encoder);if (IS_BROXTON (dev_priv)) {
@@ -756,6 +760,7 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder,I915_WRITE (DSPCLK_GATE_D , val); } +/* Assert reset */ intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_ASSERT_RESET );/* Power off, try both CRC pmic gpio and VBT */
Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 6/10 drm/i915/dsi: Group MIPI_SEQ_BACKLIGHT_ON/OFF with panel_[en|dis]able_backlight
In reply to Hans de GoedeExecute the MIPI_SEQ_BACKLIGHT_ON/OFF VBT sequences at the same time as we call intel_panel_enable_backlight() / intel_panel_disable_backlight().
---
Changes in v2:
-Drop meaningless code-comments
--- drivers/gpu/drm/i915/intel_dsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +2 -2
@@ -658,12 +658,12 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder,msleep (100 );intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_DISPLAY_ON ); -intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_BACKLIGHT_ON );intel_dsi_port_enable (encoder); }intel_panel_enable_backlight (intel_dsi->attached_connector); +intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_BACKLIGHT_ON ); } static void intel_dsi_enable_nop(struct intel_encoder *encoder,
@@ -689,6 +689,7 @@ static void intel_dsi_pre_disable(struct intel_encoder *encoder,DRM_DEBUG_KMS ("\n" ); +intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_BACKLIGHT_OFF );intel_panel_disable_backlight (intel_dsi->attached_connector);/*
@@ -733,7 +734,6 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder,* if disable packets are sent before sending shutdown packet then in * some next enable sequence send turn on packet error is observed */ -intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_BACKLIGHT_OFF );intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_DISPLAY_OFF );/* Transition to LP-00 */
Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 7/10 drm/i915/dsi: Document always using v3 SHUTDOWN / MIPI_SEQ_DISPLAY_OFF order
In reply to Hans de GoedeAccording to the spec for v2 VBTs we should call MIPI_SEQ_DISPLAY_OFF before sending SHUTDOWN, where as for v3 VBTs we should send SHUTDOWN first.
Since the v2 order has known issues, we use the v3 order everywhere, add a comment documenting this.
---
Changes in v2:
-Slightly change added comment wording
--- drivers/gpu/drm/i915/intel_dsi.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/intel_dsi.c +5 -0
@@ -701,6 +701,11 @@ static void intel_dsi_pre_disable(struct intel_encoder *encoder,I915_WRITE (MIPI_DEVICE_READY (port),0 ); } +/* +* According to the spec we should send SHUTDOWN before +* MIPI_SEQ_DISPLAY_OFF only for v3+ VBTs, but field testing +* has shown that the v3 sequence works for v2 VBTs too +*/ if (is_vid_mode (intel_dsi)) {/* Send Shutdown command to the panel in LP mode */ for_each_dsi_port (port, intel_dsi->ports)
Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 8/10 drm/i915/dsi: Execute MIPI_SEQ_TEAR_OFF from intel_dsi_post_disable
In reply to Hans de GoedeFor v3+ VBTs we should call MIPI_SEQ_TEAR_OFF before MIPI_SEQ_DISPLAY_OFF, v2 VBTs do not have MIPI_SEQ_TEAR_OFF so there this is a nop.
---
Changes in v2:
-Only call MIPI_SEQ_TEAR_OFF in cmd mode
--- drivers/gpu/drm/i915/intel_dsi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_dsi.c +2 -0
@@ -739,6 +739,8 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder,* if disable packets are sent before sending shutdown packet then in * some next enable sequence send turn on packet error is observed */ +if (is_cmd_mode (intel_dsi)) +intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_TEAR_OFF );intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_DISPLAY_OFF );/* Transition to LP-00 */
Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 9/10 drm/i915/dsi: Call MIPI_SEQ_TEAR_ON and DISPLAY_ON for cmd-mode (untested)
In reply to Hans de GoedeAccording to the spec we should call MIPI_SEQ_TEAR_ON and DISPLAY_ON on enable for cmd-mode, just like we already call their counterparts on disable. Note: untested, my panel is a vid-mode panel.
--- drivers/gpu/drm/i915/intel_dsi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_dsi.c +2 -0
@@ -651,6 +651,8 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder,if (is_cmd_mode (intel_dsi)) {for_each_dsi_port (port, intel_dsi->ports)I915_WRITE (MIPI_MAX_RETURN_PKT_SIZE (port),8 *4 ); +intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_TEAR_ON ); +intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_DISPLAY_ON ); }else {msleep (20 );/* XXX */ for_each_dsi_port (port, intel_dsi->ports)
Signature · 6 lines
2.9.3 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 10/10 drm/i915/dsi: Skip delays for v3 VBTs in vid-mode
In reply to Hans de GoedeFor v3 VBTs in vid-mode the delays are part of the VBT sequences, so we should not also delay ourselves otherwise we get double delays.
--- drivers/gpu/drm/i915/intel_dsi.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +15 -4
@@ -554,6 +554,17 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder, struct intel_crtc_state *pipe_config);static void intel_dsi_unprepare (struct intel_encoder *encoder); +static void intel_dsi_msleep (struct intel_dsi *intel_dsi,int msec) +{ +struct drm_i915_private *dev_priv =to_i915 (intel_dsi->base.base.dev); + +/* For v3 VBTs in vid-mode the delays are part of the VBT sequences */ +if (is_vid_mode (intel_dsi) && dev_priv->vbt.dsi.seq_version >=3 ) +return ; + +msleep (msec); +} +/* * Panel enable/disable sequences from the VBT spec. *
@@ -635,7 +646,7 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder,if (intel_dsi->gpio_panel)gpiod_set_value_cansleep (intel_dsi->gpio_panel,1 );intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_POWER_ON ); -msleep (intel_dsi->panel_on_delay); +intel_dsi_msleep (intel_dsi, intel_dsi->panel_on_delay);/* Deassert reset */ intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_DEASSERT_RESET );
@@ -657,7 +668,7 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder,msleep (20 );/* XXX */ for_each_dsi_port (port, intel_dsi->ports)dpi_send_cmd (intel_dsi,TURN_ON , false, port); -msleep (100 ); +intel_dsi_msleep (intel_dsi,100 );intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_DISPLAY_ON );
@@ -773,7 +784,7 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder,intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_ASSERT_RESET );/* Power off, try both CRC pmic gpio and VBT */ -msleep (intel_dsi->panel_off_delay); +intel_dsi_msleep (intel_dsi, intel_dsi->panel_off_delay);intel_dsi_exec_vbt_sequence (intel_dsi,MIPI_SEQ_POWER_OFF );if (intel_dsi->gpio_panel)gpiod_set_value_cansleep (intel_dsi->gpio_panel,0 );
@@ -782,7 +793,7 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder,* FIXME As we do with eDP, just make a note of the time here * and perform the wait before the next panel power on. */ -msleep (intel_dsi->panel_pwr_cycle_delay); +intel_dsi_msleep (intel_dsi, intel_dsi->panel_pwr_cycle_delay); } static bool intel_dsi_get_hw_state(struct intel_encoder *encoder,
Signature · 6 lines
2.9.3 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 5 lines · On Tue, 28 Feb 2017 13:59:16 +0100 Hans de Goede <[email protected]> wrote:
Document the DSI panel enable / disable sequences from the spec, for easy comparison between the code and the spec.
Signed-off-by Hans de Goede <[email protected]>Acked-by Jani Nikula <[email protected]>
I think this looks a lot better and makes it more obvious any differences between the different sequences. Thanks Hans!
The rest of the patches in this series look good too. So for the series:
Quoted 56 lines
---
Changes in v2:(quoted diff) +0
-2-Make the comment a table with 3 columns for easier comparison of the 3 sequences --- drivers/gpu/drm/i915/intel_dsi.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)drivers/gpu/drm/i915/intel_dsi.c +37
-0@@ -554,6 +554,43 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder, struct intel_crtc_state *pipe_config);static void intel_dsi_unprepare (struct intel_encoder *encoder); +/* +* Panel enable/disable sequences from the VBT spec. +* +* Note the spec has AssertReset / DeassertReset swapped from their +* usual naming. We use the normal names to avoid confusion (so below +* they are swapped compared to the spec). +* +* Steps starting with MIPI refer to VBT sequences, note that for v2 +* VBTs several steps which have a VBT in v2 are expected to be handled +* directly by the driver, by directly driving gpios for example. +* +* v2 video mode seq v3 video mode seq command mode seq +* - power on - MIPIPanelPowerOn - power on +* - wait t1+t2 - wait t1+t2 +* - MIPIDeassertResetPin - MIPIDeassertResetPin - MIPIDeassertResetPin +* - io lines to lp-11 - io lines to lp-11 - io lines to lp-11 +* - MIPISendInitialDcsCmds - MIPISendInitialDcsCmds - MIPISendInitialDcsCmds +* - MIPITearOn +* - MIPIDisplayOn +* - turn on DPI - turn on DPI - set pipe to dsr mode +* - MIPIDisplayOn - MIPIDisplayOn +* - wait t5 - wait t5 +* - backlight on - MIPIBacklightOn - backlight on +* ... ... ... issue mem cmds ... +* - backlight off - MIPIBacklightOff - backlight off +* - wait t6 - wait t6 +* - MIPIDisplayOff +* - turn off DPI - turn off DPI - disable pipe dsr mode +* - MIPITearOff +* - MIPIDisplayOff - MIPIDisplayOff +* - io lines to lp-00 - io lines to lp-00 - io lines to lp-00 +* - MIPIAssertResetPin - MIPIAssertResetPin - MIPIAssertResetPin +* - wait t3 - wait t3 +* - power off - MIPIPanelPowerOff - power off +* - wait t4 - wait t4 +*/ +static void intel_dsi_pre_enable (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config,struct drm_connector_state *conn_state)
Signature · 11 lines
-- Bob Paauwe [email protected] IOTG / PED Software Organization Intel Corp. Folsom, CA (916) 356-6193 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx