public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Philippe Schenker <dev@pschenker.ch>
To: dri-devel@lists.freedesktop.org,
	Adrien Grassein <adrien.grassein@gmail.com>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Robert Foss <robert.foss@linaro.org>,
	linux-kernel@vger.kernel.org, Daniel Vetter <daniel@ffwll.ch>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	David Airlie <airlied@linux.ie>,
	Philippe Schenker <philippe.schenker@toradex.com>
Subject: [PATCH 1/4] drm/bridge: lt8912b: add vsync hsync
Date: Thu, 22 Sep 2022 14:43:03 +0200	[thread overview]
Message-ID: <20220922124306.34729-2-dev@pschenker.ch> (raw)
In-Reply-To: <20220922124306.34729-1-dev@pschenker.ch>

From: Philippe Schenker <philippe.schenker@toradex.com>

Currently the bridge driver does not take care whether or not the display
needs positive/negative vertical/horizontal syncs. Pass these two flags
to the bridge from the EDID that was read out from the display.

Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge")
Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>

---

 drivers/gpu/drm/bridge/lontium-lt8912b.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c
index 28bad30dc4e5..0fd3472e767c 100644
--- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
+++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
@@ -268,7 +268,7 @@ static int lt8912_video_setup(struct lt8912 *lt)
 	u32 hactive, h_total, hpw, hfp, hbp;
 	u32 vactive, v_total, vpw, vfp, vbp;
 	u8 settle = 0x08;
-	int ret;
+	int ret, hsync_activehigh, vsync_activehigh;
 
 	if (!lt)
 		return -EINVAL;
@@ -278,12 +278,14 @@ static int lt8912_video_setup(struct lt8912 *lt)
 	hpw = lt->mode.hsync_len;
 	hbp = lt->mode.hback_porch;
 	h_total = hactive + hfp + hpw + hbp;
+	hsync_activehigh = lt->mode.flags & DISPLAY_FLAGS_HSYNC_HIGH;
 
 	vactive = lt->mode.vactive;
 	vfp = lt->mode.vfront_porch;
 	vpw = lt->mode.vsync_len;
 	vbp = lt->mode.vback_porch;
 	v_total = vactive + vfp + vpw + vbp;
+	vsync_activehigh = lt->mode.flags & DISPLAY_FLAGS_VSYNC_HIGH;
 
 	if (vactive <= 600)
 		settle = 0x04;
@@ -317,6 +319,11 @@ static int lt8912_video_setup(struct lt8912 *lt)
 	ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x3e, hfp & 0xff);
 	ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x3f, hfp >> 8);
 
+	ret |= regmap_update_bits(lt->regmap[I2C_MAIN], 0xab, BIT(0),
+				  vsync_activehigh ? BIT(0) : 0);
+	ret |= regmap_update_bits(lt->regmap[I2C_MAIN], 0xab, BIT(1),
+				  hsync_activehigh ? BIT(1) : 0);
+
 	return ret;
 }
 
-- 
2.37.3


  reply	other threads:[~2022-09-22 12:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 12:43 [PATCH 0/4] drm/bridge: lt8912b: Fix corrupt display output due to wrong bridge config Philippe Schenker
2022-09-22 12:43 ` Philippe Schenker [this message]
2022-09-22 18:24   ` [PATCH 1/4] drm/bridge: lt8912b: add vsync hsync Adrien Grassein
2022-09-22 12:43 ` [PATCH 2/4] drm/bridge: lt8912b: set hdmi or dvi mode Philippe Schenker
2022-09-22 18:25   ` Adrien Grassein
2022-09-22 12:43 ` [PATCH 3/4] drm/bridge: lt8912b: fix corrupted image output Philippe Schenker
2022-09-22 18:26   ` Adrien Grassein
2022-09-22 12:43 ` [PATCH 4/4] drm/bridge: lt8912b: clarify lvds output status Philippe Schenker
2022-09-22 18:26   ` Adrien Grassein
2022-09-23  9:22 ` (subset) [PATCH 0/4] drm/bridge: lt8912b: Fix corrupt display output due to wrong bridge config Neil Armstrong
2022-09-23  9:25 ` Neil Armstrong
2022-09-28 14:22 ` Robert Foss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220922124306.34729-2-dev@pschenker.ch \
    --to=dev@pschenker.ch \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=adrien.grassein@gmail.com \
    --cc=airlied@linux.ie \
    --cc=andrzej.hajda@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=philippe.schenker@toradex.com \
    --cc=robert.foss@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox