@@ -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);
@@ -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)
{
@@ -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)
{
@@ -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,
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@denx.de> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> Cc: Maxime Ripard <maxime@cerno.tech> Cc: Neil Armstrong <narmstrong@baylibre.com> Cc: Sam Ravnborg <sam@ravnborg.org> --- 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(-)