From patchwork Wed Mar 29 13:16:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 13192409 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 DD249C74A5B for ; Wed, 29 Mar 2023 13:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8gJ3hCrnoqZKnLf8bGngJ0EZzDnWEsMJGQ57toW1kpQ=; b=UOt5RZw6W2MpF2 1DQqiL0u5dumLEPZJHqX0w18NjcnWY2B6N9ZY/ZG2yx9m2AXO+bfRZBe08CP/2y9GViX6WwQyJWTQ i3/k8dIAKnkA1VFyVKVOap9W6WGvyRH/hej6JS8VMqdtcX5Q3+ZsWUHEJZyhfy4Jgk2MRLUwio7gG DGfT9UDUCeNEon9K5dhkCxUfN+IkMpRAB7jp+mMFjCEckTFek38e2DtV7sGGRVa//+HHvFWNJ5TyW D7yxM6lFevgLSuqgHo08oO6BUdrRE7xDVi0ZMhkmb26hho6bRQd+x4lAJXfIvAAXBAPrIC88o/mEL vxLW7PN5yhq5aLbbYfPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phVgi-000JTx-2f; Wed, 29 Mar 2023 13:18:04 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phVgY-000JO9-26 for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2023 13:17:56 +0000 Received: by mail-pj1-x102a.google.com with SMTP id qe8-20020a17090b4f8800b0023f07253a2cso16097216pjb.3 for ; Wed, 29 Mar 2023 06:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1680095872; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=X83RR+xeESh5armnw5mGiS+y5yBuHI5QecAlLL/Hrnk=; b=lCODPpW/6NxhsoH726H+bFRXt5XZc7LKq4hAaV3YeLWK5IMBumMR4yJb/Wt8sExtxK puC7UrYd1T7eTsINqVAVPwu88M4f147yZ3A6mk3sksWdq256N61iaKoTgCFzf24/y7Qy 8PpJKb0ZCbl2HJzucEIc5ef2XK7FWGQcc/Luw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680095872; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X83RR+xeESh5armnw5mGiS+y5yBuHI5QecAlLL/Hrnk=; b=LhzLKky5u6G2tRcrSlyUHmPPNaWBEXMPTvUxU3AIfmL+lFaYO2M7Yi9IiBSsaNal7r sLcXlguhgSICNTTAG1L5RxZzRY9NUOnMbeqLtYb0Et9iM+U3JJMFy1RlsqdMkpFeBjRM DUIP7/R0SXzPkR9loOS0uwxSk4qS91I/RPgaV8R8fCNjmdxnwY5TPjfXbegihYjnP6DK M3LXQUYT7Zx9oTVrBwJje9OXcey69S8biZFzrfePg7wRC7WyS8dXjSe5LuwKW34ItscP dCr+t1V+IUzaQORhvZtUOgukWF42MkAiuCxEXstz7CMx3NeLMRNLEQXHNrCFX6hEKA1j 7l+A== X-Gm-Message-State: AAQBX9fMAUItWjuX4OvW8Cg9ZKULfow4nVIZDr7RUNsUJLvz/g67cEa6 eO6Kh4nYuI6bfKZqdhy7lB9jK0c9crW0NzVjkUBbpw== X-Google-Smtp-Source: AKy350bvnAVlh1xYW9HG76iWL/Smz7l1Nuh3q62WlCnnyB3NpALkEXM8Qt8pTetJI11rS1iXbF3tzg== X-Received: by 2002:a17:90b:1e43:b0:23d:1b50:1ebe with SMTP id pi3-20020a17090b1e4300b0023d1b501ebemr22546115pjb.27.1680095871927; Wed, 29 Mar 2023 06:17:51 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a047:206d:4722:c4fa:e845]) by smtp.gmail.com with ESMTPSA id s16-20020a17090b071000b0023f5c867f82sm1400192pjz.41.2023.03.29.06.17.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 06:17:51 -0700 (PDT) From: Jagan Teki To: Dave Stevenson , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sam Ravnborg , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Marek Vasut , linux-amarula , Jagan Teki Subject: [PATCH v7 01/12] drm: of: Lookup if child node has DSI panel or bridge Date: Wed, 29 Mar 2023 18:46:07 +0530 Message-Id: <20230329131615.1328366-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230329131615.1328366-1-jagan@amarulasolutions.com> References: <20230329131615.1328366-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230329_061754_695165_84ACE36B X-CRM114-Status: GOOD ( 26.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Devices can also be child nodes when we also control that device through the upstream device (ie, MIPI-DCS for a MIPI-DSI device). Unlike the drm_of_find_panel_or_bridge helper it requires a special case to lookup a child node of the given parent that isn't either port or ports. Lookup for a child DSI node of the given parent that isn't either port or ports. If it is found then it will directly find the panel or bridge otherwise lookup for the child node with a given port and endpoint number as drm_of_find_panel_or_bridge does. Supporting this feature via existing drm_of_find_panel_or_bridge found several issues while handling usecases. Here is the previously failed attempt of similar and the same has been reverted later. commit <80253168dbfd> ("drm: of: Lookup if child node has panel or bridge") So, add a separate helper to handle this DSI use case. An example of the downstream panel represented as a child node: dsi { compatible = "allwinner,sun6i-a31-mipi-dsi"; port { dsi_in_tcon0: endpoint { remote-endpoint = ; }; }; panel@0 { compatible = "feixin,k101-im2ba02"; reg = <0>; }; }; An example of the downstream bridge represented as a port node: dsi { compatible = "allwinner,sun6i-a31-mipi-dsi"; port { dsi_in_tcon0: endpoint@0 { reg = <0>; remote-endpoint = ; }; dsi_out_bridge: endpoint@1 { reg = <1>; remote-endpoint = <&bridge_in_dsi>; }; }; bridge: bridge@0 { compatible = "chipone,icn6211"; reg = <0>; ports { bridge_in: port@0 { reg = <0>; bridge_in_dsi: endpoint { remote-endpoint = <&dsi_out_bridge>; }; }; bridge_out: port@1 { reg = <1>; bridge_out_panel: endpoint { remote-endpoint = <&panel_out_bridge>; }; }; }; }; }; An example of the downstream bridge represented as a ports node: i2c4 { bridge@2c { compatible = "ti,sn65dsi84"; ports { port@0 { reg = <0>; bridge_in_dsi: endpoint { remote-endpoint = <&dsi_out_bridge>; data-lanes = <1 2>; }; }; port@2 { reg = <2>; bridge_out_panel: endpoint { remote-endpoint = <&panel_out_bridge>; }; }; }; }; }; dsi { compatible = "fsl,imx8mm-mipi-dsim"; ports { port@0 { reg = <0>; dsi_in_lcdif: endpoint@0 { reg = <0>; remote-endpoint = <&lcdif_out_dsi>; }; }; port@1 { reg = <1>; dsi_out_bridge: endpoint { remote-endpoint = <&bridge_in_dsi>; }; }; }; }; An example of the downstream bridge represented as a child node, but whose host neither a port nor a ports: dsi0 { compatible = "ste,mcde-dsi"; panel@0 { reg = <0>; }; }; In, summary the DSI downstream devices are likely to be Panel, Bridge and I2C-Configured Bridge. It is possible to connect all three devices using upstream OF-graph port or ports node however only Panel and Bridge are possible to connect via child node but not possible to connect I2C-Configured Bridge via child node since I2C-Configure bridges are child of I2C not upstream DSI hosts and it must represent them via port or ports with endpoint linking. This indeed means, the OF-graph port or ports representation is mandatory for I2C-Configured DSI bridges. This patch tries to add an OF-graph port or ports representation detection code on top of existing child node detection. Overall, this patch makes use of a single standardized DRM helper for a given DSI pipeline representing downstream devices as child or OF-graph port or OF-graph ports node. Signed-off-by: Jagan Teki --- Changes for v7: - new patch drivers/gpu/drm/drm_of.c | 112 ++++++++++++++++++++++++++++++++------- include/drm/drm_of.h | 12 +++++ 2 files changed, 104 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 177b600895d3..87cfd685318a 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -217,6 +217,35 @@ int drm_of_encoder_active_endpoint(struct device_node *node, } EXPORT_SYMBOL_GPL(drm_of_encoder_active_endpoint); +static int of_drm_find_panel_or_bridge(struct device_node *remote, + struct drm_panel **panel, + struct drm_bridge **bridge) +{ + int ret = -EPROBE_DEFER; + + if (panel) { + *panel = of_drm_find_panel(remote); + if (!IS_ERR(*panel)) + ret = 0; + else + *panel = NULL; + } + + /* No panel found yet, check for a bridge next. */ + if (bridge) { + if (ret) { + *bridge = of_drm_find_bridge(remote); + if (*bridge) + ret = 0; + } else { + *bridge = NULL; + } + } + + of_node_put(remote); + return ret; +} + /** * drm_of_find_panel_or_bridge - return connected panel or bridge device * @np: device tree node containing encoder output ports @@ -239,7 +268,6 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, struct drm_panel **panel, struct drm_bridge **bridge) { - int ret = -EPROBE_DEFER; struct device_node *remote; if (!panel && !bridge) @@ -260,30 +288,74 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, if (!remote) return -ENODEV; - if (panel) { - *panel = of_drm_find_panel(remote); - if (!IS_ERR(*panel)) - ret = 0; - else - *panel = NULL; - } + return of_drm_find_panel_or_bridge(remote, panel, bridge); +} +EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); - /* No panel found yet, check for a bridge next. */ - if (bridge) { - if (ret) { - *bridge = of_drm_find_bridge(remote); - if (*bridge) - ret = 0; - } else { - *bridge = NULL; - } +/** + * drm_of_dsi_find_panel_or_bridge - return connected DSI panel or bridge device + * @np: device tree node containing encoder output ports + * @port: port in the device tree node + * @endpoint: endpoint in the device tree node + * @panel: pointer to hold returned drm_panel + * @bridge: pointer to hold returned drm_bridge + * + * Lookup for a child DSI node of the given parent that isn't either port + * or ports. If it is found then it will directly find the panel or bridge + * otherwise lookup for the child node with a given port and endpoint number + * as drm_of_find_panel_or_bridge does. + * + * Lookup a given child DSI node or a DT node's port and endpoint number, + * find the connected node and return either the associated struct drm_panel + * or drm_bridge device. Either @panel or @bridge must not be NULL. + * + * Returns zero if successful, or one of the standard error codes if it fails. + */ +int drm_of_dsi_find_panel_or_bridge(const struct device_node *np, + int port, int endpoint, + struct drm_panel **panel, + struct drm_bridge **bridge) +{ + struct device_node *remote; + + if (!panel && !bridge) + return -EINVAL; + if (panel) + *panel = NULL; + /** + * Devices can also be child nodes when we also control that device + * through the upstream device (ie, MIPI-DCS for a MIPI-DSI device). + * + * Lookup for a child node of the given parent that isn't either port + * or ports. + */ + for_each_available_child_of_node(np, remote) { + if (of_node_name_eq(remote, "port") || + of_node_name_eq(remote, "ports")) + continue; + + goto of_find_panel_or_bridge; } - of_node_put(remote); - return ret; + /* + * of_graph_get_remote_node() produces a noisy error message if port + * node isn't found and the absence of the port is a legit case here, + * so at first we silently check whether graph presents in the + * device-tree node. + */ + if (!of_graph_is_present(np)) + return -ENODEV; + + remote = of_graph_get_remote_node(np, port, endpoint); + +of_find_panel_or_bridge: + if (!remote) + return -ENODEV; + + return of_drm_find_panel_or_bridge(remote, panel, bridge); } -EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); +EXPORT_SYMBOL_GPL(drm_of_dsi_find_panel_or_bridge); enum drm_of_lvds_pixels { DRM_OF_LVDS_EVEN = BIT(0), diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index 082a6e980d01..5e0d958121ce 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -49,6 +49,10 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, int port, int endpoint, struct drm_panel **panel, struct drm_bridge **bridge); +int drm_of_dsi_find_panel_or_bridge(const struct device_node *np, + int port, int endpoint, + struct drm_panel **panel, + struct drm_bridge **bridge); int drm_of_lvds_get_dual_link_pixel_order(const struct device_node *port1, const struct device_node *port2); int drm_of_lvds_get_data_mapping(const struct device_node *port); @@ -101,6 +105,14 @@ static inline int drm_of_find_panel_or_bridge(const struct device_node *np, return -EINVAL; } +static inline int drm_of_dsi_find_panel_or_bridge(const struct device_node *np, + int port, int endpoint, + struct drm_panel **panel, + struct drm_bridge **bridge) +{ + return -EINVAL; +} + static inline int drm_of_lvds_get_dual_link_pixel_order(const struct device_node *port1, const struct device_node *port2) From patchwork Wed Mar 29 13:16:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 13192410 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 E6161C761A6 for ; Wed, 29 Mar 2023 13:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cuErzsF5lsC0gtlXGYDRKjBjL5TE+QDCxVvZTs+vFYY=; b=NdUbm3FsAuf6Dj QZDnXS/evxghBP57X5vdOZ7ncGwYg+8mqvN6iC25BzZ6DJCq/zqkC4xwmRD80Epmjv/kVI468tkFN Z6F9z6f5gcGoewZELhLYt6myYQCwSF9RQmqDKtRR5m3i7lj55WMm1uYyTWaP/Qsr5EKBx8kSxL6ou 7fZ8hJH2PLeq4a5af1ab8bsuHifGiNFCPPfGdUVbh05ktaEoSYk7sgm+GhF8uuNDMRcVHllk57kHa DaTvkoV5HCWdupM+Je1j1HG3bWq3Rwvw4vcJdJwYKIIwFCheH9IY374H0Y1VeUk1IKFHxhxOzr/i8 rq4CdHyY+UhP0tjVU2VA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phVh3-000Jm5-1C; Wed, 29 Mar 2023 13:18:25 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phVgg-000JS3-1r for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2023 13:18:04 +0000 Received: by mail-pj1-x1032.google.com with SMTP id x15so14021501pjk.2 for ; Wed, 29 Mar 2023 06:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1680095879; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0wNTb2LrxaKFlmHgalrnrr3A4EG008KaVwysZvYEb6Q=; b=cqidfaD69QRlixQGDaMVrdpnuW4E/ueB+ta+aoaLu75jvjPTb6X8dXWmHB4iaw1Puf sA0xW5rf44dDAy0wFnUg6Z94f+i5ihDnYHtGWrSMB79e2IKvSUSnAty8f9XTn8263x+E rjUs3uFYzgM1UOkgvbYUPtQBmF6OKzdBEe78o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680095879; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0wNTb2LrxaKFlmHgalrnrr3A4EG008KaVwysZvYEb6Q=; b=eToK6LPFOFMuewau9Ro7OFBZMeETGmVzQJh83+oapkhf88fES/EmAQkEHxGxm8jzhV twEnBopcummdu0nU42m7dSSe67TE1og72LvKAztd2XjwM9bSGLTFo0oi8NFaO5yv2TAg 1m9t+5lYmCIKxLIneFXUMKSL5CQeveZ+pZoi6LEjd7oPESfRgEqohVVNjVIIKgtdv2Vj 5q4/B4wPqqOVxH2pcrGsTVuIMyf/REezKBT9VEaRKo1rQObtnJEOEcSMKW7gMJ/oL+U7 +Nw3gwSqXkLa+PjMUtQ5VHLSj8KoAuDyQGBTmAhrTn8C2mNEkUrdLcCNdP70z4+3vY7s E1Qg== X-Gm-Message-State: AAQBX9foF/ven698rywJ4t1U5TdL3L31UkORNWwe8FSDdxzOwuXJ+qL/ TmgrZRMqRfOAwIFagGBoMguDdQ== X-Google-Smtp-Source: AKy350Z0nRebQpUhm57vPD2Fu3xEl648nRwouk5XbwzGKAmjhBeobsc7CNU/OD8nrZMuYEE8Qi5lQA== X-Received: by 2002:a17:90b:3511:b0:23f:a4da:1208 with SMTP id ls17-20020a17090b351100b0023fa4da1208mr21913619pjb.39.1680095879378; Wed, 29 Mar 2023 06:17:59 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a047:206d:4722:c4fa:e845]) by smtp.gmail.com with ESMTPSA id s16-20020a17090b071000b0023f5c867f82sm1400192pjz.41.2023.03.29.06.17.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 06:17:58 -0700 (PDT) From: Jagan Teki To: Dave Stevenson , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sam Ravnborg , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Marek Vasut , linux-amarula , Jagan Teki Subject: [PATCH v7 02/12] drm: bridge: panel: Implement drmm_of_dsi_get_bridge helper Date: Wed, 29 Mar 2023 18:46:08 +0530 Message-Id: <20230329131615.1328366-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230329131615.1328366-1-jagan@amarulasolutions.com> References: <20230329131615.1328366-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230329_061802_615231_9AFCBBB3 X-CRM114-Status: GOOD ( 15.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Implement a DRM-managed action helper that returns the next DSI bridge in the chain. Unlike general bridge return helper drmm_of_get_bridge, this helper uses the dsi specific panel_or_bridge helper to find the next DSI device in the pipeline. Helper lookup a given downstream DSI device that has been added via child or OF-graph port or ports node. Upstream DSI looks for downstream devices using drm pointer, port and endpoint number. Downstream devices added via child node don't affect the port and endpoint number arguments. Signed-off-by: Jagan Teki --- Changes for v7: - new patch drivers/gpu/drm/bridge/panel.c | 34 ++++++++++++++++++++++++++++++++++ include/drm/drm_bridge.h | 10 ++++++++++ 2 files changed, 44 insertions(+) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index d4b112911a99..d047c7d9551d 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -501,4 +501,38 @@ struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm, } EXPORT_SYMBOL(drmm_of_get_bridge); +/** + * drmm_of_dsi_get_bridge - Return next DSI bridge in the chain + * @drm: device to tie the bridge lifetime to + * @np: device tree node containing DSI output ports + * @port: port in the device tree node + * @endpoint: endpoint in the device tree node + * + * Given a DT node's port and endpoint number, finds the connected node + * and returns the associated DSI bridge if any, or creates and returns + * a DSI panel bridge instance if a panel is connected. + * + * Returns a drmm managed pointer to the DSI bridge if successful, or + * an error pointer otherwise. + */ +struct drm_bridge *drmm_of_dsi_get_bridge(struct drm_device *drm, + struct device_node *np, + u32 port, u32 endpoint) +{ + struct drm_bridge *bridge; + struct drm_panel *panel; + int ret; + + ret = drm_of_dsi_find_panel_or_bridge(np, port, endpoint, + &panel, &bridge); + if (ret) + return ERR_PTR(ret); + + if (panel) + bridge = drmm_panel_bridge_add(drm, panel); + + return bridge; +} +EXPORT_SYMBOL(drmm_of_dsi_get_bridge); + #endif diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 42f86327b40a..a1a31704b917 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -931,6 +931,9 @@ struct drm_bridge *devm_drm_of_get_bridge(struct device *dev, struct device_node u32 port, u32 endpoint); struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm, struct device_node *node, u32 port, u32 endpoint); +struct drm_bridge *drmm_of_dsi_get_bridge(struct drm_device *drm, + struct device_node *node, + u32 port, u32 endpoint); #else static inline struct drm_bridge *devm_drm_of_get_bridge(struct device *dev, struct device_node *node, @@ -947,6 +950,13 @@ static inline struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm, { return ERR_PTR(-ENODEV); } + +static inline struct drm_bridge *drmm_of_dsi_get_bridge(struct drm_device *drm, + struct device_node *node, + u32 port, u32 endpoint) +{ + return ERR_PTR(-ENODEV); +} #endif #endif From patchwork Wed Mar 29 13:16:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 13192411 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A0F2EC6FD18 for ; Wed, 29 Mar 2023 13:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=85yGhUH9waRrkLL5cVtI+NZoCp7cqvVESHmLILFZTGE=; b=N7hvIY76VaMAcY cVGOWS41A0VhYF0Tj9IvkztypcD6A6RFOie2mXXhvLrp+KACiXIiLscbLJ1KuMKD+omU1po9zLIEF VdBiEjeyrHaZaYKS/7MlCtbLKf3KSaUhIEkqdF8u37wlgsgO+tJozehbGWbyE6mdi43We8FTdhIzQ m9ZjatXD3j/8StdS5/zBDG5W08xD4naf2R6f3NQSw38Mbkr6A8AZILlJBMG6PsoishfPy3QSez9Oo htcby67S7VgnWOsGfcKBz5M40R5cHl7qbmiAbW+6DbBHQYVwp6M23vE6RSVFe8nV+tHYG4TSV73su ZGDoW/0mczJOasPBBqbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phVh5-000Jo2-35; Wed, 29 Mar 2023 13:18:27 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phVgn-000JV8-0I for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2023 13:18:10 +0000 Received: by mail-pj1-x1036.google.com with SMTP id lr16-20020a17090b4b9000b0023f187954acso16125414pjb.2 for ; Wed, 29 Mar 2023 06:18:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1680095886; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cv6/4Vvh1vUo/moG1pbR53z8ML2U7R1WxCNXSlwjPc4=; b=dq2gflaXd3rWznoyd8LJ65hUjiMDXLDqp0a5RSfLfMrNFDFrbLmoQMU43Fdj4z/O58 EDaIilmoyGxnNIuc9fNDvnyuCQiqB/pxw2QJFWV4UHFuG+va90m/gzt+D+JUulqQ3WbF sW46WI7QF9fIp0ljJytY4DuJU/0fhAqSLg+iI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680095886; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cv6/4Vvh1vUo/moG1pbR53z8ML2U7R1WxCNXSlwjPc4=; b=FVO7Q8JS7U+sUG1IyxNc3aLro+eWZbXZxChfNmcVOFbDBfAMYIZoBvhUhfbhQSR9dT GpCvDIkUullKVY3/eNMRxBNi2ruqMJzJaGf9NKuo1minyJhfJHSCP55tpPBLsSODwy1J 4SAjGOk7K7vpyZOqHWhtAHDGoiFysHiwbyow0wHASdu9//YhbJCyQ5ojOvtFEkNy56jO pYSFTcOxWYrQX0eqwFN0g9I7BTIRjXXzeCLinB7nHNceIGRCTarNRUXfCznFTGp9Tbou t/aYysS72C1aGWqyUraZI2LPj9xMeGegEoCGXhBwzrbFh0SQuHpYzrEi5NA5rXmIVjgk nOfQ== X-Gm-Message-State: AAQBX9eU9sPqQWEZ4DF+R/UkXKsZ/Nm7SVprP6AX7vUeS53rjtl3isBp jdthSWc+U+4kozjQTxusdYgoYw== X-Google-Smtp-Source: AKy350YSAxdStQu5k6BQ8X+TusC/NXLcHiqOIQaUy4h6emrwaIZtDtwCxjujQZcpQ0YsrrHN0GERmw== X-Received: by 2002:a17:90a:19d:b0:23f:ebf2:d3de with SMTP id 29-20020a17090a019d00b0023febf2d3demr21536210pjc.27.1680095885930; Wed, 29 Mar 2023 06:18:05 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a047:206d:4722:c4fa:e845]) by smtp.gmail.com with ESMTPSA id s16-20020a17090b071000b0023f5c867f82sm1400192pjz.41.2023.03.29.06.17.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 06:18:05 -0700 (PDT) From: Jagan Teki To: Dave Stevenson , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sam Ravnborg , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Marek Vasut , linux-amarula , Jagan Teki Subject: [PATCH v7 03/12] drm: panel: feiyang-fy07024di26a30d: Enable prepare_prev_first flag Date: Wed, 29 Mar 2023 18:46:09 +0530 Message-Id: <20230329131615.1328366-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230329131615.1328366-1-jagan@amarulasolutions.com> References: <20230329131615.1328366-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230329_061809_157669_942099E3 X-CRM114-Status: GOOD ( 12.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Enable the drm panel prepare_prev_first flag for feiyang-fy07024di26a30d so-that the previous controller should be prepared first before the prepare for the panel is called.     This makes sure that the previous controller(sun6i-mipi-dsi), likely to be a DSI host controller should be initialized to LP-11 before the panel is powered up. Signed-off-by: Jagan Teki --- Changes for v7: - new patch drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c index df493da50afe..77d66dbe01fe 100644 --- a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c +++ b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c @@ -198,6 +198,7 @@ static int feiyang_dsi_probe(struct mipi_dsi_device *dsi) drm_panel_init(&ctx->panel, &dsi->dev, &feiyang_funcs, DRM_MODE_CONNECTOR_DSI); + ctx->panel.prepare_prev_first = true; ctx->dvdd = devm_regulator_get(&dsi->dev, "dvdd"); if (IS_ERR(ctx->dvdd)) From patchwork Wed Mar 29 13:16:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 13192414 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 3CD73C74A5B for ; Wed, 29 Mar 2023 13:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fNxCUDJvCaxnFpGckwzeyaa7S0enpG196Frjht8qL54=; b=V8VlT6Meckmf8Z SkQgCsAwhsGZj83DIs1rdwkQ/0/7zB92o2An4Bzxyl84mDg831pWYoQHTOqihCFVPcpb4IodbpSHO orEyok3bbVObtA1W0imVSlqoe1v5J+v5ezVL1gA8TI0ICeHNHPM0OHigVmGqO9eMlMmv5swkRuCvn qXoFKEEMqhXmr5+bRnnGKBfcCtWF2rDBebod4y5iVATtM3s+0QelrXt7IyhXIxdaigirTrQPVhy/T CCEK4fMrijnD/3A4TjpwdwEbzNkiJXXt6SyKGuSNH0LG+JP/iST5NaCl6a8d4ezzL7yoYVizTMuCE V8ub6Qm6fD6+2lKXLxMg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phVh9-000Jqh-0Y; Wed, 29 Mar 2023 13:18:31 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phVgr-000JbB-2n for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2023 13:18:15 +0000 Received: by mail-pl1-x62f.google.com with SMTP id ja10so14880025plb.5 for ; Wed, 29 Mar 2023 06:18:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1680095892; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=d+PX9J3U7p5qZlBeWmtYaZVahtk7x+bKgv0zxDQ5NKg=; b=pNuu1Gkcpj7ou0/NxyX2OGB7HOgjlkfVVree1zpId6rRDygggKC/Odx+8t6UQxJCSH 3K+nqLT4ETFZW5uFx2XJALuvcQQIRVGsHyk4MfHSsUCru8tigfcYVsv3aZkd0DLlIYg3 n2HCEBT3mtN4hni20h9YKd5wzUcRPY5DNSsVU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680095892; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d+PX9J3U7p5qZlBeWmtYaZVahtk7x+bKgv0zxDQ5NKg=; b=2TnFZaFafMRIDGFJbaZDsS56ZKjbIxixD5lEpVriPq09i51o6XffNDHSxyQnkLnr0C 7xctjJkiTDkLGpJVNpgLLPUBgX1FNA8vXtH/FjLI2TkW+bisHPMcGYj4MLpL0fCFiaGo RChbHHU+LmYkFIUZO9oc9esMJdIA1Z2UJyLltF1h47t0aZwvn4b7LT76yrjQXMcA8/5W APhjDghtktejZ9I4iaDv6FB3fvEFnRsMphuEBlzZbg6UqeVtAYu/iX+cYPOeaYYZ0zqt IX4DA4NwTFISPGwqIYesdlMlCJb9ACGcD6TM9f2VAukW1AqIpgbigAGMeyX8tD6yr52D kO/A== X-Gm-Message-State: AAQBX9dSK87jlRogLPFyBJsGTq+/4OehHUTQ37L0ilqE/ywdnf37rho5 YNQJonpN5gFww/e0nIhgeO2VhA== X-Google-Smtp-Source: AKy350bokE1By8nbjH4J86bI+d67CKIP38qBgLKevOIo/+cgjC0kVbu1W/gnjsNm0Xt8H7dXZUIQzg== X-Received: by 2002:a17:90b:3b44:b0:23b:50ff:59ba with SMTP id ot4-20020a17090b3b4400b0023b50ff59bamr19952654pjb.21.1680095892216; Wed, 29 Mar 2023 06:18:12 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a047:206d:4722:c4fa:e845]) by smtp.gmail.com with ESMTPSA id s16-20020a17090b071000b0023f5c867f82sm1400192pjz.41.2023.03.29.06.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 06:18:11 -0700 (PDT) From: Jagan Teki To: Dave Stevenson , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sam Ravnborg , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Marek Vasut , linux-amarula , Jagan Teki Subject: [PATCH v7 04/12] drm: panel: sitronix-st7701: Enable prepare_prev_first for ts8550b Date: Wed, 29 Mar 2023 18:46:10 +0530 Message-Id: <20230329131615.1328366-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230329131615.1328366-1-jagan@amarulasolutions.com> References: <20230329131615.1328366-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230329_061813_909908_91D27706 X-CRM114-Status: GOOD ( 14.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Enable the drm panel prepare_prev_first flag for ts8550b panel so-that the previous controller should be prepared first before the prepare for the panel is called.     This makes sure that the previous controller(sun6i-mipi-dsi), likely to be a DSI host controller should be initialized to LP-11 before the panel is powered up. Signed-off-by: Jagan Teki --- Changes for v7: - new patch drivers/gpu/drm/panel/panel-sitronix-st7701.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c index 7eae83aa0ea1..dc7677412023 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c @@ -105,6 +105,7 @@ struct st7701_panel_desc { unsigned int lanes; enum mipi_dsi_pixel_format format; unsigned int panel_sleep_delay; + bool prepare_prev_first; /* TFT matrix driver configuration, panel specific. */ const u8 pv_gamma[16]; /* Positive voltage gamma control */ @@ -564,6 +565,7 @@ static const struct st7701_panel_desc ts8550b_desc = { .lanes = 2, .format = MIPI_DSI_FMT_RGB888, .panel_sleep_delay = 80, /* panel need extra 80ms for sleep out cmd */ + .prepare_prev_first = true, .pv_gamma = { CFIELD_PREP(DSI_CMD2_BK0_GAMCTRL_AJ_MASK, 0) | @@ -875,6 +877,7 @@ static int st7701_dsi_probe(struct mipi_dsi_device *dsi) drm_panel_init(&st7701->panel, &dsi->dev, &st7701_funcs, DRM_MODE_CONNECTOR_DSI); + st7701->panel.prepare_prev_first = desc->prepare_prev_first; /** * Once sleep out has been issued, ST7701 IC required to wait 120ms From patchwork Wed Mar 29 13:16:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 13192412 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 242C0C74A5B for ; Wed, 29 Mar 2023 13:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5zKAL//E5BLFiHS4Cyhe9bcWCfRI/tTIy03mTlj81H8=; b=RSw9IKlXSOMyOz bObHpcapPcGXUMlX3ngwCgWvBYHMrnk1pPuIqimESBQ0Gv1SbAKVrCEHgXY781yV+bN1oR7fiRbaY gEpKcEk4e3ct2TKApKOj/lYTMdFvkFv9nlqLBRb4TwfZVzTHvLh/wVxt2wRgA/mqaEtsthHSgoXPe dHbB+72UJHKTH6lWJ6su4x2XErf7grBFeIA4a2lHAoZZvMzJ+xoegf/363UiNjA6VsQ7MovvHeag8 4tjjnNKElLuvm0yZ/A9LfW9CY6yS3iQi4Nsp34n4S2/92FSfg9tTl3P3CBF7LU0kAsC6PTg1tPf/p wJmeRwn8lqhoWk/XP61w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phVhC-000Jt2-1l; Wed, 29 Mar 2023 13:18:34 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phVgz-000Jhm-1X for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2023 13:18:23 +0000 Received: by mail-pl1-x62e.google.com with SMTP id ix20so14890212plb.3 for ; Wed, 29 Mar 2023 06:18:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1680095899; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f+Jq4CQBAwZOjvBLdvikVzLpWjI0SGbxRpeBtUQtDcQ=; b=Ou/OtLmpNc78F/fwnqk1lzBgwyfUoX8VK7o4RpfnSYek0c6mzr55RafkbJPWpVDXEi eUvONb1/8WR9m/S+MqqA3BfxCALKIkNuYaZPDo/X4FFKOP2gHBDL14hZsB51ThK0gMCo E1irsVQt1JZisYTFF7Lfw1qND+3EgJ+bff+GA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680095899; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f+Jq4CQBAwZOjvBLdvikVzLpWjI0SGbxRpeBtUQtDcQ=; b=upsPhD/FAYa/AhlGuSfKuyOpZVyXPoYjdKneNJM3gEi1bMRnjF75sZA4ztT4MvhgiC zTqwM+QY2qPBef9lpwp7rkKRdjP2L8WSvXSyzzqHw2Vti2Jl2QIv6zrMpytG9y4ngxQX 0whecHCviTMhtXbDopSKNk3mIZw50f7UQpja6h8s55z3W52TD7iHPNAn6ewYrx1FUsf0 sz6egeyiqSQE0Xm2A/syEPOvFbdT7Y14xMQx1DCMyt+O/pMFXhvg2m035Avpq+xY3hh2 Qy3+KAkQGW7WWQr0Q3zr/vf6WZ6M3eW0AhQ0ZK+q46d48gj8yEz/RvbAPBeFf8PVVgnO I8Hw== X-Gm-Message-State: AAQBX9cJJDa4DkUPlvUaRLq+DyCTPUpveFbRUg0/K5et8O/xCZdtC8Zb IQERWbc+Nz2M5GFNOI3NpRhz5w== X-Google-Smtp-Source: AKy350YCiiWm/rDw6yILBFYbQ4o+gaIGsdINxQHWQbNw3orvvBWljZZZiHyHon7RGJ7hUl10VDOAFQ== X-Received: by 2002:a17:90b:1e4f:b0:23b:4438:e9ee with SMTP id pi15-20020a17090b1e4f00b0023b4438e9eemr2098113pjb.12.1680095899302; Wed, 29 Mar 2023 06:18:19 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a047:206d:4722:c4fa:e845]) by smtp.gmail.com with ESMTPSA id s16-20020a17090b071000b0023f5c867f82sm1400192pjz.41.2023.03.29.06.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 06:18:18 -0700 (PDT) From: Jagan Teki To: Dave Stevenson , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sam Ravnborg , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Marek Vasut , linux-amarula , Jagan Teki , Ondrej Jirman Subject: [PATCH v7 05/12] drm: panel: sitronix-st7703: Enable prepare_prev_first for xbd599 Date: Wed, 29 Mar 2023 18:46:11 +0530 Message-Id: <20230329131615.1328366-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230329131615.1328366-1-jagan@amarulasolutions.com> References: <20230329131615.1328366-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230329_061821_527282_640DE4DD X-CRM114-Status: GOOD ( 14.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Enable the drm panel prepare_prev_first flag for xbd599 panel so-that the previous controller should be prepared first before the prepare for the panel is called.     This makes sure that the previous controller(sun6i-mipi-dsi), likely to be a DSI host controller should be initialized to LP-11 before the panel is powered up. Cc: Ondrej Jirman Signed-off-by: Jagan Teki --- Changes for v7: - new patch drivers/gpu/drm/panel/panel-sitronix-st7703.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c index 6747ca237ced..6e6112f5d971 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c @@ -65,6 +65,7 @@ struct st7703_panel_desc { unsigned int lanes; unsigned long mode_flags; enum mipi_dsi_pixel_format format; + bool prepare_prev_first; int (*init_sequence)(struct st7703 *ctx); }; @@ -335,6 +336,7 @@ static const struct st7703_panel_desc xbd599_desc = { .lanes = 4, .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE, .format = MIPI_DSI_FMT_RGB888, + .prepare_prev_first = true, .init_sequence = xbd599_init_sequence, }; @@ -544,6 +546,7 @@ static int st7703_probe(struct mipi_dsi_device *dsi) drm_panel_init(&ctx->panel, dev, &st7703_drm_funcs, DRM_MODE_CONNECTOR_DSI); + ctx->panel.prepare_prev_first = ctx->desc->prepare_prev_first; ret = drm_panel_of_backlight(&ctx->panel); if (ret) From patchwork Wed Mar 29 13:16:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 13192413 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 14B41C6FD18 for ; Wed, 29 Mar 2023 13:19:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VLb29XVHLmg2JkEZLk/Ydv1lUV7beH72aWxxC6CZ0Xo=; b=Qv+hXTo9LRpzA4 xVDtbye7LMIfN3vQ1zVneDrF8Y/NQoEka4MqH5I1yCKeEKJSOHx2PGl7N8LeEmi9UQUySIjx9OQdi yikyKC39vWN3MV42sOilR/0jZk6lQGdrsEV8p9GHEhopeXf4XgYryiW13WpFa8HqwZUUnVzV+IzNg tQI/Wn5rbRdbz3imgrVTPkM6CPy67oKBMeck80smqB+QDpcHOIqYJIH2WsLQyAJ4YjYCiZRclUmE5 zpfo6xZ7EQduiKwHbP8rkySjhDde0PwAfG83vpPA8kv18iQ9LLqz3QZTuKkiMCLDpo2zVPP0E7Xk1 doNfxu+Mq2Syjh5xeK2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phVhG-000JwW-16; Wed, 29 Mar 2023 13:18:38 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phVh6-000JnE-07 for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2023 13:18:29 +0000 Received: by mail-pj1-x102b.google.com with SMTP id f6-20020a17090ac28600b0023b9bf9eb63so16110715pjt.5 for ; Wed, 29 Mar 2023 06:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1680095906; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=O2tcpLeWl99rVNnc/BvvLtZEsLOgUmupjkNUsxeTVcU=; b=UdCHrE7/F4LUh7hQ2PmcZsobbVhzz88QVAURCF04bdOUcixNytJMVbyBR/3Rw8N12x MVxl5we+vHJftN0y2JnudLK2tnLlZax9Sbw+5Oot89CpJUDrLdG8XFnbedNYOmo9FXDB oIduaHar12yN2QSMpZ8CpRYroeFZ6UkiA65Rw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680095906; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O2tcpLeWl99rVNnc/BvvLtZEsLOgUmupjkNUsxeTVcU=; b=QUnQAQZtOKujacu9FkCRyNwyiJsQhzg25W0HS63Dl71Q3yZNPsyYv7F2Edd/LM/PkB 5+aXbz1Xg2ZqzE7T8+fJutX/717s/2sYBtf6QZUtvkF0scO12XyVe6YvYdjI6hJ0wejp +AqhwiWrgL+7xTurh6pFKjZe0k9OT3Tbn7eT2+++wa2WwsMYWA77s+3Bj45IOpulCHYB klpS7Up6e2ayny1I7n45ubKcdITO1dl42VE3vAWfHCkzYTwpuQ6etXapwzZz6tANmoSK W7CMtKqww6e61kYRPpGfeYBQ31OMItRRs4skofsWzCoJdlR5yk6L9lCyOkV6Vis30rHT RIdA== X-Gm-Message-State: AAQBX9fku3IeFvDKmasGEGaF2XBltZpnlyowjS2XhGLJ6lbbqSx6vd40 OF/2EKMxNeO+GGOIxDOZUK0oRQ== X-Google-Smtp-Source: AKy350aezuMjKTTjFyH6/gyzvMVWaT+9pmv5Ms2TGgIoeYwTtKj6D8+d21S+PexByXuy9cf7MOK6Yw== X-Received: by 2002:a17:90b:4acf:b0:236:99c4:6096 with SMTP id mh15-20020a17090b4acf00b0023699c46096mr20503031pjb.35.1680095905750; Wed, 29 Mar 2023 06:18:25 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a047:206d:4722:c4fa:e845]) by smtp.gmail.com with ESMTPSA id s16-20020a17090b071000b0023f5c867f82sm1400192pjz.41.2023.03.29.06.18.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 06:18:25 -0700 (PDT) From: Jagan Teki To: Dave Stevenson , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sam Ravnborg , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Marek Vasut , linux-amarula , Jagan Teki , Icenowy Zheng Subject: [PATCH v7 06/12] drm: panel: feixin-k101-im2ba02: Enable prepare_prev_first flag Date: Wed, 29 Mar 2023 18:46:12 +0530 Message-Id: <20230329131615.1328366-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230329131615.1328366-1-jagan@amarulasolutions.com> References: <20230329131615.1328366-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230329_061828_109951_9DB5D97A X-CRM114-Status: GOOD ( 12.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Enable the drm panel prepare_prev_first flag for feixin-k101-im2ba02 so-that the previous controller should be prepared first before the prepare for the panel is called.     This makes sure that the previous controller(sun6i-mipi-dsi), likely to be a DSI host controller should be initialized to LP-11 before the panel is powered up. Cc: Icenowy Zheng Signed-off-by: Jagan Teki --- Changes for v7: - new patch drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c b/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c index 76572c922983..77c936496eef 100644 --- a/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c +++ b/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c @@ -466,6 +466,7 @@ static int k101_im2ba02_dsi_probe(struct mipi_dsi_device *dsi) drm_panel_init(&ctx->panel, &dsi->dev, &k101_im2ba02_funcs, DRM_MODE_CONNECTOR_DSI); + ctx->panel.prepare_prev_first = true; ret = drm_panel_of_backlight(&ctx->panel); if (ret) From patchwork Wed Mar 29 13:16:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 13192415 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 F0765C74A5B for ; Wed, 29 Mar 2023 13:19:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zBKSPTMiYXmkff2NgvB+sAdQSoLKB5YhETULgQwv0Og=; b=oZwmOuk6qYh8XM QW/0Y0ng3uffan0fL852IG2VnQNAFshK0wDNvieoUEL2TqAg8F60yYe8SdRBol3IcBXVQRtqOWGCw RMNYjMxk4pvuRWhU5rw0y7uD9pUz2kvVsqyjRDUnH4JKJlF5wxCTmeesQKYBze9J6IbNKwzIFi0gi yKWKZ4RFzOoBMPy///jETrwThucAicCTxp0tbeUsu8MStmkc2cZgE+R7gOHl/87252ujFY9pzLL+m Ia6O4PLpCMJcp7Fx1XRqrfTpGKVGLEANUFpsCBpPloikdGGRzKR8tgSd4+5f7styeiKhXYTqU/L62 p1PDfURQjgSWXbid3U/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phVhQ-000K6z-3B; Wed, 29 Mar 2023 13:18:49 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phVhD-000JsP-1d for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2023 13:18:37 +0000 Received: by mail-pj1-x102f.google.com with SMTP id r7-20020a17090b050700b002404be7920aso14496651pjz.5 for ; Wed, 29 Mar 2023 06:18:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1680095913; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oygreZW8DvOSbrfdutvOrgL5JnDv+HmvzMABB2AWGTU=; b=PP7u3tIVudtuhiv7qFOZesk675zC0V0fkdntB0jL9iNFdXswt5umwg2LIHdEfVOiMf SgO+s3lzSunEphaQfvxPRajR+A37yc3RjX4w8wsdfpCpN9Mb0dFYRS/j2D2PhblCX/Hd Hp+2hRKUZPeHcHj96OS+0nv+9aVyjszRGvqX8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680095913; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oygreZW8DvOSbrfdutvOrgL5JnDv+HmvzMABB2AWGTU=; b=1j9NGam0nxLMJXSBUOu1lrYv6AsArEvGuMeWqEzAxkCno/J0bhjeaV1keLpowlp4pA 9R6z6euEhkJXiKXXJNCZrYh5ekfSY6c6SxDJdUn0g00/K1UtAHOZPoGUdDBsuIzzjDcf 4t/5k57D8nDE7kILtmDru0nv5nJd4pMpTYBbJcby8sqyjIetPihKW1ChwUcLU+/Ot1Jj VT8+ZYo5AKg91RBV4reCYv/E/cxCwz8f92gRYvwDBQDD/i4JAHFD/o+3USpDmqCoEHVz AXPU44fxOPNV8zOFxRBClPRgtRvilOA3/ZvGHjv1eBLcy/um9mdgCGEbf34x6ai/v8+P Ii7g== X-Gm-Message-State: AAQBX9dnjEmF6Cv2Jf2/BZB9FaIwl+WLZo9y2jYv7hNFmiURIHnjOvRW 5Gk/6jDtngfrYlsfnEAQeKHOww== X-Google-Smtp-Source: AKy350YoFCLmv9UyFpcpczhcyZuQVDlALTndWJuxarm3WW0HnhzkLVyGld0li+h4fc7/eikeMMk/0A== X-Received: by 2002:a17:90b:1d02:b0:23d:133a:62cc with SMTP id on2-20020a17090b1d0200b0023d133a62ccmr21046371pjb.17.1680095912864; Wed, 29 Mar 2023 06:18:32 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a047:206d:4722:c4fa:e845]) by smtp.gmail.com with ESMTPSA id s16-20020a17090b071000b0023f5c867f82sm1400192pjz.41.2023.03.29.06.18.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 06:18:32 -0700 (PDT) From: Jagan Teki To: Dave Stevenson , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sam Ravnborg , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Marek Vasut , linux-amarula , Jagan Teki , Icenowy Zheng Subject: [PATCH v7 07/12] drm: panel: ilitek-ili9881c: Enable prepare_prev_first for k101_im2byl02 Date: Wed, 29 Mar 2023 18:46:13 +0530 Message-Id: <20230329131615.1328366-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230329131615.1328366-1-jagan@amarulasolutions.com> References: <20230329131615.1328366-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230329_061835_575200_13EB726A X-CRM114-Status: GOOD ( 14.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Enable the drm panel prepare_prev_first flag for k101_im2byl02 panel so-that the previous controller should be prepared first before the prepare for the panel is called.     This makes sure that the previous controller(sun6i-mipi-dsi), likely to be a DSI host controller should be initialized to LP-11 before the panel is powered up. Cc: Icenowy Zheng Signed-off-by: Jagan Teki --- Changes for v7: - new patch drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c index 1ec696adf9de..102a1df0cea0 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c @@ -42,6 +42,7 @@ struct ili9881c_desc { const size_t init_length; const struct drm_display_mode *mode; const unsigned long mode_flags; + bool prepare_prev_first; }; struct ili9881c { @@ -891,6 +892,7 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi) drm_panel_init(&ctx->panel, &dsi->dev, &ili9881c_funcs, DRM_MODE_CONNECTOR_DSI); + ctx->panel.prepare_prev_first = ctx->desc->prepare_prev_first; ctx->power = devm_regulator_get(&dsi->dev, "power"); if (IS_ERR(ctx->power)) @@ -942,6 +944,7 @@ static const struct ili9881c_desc k101_im2byl02_desc = { .init_length = ARRAY_SIZE(k101_im2byl02_init), .mode = &k101_im2byl02_default_mode, .mode_flags = MIPI_DSI_MODE_VIDEO_SYNC_PULSE, + .prepare_prev_first = true, }; static const struct ili9881c_desc w552946aba_desc = { From patchwork Wed Mar 29 13:16:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 13192416 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 4AF5DC74A5B for ; Wed, 29 Mar 2023 13:19:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=z94RColDYdHJDwGh4JEiaP8W0tt+AyixkM3J8r8mH7A=; b=kAbxlAQet2/NVY Z5Di/OdB/NndAu22C/XbtG1zxH+6d2YGeES0ZBAH7S/XlaL/nQE7U0RCr6twF2sFlJFYGR/9qjQHO fgF28bmyqvzSfzrfUxrW4QytRKrj85NDyizQfbZPwMHEqMKQRiXucbL/VpirGKpZqgt5cnX3GN/92 d5Km3WGcgatXKuROuC/gqmbMw2ElhcwAZUkI4ESkCIcsHBfUVWlqf8oNftXzvJmEP16HosyOcq3MY 8ofm0W/b349cm4zug0yN9n/M6Ar7tf4RueKk9VWZwCaCrv49ueK06Iow2oQcSfv+qqO1y4/pC4ma4 GyOlwGIDDoemgWy1+WQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phVhT-000K91-0e; Wed, 29 Mar 2023 13:18:51 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phVhH-000JyM-2P for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2023 13:18:41 +0000 Received: by mail-pj1-x102b.google.com with SMTP id om3-20020a17090b3a8300b0023efab0e3bfso18510848pjb.3 for ; Wed, 29 Mar 2023 06:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1680095919; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nd2Hzi5pbnX457/tZ1SGDUudK/Mgpe+Ly4/pUeQ6HnM=; b=BxNdyUGAorjHPinmo8knKGhWp8mcw/YgRk4iYNWDGp+87Odbgo0V0ajx8K99ZvbH3m uK1o/myHvEIucTiBG5DYCQ2UcxcizWIeVayEhlo/8lScUog6XsvXM6+6OOEyJd/pLOs2 /RttKWJwSMHDK2hDoJcL5A8izTKP8wEnKCyoc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680095919; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nd2Hzi5pbnX457/tZ1SGDUudK/Mgpe+Ly4/pUeQ6HnM=; b=bLjGBVtCTQundCnt49SLVTbLczNxk8tEk600fMFEqkjfVHyS58c63KqPaUwIu+xI9w GACq6yxwYJyn2P66bXt/FLD9eIB0zY7QpFBHckt1fxSOyRZZMu2Ja7Izdb/IqmtD7yKA 06yNPe8CjnvNZxRGKnrqHoVySt98iKDEJIiKQK5+7JBnvPPsPln2lqeo7guwWpeNUv7b skPlr8RjW1LRlYZ/yvoZCW/WvlxD1YfxBl+GNUtJGlSGK24sHblncnybhSzuQzrPoWjq xJP1d7QO+Atu6bnUe4++P6wsbmfOIctOKE2D2pf0wtMkNtZvpXF4v8l+g1/A1esrzHjh MLsg== X-Gm-Message-State: AAQBX9fSdoBaX6t9DURebrXue5H1QyvQI86+hAYYmsIWQ/P+E5p9vea5 k/evUijeqn+ijCnmtzwxJShfZg== X-Google-Smtp-Source: AKy350bk2/fzr+dtM9w5K/plrUVW+fEKnyzucVJ/a5hXz7GHf87bUlhqvKmrLM/SThMMOW9uCmEMAA== X-Received: by 2002:a17:90b:1d8e:b0:23f:37b6:48f4 with SMTP id pf14-20020a17090b1d8e00b0023f37b648f4mr20675024pjb.43.1680095918961; Wed, 29 Mar 2023 06:18:38 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a047:206d:4722:c4fa:e845]) by smtp.gmail.com with ESMTPSA id s16-20020a17090b071000b0023f5c867f82sm1400192pjz.41.2023.03.29.06.18.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 06:18:38 -0700 (PDT) From: Jagan Teki To: Dave Stevenson , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sam Ravnborg , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Marek Vasut , linux-amarula , Jagan Teki Subject: [PATCH v7 08/12] ARM: dts: sun8i: a33: Add endpoint@0 to dsi_in_tcon0 Date: Wed, 29 Mar 2023 18:46:14 +0530 Message-Id: <20230329131615.1328366-9-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230329131615.1328366-1-jagan@amarulasolutions.com> References: <20230329131615.1328366-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230329_061839_798581_583AF4C6 X-CRM114-Status: GOOD ( 16.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The DSI downstream devices are likely to be Panel, Bridge and I2C-Configured Bridge. It is possible to connect all three devices using upstream OF-graph port or ports node however only Panel and Bridge are possible to connect via child node but not possible to connect I2C-Configured Bridge via child node since I2C-Configure bridges are child of I2C not upstream DSI hosts and it must represent them via port or ports with endpoint linking. Allwinner R33 DSI node already has a port so add endpoint 0 for input tcon so that the downstream DSI devices can use endpoint 1 to connect Panel or Bridge or I2C-Configured Bridge. An example of the I2C-Configured downstream bridge representation is, i2c1 { bridge@1b { compatible = "ti,dlpc3433"; ports { port@0 { reg = <0>; bridge_in_dsi: endpoint { remote-endpoint = <&dsi_out_bridge>; data-lanes = <1 2 3 4>; }; }; port@2 { reg = <2>; bridge_out_dmd: endpoint { remote-endpoint = <&dmd_out_bridge>; }; }; }; }; }; dsi { compatible = "allwinner,sun6i-a31-mipi-dsi"; port { dsi_in_tcon0: endpoint@0 { reg = <0>; remote-endpoint = ; }; dsi_out_bridge: endpoint@1 { reg = <1>; remote-endpoint = <&bridge_in_dsi>; }; }; }; Note that existing device bindings are untouched and still represent the downstream devices via child nodes since the sun6i-mipi-dsi host will migrate to a standardized single helper to lookup for a downstream device via child or OF-graph port or port node. Signed-off-by: Jagan Teki --- Changes for v7: - new patch arch/arm/boot/dts/sun8i-a33.dtsi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/sun8i-a33.dtsi b/arch/arm/boot/dts/sun8i-a33.dtsi index b3d1bdfb5118..50c2424ec31e 100644 --- a/arch/arm/boot/dts/sun8i-a33.dtsi +++ b/arch/arm/boot/dts/sun8i-a33.dtsi @@ -269,7 +269,11 @@ dsi: dsi@1ca0000 { #size-cells = <0>; port { - dsi_in_tcon0: endpoint { + #address-cells = <1>; + #size-cells = <0>; + + dsi_in_tcon0: endpoint@0 { + reg = <0>; remote-endpoint = <&tcon0_out_dsi>; }; }; From patchwork Wed Mar 29 13:16:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 13192666 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 D8B56C6FD18 for ; Wed, 29 Mar 2023 14:31:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=S6FVHVFjT3PmBk5hLwY+u6+alXFJS0j4VU5LcU3S/HI=; b=elrRHBaJuTcupZ pY0rk/8qPOfNTUu+EyaJlTsfXU13dtja1B73IgI35TvSN5XUcoczOrth5WJWDpdU3nCuVg6I+agnn wcTGg4oOhpI/qrULN/y5EvnqXvfR8yiUPYZgyuZaFNPXMH3tgxwKSftJ+FtpnVtl4+i5b3ggbn1KP cZmcOLAZYQ47IWPSc8hB09A6kDI2yQ0U+e/gQIxEluqwVSx64XaxOphrtVb6qvIEbteeTaAOmqPNk z7TM2u3fydHI/bN9f3bp9NOsLKtZ/Gb2ywBcFtmPFXJ224/G/4sfUkj28nocofe9EMVoNI7oM+idg ziwJK0/3gNriNZbQa6BQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phWou-000cTi-2T; Wed, 29 Mar 2023 14:30:36 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phVhO-000K4E-0E for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2023 13:18:47 +0000 Received: by mail-pj1-x102f.google.com with SMTP id p3-20020a17090a74c300b0023f69bc7a68so16102729pjl.4 for ; Wed, 29 Mar 2023 06:18:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1680095925; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ayYxgFJMhixN73Dm9Yf7ruaoOJe6G2KL+MHmxqG0S5Q=; b=Tkq5mhDm5ZQ+yiV1OtfyRGIvcm6whneUFGGlczqp/vSrs7C7VXKmht8Y87gNnukLVv UblkzhL6hGy/9w74FwGQJB48hURwaWI57RoCIqlyhZ3vJWNQRbd4X52ve0dQ/geHdmTN Ximd50oNuNiixWKqCTuhz632/5gMF7XMR1vSA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680095925; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ayYxgFJMhixN73Dm9Yf7ruaoOJe6G2KL+MHmxqG0S5Q=; b=m2sG3kjT+5TzPyeOqCOza4BJlKGX56sHxVQ1Q2zfEQlstpESR0bRsONS7C5UwAMpMQ 5z80ouhb1JU7v8Gi8wCFx2x15/qXn4YSfQVAP+4V0MuCJcluLCvq3cum77cOM1JtdARf PZQ8Vg6MrNcxFfmkg8PbmoFaiIdz+W1X3wImWCeL7+gTy0tC7wBhDChZxrp1LTuPyiTh oFyNOfzPRZjk8b6wOfOgCIguZa0Z08td2RqfbNKzmlsSaXPbfQ+/1cYWzgMN1HFkoE0d Dr4OxMk5JCn4fJurQFOEjgui8UBh4ZhKqoPhLlKDfyVETZbgkWMx+ZL9eRVjN53aXCsn qP5g== X-Gm-Message-State: AAQBX9fNy57pmHHHBByY3cwp6yFKWNV5geciHEAO+4q4Ro9ZsXrWm8oU SiQ5PgpqhE9vBBuUT0asXckm7g== X-Google-Smtp-Source: AKy350YO+Kpdu0/vAJkHuRQaxWiiCBUBvweO4jcD6ZDCYS8/PYA2ZACp2GIqrs5TCbiYnZ9OHuAaCg== X-Received: by 2002:a17:90b:1b49:b0:23d:1fc0:dd20 with SMTP id nv9-20020a17090b1b4900b0023d1fc0dd20mr20207025pjb.17.1680095925196; Wed, 29 Mar 2023 06:18:45 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a047:206d:4722:c4fa:e845]) by smtp.gmail.com with ESMTPSA id s16-20020a17090b071000b0023f5c867f82sm1400192pjz.41.2023.03.29.06.18.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 06:18:44 -0700 (PDT) From: Jagan Teki To: Dave Stevenson , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sam Ravnborg , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Marek Vasut , linux-amarula , Jagan Teki Subject: [PATCH v7 09/12] arm64: dts: rockchip: a64: Add endpoint@0 to dsi_in_tcon0 Date: Wed, 29 Mar 2023 18:46:15 +0530 Message-Id: <20230329131615.1328366-10-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230329131615.1328366-1-jagan@amarulasolutions.com> References: <20230329131615.1328366-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230329_061846_141403_DDBCAC69 X-CRM114-Status: GOOD ( 15.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The DSI downstream devices are likely to be Panel, Bridge and I2C-Configured Bridge. It is possible to connect all three devices using upstream OF-graph port or ports node however only Panel and Bridge are possible to connect via child node but not possible to connect I2C-Configured Bridge via child node since I2C-Configure bridges are child of I2C not upstream DSI hosts and it must represent them via port or ports with endpoint linking. Allwinner A64 DSI node already has a port so add endpoint 0 for input tcon so that the downstream DSI devices can use endpoint 1 to connect Panel or Bridge or I2C-Configured Bridge. An example of the I2C-Configured downstream bridge representation is, i2c1 { bridge@1b { compatible = "ti,dlpc3433"; ports { port@0 { reg = <0>; bridge_in_dsi: endpoint { remote-endpoint = <&dsi_out_bridge>; data-lanes = <1 2 3 4>; }; }; port@2 { reg = <2>; bridge_out_dmd: endpoint { remote-endpoint = <&dmd_out_bridge>; }; }; }; }; }; dsi { compatible = "allwinner,sun50i-a64-mipi-dsi"; port { dsi_in_tcon0: endpoint@0 { reg = <0>; remote-endpoint = ; }; dsi_out_bridge: endpoint@1 { reg = <1>; remote-endpoint = <&bridge_in_dsi>; }; }; }; Note that existing device bindings are untouched and still represent the downstream devices via child nodes since the sun6i-mipi-dsi host will migrate to a standardized single helper to lookup for a downstream device via child or OF-graph port or port node. Signed-off-by: Jagan Teki --- Changes for v7: - new patch arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi index 77b5349f6087..3ed566dc2172 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi @@ -1189,7 +1189,11 @@ dsi: dsi@1ca0000 { #size-cells = <0>; port { - dsi_in_tcon0: endpoint { + #address-cells = <1>; + #size-cells = <0>; + + dsi_in_tcon0: endpoint@0 { + reg = <0>; remote-endpoint = <&tcon0_out_dsi>; }; }; From patchwork Wed Mar 29 13:19:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 13192419 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 E460FC77B60 for ; Wed, 29 Mar 2023 13:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=TkXHeOPYr+meM3WOUKlZ34IBL/BzRbwhKPNPB70OsDo=; b=OXIJp6XhyEFcNI jmMswnGBPUs0+k79PNR06XrcxpMePMHgTHpWXpUdkBjdbWg518iKh+Ld+2U4kmNO0jfvmSIsuhJ8R v6M+qDNtR2/6+KnkBi5/sj474OpBxM3nzIDkWaKfGBPxWQvx2Z7PZH9l4r5DPGyevd9HpYIrOJsYf vl9O4pB+NspUoZXgzTf/gSHJyNQwt9ycRav7zv5RNMdNOPWk2GMthwulfhnXOg+cubsrW5xOl3fjI 5/edf4m1jxNwbfIBsNzjwiGF0OoS8lVfxoLmHJtxYJ4drLji8s4ZpsFu5d6I5Sd01eein7ItQ13xp NR+Qbxa2UwJzP05YcDmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phVix-000LBi-1o; Wed, 29 Mar 2023 13:20:23 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phViI-000Kli-27 for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2023 13:19:44 +0000 Received: by mail-pj1-x1034.google.com with SMTP id mp3-20020a17090b190300b0023fcc8ce113so18515166pjb.4 for ; Wed, 29 Mar 2023 06:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1680095980; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/v0aeTjxkLPm8Geh7qWRGFN17I5ZClwfGotSGAvvgRo=; b=Yk1ZX+WLEPPdWL2SD3QOvrYJbjyVLaxAmc1SRNI16HvFnnip4H+fNCct1NxOY03yp7 q7v+fC3LCpqmBx+mZBhks3zK5jwjN0fyuv+W14RENLl4Q8PzI3cPphDKYB+9taccSGvd uOz0RemLx7vwkMenM1ACiUddbuNGOvikDWXBE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680095980; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/v0aeTjxkLPm8Geh7qWRGFN17I5ZClwfGotSGAvvgRo=; b=KDZAYvVr5SpfPUS6AyW79E5kWtJtt+wI4yrfw+QgIyIZr9a7TCty2/nJGC2zHOHnJg Pwj/l4E2DftVhTSctF/IBjIEZ56d90pcz7EaozCjwEgzGlTI7d6tbO4p9YtWlcgaGx0S iFY9fDtwCal8xfCGIx66YnZg12wBWJFu5VTiBcAsbhGHqDUtWuwrfOP5Iz+VgIK0yi2q A17bXuHrzKGz++NNuOCYhwcGcl43FB89TBXjZ8IrVpmQKMhX1s7cmNDzv38wbsd15kHz Mt8J4qjpqoC7B1xmEV0UxjpNNMPptlpN35qNWaFaBAlV3wGA+KhsWyVHTYu9NfN/QCKn ManQ== X-Gm-Message-State: AAQBX9eFXtK5y5Vfweb0c6M0jJuYQHIkYye/yIGFLJK7SDlHi2woVN0b sL7DD7jz6WcAa/BIMiYKC/i5Rg== X-Google-Smtp-Source: AKy350a30gmaeoHI3gtRW94k9vTAreUbchLxDVDQ49J4FoNt8UN/7ACF8JX/3OzUkhDlIZRne6BRAw== X-Received: by 2002:a17:903:22cb:b0:1a1:b174:8363 with SMTP id y11-20020a17090322cb00b001a1b1748363mr23482597plg.59.1680095980475; Wed, 29 Mar 2023 06:19:40 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a047:206d:4722:c4fa:e845]) by smtp.gmail.com with ESMTPSA id d9-20020a170902854900b0019c90f8c831sm22949389plo.242.2023.03.29.06.19.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 06:19:39 -0700 (PDT) From: Jagan Teki To: Dave Stevenson , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sam Ravnborg , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Marek Vasut , linux-amarula , Jagan Teki Subject: [PATCH v7 10/12] drm/bridge: Implement enable_next_first to alter bridge init order Date: Wed, 29 Mar 2023 18:49:27 +0530 Message-Id: <20230329131929.1328612-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230329_061942_700483_4BB0854D X-CRM114-Status: GOOD ( 27.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DSI sink devices typically send the MIPI-DCS commands to the DSI host via general MIPI_DSI_DCS read and write API. The classical DSI sequence mentioned that the DSI host receives MIPI-DCS commands from the DSI sink first in order to switch HS mode properly. Once the DSI host switches to HS mode any MIPI-DCS commands from the DSI sink are unfunctional. DSI sink uses the @enable function to send the MIPI-DCS commands. In a typical DSI host, sink pipeline the @enable call chain start with the DSI host, and then the DSI sink which is the "wrong" order as DSI host @enable is called and switched to HS mode before DSI sink @enable. If the DSI host enables with the @enable_next_first flag then the @enable for the DSI sink will be called first before the @enable of the DSI host. This alter bridge init order makes sure that the MIPI-DCS commands send first and then switch to the HS mode properly by DSI host. This new flag @enable_next_first that any bridg can set to swap the order of @enable (and #disable) for that and the immediately next bridge. [enable] If a bridge sets @enable_next_first, then the @enable for the next bridge will be called first before enable of this bridge. [disable] If a bridge sets @enable_next_first, then the @disable for the next bridge will be called first before @disable of this bridge to reverse the @enable calling direction. eg: - Panel - Bridge 1 - Bridge 2 enable_next_first - Bridge 3 - Bridge 4 enable_next_first - Bridge 5 enable_next_first - Bridge 6 - Encoder Would result in enable's being called as Encoder, Bridge 6, Bridge 3, Bridge 4, Bridge 5, Bridge 1, Bridge 2, Panel. and the result in disable's being called as Panel, Bridge 2, Bridge 1, Bridge 5, Bridge 4, Bridge 3, Bridge 6, Encoder. Signed-off-by: Jagan Teki --- Changes for v7: - new patch drivers/gpu/drm/drm_bridge.c | 171 ++++++++++++++++++++++++++++++----- include/drm/drm_bridge.h | 8 ++ 2 files changed, 154 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index caf0f341e524..cdc2669b3512 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -577,6 +577,24 @@ void drm_bridge_chain_mode_set(struct drm_bridge *bridge, } EXPORT_SYMBOL(drm_bridge_chain_mode_set); +static void drm_atomic_bridge_call_disable(struct drm_bridge *bridge, + struct drm_atomic_state *old_state) +{ + if (old_state && bridge->funcs->atomic_disable) { + struct drm_bridge_state *old_bridge_state; + + old_bridge_state = + drm_atomic_get_old_bridge_state(old_state, + bridge); + if (WARN_ON(!old_bridge_state)) + return; + + bridge->funcs->atomic_disable(bridge, old_bridge_state); + } else if (bridge->funcs->disable) { + bridge->funcs->disable(bridge); + } +} + /** * drm_atomic_bridge_chain_disable - disables all bridges in the encoder chain * @bridge: bridge control structure @@ -587,33 +605,73 @@ EXPORT_SYMBOL(drm_bridge_chain_mode_set); * starting from the last bridge to the first. These are called before calling * &drm_encoder_helper_funcs.atomic_disable * + * If a bridge sets @enable_next_first, then the @disable for the next bridge + * will be called first before @disable of this bridge to reverse the @enable + * calling direction. + * + * Example: + * Bridge A ---> Bridge B ---> Bridge C ---> Bridge D ---> Bridge E + * + * With enable_next_first flag enable in Bridge A, C, D then the resulting + * @disable order would be, + * Bridge C, Bridge D, Bridge E, Bridge A, Bridge B. + * * Note: the bridge passed should be the one closest to the encoder */ void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge, struct drm_atomic_state *old_state) { struct drm_encoder *encoder; - struct drm_bridge *iter; + struct drm_bridge *iter, *next, *limit; if (!bridge) return; encoder = bridge->encoder; + list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { - if (iter->funcs->atomic_disable) { - struct drm_bridge_state *old_bridge_state; - - old_bridge_state = - drm_atomic_get_old_bridge_state(old_state, - iter); - if (WARN_ON(!old_bridge_state)) - return; - - iter->funcs->atomic_disable(iter, old_bridge_state); - } else if (iter->funcs->disable) { - iter->funcs->disable(iter); + limit = NULL; + + if (!list_is_first(&iter->chain_node, &encoder->bridge_chain)) { + next = list_prev_entry(iter, chain_node); + + if (next->enable_next_first) { + limit = bridge; + list_for_each_entry_from_reverse(next, + &encoder->bridge_chain, + chain_node) { + if (next == bridge) + break; + + if (!next->enable_next_first) { + /* Found first bridge that does NOT + * request next to be enabled first + */ + next = list_next_entry(next, chain_node); + limit = next; + break; + } + } + + list_for_each_entry_from(next, &encoder->bridge_chain, chain_node) { + /* Call requested next bridge enable in order */ + if (next == iter) + /* At the first bridge to request next + * bridges called first. + */ + break; + + drm_atomic_bridge_call_disable(next, old_state); + } + } } + drm_atomic_bridge_call_disable(iter, old_state); + + if (limit) + /* Jump all bridges that we have already disabled */ + iter = limit; + if (iter == bridge) break; } @@ -822,6 +880,24 @@ void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge, } EXPORT_SYMBOL(drm_atomic_bridge_chain_pre_enable); +static void drm_atomic_bridge_call_enable(struct drm_bridge *bridge, + struct drm_atomic_state *old_state) +{ + if (old_state && bridge->funcs->atomic_enable) { + struct drm_bridge_state *old_bridge_state; + + old_bridge_state = + drm_atomic_get_old_bridge_state(old_state, + bridge); + if (WARN_ON(!old_bridge_state)) + return; + + bridge->funcs->atomic_enable(bridge, old_bridge_state); + } else if (bridge->funcs->enable) { + bridge->funcs->enable(bridge); + } +} + /** * drm_atomic_bridge_chain_enable - enables all bridges in the encoder chain * @bridge: bridge control structure @@ -832,31 +908,76 @@ EXPORT_SYMBOL(drm_atomic_bridge_chain_pre_enable); * starting from the first bridge to the last. These are called after completing * &drm_encoder_helper_funcs.atomic_enable * + * If a bridge sets @enable_next_first, then the @enable for the next bridge + * will be called first before enable of this bridge. + * + * Example: + * Bridge A ---> Bridge B ---> Bridge C ---> Bridge D ---> Bridge E + * + * With enable_next_first flag enable in Bridge A, C, D then the resulting + * @enable order would be, + * Bridge B, Bridge A, Bridge E, Bridge D, Bridge C. + * * Note: the bridge passed should be the one closest to the encoder */ void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge, struct drm_atomic_state *old_state) { struct drm_encoder *encoder; + struct drm_bridge *next, *limit; if (!bridge) return; encoder = bridge->encoder; + list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { - if (bridge->funcs->atomic_enable) { - struct drm_bridge_state *old_bridge_state; - - old_bridge_state = - drm_atomic_get_old_bridge_state(old_state, - bridge); - if (WARN_ON(!old_bridge_state)) - return; - - bridge->funcs->atomic_enable(bridge, old_bridge_state); - } else if (bridge->funcs->enable) { - bridge->funcs->enable(bridge); + limit = NULL; + + if (!list_is_last(&bridge->chain_node, &encoder->bridge_chain)) { + if (bridge->enable_next_first) { + /* next bridge had requested that next + * was enabled first, so disabled last + */ + next = list_next_entry(bridge, chain_node); + limit = next; + + list_for_each_entry_from(next, &encoder->bridge_chain, + chain_node) { + /* Find the next bridge that has NOT requested + * next to be enabled first / disabled last + */ + if (!next->enable_next_first) { + limit = next; + break; + } + + /* Last bridge has requested next to be limit + * otherwise the control move to end of chain + */ + if (list_is_last(&next->chain_node, + &encoder->bridge_chain)) { + limit = next; + break; + } + } + + /* Call these bridges in reverse order */ + list_for_each_entry_from_reverse(next, &encoder->bridge_chain, + chain_node) { + if (next == bridge) + break; + + drm_atomic_bridge_call_enable(next, old_state); + } + } } + + drm_atomic_bridge_call_enable(bridge, old_state); + + if (limit) + /* Jump all bridges that we have already enabled */ + bridge = limit; } } EXPORT_SYMBOL(drm_atomic_bridge_chain_enable); diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index a1a31704b917..9879129047e4 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -752,6 +752,14 @@ struct drm_bridge { * before the peripheral. */ bool pre_enable_prev_first; + /** + * @enable_next_first: The bridge requires that the next bridge @enable + * function is called first before its @enable, and conversely for + * @disable. This is most frequently a requirement for a DSI host to + * receive MIPI-DCS commands from DSI sink first in order to switch + * HS mode properly. + */ + bool enable_next_first; /** * @ddc: Associated I2C adapter for DDC access, if any. */ From patchwork Wed Mar 29 13:19:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 13192417 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 AFFAEC6FD18 for ; Wed, 29 Mar 2023 13:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OfMMKrvnB1acJ72WsigwEP3FcboBee95ANGq9MCF9Pc=; b=pZn99D/vXs+bLu cgd8S7V8nRSif2TPK+F+11nUN1jP2W/gW0CdeQSLjMpVlWetACPkbzTtwf6SW7FCOH9erLIPLP6HR 7K2xeHuvOzDVq3X/yExH6EnMsHUbB6ypPxDa9j2DeqM06d+LGWPgObOlWego9Pn3ihaalg0OtNh5R vOkGgnMnGMaFdHfbopMMBCEr0SYYN9/KmoV3v+5DVDRYaXFDrn2BBn5R48SzVZkWlwOiZ7eBBrdVJ cYz7AEmiJuIzDgzyHT80Lvp/lHVstBj6sj9+2WNaI9UAdIZhBmROLK+YvPXXVin7tBIMJWU6BepJ/ 4YO8EHO1IT4D1bXNAtfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phViy-000LCZ-2n; Wed, 29 Mar 2023 13:20:24 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phViN-000Kq7-2l for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2023 13:19:50 +0000 Received: by mail-pl1-x62f.google.com with SMTP id c18so14861434ple.11 for ; Wed, 29 Mar 2023 06:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1680095987; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=u6Zop59KiDms2RJ1oWf1wfATSRqRH4OJms0tUCu66Ds=; b=QQ4mv0hzsvmkqMfZ15yfLZhf/wl79O4+d+NBuatGYLK4BGPk9Np/s4ckoMZRB3LZXo I3dscvMrxXCbTMtb7/FDV05iLJ2rUvj36gPeS7d0vqmmPQeVd2WB7IiqF1xr4PDKBwF2 i3aV50EnDgs+bsKD5ZfaHeeybIOgqGkOc1ghc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680095987; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u6Zop59KiDms2RJ1oWf1wfATSRqRH4OJms0tUCu66Ds=; b=gtYrX+UABASKnh8ckf1ofaINPE106iBfqsUZ9jhASZsAkVkkJjlYbA/iX+gvni2Tif nRoDhI1iFFR0ffkmQMR7m1fSgDxRkpmtcc1zCrIrNns6br9KfKn7wXF6VGlDSAOdlYUf vIHCZfKjaAtu0Y2NiqOhSqUqxqMBUxGvIUOGzhAAesNd/KISUS546rKOsnml4ite9Te7 Ea15HyTHOkSYonB1+wreeaOxJFcXdubrUq4tunlhyhF92DZjxmMrkMmnOza4EPOjbwBC NO9G8Y6RtRs/6QliY4t5RzIPKIdS3q7dn6YAIOUI05LYwrVeFY+HtxqbJ4wrUDI1OICE DqUw== X-Gm-Message-State: AAQBX9f0OMihEBSHyVdBYAhR8waMwvs2HbOYJDVDALlscacs+4bMFkjI wHnpkfGzP6uuCzfKvnX8FbUHxQ== X-Google-Smtp-Source: AKy350bJSgXAsk9heZqbdTPpDv1tZiTFnee58NDrLnd5uUac7ubukuyOG3UH7pLKrlBz3vrhjtw4ZQ== X-Received: by 2002:a17:902:d2d2:b0:1a0:6ed9:f9d0 with SMTP id n18-20020a170902d2d200b001a06ed9f9d0mr24347448plc.68.1680095987116; Wed, 29 Mar 2023 06:19:47 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a047:206d:4722:c4fa:e845]) by smtp.gmail.com with ESMTPSA id d9-20020a170902854900b0019c90f8c831sm22949389plo.242.2023.03.29.06.19.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 06:19:46 -0700 (PDT) From: Jagan Teki To: Dave Stevenson , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sam Ravnborg , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Marek Vasut , linux-amarula , Jagan Teki Subject: [PATCH v7 11/12] drm/bridge: Document bridge init order with enable_next_first Date: Wed, 29 Mar 2023 18:49:28 +0530 Message-Id: <20230329131929.1328612-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230329131929.1328612-1-jagan@amarulasolutions.com> References: <20230329131929.1328612-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230329_061947_903290_153C4D1C X-CRM114-Status: GOOD ( 14.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In order to switch HS mode properly by DSI host, the DSI sink has to send the MIPI-DCS commands first before the DSI host switches to HS mode. This behavior requires a bridge init alter in @enable and @disable function calls with the help of @enable_next_first. Document the affected bridge init order with a proper explanation. Signed-off-by: Jagan Teki --- Changes for v7: - new patch drivers/gpu/drm/drm_bridge.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index cdc2669b3512..3c6c9937537a 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -190,6 +190,21 @@ * Ultra Low Power State (ULPS) is not explicitly supported by DRM. If * implemented, it therefore needs to be handled entirely within the DSI Host * driver. + * + * DSI sink devices typically send the MIPI-DCS commands to the DSI host via + * general MIPI_DSI_DCS read and write API. The classical DSI sequence + * mentioned that the DSI host receives MIPI-DCS commands from the DSI sink + * first in order to switch HS mode properly. Once the DSI host switches to + * HS mode any MIPI-DCS commands from the DSI sink are unfunctional. + * + * DSI sink uses the @enable function to send the MIPI-DCS commands. In a + * typical DSI host, sink pipeline the @enable call chain start with the + * DSI host, and then the DSI sink which is the "wrong" order as DSI host + * @enable is called and switched to HS mode before DSI sink @enable. If + * the DSI host enables with the @enable_next_first flag then the @enable + * for the DSI sink will be called first before the @enable of the DSI host. + * This alter bridge init order makes sure that the MIPI-DCS commands send + * first and then switch to the HS mode properly by the DSI host. */ static DEFINE_MUTEX(bridge_lock); From patchwork Wed Mar 29 13:19:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 13192418 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A025CC77B6C for ; Wed, 29 Mar 2023 13:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vqKeOQ/ili1EXTjlTVjeaeaDiGmwbSdHqrft38o23W4=; b=AEuhCTMTbSH1xq giJhrsKajJGy4RkkQr6rS4WMguKvoryKQITEaUugO/+AaZzjjq/V2RKURjAWo411b+lT26HJDoGD+ D20tSoh9Av3uFujs7drxPCBWCNI3SEQRkHHCv8TUS7wG56zukW39HFa/kkk1lTl+hMxEl/SRP7h8l H6aUXQ5EJDdjPgz/iNrlrQt2RE3+dYC5nJdA0wFAPZY90yIZhKpmqB0SQsgfzF1mmZGxltSXrVmFC N4+xVqBnG3SNCDmT2w15WIq+oNQGUPjXXIVElL3wnkeSVT+id008Nhb25S/FelkN7EYJvkOMwva7V eiWDcFV63vm69JtA29Fg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phVj0-000LDN-0V; Wed, 29 Mar 2023 13:20:26 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phViU-000Kun-1e for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2023 13:19:57 +0000 Received: by mail-pj1-x1034.google.com with SMTP id gp15-20020a17090adf0f00b0023d1bbd9f9eso18577051pjb.0 for ; Wed, 29 Mar 2023 06:19:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1680095994; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cAaFhF/a5ENgWUKZdfeicYv37T8G+yzz+kNYaBM8Ibc=; b=HKqkbFZ2TYU68RSVDYycQrf3/QBAqDxyk3yugbSjnTad90HAJxauBWG3pqUTxIC5OX LSXPyPy4TO+DdSqZfNlD9kWSuR9mQamSmKAps4wplUDsC9JvHvXe4R4Tdeo2e4SD67qC eFn3r+7noJAIVpNaVr59LcSBfBFHcXvKjrQh8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680095994; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cAaFhF/a5ENgWUKZdfeicYv37T8G+yzz+kNYaBM8Ibc=; b=jJGngdYeJOqK8jqqrLAvdpE5LZ2G+5FDe4h1F8ZoqvSZ/EbIEC1eJRoa9D4PMgyKix 8omnDiwG2eecboV+Dm9Knu13X3sPGvSV5TSnv/GAo4EmyPEjYM/9uPVS4ONahrF2Uwsp QQ9bTvSR/NHJVtxKJbsIdNAUBofSv6d94UvrUwP0kwdjNAMf12OsGVk3/XeyOkdYoi7R TrJi8Up4qx6bhhW3xCO6gsX2LEP8ic1Q1wp9Jt0uvU4dXzvWYUJcbCZ9LXWOF7iAxSR/ wfS8CyEqmWDTwPSs6OfbYXn8xinOtDXWC/qJX6DvIp+R0KmbEGxDbBMLS4PDeu+2nYTv 10Sg== X-Gm-Message-State: AAQBX9fTkD3ydcS/68ajwiNcocgFFYhdhKHqOqw6HgP4K/CIQ7yOmC6B XlKLp5bS+Fvtm0S0FC/uQf91Zw== X-Google-Smtp-Source: AKy350aIXLLIcBKLX4EnbM2MFHWk3+DhkZBq+rft36HmP01HP9W/YHK9ov8fdY0JAetpLe7hMizBhA== X-Received: by 2002:a17:902:f551:b0:1a0:616d:7618 with SMTP id h17-20020a170902f55100b001a0616d7618mr18983382plf.51.1680095993863; Wed, 29 Mar 2023 06:19:53 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a047:206d:4722:c4fa:e845]) by smtp.gmail.com with ESMTPSA id d9-20020a170902854900b0019c90f8c831sm22949389plo.242.2023.03.29.06.19.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 06:19:53 -0700 (PDT) From: Jagan Teki To: Dave Stevenson , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sam Ravnborg , Rob Herring , Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Marek Vasut , linux-amarula , Jagan Teki Subject: [PATCH v7 12/12] drm: sun4: dsi: Convert to bridge driver Date: Wed, 29 Mar 2023 18:49:29 +0530 Message-Id: <20230329131929.1328612-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230329131929.1328612-1-jagan@amarulasolutions.com> References: <20230329131929.1328612-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230329_061954_570465_9B4126E0 X-CRM114-Status: GOOD ( 24.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Convert the encoder to bridge driver in order to standardize on a single API by supporting all varients of downstream bridge devices. The drm_encoder can't be removed as it's exposed to userspace, so it then becomes a dumb encoder, without any operation implemented. Tested on DSI Panel, DSI Bridge, I2C-Configured DSI Bridge. Signed-off-by: Jagan Teki --- Changes for v7: - drop bridge call chain - use drmm_of_dsi_get_bridge - switch to atomic bridge calls - use atomic_pre_enable and atomic_enable for previous enable Changes for v6: - support donwstream bridge - drop bridge conversion - devm_drm_of_get_bridge() require child lookup https://patchwork.kernel.org/project/dri-devel/cover/20211207054747.461029-1-jagan@amarulasolutions.com/ Changes for v5: - add atomic APIs - find host and device variant DSI devices. Changes for v4, v3: - none drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 143 ++++++++++--------------- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 10 +- 2 files changed, 61 insertions(+), 92 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 760ff05eabf4..71951a6dc914 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -20,8 +20,8 @@ #include #include +#include #include -#include #include #include #include @@ -713,10 +713,11 @@ static int sun6i_dsi_start(struct sun6i_dsi *dsi, return 0; } -static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) +static void sun6i_dsi_bridge_pre_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_state) { - struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; - struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder); + struct drm_display_mode *mode = &bridge->encoder->crtc->state->adjusted_mode; + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); struct mipi_dsi_device *device = dsi->device; union phy_configure_opts opts = { }; struct phy_configure_opts_mipi_dphy *cfg = &opts.mipi_dphy; @@ -768,9 +769,12 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) phy_set_mode(dsi->dphy, PHY_MODE_MIPI_DPHY); phy_configure(dsi->dphy, &opts); phy_power_on(dsi->dphy); +} - if (dsi->panel) - drm_panel_prepare(dsi->panel); +static void sun6i_dsi_bridge_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_state) +{ + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); /* * FIXME: This should be moved after the switch to HS mode. @@ -784,9 +788,6 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) * ordering on the panels I've tested it with, so I guess this * will do for now, until that IP is better understood. */ - if (dsi->panel) - drm_panel_enable(dsi->panel); - sun6i_dsi_start(dsi, DSI_START_HSC); udelay(1000); @@ -794,17 +795,13 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) sun6i_dsi_start(dsi, DSI_START_HSD); } -static void sun6i_dsi_encoder_disable(struct drm_encoder *encoder) +static void sun6i_dsi_bridge_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_state) { - struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder); + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); DRM_DEBUG_DRIVER("Disabling DSI output\n"); - if (dsi->panel) { - drm_panel_disable(dsi->panel); - drm_panel_unprepare(dsi->panel); - } - phy_power_off(dsi->dphy); phy_exit(dsi->dphy); @@ -813,38 +810,23 @@ static void sun6i_dsi_encoder_disable(struct drm_encoder *encoder) regulator_disable(dsi->regulator); } -static int sun6i_dsi_get_modes(struct drm_connector *connector) -{ - struct sun6i_dsi *dsi = connector_to_sun6i_dsi(connector); - - return drm_panel_get_modes(dsi->panel, connector); -} - -static const struct drm_connector_helper_funcs sun6i_dsi_connector_helper_funcs = { - .get_modes = sun6i_dsi_get_modes, -}; - -static enum drm_connector_status -sun6i_dsi_connector_detect(struct drm_connector *connector, bool force) +static int sun6i_dsi_bridge_attach(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) { - struct sun6i_dsi *dsi = connector_to_sun6i_dsi(connector); + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); - return dsi->panel ? connector_status_connected : - connector_status_disconnected; + return drm_bridge_attach(bridge->encoder, dsi->out_bridge, + &dsi->bridge, flags); } -static const struct drm_connector_funcs sun6i_dsi_connector_funcs = { - .detect = sun6i_dsi_connector_detect, - .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = drm_connector_cleanup, - .reset = drm_atomic_helper_connector_reset, - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, -}; - -static const struct drm_encoder_helper_funcs sun6i_dsi_enc_helper_funcs = { - .disable = sun6i_dsi_encoder_disable, - .enable = sun6i_dsi_encoder_enable, +static const struct drm_bridge_funcs sun6i_mipi_dsi_bridge_funcs = { + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_pre_enable = sun6i_dsi_bridge_pre_enable, + .atomic_enable = sun6i_dsi_bridge_enable, + .atomic_disable = sun6i_dsi_bridge_disable, + .attach = sun6i_dsi_bridge_attach, }; static u32 sun6i_dsi_dcs_build_pkt_hdr(struct sun6i_dsi *dsi, @@ -959,20 +941,27 @@ static int sun6i_dsi_dcs_read(struct sun6i_dsi *dsi, return 1; } +static const struct component_ops sun6i_dsi_ops; + static int sun6i_dsi_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { struct sun6i_dsi *dsi = host_to_sun6i_dsi(host); - struct drm_panel *panel = of_drm_find_panel(device->dev.of_node); + int ret; + + dsi->device = device; + + drm_bridge_add(&dsi->bridge); + + ret = component_add(dsi->dev, &sun6i_dsi_ops); + if (ret) { + dev_err(dsi->dev, "Couldn't register our component\n"); + return ret; + } - if (IS_ERR(panel)) - return PTR_ERR(panel); if (!dsi->drm || !dsi->drm->registered) return -EPROBE_DEFER; - dsi->panel = panel; - dsi->device = device; - drm_kms_helper_hotplug_event(dsi->drm); dev_info(host->dev, "Attached device %s\n", device->name); @@ -985,11 +974,10 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host, { struct sun6i_dsi *dsi = host_to_sun6i_dsi(host); - dsi->panel = NULL; + component_del(dsi->dev, &sun6i_dsi_ops); + drm_bridge_remove(&dsi->bridge); dsi->device = NULL; - drm_kms_helper_hotplug_event(dsi->drm); - return 0; } @@ -1054,8 +1042,13 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, struct sun6i_dsi *dsi = dev_get_drvdata(dev); int ret; - drm_encoder_helper_add(&dsi->encoder, - &sun6i_dsi_enc_helper_funcs); + dsi->out_bridge = drmm_of_dsi_get_bridge(drm, dev->of_node, 0, 1); + if (IS_ERR(dsi->out_bridge)) { + ret = PTR_ERR(dsi->out_bridge); + DRM_DEV_ERROR(dsi->dev, "failed to find the bridge: %d\n", ret); + return ret; + } + ret = drm_simple_encoder_init(drm, &dsi->encoder, DRM_MODE_ENCODER_DSI); if (ret) { @@ -1064,39 +1057,19 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, } dsi->encoder.possible_crtcs = BIT(0); - drm_connector_helper_add(&dsi->connector, - &sun6i_dsi_connector_helper_funcs); - ret = drm_connector_init(drm, &dsi->connector, - &sun6i_dsi_connector_funcs, - DRM_MODE_CONNECTOR_DSI); + ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, 0); if (ret) { - dev_err(dsi->dev, - "Couldn't initialise the DSI connector\n"); - goto err_cleanup_connector; + dev_err(dsi->dev, "Couldn't attach the DSI bridge\n"); + return ret; } - drm_connector_attach_encoder(&dsi->connector, &dsi->encoder); - dsi->drm = drm; return 0; - -err_cleanup_connector: - drm_encoder_cleanup(&dsi->encoder); - return ret; -} - -static void sun6i_dsi_unbind(struct device *dev, struct device *master, - void *data) -{ - struct sun6i_dsi *dsi = dev_get_drvdata(dev); - - dsi->drm = NULL; } static const struct component_ops sun6i_dsi_ops = { .bind = sun6i_dsi_bind, - .unbind = sun6i_dsi_unbind, }; static int sun6i_dsi_probe(struct platform_device *pdev) @@ -1175,22 +1148,19 @@ static int sun6i_dsi_probe(struct platform_device *pdev) goto err_unprotect_clk; } + dsi->bridge.funcs = &sun6i_mipi_dsi_bridge_funcs; + dsi->bridge.of_node = dev->of_node; + dsi->bridge.type = DRM_MODE_CONNECTOR_DSI; + dsi->bridge.enable_next_first = true; + ret = mipi_dsi_host_register(&dsi->host); if (ret) { dev_err(dev, "Couldn't register MIPI-DSI host\n"); goto err_unprotect_clk; } - ret = component_add(&pdev->dev, &sun6i_dsi_ops); - if (ret) { - dev_err(dev, "Couldn't register our component\n"); - goto err_remove_dsi_host; - } - return 0; -err_remove_dsi_host: - mipi_dsi_host_unregister(&dsi->host); err_unprotect_clk: if (dsi->variant->has_mod_clk && dsi->variant->set_mod_clk) clk_rate_exclusive_put(dsi->mod_clk); @@ -1205,7 +1175,6 @@ static int sun6i_dsi_remove(struct platform_device *pdev) struct device *dev = &pdev->dev; struct sun6i_dsi *dsi = dev_get_drvdata(dev); - component_del(&pdev->dev, &sun6i_dsi_ops); mipi_dsi_host_unregister(&dsi->host); if (dsi->variant->has_mod_clk && dsi->variant->set_mod_clk) clk_rate_exclusive_put(dsi->mod_clk); diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index f1ddefe0f554..8b9263e0f4ef 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -21,9 +21,9 @@ struct sun6i_dsi_variant { }; struct sun6i_dsi { - struct drm_connector connector; struct drm_encoder encoder; struct mipi_dsi_host host; + struct drm_bridge bridge; struct clk *bus_clk; struct clk *mod_clk; @@ -35,7 +35,7 @@ struct sun6i_dsi { struct device *dev; struct mipi_dsi_device *device; struct drm_device *drm; - struct drm_panel *panel; + struct drm_bridge *out_bridge; const struct sun6i_dsi_variant *variant; }; @@ -45,10 +45,10 @@ static inline struct sun6i_dsi *host_to_sun6i_dsi(struct mipi_dsi_host *host) return container_of(host, struct sun6i_dsi, host); }; -static inline struct sun6i_dsi *connector_to_sun6i_dsi(struct drm_connector *connector) +static inline struct sun6i_dsi *bridge_to_sun6i_dsi(struct drm_bridge *bridge) { - return container_of(connector, struct sun6i_dsi, connector); -}; + return container_of(bridge, struct sun6i_dsi, bridge); +} static inline struct sun6i_dsi *encoder_to_sun6i_dsi(const struct drm_encoder *encoder) {