Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp910390ybt; Tue, 7 Jul 2020 03:20:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNNB76AG3YL/LTZc35p6S3yGgA+XFnNBjjldUgOBCsmOqpNTNh9CzSl3EGzykfbD7QlkLU X-Received: by 2002:a17:906:fa15:: with SMTP id lo21mr48944866ejb.156.1594117239956; Tue, 07 Jul 2020 03:20:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594117239; cv=none; d=google.com; s=arc-20160816; b=RQufhyGy+p/wJhtRlhV5ij1wpNvsL7OnhiU+6lvo5sm2TyCG5JWioQ/HmxDzBTH1Vl 8YDIsDVVb4ovzZuW1mKMknJTyu7GZIFAwi/b0hfchIFF+Gc2nlp/+OuZygMYAjqOldqd fnAIv0GHWHJqj8j3hb/uTZ1QVEiN9Z+8p+0Z25TTUyeDqyqAIuJfg+N5U8z/CMuDTcbr 8pxXX/S3CegKJu+TRnBqKUcQFePniKs2p+ymGGxMp5QnlZleotT8yj03eE2i6iExtBmB 3KqjoPZT1lQZVkwRTOcCJOSf35L2TUNJeKdCvRHdoulwvXZThFStkkSILOttc2udRZAB lPjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=4hTmYwJWs3UiuN5nnPv+gaN3eGDOSwKQFpI5Se/4Tg0=; b=JvVKScy0LpjQWSF3JYemXLD6QjLdvToADrrs7PBb1kJIb8BVP3rGGXkyFIpSmfMitw fBmihApTwWA88aIMexIlkZMdN7Fy3vtg2Gbxin12VSNVxoZf4c6chlUnc/PAzj4aEUNd +MdW1+YfUmEfMOfDZXxXBIuOWgF7mMisiPXLsq759ZAzwC5/RA8AjGWuZ9/wMWh9hQWu 6gWNvhbTPMImPO22EhxlMvU1QoTrLp8AVxk6uT3oQ90PyH40FZ2wrpZHpBarcRvxHGPk eTsI7j4sqtNGaDLvxt3b0fHYU/5QTHTeixAnDkblqVdrFlEBCrN7I62HuMSmToJoXrbP A3uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=S6qsvSa7; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=go7AXU4R; 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 b12si14237091eds.283.2020.07.07.03.20.16; Tue, 07 Jul 2020 03:20:39 -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=S6qsvSa7; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=go7AXU4R; 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 S1728179AbgGGKUA (ORCPT + 99 others); Tue, 7 Jul 2020 06:20:00 -0400 Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]:40011 "EHLO wnew2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727871AbgGGKTW (ORCPT ); Tue, 7 Jul 2020 06:19:22 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 9F308ACC; Tue, 7 Jul 2020 06:19:19 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 07 Jul 2020 06:19:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm3; bh=4hTmYwJWs3UiuN5nnPv+gaN3eG DOSwKQFpI5Se/4Tg0=; b=S6qsvSa7vwbAhGWVbj2k/hnHW3c6IxoLUWewbt5Hkc jg9S+dgZVYYBNE9tvf8h0xpjeI/Cie0+Ejo7qhJzUEt07Rd5okcFHHgrZq/9Bs80 14bM803jIhLnAlwZxzqVMHUUaKzZMrtNFiHqaUt26kW0C9lD8/8k3QMuCKl3yd1b lp1hYN4NV+fVL7XcPMKjzJshpgyxmB5OjMG0YnqZmeKLWwdzZcx1XPE5XzmqFsOJ dHWeUVT2gs7vEDqMzpVT9Wi7j1K8xtFrpF4dU9Lgv8DXvwzEHFi1Uslm8ww8OBeM Do1AsIOlRlQybLutZNc+FOZRg/T+Y/2aygb4IzcYbTNw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=4hTmYwJWs3UiuN5nn Pv+gaN3eGDOSwKQFpI5Se/4Tg0=; b=go7AXU4Rap0ZGn4ZsXOVv+GMktdWyS+uy MlsVSvtOaczJnPHdE+rq13MxJKMI2nmMluWLM8V39YKJaJZhOpSAVswA3nRtwW2j vxFLU/v7lTzCvVZeFc9WEtRKpeDezubZZ2W3fU2zsCrz97tmhePE3Ig1UuCwHOTj J95bvVqvddYfgYUfGLutnZwNoWuk2fKhr7lP6OZKCSOxltab5LnAeU0/Ju05HQfN u8K9nMSniP2+X9/PDmXdK0qYbaZLcv2m95R041F1mWvlaPPayzt/U7H/qTiY4nhc wduZHgkAnu3zCGjEXMV32GO7pHeUnZXMnoVkIqNhyNspVyVVo948w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudehgddvtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgggfestdekredtredttdenucfhrhhomhepofgrgihimhgvucft ihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtthgvrh hnpeejffehuddvvddvlefhgeelleffgfeijedvhefgieejtdeiueetjeetfeeukeejgeen ucfkphepledtrdekledrieekrdejieenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 0B595328005E; Tue, 7 Jul 2020 06:19:17 -0400 (EDT) From: Maxime Ripard To: Nicolas Saenz Julienne , Eric Anholt Cc: dri-devel@lists.freedesktop.org, linux-rpi-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Dave Stevenson , Tim Gover , Phil Elwell , Andrzej Hajda , Maxime Ripard Subject: [PATCH] drm/vc4: dsi: Only register our component once a DSI device is attached Date: Tue, 7 Jul 2020 12:19:12 +0200 Message-Id: <20200707101912.571531-1-maxime@cerno.tech> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the DSI driver is the last to probe, component_add will try to run all the bind callbacks straight away and return the error code. However, since we depend on a power domain, we're pretty much guaranteed to be in that case on the BCM2711, and are just lucky on the previous SoCs since the v3d also depends on that power domain and is further in the probe order. In that case, the DSI host will not stick around in the system: the DSI bind callback will be executed, will not find any DSI device attached and will return EPROBE_DEFER, and we will then remove the DSI host and ask to be probed later on. But since that host doesn't stick around, DSI devices like the RaspberryPi touchscreen whose probe is not linked to the DSI host (unlike the usual DSI devices that will be probed through the call to mipi_dsi_host_register) cannot attach to the DSI host, and we thus end up in a situation where the DSI host cannot probe because the panel hasn't probed yet, and the panel cannot probe because the DSI host hasn't yet. In order to break this cycle, let's wait until there's a DSI device that attaches to the DSI host to register the component and allow to progress further. Suggested-by: Andrzej Hajda Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_dsi.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index eaf276978ee7..19aab4e7e209 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -1246,10 +1246,12 @@ 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; @@ -1284,6 +1286,12 @@ 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; } @@ -1662,7 +1670,6 @@ 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) @@ -1670,26 +1677,10 @@ 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.26.2