From nobody Mon Apr 6 10:30:41 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16DE9C6FA82 for ; Thu, 22 Sep 2022 12:53:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231674AbiIVMxC (ORCPT ); Thu, 22 Sep 2022 08:53:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231585AbiIVMwt (ORCPT ); Thu, 22 Sep 2022 08:52:49 -0400 Received: from smtp-190a.mail.infomaniak.ch (smtp-190a.mail.infomaniak.ch [IPv6:2001:1600:4:17::190a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3161E7C18 for ; Thu, 22 Sep 2022 05:52:46 -0700 (PDT) Received: from smtp-3-0000.mail.infomaniak.ch (unknown [10.4.36.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4MYFLr4H9vzMpvbT; Thu, 22 Sep 2022 14:43:16 +0200 (CEST) Received: from philippe-pc.toradex.int (unknown [31.10.206.125]) by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4MYFLr1mgZzx4; Thu, 22 Sep 2022 14:43:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=pschenker.ch; s=20220412; t=1663850596; bh=E4CXD4d3Xn+bPdqQlu5YfOTpM5v82SNMUk19vcUlzSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UigWODTfq0hnHtkrn8jCupkr83Ls8C7bR4EE9i16Us3KHcqRTYNIqaTw05VxST2RP kwRTrtRtnStmHNfU9Sr8kCo8Gz7V2zvBqZ4AVgF5e/XC7xFxRcf94B2czKkbMtSoPV 9fBxlD+/KdPjsJ42zTGbq0QNwDxkNNSPRDp75Xqg= From: Philippe Schenker To: dri-devel@lists.freedesktop.org, Adrien Grassein Cc: Jernej Skrabec , Jonas Karlman , Robert Foss , linux-kernel@vger.kernel.org, Daniel Vetter , Neil Armstrong , Laurent Pinchart , Andrzej Hajda , David Airlie , Philippe Schenker Subject: [PATCH 1/4] drm/bridge: lt8912b: add vsync hsync Date: Thu, 22 Sep 2022 14:43:03 +0200 Message-Id: <20220922124306.34729-2-dev@pschenker.ch> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220922124306.34729-1-dev@pschenker.ch> References: <20220922124306.34729-1-dev@pschenker.ch> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Philippe Schenker 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 Acked-by: Adrien Grassein --- 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/bri= dge/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 =3D 0x08; - int ret; + int ret, hsync_activehigh, vsync_activehigh; =20 if (!lt) return -EINVAL; @@ -278,12 +278,14 @@ static int lt8912_video_setup(struct lt8912 *lt) hpw =3D lt->mode.hsync_len; hbp =3D lt->mode.hback_porch; h_total =3D hactive + hfp + hpw + hbp; + hsync_activehigh =3D lt->mode.flags & DISPLAY_FLAGS_HSYNC_HIGH; =20 vactive =3D lt->mode.vactive; vfp =3D lt->mode.vfront_porch; vpw =3D lt->mode.vsync_len; vbp =3D lt->mode.vback_porch; v_total =3D vactive + vfp + vpw + vbp; + vsync_activehigh =3D lt->mode.flags & DISPLAY_FLAGS_VSYNC_HIGH; =20 if (vactive <=3D 600) settle =3D 0x04; @@ -317,6 +319,11 @@ static int lt8912_video_setup(struct lt8912 *lt) ret |=3D regmap_write(lt->regmap[I2C_CEC_DSI], 0x3e, hfp & 0xff); ret |=3D regmap_write(lt->regmap[I2C_CEC_DSI], 0x3f, hfp >> 8); =20 + ret |=3D regmap_update_bits(lt->regmap[I2C_MAIN], 0xab, BIT(0), + vsync_activehigh ? BIT(0) : 0); + ret |=3D regmap_update_bits(lt->regmap[I2C_MAIN], 0xab, BIT(1), + hsync_activehigh ? BIT(1) : 0); + return ret; } =20 --=20 2.37.3 From nobody Mon Apr 6 10:30:41 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FA8FC54EE9 for ; Thu, 22 Sep 2022 12:52:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231637AbiIVMwy (ORCPT ); Thu, 22 Sep 2022 08:52:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231424AbiIVMwt (ORCPT ); Thu, 22 Sep 2022 08:52:49 -0400 X-Greylist: delayed 567 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 22 Sep 2022 05:52:46 PDT Received: from smtp-190a.mail.infomaniak.ch (smtp-190a.mail.infomaniak.ch [IPv6:2001:1600:4:17::190a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B0CCE11F7 for ; Thu, 22 Sep 2022 05:52:45 -0700 (PDT) Received: from smtp-3-0000.mail.infomaniak.ch (unknown [10.4.36.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4MYFLs0F6WzMpvFw; Thu, 22 Sep 2022 14:43:17 +0200 (CEST) Received: from philippe-pc.toradex.int (unknown [31.10.206.125]) by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4MYFLr4bfzzx4; Thu, 22 Sep 2022 14:43:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=pschenker.ch; s=20220412; t=1663850596; bh=rPRq0sZw9ssZ1DOgDKQ+DheMaamSeVNAcj9Urfa5r+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=di9Svk+N3G3GlNs89fp8R6/eavGQmIAwGU378ycae64rVgx19NkobiulRhs0LEygH saQe07et07Zon9c9xQjot48c90LT/vUeeyUt3YmEWJUrT9mM1Md7cVDf+1DZ9bjwkw vJ/MqjiihulFIcSCR/sVY1f6wGNvMA1faz7NJ4lA= From: Philippe Schenker To: dri-devel@lists.freedesktop.org, Adrien Grassein Cc: Jernej Skrabec , Jonas Karlman , Robert Foss , linux-kernel@vger.kernel.org, Daniel Vetter , Neil Armstrong , Laurent Pinchart , Andrzej Hajda , David Airlie , Philippe Schenker Subject: [PATCH 2/4] drm/bridge: lt8912b: set hdmi or dvi mode Date: Thu, 22 Sep 2022 14:43:04 +0200 Message-Id: <20220922124306.34729-3-dev@pschenker.ch> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220922124306.34729-1-dev@pschenker.ch> References: <20220922124306.34729-1-dev@pschenker.ch> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Philippe Schenker The Lontium LT8912 does have a setting for DVI or HDMI. This patch reads from EDID what the display needs and sets it accordingly. Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge") Signed-off-by: Philippe Schenker Acked-by: Adrien Grassein --- drivers/gpu/drm/bridge/lontium-lt8912b.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bri= dge/lontium-lt8912b.c index 0fd3472e767c..6a4bb7422176 100644 --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c @@ -323,6 +323,8 @@ static int lt8912_video_setup(struct lt8912 *lt) vsync_activehigh ? BIT(0) : 0); ret |=3D regmap_update_bits(lt->regmap[I2C_MAIN], 0xab, BIT(1), hsync_activehigh ? BIT(1) : 0); + ret |=3D regmap_update_bits(lt->regmap[I2C_MAIN], 0xb2, BIT(0), + lt->connector.display_info.is_hdmi ? BIT(0) : 0); =20 return ret; } --=20 2.37.3 From nobody Mon Apr 6 10:30:41 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8F52C54EE9 for ; Thu, 22 Sep 2022 12:53:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231635AbiIVMw6 (ORCPT ); Thu, 22 Sep 2022 08:52:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231580AbiIVMwt (ORCPT ); Thu, 22 Sep 2022 08:52:49 -0400 X-Greylist: delayed 566 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 22 Sep 2022 05:52:46 PDT Received: from smtp-42ae.mail.infomaniak.ch (smtp-42ae.mail.infomaniak.ch [84.16.66.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2E51E7C03 for ; Thu, 22 Sep 2022 05:52:46 -0700 (PDT) Received: from smtp-3-0000.mail.infomaniak.ch (unknown [10.4.36.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4MYFLs2jySzMqJ30; Thu, 22 Sep 2022 14:43:17 +0200 (CEST) Received: from philippe-pc.toradex.int (unknown [31.10.206.125]) by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4MYFLs0bwZzx4; Thu, 22 Sep 2022 14:43:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=pschenker.ch; s=20220412; t=1663850597; bh=+OIz10N0TA8uuQex2ybW9n6SGAbwcDokvY4GhIEiPro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=av5JMroOBKiey1Rx1ox6FjGZK+pgv1N0kM2fJGIJQoRKGafLPwBJVCoDSFa6SUGqI g8ADwi3jh/0D6nX3yIlEH1zclnikto68pCqs73JC6BBfYefSo8s2zfn9iOqaowkshn S/dK2UHJ0GuyVRFlJjqXjav6u9iF4sZRgbKJVCPo= From: Philippe Schenker To: dri-devel@lists.freedesktop.org, Adrien Grassein Cc: Jernej Skrabec , Jonas Karlman , Robert Foss , linux-kernel@vger.kernel.org, Daniel Vetter , Neil Armstrong , Laurent Pinchart , Andrzej Hajda , David Airlie , Francesco Dolcini , Philippe Schenker Subject: [PATCH 3/4] drm/bridge: lt8912b: fix corrupted image output Date: Thu, 22 Sep 2022 14:43:05 +0200 Message-Id: <20220922124306.34729-4-dev@pschenker.ch> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220922124306.34729-1-dev@pschenker.ch> References: <20220922124306.34729-1-dev@pschenker.ch> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Francesco Dolcini Correct I2C address for the register list in lt8912_write_lvds_config(), these registers are on the first I2C address (0x48), the current function is just writing garbage to the wrong registers and this creates multiple issues (artifacts and output completely corrupted) on some HDMI displays. Correct I2C address comes from Lontium documentation and it is the one used on other out-of-tree LT8912B drivers [1]. [1] https://github.com/boundarydevices/linux/blob/boundary-imx_5.10.x_2.0.0= /drivers/video/lt8912.c#L296 Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge") Signed-off-by: Francesco Dolcini Signed-off-by: Philippe Schenker Acked-by: Adrien Grassein --- drivers/gpu/drm/bridge/lontium-lt8912b.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bri= dge/lontium-lt8912b.c index 6a4bb7422176..5968f4af190b 100644 --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c @@ -188,7 +188,7 @@ static int lt8912_write_lvds_config(struct lt8912 *lt) {0x03, 0xff}, }; =20 - return regmap_multi_reg_write(lt->regmap[I2C_CEC_DSI], seq, ARRAY_SIZE(se= q)); + return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, ARRAY_SIZE(seq)); }; =20 static inline struct lt8912 *bridge_to_lt8912(struct drm_bridge *b) --=20 2.37.3 From nobody Mon Apr 6 10:30:41 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AE52C54EE9 for ; Thu, 22 Sep 2022 12:53:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231685AbiIVMxF (ORCPT ); Thu, 22 Sep 2022 08:53:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231582AbiIVMwt (ORCPT ); Thu, 22 Sep 2022 08:52:49 -0400 Received: from smtp-8fa8.mail.infomaniak.ch (smtp-8fa8.mail.infomaniak.ch [IPv6:2001:1600:4:17::8fa8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F2D6E7C2E for ; Thu, 22 Sep 2022 05:52:47 -0700 (PDT) Received: from smtp-3-0000.mail.infomaniak.ch (unknown [10.4.36.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4MYFLs5Y7wzMpp4G; Thu, 22 Sep 2022 14:43:17 +0200 (CEST) Received: from philippe-pc.toradex.int (unknown [31.10.206.125]) by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4MYFLs37m5z3g; Thu, 22 Sep 2022 14:43:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=pschenker.ch; s=20220412; t=1663850597; bh=txqoeLVu69b7SOW8ljUizaUSKTWyveLWsrFwR5lKTZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gqXxNIlL6AAoK9a3rCfNjZFvJTXM3EeeCKG/LoCE4RdufGOn/vPayg6nQVe49HvJl Z/bsE+axEzj4hajsbXbHi6l4pzFUNCxYMfVmP+Tqd62wgbZpybTU/8eEnFPQRibe1x yR+jMUzfDnQTgZLF0ESsMRtggq/eurbjkk/cKXxQ= From: Philippe Schenker To: dri-devel@lists.freedesktop.org, Adrien Grassein Cc: Jernej Skrabec , Jonas Karlman , Robert Foss , linux-kernel@vger.kernel.org, Daniel Vetter , Neil Armstrong , Laurent Pinchart , Andrzej Hajda , David Airlie , Francesco Dolcini , Philippe Schenker Subject: [PATCH 4/4] drm/bridge: lt8912b: clarify lvds output status Date: Thu, 22 Sep 2022 14:43:06 +0200 Message-Id: <20220922124306.34729-5-dev@pschenker.ch> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220922124306.34729-1-dev@pschenker.ch> References: <20220922124306.34729-1-dev@pschenker.ch> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Francesco Dolcini Add comments on the lt8912_write_lvds_config() config to document the current settings and to make it clear that this is a hardcoded configuration not relevant for the HDMI output (could be removed without affecting the HDMI port). No changes on the actual register writes. Signed-off-by: Francesco Dolcini Signed-off-by: Philippe Schenker Acked-by: Adrien Grassein --- drivers/gpu/drm/bridge/lontium-lt8912b.c | 26 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bri= dge/lontium-lt8912b.c index 5968f4af190b..3e870d45f881 100644 --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c @@ -165,24 +165,32 @@ static int lt8912_write_rxlogicres_config(struct lt89= 12 *lt) return ret; }; =20 +/* enable LVDS output with some hardcoded configuration, not required for = the HDMI output */ static int lt8912_write_lvds_config(struct lt8912 *lt) { const struct reg_sequence seq[] =3D { + // lvds power up {0x44, 0x30}, {0x51, 0x05}, - {0x50, 0x24}, - {0x51, 0x2d}, - {0x52, 0x04}, - {0x69, 0x0e}, + + // core pll bypass + {0x50, 0x24}, // cp=3D50uA + {0x51, 0x2d}, // Pix_clk as reference, second order passive LPF PLL + {0x52, 0x04}, // loopdiv=3D0, use second-order PLL + {0x69, 0x0e}, // CP_PRESET_DIV_RATIO {0x69, 0x8e}, {0x6a, 0x00}, - {0x6c, 0xb8}, + {0x6c, 0xb8}, // RGD_CP_SOFT_K_EN,RGD_CP_SOFT_K[13:8] {0x6b, 0x51}, - {0x04, 0xfb}, + + {0x04, 0xfb}, // core pll reset {0x04, 0xff}, - {0x7f, 0x00}, - {0xa8, 0x13}, - {0x02, 0xf7}, + + // scaler bypass + {0x7f, 0x00}, // disable scaler + {0xa8, 0x13}, // 0x13: JEIDA, 0x33: VESA + + {0x02, 0xf7}, // lvds pll reset {0x02, 0xff}, {0x03, 0xcf}, {0x03, 0xff}, --=20 2.37.3