Commit c9a396cf authored by Dave Stevenson's avatar Dave Stevenson Committed by Maxime Ripard

drm/vc4: dsi: Move initialisation to encoder_mode_set

Breaking the bridge chain does not work for atomic bridges/panels
and generally causes issues.
We need to initialise the DSI host before the bridge pre_enables
are called, so move that to encoder_mode_set in the same way that
dw-mipi-dsi does.
Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://lore.kernel.org/r/20221207-rpi-dsi-bridge-v1-2-8f68ee0b0adb@cerno.techSigned-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
parent 9fc92580
...@@ -874,18 +874,18 @@ static bool vc4_dsi_encoder_mode_fixup(struct drm_encoder *encoder, ...@@ -874,18 +874,18 @@ static bool vc4_dsi_encoder_mode_fixup(struct drm_encoder *encoder,
return true; return true;
} }
static void vc4_dsi_encoder_enable(struct drm_encoder *encoder) static void vc4_dsi_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{ {
struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
struct vc4_dsi *dsi = to_vc4_dsi(encoder); struct vc4_dsi *dsi = to_vc4_dsi(encoder);
struct device *dev = &dsi->pdev->dev; struct device *dev = &dsi->pdev->dev;
bool debug_dump_regs = false; bool debug_dump_regs = false;
struct drm_bridge *iter;
unsigned long hs_clock; unsigned long hs_clock;
u32 ui_ns; u32 ui_ns;
/* Minimum LP state duration in escape clock cycles. */ /* Minimum LP state duration in escape clock cycles. */
u32 lpx = dsi_esc_timing(60); u32 lpx = dsi_esc_timing(60);
unsigned long pixel_clock_hz = mode->clock * 1000; unsigned long pixel_clock_hz = adjusted_mode->clock * 1000;
unsigned long dsip_clock; unsigned long dsip_clock;
unsigned long phy_clock; unsigned long phy_clock;
int ret; int ret;
...@@ -1112,6 +1112,13 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder) ...@@ -1112,6 +1112,13 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder)
~DSI_PORT_BIT(PHY_AFEC0_RESET)); ~DSI_PORT_BIT(PHY_AFEC0_RESET));
vc4_dsi_ulps(dsi, false); vc4_dsi_ulps(dsi, false);
}
static void vc4_dsi_encoder_enable(struct drm_encoder *encoder)
{
struct vc4_dsi *dsi = to_vc4_dsi(encoder);
bool debug_dump_regs = false;
struct drm_bridge *iter;
list_for_each_entry_reverse(iter, &dsi->bridge_chain, chain_node) { list_for_each_entry_reverse(iter, &dsi->bridge_chain, chain_node) {
if (iter->funcs->pre_enable) if (iter->funcs->pre_enable)
...@@ -1377,6 +1384,7 @@ static const struct drm_encoder_helper_funcs vc4_dsi_encoder_helper_funcs = { ...@@ -1377,6 +1384,7 @@ static const struct drm_encoder_helper_funcs vc4_dsi_encoder_helper_funcs = {
.disable = vc4_dsi_encoder_disable, .disable = vc4_dsi_encoder_disable,
.enable = vc4_dsi_encoder_enable, .enable = vc4_dsi_encoder_enable,
.mode_fixup = vc4_dsi_encoder_mode_fixup, .mode_fixup = vc4_dsi_encoder_mode_fixup,
.mode_set = vc4_dsi_encoder_mode_set,
}; };
static int vc4_dsi_late_register(struct drm_encoder *encoder) static int vc4_dsi_late_register(struct drm_encoder *encoder)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment