From: Lucas Stach <l.stach@xxxxxxxxxxxxxx> On systems without a mux between the IPU display interfaces and the LVDS channels it isn't possible to infer the DI number from the LDB port numbers, but have a static 1:1 mapping. Signed-off-by: Lucas Stach <l.stach@xxxxxxxxxxxxxx> Signed-off-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx> --- drivers/gpu/drm/imx/imx-ldb.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c index 631909e..4fca2b9 100644 --- a/drivers/gpu/drm/imx/imx-ldb.c +++ b/drivers/gpu/drm/imx/imx-ldb.c @@ -131,6 +131,19 @@ static bool imx_ldb_encoder_mode_fixup(struct drm_encoder *encoder, return true; } +static int imx_ldb_get_mux_id(struct imx_ldb_channel *channel) +{ + /* + * If there is no mux in between the mapping from lvds channel number + * to display interface number is 1:1 + */ + if (channel->ldb->lvds_mux) + return imx_drm_encoder_get_mux_id(channel->child, + &channel->encoder); + else + return channel->chno; +} + static void imx_ldb_set_clock(struct imx_ldb *ldb, int mux, int chno, unsigned long serial_clk, unsigned long di_clk) { @@ -195,7 +208,7 @@ static void imx_ldb_encoder_commit(struct drm_encoder *encoder) struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder); struct imx_ldb *ldb = imx_ldb_ch->ldb; int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; - int mux = imx_drm_encoder_get_mux_id(imx_ldb_ch->child, encoder); + int mux = imx_ldb_get_mux_id(imx_ldb_ch); if (dual) { clk_prepare_enable(ldb->clk[0]); @@ -241,7 +254,7 @@ static void imx_ldb_encoder_mode_set(struct drm_encoder *encoder, int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; unsigned long serial_clk; unsigned long di_clk = mode->clock * 1000; - int mux = imx_drm_encoder_get_mux_id(imx_ldb_ch->child, encoder); + int mux = imx_ldb_get_mux_id(imx_ldb_ch); if (mode->clock > 170000) { dev_warn(ldb->dev, -- 2.1.4 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel