Pass negotiated bridge state, which now optionally contains required DSI bus clock, into dw_mipi_dsi_get_lane_mbps(). The dw_mipi_dsi_get_lane_mbps() is a misnomer, it is also responsible for configuration of the bridge PLL and thus also configuration of the clock the bridge outputs on the DSI bus. Signed-off-by: Marek Vasut <marex@xxxxxxx> Cc: Laurent Pinchart <Laurent.pinchart@xxxxxxxxxxxxxxxx> Cc: Maxime Ripard <maxime@xxxxxxxxxx> Cc: Neil Armstrong <narmstrong@xxxxxxxxxxxx> Cc: Sam Ravnborg <sam@xxxxxxxxxxxx> --- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 15 ++++++++++----- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 1 + drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 1 + include/drm/bridge/dw_mipi_dsi.h | 2 ++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 7a2ea21dc0554..d5f3c98cefdb5 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -996,7 +996,8 @@ static unsigned int dw_mipi_dsi_get_lanes(struct dw_mipi_dsi *dsi) } static void dw_mipi_dsi_mode_set(struct dw_mipi_dsi *dsi, - const struct drm_display_mode *adjusted_mode) + const struct drm_display_mode *adjusted_mode, + const struct drm_bridge_state *bridge_state) { const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops; void *priv_data = dsi->plat_data->priv_data; @@ -1005,8 +1006,9 @@ static void dw_mipi_dsi_mode_set(struct dw_mipi_dsi *dsi, clk_prepare_enable(dsi->pclk); - ret = phy_ops->get_lane_mbps(priv_data, adjusted_mode, dsi->mode_flags, - lanes, dsi->format, &dsi->lane_mbps); + ret = phy_ops->get_lane_mbps(priv_data, adjusted_mode, bridge_state, + dsi->mode_flags, lanes, dsi->format, + &dsi->lane_mbps); if (ret) DRM_DEBUG_DRIVER("Phy get_lane_mbps() failed\n"); @@ -1054,11 +1056,14 @@ static void dw_mipi_dsi_bridge_atomic_enable(struct drm_bridge *bridge, struct drm_bridge_state *old_bridge_state) { struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge); + struct drm_atomic_state *state = old_bridge_state->base.state; + const struct drm_bridge_state *bridge_state; const struct drm_display_mode *adjusted_mode = &dsi->mode; + bridge_state = drm_atomic_get_new_bridge_state(state, bridge); - dw_mipi_dsi_mode_set(dsi, adjusted_mode); + dw_mipi_dsi_mode_set(dsi, adjusted_mode, bridge_state); if (dsi->slave) - dw_mipi_dsi_mode_set(dsi->slave, adjusted_mode); + dw_mipi_dsi_mode_set(dsi->slave, adjusted_mode, bridge_state); /* Switch to video mode for panel-bridge enable & panel enable */ dw_mipi_dsi_set_mode(dsi, MIPI_DSI_MODE_VIDEO); diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c index 4ed7a68681978..39965e0d16c95 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -526,6 +526,7 @@ static void dw_mipi_dsi_phy_power_off(void *priv_data) static int dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode, + const struct drm_bridge_state *bridge_state, unsigned long mode_flags, u32 lanes, u32 format, unsigned int *lane_mbps) { diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c index 32cb41b2202fe..0132e576339dd 100644 --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c @@ -239,6 +239,7 @@ static void dw_mipi_dsi_phy_power_off(void *priv_data) static int dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode, + const struct drm_bridge_state *bridge_state, unsigned long mode_flags, u32 lanes, u32 format, unsigned int *lane_mbps) { diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h index 5286a53a1875d..f449ff36c4653 100644 --- a/include/drm/bridge/dw_mipi_dsi.h +++ b/include/drm/bridge/dw_mipi_dsi.h @@ -11,6 +11,7 @@ #include <linux/types.h> +#include <drm/drm_atomic.h> #include <drm/drm_modes.h> struct drm_display_mode; @@ -32,6 +33,7 @@ struct dw_mipi_dsi_phy_ops { void (*power_off)(void *priv_data); int (*get_lane_mbps)(void *priv_data, const struct drm_display_mode *mode, + const struct drm_bridge_state *bridge_state, unsigned long mode_flags, u32 lanes, u32 format, unsigned int *lane_mbps); int (*get_timing)(void *priv_data, unsigned int lane_mbps, -- 2.34.1