From: Janine Hagemann <j.hagem...@phytec.de>

Add a optional property to change LVDS output voltage. This should not
be static as this depends mainly on the connected display voltage
requirement.

If the property is not present, the default value of 0x05 is used.

Signed-off-by: Janine Hagemann <j.hagem...@phytec.de>
Signed-off-by: Andrej Picej <andrej.pi...@norik.com>
---
 drivers/gpu/drm/bridge/ti-sn65dsi83.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c 
b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
index 57a7ed13f996..d6824f6501b6 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
@@ -147,6 +147,7 @@ struct sn65dsi83 {
        struct regulator                *vcc;
        bool                            lvds_dual_link;
        bool                            lvds_dual_link_even_odd_swap;
+       u32                             lvds_vcom;
 };
 
 static const struct regmap_range sn65dsi83_readable_ranges[] = {
@@ -435,7 +436,7 @@ static void sn65dsi83_atomic_pre_enable(struct drm_bridge 
*bridge,
                val |= REG_LVDS_FMT_LVDS_LINK_CFG;
 
        regmap_write(ctx->regmap, REG_LVDS_FMT, val);
-       regmap_write(ctx->regmap, REG_LVDS_VCOM, 0x05);
+       regmap_write(ctx->regmap, REG_LVDS_VCOM, ctx->lvds_vcom);
        regmap_write(ctx->regmap, REG_LVDS_LANE,
                     (ctx->lvds_dual_link_even_odd_swap ?
                      REG_LVDS_LANE_EVEN_ODD_SWAP : 0) |
@@ -580,6 +581,13 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum 
sn65dsi83_model model)
 {
        struct drm_bridge *panel_bridge;
        struct device *dev = ctx->dev;
+       struct device_node *endpoint;
+
+       ctx->lvds_vcom = 0x05;
+
+       endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, 0);
+       of_property_read_u32(endpoint, "ti,lvds-vcom", &ctx->lvds_vcom);
+       of_node_put(endpoint);
 
        ctx->lvds_dual_link = false;
        ctx->lvds_dual_link_even_odd_swap = false;
-- 
2.34.1

Reply via email to