Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4571163pxv; Tue, 20 Jul 2021 06:53:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOUpyhhBoudd/CiLj8Mgfoc68p4g3iSCFPQq+rESw0OpmuCbWWkithPAJiH40PEaM0ahcL X-Received: by 2002:a17:906:ecb3:: with SMTP id qh19mr24705510ejb.113.1626789210044; Tue, 20 Jul 2021 06:53:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626789210; cv=none; d=google.com; s=arc-20160816; b=QsDNJkYBzqcol1qjINLAxYeyiV5GoMtfo1QbsPnQszR6zl8560BJDao2ee/PQw5igI x/NLO2Cb7iWXcV7BpH/vZ3yz6v2m4s/ZESHls0cwW4kdgIjfYQfVUF9J0tjz46ikj3sZ P/Wp+wTdRBpIks8irjz90ypbO/SzFvO4l+0ejZHKNLK9Li2QE/tL0VDPD0CFY/v39cLI OKX192R2J04QCxmk8TEVoZZBTJPmj1AhwYnUzzDOJytuBnw4Dh40u1oUO9hxzMgd2m7z ODbvkfyfIChrOQZ1XNf7yQGGBqjy1IpIY5KidmsrQKjCa6jf3PVsy3++/ai8jQv5Zlrt 44eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=s1/AGqxR15g+hPk2op+DrdT6xO3KSQkr55JaRssrGcY=; b=tmqXrkRsilCNHI9zdNFMDOgBzdReezyj3Eg2MJnnGE1rYjYGKkdmd13Vt2CvqgX7nc 8MLItn5CUyNKVmWaVlUXBJ0ZKLXyGCwgH2k1DJj+vHbK5/zCXj2YInYztzOJjWRZsk2p 4rk6I0r67baudRnmBTQLDcKzLYY+4lK9gZ7VMySZhxe4TrIhsFU6HoqpDY1NNQ54/Au+ aUJkK+Tmu1TT9l0glcu8TAyFs6vk4V2DT9w1YWOBZVtkFIMDFIblFBqZaFInHWoRaaGE lZbTgTGJYc7hAigoOAofQYMhzqPCkzaTtxWJefVK32qmZcIbvGy906eX9Lq3P7/nq9Fu 2Tmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=EbC4yCxj; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Iq0S8KeP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p20si25489739edx.40.2021.07.20.06.53.06; Tue, 20 Jul 2021 06:53:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=EbC4yCxj; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Iq0S8KeP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239313AbhGTNLD (ORCPT + 99 others); Tue, 20 Jul 2021 09:11:03 -0400 Received: from wnew3-smtp.messagingengine.com ([64.147.123.17]:44047 "EHLO wnew3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237295AbhGTNE7 (ORCPT ); Tue, 20 Jul 2021 09:04:59 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 182F22B01189; Tue, 20 Jul 2021 09:45:36 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 20 Jul 2021 09:45: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=EbC4yCxjXxo6DS/vKoYyfM/ORjISk uu1uLEFJgthMaHxG/pUXxz+5mWDCMlFnLNDbC5VFYOv7D5niZCh+Blu6JnC2mwFj lxMJkHlSzAWeFT0JI95aLwSQy5SwTBUy+RtzQGLoRt1K+J+H7P7GcsY13taMNbfP mf6gq2TYoS6EyjKnZgzwUGDkwx3UGDnAKVS/isoD/wWRxGSLQ97iJeCpoBH57Oa0 HK3CJkBQ3fAFlpH5rlvld/be4BSiZeTfLH1ahn08TaRrQjHkd+mU6a5/OqrcRelP U401+gqmX2ThdL0BwXMitE9zAEuIqOoHs4L7lQqmxmoy5qT9sjRF8eZFQ== 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=Iq0S8KeP N1NUOw1XSE+kw9ebJzm8UXOa4J8Vae2JAldVuBioqFD0D7kaSYjSwLUAsXDx/V6S Vojze0ZW4HXvy0hhOSWUFQMUhU/WuT336lfIFbLrqlJSwr0pS2QFx/L7UOL9bvyy JHPZYUuyy6Nl7LKxXJ7YtILMtgC7zJ4qmSZiq/iCdk9rC/N7lwSxchfz83OmxwNk nxR2EFtXLg1Sogwb2PBdDTEbRfF70IhvszqX75nGiUKmcJPVZFX+fMexGIDOYOC0 DDFmMLR3Fl5fpK4v5piGb3E+MbVwJ+8VwXYX0uAcfOSQ+4A9efyTO+twCDP0dYft pnTVjynvzGbhgA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrfedvgdeikecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Jul 2021 09:45:34 -0400 (EDT) From: Maxime Ripard To: Robert Foss , Andrzej Hajda , Daniel Vetter , David Airlie , Sam Ravnborg , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Thierry Reding , Laurent Pinchart Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/10] Revert "drm/vc4: dsi: Only register our component once a DSI device is attached" Date: Tue, 20 Jul 2021 15:45:16 +0200 Message-Id: <20210720134525.563936-2-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210720134525.563936-1-maxime@cerno.tech> References: <20210720134525.563936-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