From patchwork Fri Feb 24 12:55:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Keeping X-Patchwork-Id: 9590233 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DC32F60471 for ; Fri, 24 Feb 2017 13:12:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A60711FF8F for ; Fri, 24 Feb 2017 13:12:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AD002236A; Fri, 24 Feb 2017 13:12:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4A6021FF8F for ; Fri, 24 Feb 2017 13:12:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=gud37qJh87Ni3FcmNfBbrw0D0irMQrwCgD13HVLOPfo=; b=X+JhEJugwVNFE0VEQqB664kfds QagjB24bh1XZWLUUQMb80hA+7uHnvtjWFEm8aXM8GnTNDIsqnadIvPUvQLWv7ds/rYjN8CwZy7KuZ AHNDfKWvWwfDaa7CXypBdNqSt/QfCvcgO493yG/W+9jScdLu9AeP0fFeEI99hw7NGiW8boUI07rtH x+EzDGYmGUjajbSSbgYjqzOI/DN9ovj7RyC3s06kuKfQFkU+ZTK+yg5GBQyOKs7ToQf4FpfYdZoZA hHxRCrm/qDX82t8wf+itEJx+hHMsoOaD8R4loSojqnRv9UNPnB392utjt/8V1f1tm09RE3DF8H8j4 CZ9soYdA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1chFfK-0002eN-NR; Fri, 24 Feb 2017 13:12:06 +0000 Received: from dougal.metanate.com ([90.155.101.14] helo=metanate.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1chFPb-0006R3-Nk; Fri, 24 Feb 2017 12:56:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=simple/simple; d=metanate.com; s=stronger; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=XZEPUbPgI6PBuP8zfAEKCRoMwtZkUIR+0IstQ2oEhic=; b=Hc7Qan23q/JL8ETr6mK+CH8dtGuerVCokBH0rr2h/0HumdYx18q1+8i+4iBAb3Yd2rv4BK7APZX/1VkBOs3z+cyJsrucvTF4UMrNUn+BI+RzeXn2UpLrYQiuhHXFkX6AVb7GD9Gbt80RkzAC+kGaD/fH3B20IHpdIMefe1wU57AkLfor2Ee0IhmiAIf+On1f2jC5I2mzVgkGEHHmkrtb4inTdMRRrmHBl1+uj84nVcolw80zPZFHbpIm/0ZiF2MNPAzIVBuMPQfRi0TXj1je7Y9/7a3+xr+hR4+dL5a5ezd2Sr/s9U4itPG9BCMp28jgYpKbaXsde7uAEqi7mokSTQ==; Received: from brian ([192.168.88.1] helo=leela.metanate.com) by shrek.metanate.com with esmtpsa (TLSv1.2:DHE-RSA-AES128-GCM-SHA256:128) (Exim 4.83_RC2) (envelope-from ) id 1chFP2-0006ml-Ts; Fri, 24 Feb 2017 12:55:16 +0000 From: John Keeping To: Mark Yao Subject: [PATCH v4 21/23] drm/rockchip: dw-mipi-dsi: defer probe if panel is not loaded Date: Fri, 24 Feb 2017 12:55:04 +0000 Message-Id: <20170224125506.21533-22-john@metanate.com> X-Mailer: git-send-email 2.12.0.rc0.230.gf625d4cdb9.dirty In-Reply-To: <20170224125506.21533-1-john@metanate.com> References: <20170224125506.21533-1-john@metanate.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170224_045552_385445_34D158BD X-CRM114-Status: UNSURE ( 8.17 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, Sean Paul , Chris Zhong , John Keeping , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This ensures that the output resolution is known before fbcon loads. mipi_dsi_host_register() is moved above dw_mipi_dsi_register() to simplify error cleanup since the order of these operations does not matter. Signed-off-by: John Keeping --- v4: - Use "return 0" to separate normal code flow from error cleanup Unchanged in v3 Unchanged in v2 --- drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index 60dfb5666a25..9edb868f8dc1 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c @@ -1189,12 +1189,27 @@ static int dw_mipi_dsi_bind(struct device *dev, struct device *master, goto err_pllref; } - dev_set_drvdata(dev, dsi); - dsi->dsi_host.ops = &dw_mipi_dsi_host_ops; dsi->dsi_host.dev = dev; - return mipi_dsi_host_register(&dsi->dsi_host); + ret = mipi_dsi_host_register(&dsi->dsi_host); + if (ret) { + dev_err(dev, "Failed to register MIPI host: %d\n", ret); + goto err_cleanup; + } + + if (!dsi->panel) { + ret = -EPROBE_DEFER; + goto err_mipi_dsi_host; + } + dev_set_drvdata(dev, dsi); + return 0; + +err_mipi_dsi_host: + mipi_dsi_host_unregister(&dsi->dsi_host); +err_cleanup: + drm_encoder_cleanup(&dsi->encoder); + drm_connector_cleanup(&dsi->connector); err_pllref: clk_disable_unprepare(dsi->pllref_clk); return ret;