From patchwork Mon Jan 16 10:08:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Zhong X-Patchwork-Id: 9518415 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 8F1A76020B for ; Mon, 16 Jan 2017 10:10:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C81428364 for ; Mon, 16 Jan 2017 10:10:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5029328435; Mon, 16 Jan 2017 10:10:47 +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=-2.5 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, URIBL_BLACK autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 01AC328364 for ; Mon, 16 Jan 2017 10:10:47 +0000 (UTC) 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 1cT4FP-0003yX-Jh; Mon, 16 Jan 2017 10:10:43 +0000 Received: from mail-pg0-f66.google.com ([74.125.83.66]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cT4EF-00009s-KY; Mon, 16 Jan 2017 10:09:34 +0000 Received: by mail-pg0-f66.google.com with SMTP id t6so952473pgt.1; Mon, 16 Jan 2017 02:09:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=t15NVACqgSzBK9aiJ5Cku54uI/mMKl93/CBgN3Abxsk=; b=cURGpwbsMs1vQ+bWaeyUjc1qebTIE0MLsdZQtT6+cYD6ymHx2F6zoJXZcNc5wSYhiH iieTwgYiMeH4Jb9kEweikm/V5+Zjy1dgIid5wg+NSzw24JWhy8kqu10/x11ZfOUmMFVY YyD7fHAqs1N6NA9iPagr/hFxII9o0b1Th0k8kdszbr5pmFRGKMX+uGV3d7Xkn2fbG1ly DfLUxnrX1npHtuvRXEiL0rOv5BnX95gsyNw9+KsTp8t2ZdrmbKIswMjGxiRnwzEm8Q7/ Ovy83AqrMr8gKDVyTEjPNWyXpOCUwrQ9cn07dtJ9o1XUt7zrlyle42iFAyPhefyqNlmm Fc1g== X-Gm-Message-State: AIkVDXJP1RKFAH8ScLWBk/Jb4ttBOn7HrgfHa7v/xkmfH0UAAbWCwwD6Zcsmwf9aI+KjYw== X-Received: by 10.99.98.132 with SMTP id w126mr39365192pgb.59.1484561350681; Mon, 16 Jan 2017 02:09:10 -0800 (PST) Received: from localhost.localdomain ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id k78sm46351848pfb.93.2017.01.16.02.09.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Jan 2017 02:09:10 -0800 (PST) From: Chris Zhong To: dianders@chromium.org, tfiga@chromium.org, heiko@sntech.de, yzq@rock-chips.com, mark.rutland@arm.com, devicetree@vger.kernel.org, robh+dt@kernel.org, galak@codeaurora.org, pawel.moll@arm.com, seanpaul@chromium.org Subject: [PATCH v2 06/11] drm/rockchip/dsi: return probe defer if attach panel failed Date: Mon, 16 Jan 2017 18:08:26 +0800 Message-Id: <1484561311-494-7-git-send-email-zyw@rock-chips.com> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1484561311-494-1-git-send-email-zyw@rock-chips.com> References: <1484561311-494-1-git-send-email-zyw@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170116_020932_125232_AF801C64 X-CRM114-Status: GOOD ( 10.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, Chris Zhong , linux-arm-kernel@lists.infradead.org, Mark Yao MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mark Yao Return -EINVAL would cause mipi dsi bad behavior, probe defer to ensure mipi find the correct mode, Signed-off-by: Mark Yao Signed-off-by: Chris Zhong --- drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index d2a3efb..5e3f031 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c @@ -549,10 +549,14 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host, dsi->channel = device->channel; dsi->format = device->format; dsi->panel = of_drm_find_panel(device->dev.of_node); - if (dsi->panel) - return drm_panel_attach(dsi->panel, &dsi->connector); + if (!dsi->panel) { + DRM_ERROR("failed to find panel\n"); + return -EPROBE_DEFER; + } - return -EINVAL; + drm_panel_attach(dsi->panel, &dsi->connector); + + return 0; } static int dw_mipi_dsi_host_detach(struct mipi_dsi_host *host, @@ -560,7 +564,8 @@ static int dw_mipi_dsi_host_detach(struct mipi_dsi_host *host, { struct dw_mipi_dsi *dsi = host_to_dsi(host); - drm_panel_detach(dsi->panel); + if (dsi->panel) + drm_panel_detach(dsi->panel); return 0; }