• Nícolas F. R. A. Prado's avatar
    drm/bridge: anx7625: Prevent endless probe loop · 1464e48d
    Nícolas F. R. A. Prado authored
    During probe, the driver registers i2c dummy devices and populates the
    aux bus, which registers a device for the panel. After doing that, the
    driver can still defer probe if needed. This ordering of operations is
    troublesome however, because the deferred probe work will retry probing
    all pending devices every time a new device is registered. Therefore, if
    modules need to be loaded in order to satisfy the dependencies for this
    driver to complete probe, the kernel will stall, since it'll keep trying
    to probe the anx7625 driver, but never succeed, given that modules would
    only be loaded after the deferred probe work completes.
    
    Two changes are required to avoid this issue:
    * Move of_find_mipi_dsi_host_by_node(), which can defer probe, to before
      anx7625_register_i2c_dummy_clients() and
      devm_of_dp_aux_populate_ep_devices(), which register devices.
    * Make use of the done_probing callback when populating the aux bus,
      so that the bridge registration is only done after the panel is
      probed. This is required because the panel might need to defer probe,
      but the aux bus population needs the i2c dummy devices working, so
      this call couldn't just be moved to an earlier point in probe.
      One caveat is that if the panel is described outside the aux bus, the
      probe loop issue can still happen, but we don't have a way to avoid
      it in that case since there's no callback available.
    
    With this patch applied, it's possible to boot on
    mt8192-asurada-spherion with
    
    CONFIG_DRM_ANALOGIX_ANX7625=y
    CONFIG_MTK_MMSYS=m
    CONFIG_BACKLIGHT_PWM=y
    
    and also with
    
    CONFIG_DRM_ANALOGIX_ANX7625=y
    CONFIG_MTK_MMSYS=y
    CONFIG_BACKLIGHT_PWM=m
    
    Fixes: adca62ec ("drm/bridge: anx7625: Support reading edid through aux channel")
    Fixes: 26933299 ("drm/bridge: anx7625: Return -EPROBE_DEFER if the dsi host was not found")
    Reported-by: default avatar"kernelci.org bot" <bot@kernelci.org>
    Signed-off-by: default avatarNícolas F. R. A. Prado <nfraprado@collabora.com>
    Reviewed-by: default avatarRobert Foss <rfoss@kernel.org>
    Signed-off-by: default avatarRobert Foss <rfoss@kernel.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230518193902.891121-1-nfraprado@collabora.com
    1464e48d
anx7625.c 70.7 KB