From patchwork Sun Nov 26 16:32:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 13468892 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D240C4167B for ; Sun, 26 Nov 2023 16:39:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3706C10E129; Sun, 26 Nov 2023 16:39:18 +0000 (UTC) X-Greylist: delayed 329 seconds by postgrey-1.36 at gabe; Sun, 26 Nov 2023 16:39:15 UTC Received: from mail5.25mail.st (mail5.25mail.st [74.50.62.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id D7BDB10E130 for ; Sun, 26 Nov 2023 16:39:15 +0000 (UTC) Received: from localhost (91-158-86-216.elisa-laajakaista.fi [91.158.86.216]) by mail5.25mail.st (Postfix) with ESMTPSA id 19C386044A; Sun, 26 Nov 2023 16:32:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=atomide.com; s=25mailst; t=1701016425; bh=71ibKMM9DOpdFN+a6X/3dcd9slUwLcDlPWzmSrWFgV0=; h=From:To:Cc:Subject:Date:From; b=lSnz8z8xKloMjctrV+6oAOGgUr4m6GCC2n2O9iAgoVuhbmkUd8ca/Cyykaykwjt1K QwLD3o8y9ekMGVIzJah5C7ummdcMULRvG90ynyTeULkJBbwZxVwTPWJnaaFBiLJa+w oQ03uc2ZH6G2QdSd+jZBZRUDSt+vaew/72iKJmj9+CUwaqMWU1IHcN8ZijoUgKENJd pSXAHX91sTLUO/IkF5sgoQA19dlL1EaRJj3SwY6QKWb4zzAFC8MCbDkcR9VzcHeH7V zqkNJkLMknptGhil1wYDPc5G9pjTHZ9HJsqBnosYuwskR45PifY6Wm9QVL6k6lNKXr j3EVN2PnuWDjA== From: Tony Lindgren To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Simha BN Subject: [PATCH 1/6] dt-bindings: tc358775: Add support for tc358765 Date: Sun, 26 Nov 2023 18:32:36 +0200 Message-ID: <20231126163247.10131-1-tony@atomide.com> X-Mailer: git-send-email 2.42.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carl Philipp Klemm , devicetree@vger.kernel.org, Ivaylo Dimitrov , Merlijn Wajer , Sebastian Reichel , dri-devel@lists.freedesktop.org, Pavel Machek Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The tc358765 is similar to tc358775 except for the stdby-gpios. Signed-off-by: Tony Lindgren Reviewed-by: Krzysztof Kozlowski --- .../display/bridge/toshiba,tc358775.yaml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml --- a/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml +++ b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml @@ -10,7 +10,7 @@ maintainers: - Vinay Simha BN description: | - This binding supports DSI to LVDS bridge TC358775 + This binding supports DSI to LVDS bridges TC358765 and TC358775 MIPI DSI-RX Data 4-lane, CLK 1-lane with data rates up to 800 Mbps/lane. Video frame size: @@ -21,7 +21,9 @@ description: | properties: compatible: - const: toshiba,tc358775 + enum: + - toshiba,tc358765 + - toshiba,tc358775 reg: maxItems: 1 @@ -70,12 +72,21 @@ required: - reg - vdd-supply - vddio-supply - - stby-gpios - reset-gpios - ports additionalProperties: false +allOf: + - if: + properties: + compatible: + contains: + const: toshiba,tc358775 + then: + required: + - stby-gpios + examples: - | #include From patchwork Sun Nov 26 16:32:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 13468894 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77DEAC4167B for ; Sun, 26 Nov 2023 16:44:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A69310E131; Sun, 26 Nov 2023 16:44:18 +0000 (UTC) Received: from mail5.25mail.st (mail5.25mail.st [74.50.62.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id E03BA10E131 for ; Sun, 26 Nov 2023 16:44:15 +0000 (UTC) Received: from localhost (91-158-86-216.elisa-laajakaista.fi [91.158.86.216]) by mail5.25mail.st (Postfix) with ESMTPSA id 13C0B60461; Sun, 26 Nov 2023 16:33:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=atomide.com; s=25mailst; t=1701016472; bh=9i8b9tXyh1uDR+OQA6gU/NAtE3k4V7XC10gl799vQqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IMfnWViolujDn0MfZMj3UnLY4R85WyrD+34DaiXlvGbPvIN9SLLra4j0TtlgeECUs OWkjzSx2y+p3I6nj2ojMY6OtT7cnGlwAUIYHFkbTXQJ28p1F+bMI+I7rgUhuboreB9 PwsTrRbCJOwMA7K8tt53Wl9SxOkOSN7l8epGwCe3wYXDWVhUe8cVTDiTzTHF7BQH8u ue6n4R7XD7IAIccB2D+v48MRACMVBUrkOc4cI6/U72ENN0Z9k+J/43oWmYIkWJDUkA dSGAFBzzLqPggezTXrRH+ZcK2fnyrESOmqvKr+ER0KgA1j6FmYmrA/YfOhIW+yCeqw OGjN4djTnuPEQ== From: Tony Lindgren To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sam Ravnborg , Vinay Simha BN Subject: [PATCH 2/6] drm/bridge: tc358775: Fix getting dsi host data lanes Date: Sun, 26 Nov 2023 18:32:37 +0200 Message-ID: <20231126163247.10131-2-tony@atomide.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231126163247.10131-1-tony@atomide.com> References: <20231126163247.10131-1-tony@atomide.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carl Philipp Klemm , devicetree@vger.kernel.org, Ivaylo Dimitrov , Merlijn Wajer , Sebastian Reichel , dri-devel@lists.freedesktop.org, Pavel Machek Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The current code assume hardcoded dsi host endpoint 1, which may not be the case. Let's fix that and simplify the code by getting the dsi endpoint with of_graph_get_remote_endpoint() that does not assume any endpoint numbering. Fixes: b26975593b17 ("display/drm/bridge: TC358775 DSI/LVDS driver") Signed-off-by: Tony Lindgren --- drivers/gpu/drm/bridge/tc358775.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358775.c b/drivers/gpu/drm/bridge/tc358775.c --- a/drivers/gpu/drm/bridge/tc358775.c +++ b/drivers/gpu/drm/bridge/tc358775.c @@ -528,25 +528,17 @@ tc_mode_valid(struct drm_bridge *bridge, static int tc358775_parse_dt(struct device_node *np, struct tc_data *tc) { struct device_node *endpoint; - struct device_node *parent; struct device_node *remote; int dsi_lanes = -1; - /* - * To get the data-lanes of dsi, we need to access the dsi0_out of port1 - * of dsi0 endpoint from bridge port0 of d2l_in - */ endpoint = of_graph_get_endpoint_by_regs(tc->dev->of_node, TC358775_DSI_IN, -1); if (endpoint) { - /* dsi0_out node */ - parent = of_graph_get_remote_port_parent(endpoint); + /* Get the configured data lanes on the dsi host side */ + remote = of_graph_get_remote_endpoint(endpoint); of_node_put(endpoint); - if (parent) { - /* dsi0 port 1 */ - dsi_lanes = drm_of_get_data_lanes_count_ep(parent, 1, -1, 1, 4); - of_node_put(parent); - } + dsi_lanes = drm_of_get_data_lanes_count(remote, 1, 4); + of_node_put(remote); } if (dsi_lanes < 0) From patchwork Sun Nov 26 17:18:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 13468896 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 59487C4167B for ; Sun, 26 Nov 2023 17:19:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7274F10E136; Sun, 26 Nov 2023 17:19:23 +0000 (UTC) Received: from mail5.25mail.st (mail5.25mail.st [74.50.62.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F14710E138 for ; Sun, 26 Nov 2023 17:19:21 +0000 (UTC) Received: from localhost (91-158-86-216.elisa-laajakaista.fi [91.158.86.216]) by mail5.25mail.st (Postfix) with ESMTPSA id 894AA60479; Sun, 26 Nov 2023 17:18:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=atomide.com; s=25mailst; t=1701019160; bh=Yi4nE9OmTsFagLEE5vj6YKCJ5nsTaUEbxvbympjRX3k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XVTNgv3ElKZu0YZB3dm19Jz+9FI9cI0PM9gtu651eE/WOg8Vau2jHgTxbpXeu3mFT noyWvXrA0QyiL/MiyYLtIsHfUO+aSCZ0ui2ML7hs83J1uaMnqava4knjozc8daBJ/u 6FwvbtH/dNk2Cf24RvWIDf8j8WomvAWIJl4jcxqw2sdkHlq3mDm5Sh1DxKN9MRYvRX cWrACrSAwQ40vHdjkcdOzEf4HGSjt8rRWs27Pju6Hv3qrsrOMvZ3l0YNzcy8fexVxl w/SFo4hwFgrRfF+ylxjVzfuJdqbVbApeuW/bWqvyaShMAjFQJIqDJ5jnf4rjOp1xZz MVCjPiPv7khGA== Date: Sun, 26 Nov 2023 19:18:37 +0200 From: Tony Lindgren To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sam Ravnborg , Vinay Simha BN Subject: [PATCH 3/6] drm/bridge: tc358775: Add jeida-24 support Message-ID: <20231126171837.GK5169@atomide.com> References: <20231126163247.10131-1-tony@atomide.com> <20231126163247.10131-2-tony@atomide.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231126163247.10131-2-tony@atomide.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carl Philipp Klemm , devicetree@vger.kernel.org, Ivaylo Dimitrov , Merlijn Wajer , Sebastian Reichel , dri-devel@lists.freedesktop.org, Pavel Machek Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The jeida-24 register values are the default hardware settings, but they not listed in the driver. Let's add them. Signed-off-by: Tony Lindgren Signed-off-by: Michael Walle Tested-by: Tony Lindgren --- drivers/gpu/drm/bridge/tc358775.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358775.c b/drivers/gpu/drm/bridge/tc358775.c --- a/drivers/gpu/drm/bridge/tc358775.c +++ b/drivers/gpu/drm/bridge/tc358775.c @@ -458,8 +458,18 @@ static void tc_bridge_enable(struct drm_bridge *bridge) * Default hardware register settings of tc358775 configured * with MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA jeida-24 format */ - if (connector->display_info.bus_formats[0] == - MEDIA_BUS_FMT_RGB888_1X7X4_SPWG) { + switch (connector->display_info.bus_formats[0]) { + case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA: + /* JEIDA-24 */ + d2l_write(tc->i2c, LV_MX0003, LV_MX(LVI_R2, LVI_R3, LVI_R4, LVI_R5)); + d2l_write(tc->i2c, LV_MX0407, LV_MX(LVI_R6, LVI_R1, LVI_R7, LVI_G2)); + d2l_write(tc->i2c, LV_MX0811, LV_MX(LVI_G3, LVI_G4, LVI_G0, LVI_G1)); + d2l_write(tc->i2c, LV_MX1215, LV_MX(LVI_G5, LVI_G6, LVI_G7, LVI_B2)); + d2l_write(tc->i2c, LV_MX1619, LV_MX(LVI_B0, LVI_B1, LVI_B3, LVI_B4)); + d2l_write(tc->i2c, LV_MX2023, LV_MX(LVI_B5, LVI_B6, LVI_B7, LVI_L0)); + d2l_write(tc->i2c, LV_MX2427, LV_MX(LVI_HS, LVI_VS, LVI_DE, LVI_R0)); + break; + case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG: /* VESA-24 */ d2l_write(tc->i2c, LV_MX0003, LV_MX(LVI_R0, LVI_R1, LVI_R2, LVI_R3)); d2l_write(tc->i2c, LV_MX0407, LV_MX(LVI_R4, LVI_R7, LVI_R5, LVI_G0)); @@ -468,7 +478,9 @@ static void tc_bridge_enable(struct drm_bridge *bridge) d2l_write(tc->i2c, LV_MX1619, LV_MX(LVI_B6, LVI_B7, LVI_B1, LVI_B2)); d2l_write(tc->i2c, LV_MX2023, LV_MX(LVI_B3, LVI_B4, LVI_B5, LVI_L0)); d2l_write(tc->i2c, LV_MX2427, LV_MX(LVI_HS, LVI_VS, LVI_DE, LVI_R6)); - } else { /* MEDIA_BUS_FMT_RGB666_1X7X3_SPWG - JEIDA-18 */ + break; + case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG: + /* JEIDA-18 */ d2l_write(tc->i2c, LV_MX0003, LV_MX(LVI_R0, LVI_R1, LVI_R2, LVI_R3)); d2l_write(tc->i2c, LV_MX0407, LV_MX(LVI_R4, LVI_L0, LVI_R5, LVI_G0)); d2l_write(tc->i2c, LV_MX0811, LV_MX(LVI_G1, LVI_G2, LVI_L0, LVI_L0)); @@ -476,6 +488,9 @@ static void tc_bridge_enable(struct drm_bridge *bridge) d2l_write(tc->i2c, LV_MX1619, LV_MX(LVI_L0, LVI_L0, LVI_B1, LVI_B2)); d2l_write(tc->i2c, LV_MX2023, LV_MX(LVI_B3, LVI_B4, LVI_B5, LVI_L0)); d2l_write(tc->i2c, LV_MX2427, LV_MX(LVI_HS, LVI_VS, LVI_DE, LVI_L0)); + break; + default: + break; } d2l_write(tc->i2c, VFUEN, VFUEN_EN); From patchwork Sun Nov 26 18:17:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 13468897 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 31DBCC4167B for ; Sun, 26 Nov 2023 18:18:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 16A2210E138; Sun, 26 Nov 2023 18:18:42 +0000 (UTC) Received: from mail5.25mail.st (mail5.25mail.st [74.50.62.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8CBD910E138 for ; Sun, 26 Nov 2023 18:18:39 +0000 (UTC) Received: from localhost (91-158-86-216.elisa-laajakaista.fi [91.158.86.216]) by mail5.25mail.st (Postfix) with ESMTPSA id B3B3D603F0; Sun, 26 Nov 2023 18:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=atomide.com; s=25mailst; t=1701022718; bh=xs8p0d+QAEnyiqX7pAek4yQaE4qoG0cOhuR0YEkyh/I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KGSuGd3a8lrrxny61YWvDXxZRpyddg2ysLQ1oRPvI90ey9wGlAXf3/6Y6F13pQjJ2 izoIWMQKjbweTKSNsSwXWvgIWII6nuMf+jyqxpz4b7Au6joPD8hD+A8Dyw2MR9ZGoT 4AGwHVLDQ2Zhb4aKRgQ2IfTA2DfAqQjlmFXYI+czNyTGoB//mVS9a98qLDFOKIKS7U tPRJfkQSBVJBIyU0rIOmdaJevi4U0vQRP4SSjG/sQ4EbLlHk5BSgEOQFiagV9tezm3 IDNhvyYHscDJF94hBYZPTzprTEPxXSIO58qTCA1waCsuaRUsm1sSV3iq9b/shrfbDv AycHKAzGRsKjA== Date: Sun, 26 Nov 2023 20:17:56 +0200 From: Tony Lindgren To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sam Ravnborg , Vinay Simha BN Subject: [PATCH 4/6] drm/bridge: tc358775: Add burst and low-power modes Message-ID: <20231126172018.GL5169@atomide.com> References: <20231126163247.10131-1-tony@atomide.com> <20231126163247.10131-2-tony@atomide.com> <20231126171837.GK5169@atomide.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231126171837.GK5169@atomide.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carl Philipp Klemm , devicetree@vger.kernel.org, Ivaylo Dimitrov , Merlijn Wajer , Sebastian Reichel , dri-devel@lists.freedesktop.org, Pavel Machek Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Burst and low-power modes are supported both for tc358765 and tc358775. Signed-off-by: Tony Lindgren --- drivers/gpu/drm/bridge/tc358775.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/tc358775.c b/drivers/gpu/drm/bridge/tc358775.c --- a/drivers/gpu/drm/bridge/tc358775.c +++ b/drivers/gpu/drm/bridge/tc358775.c @@ -632,7 +632,8 @@ static int tc_attach_host(struct tc_data *tc) dsi->lanes = tc->num_dsi_lanes; dsi->format = MIPI_DSI_FMT_RGB888; - dsi->mode_flags = MIPI_DSI_MODE_VIDEO; + dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | + MIPI_DSI_MODE_LPM; ret = devm_mipi_dsi_attach(dev, dsi); if (ret < 0) { From patchwork Sun Nov 26 18:56:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 13468902 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63148C4167B for ; Sun, 26 Nov 2023 18:57:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CBE8D10E13F; Sun, 26 Nov 2023 18:57:37 +0000 (UTC) Received: from mail5.25mail.st (mail5.25mail.st [74.50.62.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3223E10E13F for ; Sun, 26 Nov 2023 18:57:36 +0000 (UTC) Received: from localhost (91-158-86-216.elisa-laajakaista.fi [91.158.86.216]) by mail5.25mail.st (Postfix) with ESMTPSA id 3ED59604DD; Sun, 26 Nov 2023 18:56:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=atomide.com; s=25mailst; t=1701025055; bh=ZvVqIuD0d9Tn28us7HyavAfK8kAIYY6+EYFfE0Fl3Ro=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lR3EO1mFh+2yQruWymfFJwV3egJi4K9MHs20Yp6V23a9S9L2k0O971br6RpTm6yVp X4Brf3rnNhE+LReEOd/5jmQsvFVqcKO+EwpAZh2PFS+NtwgIHfG7605LttwCSrrSEt nKoJCshnm0jUiyJMAnw6Yf8Rpt+6lRc1/TcAjTlNBKMmde9EpJTWq/SUZH3g5i0K/W ydrFZd47SRRuw3IzxgBPHbqwyxurFg8CZok2Q+52noFzm237bskxx2vMyVjc+AAQ8B BMvnFJtuCyQ3HqxRUaYav/SZMTXK5LchfbBTtkmKyjscBGdX/TahmbjAZS7SXZM4YW 6dvLsPakO23gQ== Date: Sun, 26 Nov 2023 20:56:52 +0200 From: Tony Lindgren To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sam Ravnborg , Vinay Simha BN Subject: [PATCH 5/6] drm/bridge: tc358775: Add support for tc358765 Message-ID: <20231126182135.GA5166@atomide.com> References: <20231126163247.10131-1-tony@atomide.com> <20231126163247.10131-2-tony@atomide.com> <20231126171837.GK5169@atomide.com> <20231126172018.GL5169@atomide.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231126172018.GL5169@atomide.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carl Philipp Klemm , devicetree@vger.kernel.org, Ivaylo Dimitrov , Merlijn Wajer , Sebastian Reichel , dri-devel@lists.freedesktop.org, Pavel Machek Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Looks like tc358775 is pin compatible with earlier tc358765 according to the tc358774xbg_datasheet_en_20190118.pdf documentation. On tc358775, there is an extra GPIO for STBY pin added, and few other improvments. The tc358765 has a register bit for video event mode that we must set for the LCD output to work. On tc358775, this bit no longer exists. Looks like the registers seem to match otherwise based on a quick glance comparing the defines to the earlier Android kernel tc358765 driver. Signed-off-by: Tony Lindgren --- drivers/gpu/drm/bridge/tc358775.c | 55 +++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358775.c b/drivers/gpu/drm/bridge/tc358775.c --- a/drivers/gpu/drm/bridge/tc358775.c +++ b/drivers/gpu/drm/bridge/tc358775.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -107,6 +108,7 @@ #define RDPKTLN 0x0404 /* Command Read Packet Length */ #define VPCTRL 0x0450 /* Video Path Control */ +#define EVTMODE BIT(5) /* Video event mode enable, tc35876x only */ #define HTIM1 0x0454 /* Horizontal Timing Control 1 */ #define HTIM2 0x0458 /* Horizontal Timing Control 2 */ #define VTIM1 0x045C /* Vertical Timing Control 1 */ @@ -254,6 +256,11 @@ enum tc358775_ports { TC358775_LVDS_OUT1, }; +enum tc3587x5_type { + TC358765, + TC358775, +}; + struct tc_data { struct i2c_client *i2c; struct device *dev; @@ -271,6 +278,8 @@ struct tc_data { struct gpio_desc *stby_gpio; u8 lvds_link; /* single-link or dual-link */ u8 bpc; + + enum tc3587x5_type type; }; static inline struct tc_data *bridge_to_tc(struct drm_bridge *b) @@ -294,8 +303,10 @@ static void tc_bridge_pre_enable(struct drm_bridge *bridge) dev_err(dev, "regulator vdd enable failed, %d\n", ret); usleep_range(10000, 11000); - gpiod_set_value(tc->stby_gpio, 0); - usleep_range(10000, 11000); + if (!IS_ERR(tc->stby_gpio)) { + gpiod_set_value(tc->stby_gpio, 0); + usleep_range(10000, 11000); + } gpiod_set_value(tc->reset_gpio, 0); usleep_range(10, 20); @@ -310,8 +321,10 @@ static void tc_bridge_post_disable(struct drm_bridge *bridge) gpiod_set_value(tc->reset_gpio, 1); usleep_range(10, 20); - gpiod_set_value(tc->stby_gpio, 1); - usleep_range(10000, 11000); + if (!IS_ERR(tc->stby_gpio)) { + gpiod_set_value(tc->stby_gpio, 1); + usleep_range(10000, 11000); + } ret = regulator_disable(tc->vdd); if (ret < 0) @@ -424,10 +437,16 @@ static void tc_bridge_enable(struct drm_bridge *bridge) d2l_write(tc->i2c, PPI_STARTPPI, PPI_START_FUNCTION); d2l_write(tc->i2c, DSI_STARTDSI, DSI_RX_START); + /* Video event mode, this bit does not exist for tc358775 */ + if (tc->type == TC358765) + val = EVTMODE; + else + val = 0; + if (tc->bpc == 8) - val = TC358775_VPCTRL_OPXLFMT(1); + val |= TC358775_VPCTRL_OPXLFMT(1); else /* bpc = 6; */ - val = TC358775_VPCTRL_MSF(1); + val |= TC358775_VPCTRL_MSF(1); dsiclk = mode->crtc_clock * 3 * tc->bpc / tc->num_dsi_lanes / 1000; clkdiv = dsiclk / (tc->lvds_link == DUAL_LINK ? DIVIDE_BY_6 : DIVIDE_BY_3); @@ -656,6 +675,7 @@ static int tc_probe(struct i2c_client *client) tc->dev = dev; tc->i2c = client; + tc->type = (enum tc3587x5_type)of_device_get_match_data(dev); tc->panel_bridge = devm_drm_of_get_bridge(dev, dev->of_node, TC358775_LVDS_OUT0, 0); @@ -680,11 +700,15 @@ static int tc_probe(struct i2c_client *client) return ret; } - tc->stby_gpio = devm_gpiod_get(dev, "stby", GPIOD_OUT_HIGH); - if (IS_ERR(tc->stby_gpio)) { - ret = PTR_ERR(tc->stby_gpio); - dev_err(dev, "cannot get stby-gpio %d\n", ret); - return ret; + if (tc->type == TC358775) { + tc->stby_gpio = devm_gpiod_get(dev, "stby", GPIOD_OUT_HIGH); + if (IS_ERR(tc->stby_gpio)) { + ret = PTR_ERR(tc->stby_gpio); + dev_err(dev, "cannot get stby-gpio %d\n", ret); + return ret; + } + } else { + tc->stby_gpio = ERR_PTR(-ENODEV); } tc->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); @@ -696,6 +720,7 @@ static int tc_probe(struct i2c_client *client) tc->bridge.funcs = &tc_bridge_funcs; tc->bridge.of_node = dev->of_node; + tc->bridge.pre_enable_prev_first = true; drm_bridge_add(&tc->bridge); i2c_set_clientdata(client, tc); @@ -715,17 +740,21 @@ static void tc_remove(struct i2c_client *client) { struct tc_data *tc = i2c_get_clientdata(client); + mipi_dsi_detach(tc->dsi); drm_bridge_remove(&tc->bridge); + tc->bridge.funcs = NULL; } static const struct i2c_device_id tc358775_i2c_ids[] = { - { "tc358775", 0 }, + { "tc358765", TC358765, }, + { "tc358775", TC358775, }, { } }; MODULE_DEVICE_TABLE(i2c, tc358775_i2c_ids); static const struct of_device_id tc358775_of_ids[] = { - { .compatible = "toshiba,tc358775", }, + { .compatible = "toshiba,tc358765", .data = (void *)TC358765, }, + { .compatible = "toshiba,tc358775", .data = (void *)TC358775, }, { } }; MODULE_DEVICE_TABLE(of, tc358775_of_ids); From patchwork Sun Nov 26 19:15:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 13468903 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9EDAFC4167B for ; Sun, 26 Nov 2023 19:16:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 42BB310E142; Sun, 26 Nov 2023 19:16:40 +0000 (UTC) Received: from mail5.25mail.st (mail5.25mail.st [74.50.62.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id B59E810E142 for ; Sun, 26 Nov 2023 19:16:37 +0000 (UTC) Received: from localhost (91-158-86-216.elisa-laajakaista.fi [91.158.86.216]) by mail5.25mail.st (Postfix) with ESMTPSA id BE62960342; Sun, 26 Nov 2023 19:15:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=atomide.com; s=25mailst; t=1701026197; bh=BcTjqWe4uScWhaNbhPONqwVftNfiGtAQS9TIsxqQBR4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PPZzIyLRPGvv/xqQ0VhyiPLCAqPrN+lwNamSXl5xslpa1kXkRd5ZbfElk+s1oVhgK kNOLfyd+ZINqltUejUdoVzKl0XJDFoCoK8pd+TbD+Kqs7lTT53Y886uUXCatsw9wsX aduQj+BC6APTu0Gc7roXsUHDORJYA5Ip9yotJ5iH9SuHLXjQLURKOpScFKJbRp3H1+ wggJVix7Hg8ijuk2n0nepak09rkn/1abhPIfi1bndDecZeg2W9a6zvvIa0CfbJKQtx 0p6Ne7gUElgwGD68p6EkB+97P198ihe2F3kORpXX58BVgMUtTds+q1NDQg3lt8djIK ItJp+J6nWkBxA== Date: Sun, 26 Nov 2023 21:15:54 +0200 From: Tony Lindgren To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sam Ravnborg , Vinay Simha BN Subject: [PATCH 6/6] drm/bridge: tc358775: Configure hs_rate and lp_rate Message-ID: <20231126191554.GM5169@atomide.com> References: <20231126163247.10131-1-tony@atomide.com> <20231126163247.10131-2-tony@atomide.com> <20231126171837.GK5169@atomide.com> <20231126172018.GL5169@atomide.com> <20231126182135.GA5166@atomide.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231126182135.GA5166@atomide.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carl Philipp Klemm , devicetree@vger.kernel.org, Ivaylo Dimitrov , Merlijn Wajer , Sebastian Reichel , dri-devel@lists.freedesktop.org, Pavel Machek Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The hs_rate and lp_rate may be used by the dsi host for timing calculations. The tc358775 has a maximum bit rate of 1 Gbps/lane, tc358765 has maximurate of 800 Mbps per lane. Signed-off-by: Tony Lindgren --- drivers/gpu/drm/bridge/tc358775.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/bridge/tc358775.c b/drivers/gpu/drm/bridge/tc358775.c --- a/drivers/gpu/drm/bridge/tc358775.c +++ b/drivers/gpu/drm/bridge/tc358775.c @@ -653,6 +653,11 @@ static int tc_attach_host(struct tc_data *tc) dsi->format = MIPI_DSI_FMT_RGB888; dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_LPM; + if (tc->type == TC358765) + dsi->hs_rate = 800000000; + else + dsi->hs_rate = 1000000000; + dsi->lp_rate = 10000000; ret = devm_mipi_dsi_attach(dev, dsi); if (ret < 0) {