From patchwork Sat Jan 7 10:22:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pin-yen Lin X-Patchwork-Id: 640429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36016C54EBE for ; Sat, 7 Jan 2023 10:24:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229544AbjAGKYI (ORCPT ); Sat, 7 Jan 2023 05:24:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232571AbjAGKXp (ORCPT ); Sat, 7 Jan 2023 05:23:45 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 599E48CBCC for ; Sat, 7 Jan 2023 02:23:12 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id w3so4306833ply.3 for ; Sat, 07 Jan 2023 02:23:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=C65HbTqm4aoCrwDl2BLz1roa80SXzNKa5x0ufot4CrI=; b=NhvSun8IDngMENCKoe60MmVhh6WR87sqakP2KpY6QRkgQDyzSV4zsnKPfvJG8gHiq0 FIhzMtiK6DfyKs5QTX8SRtKnke1sBBuJmKa/xMcBxiLATItah+clJGd2/PMhl0YiMmX2 zBoBeykpq0FMW3KusqpsNweM00yVzZSwO3lN0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C65HbTqm4aoCrwDl2BLz1roa80SXzNKa5x0ufot4CrI=; b=pk5giL330fsm/LSdmIomlR85B2JYIWuG82Ci3scLlb9WQjhKPfu1GASwdi1QWGjsfo u/S88V261yaO06dPiSk3x1+iiz6d7NDpUWVLdDI6hrAg/Hxu2Klxk4vV6eluRCW440tt LkggcmBPwFmFVoPR+O2/yMky48u7Vw65oGVXqI0naO5EIzzOWoorfmNpXx1J5XwodnDV vxDhmjJjQUsPoLcY+k8opxSN8CKD6lzjpHet/tLRAnbD5rS52iSLZf40H7AWASyh0Wqp Gy+NZaeoKLcU+ZszZgDRnQWINhQw5nkfYVTzL/6EYzFNEjNo0TNWF0iNH1OHMPlvqjzQ sPng== X-Gm-Message-State: AFqh2kqAZC4Qa5mqVzq8HTLbiSEYr5WKFIuzlvUiNZxJNKgRY40aan+A 2UlsWj4SPQx7rS+i6TeuvKtCgw== X-Google-Smtp-Source: AMrXdXtKqkodLXKQ6L9lwT8I5s1zHF1tdk4y+K3o9uMXCwdynIyecE2h1Ccix3uFPElYDEpup+JenQ== X-Received: by 2002:a17:903:3311:b0:186:a7ff:e8ad with SMTP id jk17-20020a170903331100b00186a7ffe8admr58281256plb.24.1673086991889; Sat, 07 Jan 2023 02:23:11 -0800 (PST) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:180d:95e8:f4:84fb]) by smtp.gmail.com with ESMTPSA id b1-20020a170903228100b001892af9472esm2366362plh.261.2023.01.07.02.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Jan 2023 02:23:11 -0800 (PST) From: Pin-yen Lin To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J . Wysocki" , Prashant Malani , Benson Leung , Guenter Roeck Cc: Thomas Zimmermann , dri-devel@lists.freedesktop.org, Lyude Paul , Javier Martinez Canillas , linux-kernel@vger.kernel.org, Xin Ji , Pin-yen Lin , AngeloGioacchino Del Regno , Allen Chen , Hsin-Yi Wang , chrome-platform@lists.linux.dev, =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_P?= =?utf-8?q?rado?= , devicetree@vger.kernel.org, Marek Vasut , linux-acpi@vger.kernel.org, Stephen Boyd Subject: [PATCH v8 5/9] drm/bridge: anx7625: Check for Type-C during panel registration Date: Sat, 7 Jan 2023 18:22:27 +0800 Message-Id: <20230107102231.23682-6-treapking@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230107102231.23682-1-treapking@chromium.org> References: <20230107102231.23682-1-treapking@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The output port endpoints can be connected to USB-C connectors. Running drm_of_find_panel_or_bridge() with such endpoints leads to a continuous return value of -EPROBE_DEFER, even though there is no panel present. To avoid this, check for the existence of a "mode-switch" property in the port endpoint, and skip panel registration completely if so. Signed-off-by: Pin-yen Lin --- (no changes since v6) Changes in v6: - New in v6 drivers/gpu/drm/bridge/analogix/anx7625.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index b375887e655d..1cf242130b91 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -1649,7 +1649,7 @@ static int anx7625_get_swing_setting(struct device *dev, static int anx7625_parse_dt(struct device *dev, struct anx7625_platform_data *pdata) { - struct device_node *np = dev->of_node, *ep0; + struct device_node *np = dev->of_node, *ep0, *sw; int bus_type, mipi_lanes; anx7625_get_swing_setting(dev, pdata); @@ -1688,6 +1688,17 @@ static int anx7625_parse_dt(struct device *dev, if (of_property_read_bool(np, "analogix,audio-enable")) pdata->audio_en = 1; + /* + * Don't bother finding a panel if a Type-C `mode-switch` property is + * present in one of the endpoints. + */ + for_each_endpoint_of_node(np, sw) { + if (of_property_read_bool(sw, "mode-switch")) { + of_node_put(sw); + return 0; + } + } + pdata->panel_bridge = devm_drm_of_get_bridge(dev, np, 1, 0); if (IS_ERR(pdata->panel_bridge)) { if (PTR_ERR(pdata->panel_bridge) == -ENODEV) {