From nobody Thu Apr 9 09:03:34 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A19BB425CED for ; Mon, 9 Mar 2026 22:07:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773094038; cv=none; b=BxsskvTUx7TbU0kLgOMDhJ11aeY2CQB+CHLJId32mvN8P1XgHiYxV7L4KsrXnRkuSNMzig4l/oDouofSj6VWaXyJj2tNZjSgIoUFj8BLepaCaKU3PiW+AXA3X4okfoBSzVTzOqK+Jx6aigeGCF83CBfeAKQ3Hd6OKsD2zM9sCMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773094038; c=relaxed/simple; bh=zp3CJRaXwRj+Y2Bqykuf1K1Fxu/EY1nn0bljxaRWPyo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=K9cjUFTuI59KWeEt3SrEy935ZATkxCwZMVzJ8QgX6f9QEp7zVKTAbGP5jloV24nC8dZhZr9F+xKEU/bhupSKtIynSF1KP+8usDzhmNXUc2r34oSlxN9NBRWPTaPdX1nZ7TGGwq1Fmee/QB5o3DOMgtt1we7Iq2oG+kYiXBAW4yk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=pA9SPLNt; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="pA9SPLNt" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 0C9D31A2CD6; Mon, 9 Mar 2026 22:07:15 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id D6A135FFB8; Mon, 9 Mar 2026 22:07:14 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 57C921036971B; Mon, 9 Mar 2026 23:07:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1773094033; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=uPN5ODiFDnwnJDTSstK7yiOs+hypMF3ir9ywO8DFVJ0=; b=pA9SPLNtjltc/NoQwx6hXEYMXijyabTzyOO9RfbU8GEGWGNkYC5LhtByTPrmC5yOyyG9u1 rXShHl/49ruQv5sQiLS1+DB5VIjc6oGWosyHzzFcuYefo8XKbBC5Zwg3uXa0ll2DXH2KAi D7xIz7sOpJnk1ya2FrLUDWlIUiGdDlX+w7iANmJgRdhkkCQftIKOe5NXfjty7wxpgpVOSF TXMIan8/hQTeA1HHQpNIC39Zy3Q7yd7ZnDMPG+gBmYS37m9o6Nr4n1XTPiVBXVylI5j+i+ FIlf9soU3JHnWXYwcq8r2Jkb5HG+Ou1sH19LeQTRV8RRuITDRy7cLILsZsQiGQ== From: Luca Ceresoli Date: Mon, 09 Mar 2026 23:06:40 +0100 Subject: [PATCH v2] drm/bridge: ti-sn65dsi83: add test pattern generation support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260309-ti-sn65dsi83-dual-lvds-fixes-and-test-pattern-v2-1-e6aaa7e1d181@bootlin.com> References: <20260309-ti-sn65dsi83-dual-lvds-fixes-and-test-pattern-v2-0-e6aaa7e1d181@bootlin.com> In-Reply-To: <20260309-ti-sn65dsi83-dual-lvds-fixes-and-test-pattern-v2-0-e6aaa7e1d181@bootlin.com> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Frieder Schrempf , Marek Vasut , Linus Walleij Cc: Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Luca Ceresoli , Hui Pu , Ian Ray X-Mailer: b4 0.15-dev-5464f X-Last-TLS-Session-Version: TLSv1.3 Generation of a test pattern output is a useful tool for panel bringup and debugging, and very simple to support with this chip. The value of REG_VID_CHA_ACTIVE_LINE_LENGTH_LOW needs to be divided by two for the test pattern to work in dual LVDS mode. While not clearly stated in the datasheet, this is needed according to the DSI Tuner [0] output. And some dual-LVDS panels refuse to show any picture without this division by two. [0] https://www.ti.com/tool/DSI-TUNER Signed-off-by: Luca Ceresoli --- Changes in v2: - added local variable to avoid potential race condition leading to inconsistent settings --- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge= /ti-sn65dsi83.c index f6736b4457bb..1936080e6a1a 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c @@ -114,6 +114,7 @@ #define REG_VID_CHA_HORIZONTAL_FRONT_PORCH 0x38 #define REG_VID_CHA_VERTICAL_FRONT_PORCH 0x3a #define REG_VID_CHA_TEST_PATTERN 0x3c +#define REG_VID_CHA_TEST_PATTERN_EN BIT(4) /* IRQ registers */ #define REG_IRQ_GLOBAL 0xe0 #define REG_IRQ_GLOBAL_IRQ_EN BIT(0) @@ -134,6 +135,9 @@ #define REG_IRQ_STAT_CHA_SOT_BIT_ERR BIT(2) #define REG_IRQ_STAT_CHA_PLL_UNLOCK BIT(0) =20 +static bool sn65dsi83_test_pattern; +module_param_named(test_pattern, sn65dsi83_test_pattern, bool, 0644); + enum sn65dsi83_channel { CHANNEL_A, CHANNEL_B @@ -522,6 +526,7 @@ static void sn65dsi83_atomic_pre_enable(struct drm_brid= ge *bridge, const struct drm_display_mode *mode; struct drm_connector *connector; struct drm_crtc *crtc; + bool test_pattern =3D sn65dsi83_test_pattern; bool lvds_format_24bpp; bool lvds_format_jeida; unsigned int pval; @@ -644,7 +649,11 @@ static void sn65dsi83_atomic_pre_enable(struct drm_bri= dge *bridge, REG_LVDS_LANE_CHB_LVDS_TERM : 0)); regmap_write(ctx->regmap, REG_LVDS_CM, 0x00); =20 - le16val =3D cpu_to_le16(mode->hdisplay); + /* + * Active line length needs to be halved for test pattern + * generation in dual LVDS output. + */ + le16val =3D cpu_to_le16(mode->hdisplay / (test_pattern ? 2 : 1)); regmap_bulk_write(ctx->regmap, REG_VID_CHA_ACTIVE_LINE_LENGTH_LOW, &le16val, 2); le16val =3D cpu_to_le16(mode->vdisplay); @@ -667,7 +676,8 @@ static void sn65dsi83_atomic_pre_enable(struct drm_brid= ge *bridge, mode->hsync_start - mode->hdisplay); regmap_write(ctx->regmap, REG_VID_CHA_VERTICAL_FRONT_PORCH, mode->vsync_start - mode->vdisplay); - regmap_write(ctx->regmap, REG_VID_CHA_TEST_PATTERN, 0x00); + regmap_write(ctx->regmap, REG_VID_CHA_TEST_PATTERN, + test_pattern ? REG_VID_CHA_TEST_PATTERN_EN : 0); =20 /* Enable PLL */ regmap_write(ctx->regmap, REG_RC_PLL_EN, REG_RC_PLL_EN_PLL_EN); --=20 2.53.0