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 7BBEEC61DA3 for ; Tue, 21 Feb 2023 09:52:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234104AbjBUJwX (ORCPT ); Tue, 21 Feb 2023 04:52:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234073AbjBUJwJ (ORCPT ); Tue, 21 Feb 2023 04:52:09 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D9CB25E04 for ; Tue, 21 Feb 2023 01:51:51 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id qi12-20020a17090b274c00b002341621377cso4117919pjb.2 for ; Tue, 21 Feb 2023 01:51:51 -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=KG6QSJbypzUGB5xaZ21VNAzG0yHFxcV/96+5oqf9BzQ=; b=KuyVVTOClmKqZW8WOr08nnolQpZRXrV9mpvaydXdCafjx1XTd8QTNHjiB6gl3bvV25 QWfK8U/aSXWzvNTZptHA30lkxH1wnE0LxABcxEY5W4WJu6VRbDTmZeJKsL4ONKDDtqhp q0gLLqrqiv/v6yV2v9NMuou9AOS9KoGQEq8ws= 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=KG6QSJbypzUGB5xaZ21VNAzG0yHFxcV/96+5oqf9BzQ=; b=aQ1419LGoRtD0BmRPyS/7yaooknz/6AbU6UI5dNo5mPHs3EQw7jeNnYkeVQR2PiNFv ye7v3u4cB5FJzyOZRqyFO87yDCAWpy3vxTJWs73Kq3bhhAP+ltyBucIEWT5dTXQVl9uP erD2/KMQlXkgVAWhfLZMBiAFBMqj6ZlObcLZ/jIBJOebDImdqgyXcbrAbP9YlbN0lqqa Ipzr9kVvhaB2BK8HICxlsGmWmYhzKKWAowFx/KW88+s70TJEgPwXX8VU2G2b2AcvanfB hXxZ9sclMBPRPF6pI1Xn48musMS57iPlfoeEXj4QrvCCOPLoj5ux9vDt6jIyd3hP0rBU yZfg== X-Gm-Message-State: AO0yUKXdNYHqOBe+YKrL2ZW1rSSTMjYB84LcoU2IQ4wY/4KtoWBMMKx5 n7KTt8rA2lCd9sB8Dp2cCrL4iQ== X-Google-Smtp-Source: AK7set83merWWBZBGuzCzPIekx2EVTUiErZDikE4N3fOkXMpulNW3ufMoGkyxAWm4YPtCanMcw6blA== X-Received: by 2002:a05:6a20:914a:b0:be:d368:5c7f with SMTP id x10-20020a056a20914a00b000bed3685c7fmr15892164pzc.41.1676973105963; Tue, 21 Feb 2023 01:51:45 -0800 (PST) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:a1f5:f58d:584e:5906]) by smtp.gmail.com with ESMTPSA id t25-20020a656099000000b004eca54eab50sm3524918pgu.28.2023.02.21.01.51.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 01:51:45 -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: Pin-yen Lin , linux-kernel@vger.kernel.org, Hsin-Yi Wang , Marek Vasut , Thomas Zimmermann , dri-devel@lists.freedesktop.org, Xin Ji , Lyude Paul , Allen Chen , devicetree@vger.kernel.org, AngeloGioacchino Del Regno , =?UTF-8?q?N=C3=ADcolas=20F=20=2E=20R=20=2E=20A=20=2E=20Prado?= , chrome-platform@lists.linux.dev, Javier Martinez Canillas , linux-acpi@vger.kernel.org, Stephen Boyd Subject: [PATCH v12 05/10] drm/bridge: anx7625: Check for Type-C during panel registration Date: Tue, 21 Feb 2023 17:50:49 +0800 Message-Id: <20230221095054.1868277-6-treapking@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230221095054.1868277-1-treapking@chromium.org> References: <20230221095054.1868277-1-treapking@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- Changes in v12: - Updated to use fwnode_for_each_typec_mode_switch macro - Dropped collected tags Changes in v10: - Collected Reviewed-by and Tested-by tags 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 6846199a2ee1..486b5099f5dd 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -1648,7 +1648,8 @@ 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, *port_node; + struct fwnode_handle *fwnode; int bus_type, mipi_lanes; anx7625_get_swing_setting(dev, pdata); @@ -1687,6 +1688,16 @@ 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 in the output port. + */ + port_node = of_graph_get_port_by_id(np, 1); + fwnode_for_each_typec_mode_switch(&port_node->fwnode, fwnode) { + fwnode_handle_put(fwnode); + 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) { -- 2.39.2.637.g21b0678d19-goog