Skip to content
Snippets Groups Projects
  1. Oct 16, 2023
  2. Sep 06, 2023
  3. Jul 21, 2023
  4. Jun 22, 2023
    • Ondrej Jirman's avatar
      drm: bridge: dw-mipi-dsi: Fix enable/disable of DSI controller · 05aa6133
      Ondrej Jirman authored
      
      Before this patch, booting to Linux VT and doing a simple:
      
        echo 2 > /sys/class/graphics/fb0/blank
        echo 0 > /sys/class/graphics/fb0/blank
      
      would result in failures to re-enable the panel. Mode set callback is
      called only once during boot in this scenario, while calls to
      enable/disable callbacks are balanced afterwards. The driver doesn't
      work unless userspace calls modeset before enabling the CRTC/connector.
      
      This patch moves enabling of the DSI host from mode_set into pre_enable
      callback, and removes some old hacks where this bridge driver is
      directly calling into other bridge driver's callbacks.
      
      pre_enable_prev_first flag is set on the panel's bridge so that panel
      drivers will get their prepare function called between DSI host's
      pre_enable and enable callbacks, so that they get a chance to
      perform panel setup while DSI host is already enabled in command
      mode. Otherwise panel's prepare would be called before DSI host
      is enabled, and any DSI communication used in prepare callback
      would fail.
      
      With all these changes, the enable/disable sequence is now well
      balanced, and host's and panel's callbacks are called in proper order
      documented in the drm_panel API documentation without needing the old
      hacks. (Mainly that panel->prepare is called when DSI host is ready to
      allow the panel driver to send DSI commands and vice versa during
      disable.)
      
      Tested on Pinephone Pro. Trace of the callbacks follows.
      
      Before:
      
      [    1.253882] dw-mipi-dsi-rockchip ff960000.dsi: mode_set
      [    1.290732] panel-himax-hx8394 ff960000.dsi.0: prepare
      [    1.475576] dw-mipi-dsi-rockchip ff960000.dsi: enable
      [    1.475593] panel-himax-hx8394 ff960000.dsi.0: enable
      
      echo 2 > /sys/class/graphics/fb0/blank
      
      [   13.722799] panel-himax-hx8394 ff960000.dsi.0: disable
      [   13.774502] dw-mipi-dsi-rockchip ff960000.dsi: post_disable
      [   13.774526] panel-himax-hx8394 ff960000.dsi.0: unprepare
      
      echo 0 > /sys/class/graphics/fb0/blank
      
      [   17.735796] panel-himax-hx8394 ff960000.dsi.0: prepare
      [   17.923522] dw-mipi-dsi-rockchip ff960000.dsi: enable
      [   17.923540] panel-himax-hx8394 ff960000.dsi.0: enable
      [   17.944330] dw-mipi-dsi-rockchip ff960000.dsi: failed to write command FIFO
      [   17.944335] panel-himax-hx8394 ff960000.dsi.0: sending command 0xb9 failed: -110
      [   17.944340] panel-himax-hx8394 ff960000.dsi.0: Panel init sequence failed: -110
      
      echo 2 > /sys/class/graphics/fb0/blank
      
      [  431.148583] panel-himax-hx8394 ff960000.dsi.0: disable
      [  431.169259] dw-mipi-dsi-rockchip ff960000.dsi: failed to write command FIFO
      [  431.169268] panel-himax-hx8394 ff960000.dsi.0: Failed to enter sleep mode: -110
      [  431.169282] dw-mipi-dsi-rockchip ff960000.dsi: post_disable
      [  431.169316] panel-himax-hx8394 ff960000.dsi.0: unprepare
      [  431.169357] pclk_mipi_dsi0 already disabled
      
      echo 0 > /sys/class/graphics/fb0/blank
      
      [  432.796851] panel-himax-hx8394 ff960000.dsi.0: prepare
      [  432.981537] dw-mipi-dsi-rockchip ff960000.dsi: enable
      [  432.981568] panel-himax-hx8394 ff960000.dsi.0: enable
      [  433.002290] dw-mipi-dsi-rockchip ff960000.dsi: failed to write command FIFO
      [  433.002299] panel-himax-hx8394 ff960000.dsi.0: sending command 0xb9 failed: -110
      [  433.002312] panel-himax-hx8394 ff960000.dsi.0: Panel init sequence failed: -110
      
      -----------------------------------------------------------------------
      
      After:
      
      [    1.248372] dw-mipi-dsi-rockchip ff960000.dsi: mode_set
      [    1.248704] dw-mipi-dsi-rockchip ff960000.dsi: pre_enable
      [    1.285377] panel-himax-hx8394 ff960000.dsi.0: prepare
      [    1.468392] dw-mipi-dsi-rockchip ff960000.dsi: enable
      [    1.468421] panel-himax-hx8394 ff960000.dsi.0: enable
      
      echo 2 > /sys/class/graphics/fb0/blank
      
      [   16.210357] panel-himax-hx8394 ff960000.dsi.0: disable
      [   16.261315] dw-mipi-dsi-rockchip ff960000.dsi: post_disable
      [   16.261339] panel-himax-hx8394 ff960000.dsi.0: unprepare
      
      echo 0 > /sys/class/graphics/fb0/blank
      
      [   19.161453] dw-mipi-dsi-rockchip ff960000.dsi: pre_enable
      [   19.197869] panel-himax-hx8394 ff960000.dsi.0: prepare
      [   19.382141] dw-mipi-dsi-rockchip ff960000.dsi: enable
      [   19.382158] panel-himax-hx8394 ff960000.dsi.0: enable
      
             (But depends on functionality intorduced in Linux 6.3, so this patch will
              not build on older kernels when applied to older stable branches.)
      
      Fixes: 46fc5154 ("drm/bridge/synopsys: Add MIPI DSI host controller bridge")
      Signed-off-by: default avatarOndrej Jirman <megi@xff.cz>
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarRobert Foss <rfoss@kernel.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230617224915.1923630-1-megi@xff.cz
      05aa6133
  5. Mar 31, 2022
  6. Jan 13, 2022
  7. Jan 05, 2022
  8. Jan 04, 2022
  9. Jul 28, 2021
  10. Jul 27, 2021
  11. Sep 11, 2020
  12. Sep 08, 2020
  13. Sep 07, 2020
  14. Jun 25, 2020
  15. Jun 23, 2020
  16. Feb 26, 2020
    • Laurent Pinchart's avatar
      drm/bridge: Extend bridge API to disable connector creation · a25b988f
      Laurent Pinchart authored
      
      Most bridge drivers create a DRM connector to model the connector at the
      output of the bridge. This model is historical and has worked pretty
      well so far, but causes several issues:
      
      - It prevents supporting more complex display pipelines where DRM
      connector operations are split over multiple components. For instance a
      pipeline with a bridge connected to the DDC signals to read EDID data,
      and another one connected to the HPD signal to detect connection and
      disconnection, will not be possible to support through this model.
      
      - It requires every bridge driver to implement similar connector
      handling code, resulting in code duplication.
      
      - It assumes that a bridge will either be wired to a connector or to
      another bridge, but doesn't support bridges that can be used in both
      positions very well (although there is some ad-hoc support for this in
      the analogix_dp bridge driver).
      
      In order to solve these issues, ownership of the connector should be
      moved to the display controller driver (where it can be implemented
      using helpers provided by the core).
      
      Extend the bridge API to allow disabling connector creation in bridge
      drivers as a first step towards the new model. The new flags argument to
      the bridge .attach() operation allows instructing the bridge driver to
      skip creating a connector. Unconditionally set the new flags argument to
      0 for now to keep the existing behaviour, and modify all existing bridge
      drivers to return an error when connector creation is not requested as
      they don't support this feature yet.
      
      The change is based on the following semantic patch, with manual review
      and edits.
      
      @ rule1 @
      identifier funcs;
      identifier fn;
      @@
       struct drm_bridge_funcs funcs = {
       	...,
       	.attach = fn
       };
      
      @ depends on rule1 @
      identifier rule1.fn;
      identifier bridge;
      statement S, S1;
      @@
       int fn(
       	struct drm_bridge *bridge
      +	, enum drm_bridge_attach_flags flags
       )
       {
       	... when != S
      +	if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) {
      +		DRM_ERROR("Fix bridge driver to make connector optional!");
      +		return -EINVAL;
      +	}
      +
       	S1
       	...
       }
      
      @ depends on rule1 @
      identifier rule1.fn;
      identifier bridge, flags;
      expression E1, E2, E3;
      @@
       int fn(
       	struct drm_bridge *bridge,
       	enum drm_bridge_attach_flags flags
       ) {
       <...
       drm_bridge_attach(E1, E2, E3
      +	, flags
       )
       ...>
       }
      
      @@
      expression E1, E2, E3;
      @@
       drm_bridge_attach(E1, E2, E3
      +	, 0
       )
      
      Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Reviewed-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Reviewed-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
      Tested-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200226112514.12455-10-laurent.pinchart@ideasonboard.com
      a25b988f
  17. Feb 10, 2020
  18. Dec 16, 2019
  19. Sep 25, 2019
  20. Sep 08, 2019
    • Laurent Pinchart's avatar
      drm/bridge: panel: Infer connector type from panel by default · 89958b7c
      Laurent Pinchart authored
      
      The drm panel bridge creates a connector using a connector type
      explicitly passed by the display controller or bridge driver that
      instantiates the panel bridge. Now that drm_panel reports its connector
      type, we can use it to avoid passing an explicit (and often incorrect)
      connector type to drm_panel_bridge_add() and
      devm_drm_panel_bridge_add().
      
      Several drivers report incorrect or unknown connector types to
      userspace. Reporting a different type may result in a breakage. For that
      reason, rename (devm_)drm_panel_bridge_add() to
      (devm_)drm_panel_bridge_add_typed(), and add new
      (devm_)drm_panel_bridge_add() functions that use the panel connector
      type. Update all callers of (devm_)drm_panel_bridge_add() to the _typed
      function, they will be converted one by one after testing.
      
      The panel drivers have been updated with the following Coccinelle
      semantic patch, with manual inspection and fixes to indentation.
      
      @@
      expression bridge;
      expression dev;
      expression panel;
      identifier type;
      @@
      (
      -bridge = drm_panel_bridge_add(panel, type);
      +bridge = drm_panel_bridge_add_typed(panel, type);
      |
      -bridge = devm_drm_panel_bridge_add(dev, panel, type);
      +bridge = devm_drm_panel_bridge_add_typed(dev, panel, type);
      )
      
      Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Reviewed-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190904132804.29680-3-laurent.pinchart@ideasonboard.com
      89958b7c
  21. Jun 24, 2019
  22. Jun 12, 2019
  23. May 26, 2019
  24. Jan 24, 2019
  25. Jan 14, 2019
  26. Oct 30, 2018
Loading