From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FC80C433E0 for ; Tue, 16 Mar 2021 18:29:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C6B8D650A1 for ; Tue, 16 Mar 2021 18:29:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239980AbhCPS2l (ORCPT ); Tue, 16 Mar 2021 14:28:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239957AbhCPS2G (ORCPT ); Tue, 16 Mar 2021 14:28:06 -0400 Received: from the.earth.li (the.earth.li [IPv6:2a00:1098:86:4d:c0ff:ee:15:900d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C159C06174A for ; Tue, 16 Mar 2021 11:28:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=earth.li; s=the; h=Content-Type:MIME-Version:Message-ID:Subject:To:From:Date:Sender: Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=5abAEvlb6RQ//aPbXWSlsFscXPRdObN6cMphxdvzJjg=; b=xg1tvYgAsbdUB+jLBkj30dqmd1 xXNF3flKWiQA6A5RpDXb/gRLMMkpDcBWQseNapujwWNGcgD/j3rKawPNtDnKinp5myE2eGIDhpNiJ tV8aMStaMoMtIOdZQCTU0RsyFJXKGzrN5IbYHzp3jfg4jwZbLETRAGvGDfHiSLqqguD+IhFHafnI2 FS59nvVC+IU4NxVJRk3jIk3op3MgO0BeWRQeowZoko5Sr7Xo6PPhDw4SvBQrgKLMoXB5N5QflXNNp nBIwWPF8Cac4CimaOARg41uFTWwYtlrFqu0WbEvgclG/qWnBRTLkunR5o/UbGO+Lb/Xk1WPKpuFzH WTJa8e8g==; Received: from noodles by the.earth.li with local (Exim 4.92) (envelope-from ) id 1lMEQ5-0006i4-VW; Tue, 16 Mar 2021 18:27:54 +0000 Date: Tue, 16 Mar 2021 18:27:53 +0000 From: Jonathan McDowell To: Sandy Huang , Heiko =?iso-8859-1?Q?St=FCbner?= , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/rockchip: Cope with endpoints that haven't been registered yet Message-ID: <20210316182753.GA25685@earth.li> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Rockchip RGB CRTC output driver attempts to avoid probing Rockchip subdrivers to see if they're a connected panel or bridge. However part of its checks assumes that if no OF platform device is found then it can't be a valid bridge or panel. This causes issues with I2C controlled bridges that have not yet been registered to the point they can be found. Change this to return EPROBE_DEFER instead of ENODEV and don't ignore such devices. The subsequent call to drm_of_find_panel_or_bridge() will return EPROBE_DEFER as well if there's actually a valid device we should wait for. Signed-off-by: Jonathan McDowell --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 8 ++++++-- drivers/gpu/drm/rockchip/rockchip_rgb.c | 7 ++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 212bd87c0c4a..b0d63a566501 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -270,11 +270,15 @@ int rockchip_drm_endpoint_is_subdriver(struct device_node *ep) if (!node) return -ENODEV; - /* status disabled will prevent creation of platform-devices */ + /* + * status disabled will prevent creation of platform-devices, + * but equally we can't rely on the driver having been registered + * yet (e.g. I2C bridges). + */ pdev = of_find_device_by_node(node); of_node_put(node); if (!pdev) - return -ENODEV; + return -EPROBE_DEFER; /* * All rockchip subdrivers have probed at this point, so diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c index c079714477d8..989595087397 100644 --- a/drivers/gpu/drm/rockchip/rockchip_rgb.c +++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c @@ -77,7 +77,7 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev, struct drm_encoder *encoder; struct device_node *port, *endpoint; u32 endpoint_id; - int ret = 0, child_count = 0; + int subret, ret = 0, child_count = 0; struct drm_panel *panel; struct drm_bridge *bridge; @@ -96,8 +96,9 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev, if (of_property_read_u32(endpoint, "reg", &endpoint_id)) endpoint_id = 0; - /* if subdriver (> 0) or error case (< 0), ignore entry */ - if (rockchip_drm_endpoint_is_subdriver(endpoint) != 0) + /* if subdriver (> 0) or non-defer error case (< 0), ignore entry */ + subret = rockchip_drm_endpoint_is_subdriver(endpoint); + if (subret != 0 && subret != -EPROBE_DEFER) continue; child_count++; -- 2.20.1