Skip to content
  1. Jun 27, 2023
  2. Jun 26, 2023
  3. Jun 25, 2023
  4. Jun 23, 2023
  5. 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
    • Uwe Kleine-König's avatar
      drm/i2c: Switch i2c drivers back to use .probe() · d13b5d2b
      Uwe Kleine-König authored
      After commit b8a1a4cd ("i2c: Provide a temporary .probe_new()
      call-back type"), all drivers being converted to .probe_new() and then
      commit 03c835f4
      
       ("i2c: Switch .probe() to not take an id parameter")
      convert back to (the new) .probe() to be able to eventually drop
      .probe_new() from struct i2c_driver.
      
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
      Reviewed-by: default avatarAndi Shyti <andi.shyti@kernel.org>
      Signed-off-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230611202740.826120-1-u.kleine-koenig@pengutronix.de
      d13b5d2b
    • Marek Vasut's avatar
      drm/bridge: tc358762: Handle HS/VS polarity · 7f4e171f
      Marek Vasut authored
      
      
      Add support for handling the HS/VS sync signals polarity in the bridge
      driver, otherwise e.g. DSIM bridge feeds the TC358762 inverted polarity
      sync signals and the image is shifted to the left, up, and wobbly.
      
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarRobert Foss <rfoss@kernel.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230615201902.566182-5-marex@denx.de
      7f4e171f