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: 9518363 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 893A16020B for ; Mon, 16 Jan 2017 10:09:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56DC328364 for ; Mon, 16 Jan 2017 10:09:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BB6728435; Mon, 16 Jan 2017 10:09:14 +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 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 0C2BB283FD for ; Mon, 16 Jan 2017 10:09:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A77DB6E2C7; Mon, 16 Jan 2017 10:09:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-f66.google.com (mail-pg0-f66.google.com [74.125.83.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0F3346E2C8 for ; Mon, 16 Jan 2017 10:09:11 +0000 (UTC) Received: by mail-pg0-f66.google.com with SMTP id t6so952472pgt.1 for ; 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=YSdeLN5i1hhqKQqDFcSOkEk3nx1uSWiv1lFQAFDWyUchAkJd6YbfLhz2WwbV0jt0Sc 1nlGYPtvXoo+0qPKXoq9PCVYvGoIISMNDr7aw/6yU6ovH/U2gWUkLKTf7Qk1iXh+Zdw+ uAd4ALEGrWt4PVr7OSA7ZR5KZkLtGnZ5qp70kDvJ81BH98qAnZzXxl4KVpGyOimnlnQA pu3WDwsixF1HbfRHecfZkaMYRWSZnLgXGgchxCEjCDygFxSxfxVm56/nHfxSeoUC5jea 4yOXsb2PkbHiijRb5PDotjPAhE6f1KGx2O+YWoq+OvG4ZAGk4S30PumtjaWoKvvFflBU yanw== X-Gm-Message-State: AIkVDXLJ6wC8hVltqGRadSMlecdqRSqe4SaslrvTc7NTDJM6c2kU59bjzPRz6UO9nK8c6Q== 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> 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 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; }