From: Wojciech Dubowik <[email protected]>

Add parsing of lvds reverse lanes device tree property. When
set, the endpoint lvds data lanes are configured in <4 3 2 1>
order instead of default <1 2 3 4>. This is needed for layouts
where lanes have been swapped.

Signed-off-by: Wojciech Dubowik <[email protected]>
---
 drivers/gpu/drm/bridge/ti-sn65dsi83.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c 
b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
index 42b451432bbb..2ab2764065c4 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
@@ -163,6 +163,7 @@ struct sn65dsi83 {
        struct regulator                *vcc;
        bool                            lvds_dual_link;
        bool                            lvds_dual_link_even_odd_swap;
+       bool                            lvds_reverse_lanes_conf[2];
        int                             lvds_vod_swing_conf[2];
        int                             lvds_term_conf[2];
        int                             irq;
@@ -644,6 +645,10 @@ static void sn65dsi83_atomic_pre_enable(struct drm_bridge 
*bridge,
        regmap_write(ctx->regmap, REG_LVDS_LANE,
                     (ctx->lvds_dual_link_even_odd_swap ?
                      REG_LVDS_LANE_EVEN_ODD_SWAP : 0) |
+                    (ctx->lvds_reverse_lanes_conf[CHANNEL_A] ?
+                     REG_LVDS_LANE_CHA_REVERSE_LVDS : 0) |
+                    (ctx->lvds_reverse_lanes_conf[CHANNEL_B] ?
+                     REG_LVDS_LANE_CHB_REVERSE_LVDS : 0) |
                     (ctx->lvds_term_conf[CHANNEL_A] ?
                          REG_LVDS_LANE_CHA_LVDS_TERM : 0) |
                     (ctx->lvds_term_conf[CHANNEL_B] ?
@@ -854,6 +859,9 @@ static int sn65dsi83_parse_lvds_endpoint(struct sn65dsi83 
*ctx, int channel)
                goto exit;
        }
 
+       ctx->lvds_reverse_lanes_conf[channel] =
+               of_property_read_bool(endpoint, "ti,lvds-reverse-lanes");
+
        ret_data = of_property_read_u32_array(endpoint, 
"ti,lvds-vod-swing-data-microvolt",
                                        lvds_vod_swing_data, 
ARRAY_SIZE(lvds_vod_swing_data));
        if (ret_data != 0 && ret_data != -EINVAL) {
-- 
2.47.3

Reply via email to