@@ -729,11 +729,16 @@ static void rcar_du_crtc_atomic_enable(struct drm_crtc *crtc,
rstate->outputs == BIT(RCAR_DU_OUTPUT_DPAD0)) {
struct rcar_du_encoder *encoder =
rcdu->encoders[RCAR_DU_OUTPUT_LVDS0 + rcrtc->index];
+ struct rcar_du_encoder *enc_dual_link =
+ rcdu->encoders[RCAR_DU_OUTPUT_LVDS0];
const struct drm_display_mode *mode =
&crtc->state->adjusted_mode;
struct drm_bridge *bridge;
- bridge = drm_bridge_chain_get_first_bridge(&encoder->base);
+ bridge = drm_bridge_chain_get_first_bridge(&enc_dual_link->base);
+ if (!rcar_lvds_dual_link(bridge))
+ bridge = drm_bridge_chain_get_first_bridge(&encoder->base);
+
rcar_lvds_clk_enable(bridge, mode->clock * 1000);
}
@@ -761,13 +766,18 @@ static void rcar_du_crtc_atomic_disable(struct drm_crtc *crtc,
rstate->outputs == BIT(RCAR_DU_OUTPUT_DPAD0)) {
struct rcar_du_encoder *encoder =
rcdu->encoders[RCAR_DU_OUTPUT_LVDS0 + rcrtc->index];
+ struct rcar_du_encoder *enc_dual_link =
+ rcdu->encoders[RCAR_DU_OUTPUT_LVDS0];
struct drm_bridge *bridge;
/*
* Disable the LVDS clock output, see
* rcar_du_crtc_atomic_enable().
*/
- bridge = drm_bridge_chain_get_first_bridge(&encoder->base);
+ bridge = drm_bridge_chain_get_first_bridge(&enc_dual_link->base);
+ if (!rcar_lvds_dual_link(bridge))
+ bridge = drm_bridge_chain_get_first_bridge(&encoder->base);
+
rcar_lvds_clk_disable(bridge);
}
@@ -373,6 +373,9 @@ int rcar_lvds_clk_enable(struct drm_bridge *bridge, unsigned long freq)
struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge);
int ret;
+ if (lvds->link_type != RCAR_LVDS_SINGLE_LINK && lvds->companion)
+ lvds = bridge_to_rcar_lvds(lvds->companion);
+
if (WARN_ON(!(lvds->info->quirks & RCAR_LVDS_QUIRK_EXT_PLL)))
return -ENODEV;
@@ -392,6 +395,9 @@ void rcar_lvds_clk_disable(struct drm_bridge *bridge)
{
struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge);
+ if (lvds->link_type != RCAR_LVDS_SINGLE_LINK && lvds->companion)
+ lvds = bridge_to_rcar_lvds(lvds->companion);
+
if (WARN_ON(!(lvds->info->quirks & RCAR_LVDS_QUIRK_EXT_PLL)))
return;