From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADFBAC4338F for ; Wed, 28 Jul 2021 13:32:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 96C8D60FED for ; Wed, 28 Jul 2021 13:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236349AbhG1Ncl (ORCPT ); Wed, 28 Jul 2021 09:32:41 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:38893 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236336AbhG1Ncj (ORCPT ); Wed, 28 Jul 2021 09:32:39 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id EBDE3580B89; Wed, 28 Jul 2021 09:32:37 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 28 Jul 2021 09:32:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=s1/AGqxR15g+h Pk2op+DrdT6xO3KSQkr55JaRssrGcY=; b=S4RIe9lWYsv7BQi3qSJKjL6zckLrC C4hClnsa4/3gIWlspEhNzsJWdS1RQaH8kpbnCWyHWzZ3LkrxEn1NVrTClsRDlXsh 0iEXtA+iNeYvSxkPrnA/L3rcBcj4OMrhS7fuF7INwMN/F458sVbARP7qdqNnzubN jOGhJ2EIGWHqTn6bgLPwyFPQoku4hJBLvJmB0yiySd70hkOibchWVXsalwG7g8bs b7/+NaVMuW9R+4/t8IodPDBBuM/qUCg4ReYYRoTCrEM7ZDQVq9euiOFvlibwZHWN lVZy29fZwYH9YboGV5fb8pmXPUrILk0ThP+NTJx2iycBRNZn682v6qCew== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=s1/AGqxR15g+hPk2op+DrdT6xO3KSQkr55JaRssrGcY=; b=fiy/ciDZ olclcVZJcc3IRh1EsV32IMWz9JEByU+/bVx3fMw8ercbvRD1OH+lfW8PzyPUE6AS OV7wuS4J2tcbSnto4iL6ZzNnwF56xZFFWZFZOu5pbvcy3FpflIf5NcuM/MJ6wAQ6 wkjxzHH2dGHbw4Mh0uMM6cs2gveTDrFjcn+oSYp9yh2bld4P7wnaLKiUqUiOqvm2 Nyo5XDu6rUIt4WlJ6v/3s1vGRYxeKIAFxGtGJIZcoJIpgCGRlABQCbYhGFP1u+1N HGjzLrQkphL2ezzs6W0M8stKB16T/Rjq+eDmgUGa9rnPDyDb/B7nsPLcfnArMHa8 YV5JH03ynGmLiQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrgeelgdeivdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 28 Jul 2021 09:32:35 -0400 (EDT) From: Maxime Ripard To: Sam Ravnborg , Daniel Vetter , David Airlie , Thierry Reding , Laurent Pinchart , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Jernej Skrabec , Neil Armstrong , Andrzej Hajda , Jonas Karlman , Robert Foss Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 1/8] Revert "drm/vc4: dsi: Only register our component once a DSI device is attached" Date: Wed, 28 Jul 2021 15:32:22 +0200 Message-Id: <20210728133229.2247965-2-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210728133229.2247965-1-maxime@cerno.tech> References: <20210728133229.2247965-1-maxime@cerno.tech> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit 7213246a803f9b8da0677adb9ae06a3d8b806d02. The commit 7213246a803f ("drm/vc4: dsi: Only register our component once a DSI device is attached") aimed at preventing an endless probe loop between the DSI host driver and its panel/bridge where both would wait for each other to probe. The solution implemented in that commit however relies on the fact that MIPI-DSI device will either be a MIPI-DSI device, or would call mipi_dsi_device_register_full() at probe time. This assumption isn't true for bridges though where most drivers will do so in the bridge attach hook. However, the drm_bridge_attach is usually called in the DSI host bind hook, and thus we never get this far, resulting in a DSI bridge that will never have its attach run, and the DSI host that will never be bound, effectively creating the same situation we were trying to avoid for panels. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_dsi.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index a55256ed0955..6dfcbd9e234e 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -1257,12 +1257,10 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_dsi_host *host, return ret; } -static const struct component_ops vc4_dsi_ops; static int vc4_dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { struct vc4_dsi *dsi = host_to_dsi(host); - int ret; dsi->lanes = device->lanes; dsi->channel = device->channel; @@ -1297,12 +1295,6 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host, return 0; } - ret = component_add(&dsi->pdev->dev, &vc4_dsi_ops); - if (ret) { - mipi_dsi_host_unregister(&dsi->dsi_host); - return ret; - } - return 0; } @@ -1689,6 +1681,7 @@ static int vc4_dsi_dev_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct vc4_dsi *dsi; + int ret; dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL); if (!dsi) @@ -1696,10 +1689,26 @@ static int vc4_dsi_dev_probe(struct platform_device *pdev) dev_set_drvdata(dev, dsi); dsi->pdev = pdev; + + /* Note, the initialization sequence for DSI and panels is + * tricky. The component bind above won't get past its + * -EPROBE_DEFER until the panel/bridge probes. The + * panel/bridge will return -EPROBE_DEFER until it has a + * mipi_dsi_host to register its device to. So, we register + * the host during pdev probe time, so vc4 as a whole can then + * -EPROBE_DEFER its component bind process until the panel + * successfully attaches. + */ dsi->dsi_host.ops = &vc4_dsi_host_ops; dsi->dsi_host.dev = dev; mipi_dsi_host_register(&dsi->dsi_host); + ret = component_add(&pdev->dev, &vc4_dsi_ops); + if (ret) { + mipi_dsi_host_unregister(&dsi->dsi_host); + return ret; + } + return 0; } -- 2.31.1