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: 9590075 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 43934601AE for ; Fri, 24 Feb 2017 12:56:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0AB4A2875B for ; Fri, 24 Feb 2017 12:56:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F384528783; Fri, 24 Feb 2017 12:56:34 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BE6692875B for ; Fri, 24 Feb 2017 12:56:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 84FB06EC56; Fri, 24 Feb 2017 12:55:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from metanate.com (dougal.metanate.com [90.155.101.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id BCEDF6EC32 for ; Fri, 24 Feb 2017 12:55:21 +0000 (UTC) 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> Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, Chris Zhong , linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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;