From patchwork Fri Mar 3 14:33:45 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: 659310 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 57E3AC7EE32 for ; Fri, 3 Mar 2023 14:34:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231335AbjCCOez (ORCPT ); Fri, 3 Mar 2023 09:34:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231360AbjCCOel (ORCPT ); Fri, 3 Mar 2023 09:34:41 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 456D04C6EC for ; Fri, 3 Mar 2023 06:34:28 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id n6so2851833plf.5 for ; Fri, 03 Mar 2023 06:34:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1677854067; 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=1mSCOEOZwzSe4923gv/lNmAI3ycw4GWSqU0gMJqiLLo=; b=AGaD40dojqpatUV6OK0VH7EFEQ2f8L7gm8KFO7t1tKybUfhbjsuAeBpCTIh0g8dX1C Vb8448kxRNXXDZ/M9E1FYhYlT7cdc5iKzb7INg3gHb9eEioavVt1NiNfi+h5YhGX7qMg no6zYPiori0O301ujrZ9lB+Fk/LUreDTAFyHo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677854067; 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=1mSCOEOZwzSe4923gv/lNmAI3ycw4GWSqU0gMJqiLLo=; b=flwJ6VYupBxps56A2+F6JtamgjGRfPbn08HhMu/8LSsZNdKoLJavGeAzJh9nnYJchs Hog0HqchJ4fnL50m6wuI9OT7ockcEkszeBPmddxsbxqddm5cz58ssc313p7PoDBXgVSk lIXT55z4u7eDAo1kJOllTyQmRJoRG4lePocIAVFfkxSslfIf4aS8zHxFtu6qszEYKVIJ 5x/JtuTl8o2hgRcu8sjsOUg3AfwAxi/zG1M3GAcX+msmzs9FWGjfmsCrILyiuV6OIlI+ i9BtHiwrjkZow3bEap+l6bsqLLd4NSeR4rC+4mSoqVySgnhcMUua3EZAK7oNJT3PLvx1 h9Nw== X-Gm-Message-State: AO0yUKVO5oOII9EIFzH+y72ccKGMTUCrxV9xfT3zc0xkFbpZRtfXLsEf sl6P2L+nQ+bBcNB0mQ+uWVUYUg== X-Google-Smtp-Source: AK7set+pyUWzedW/NgMwm/VObu1a/KNPG+Slpi+Dwb1JCgHod2AcrWpNOV6WLtxyHsksdq3I4V1eXg== X-Received: by 2002:a05:6a20:8f04:b0:cc:f27d:eb83 with SMTP id b4-20020a056a208f0400b000ccf27deb83mr2609226pzk.53.1677854067699; Fri, 03 Mar 2023 06:34:27 -0800 (PST) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:55e5:8423:31ee:83dd]) by smtp.gmail.com with ESMTPSA id c18-20020aa781d2000000b005a8b4dcd21asm1767214pfn.15.2023.03.03.06.34.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 06:34:27 -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: Xin Ji , Javier Martinez Canillas , Lyude Paul , linux-kernel@vger.kernel.org, Pin-yen Lin , AngeloGioacchino Del Regno , chrome-platform@lists.linux.dev, =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_P?= =?utf-8?q?rado?= , Marek Vasut , Hsin-Yi Wang , devicetree@vger.kernel.org, Allen Chen , dri-devel@lists.freedesktop.org, Thomas Zimmermann , Stephen Boyd , linux-acpi@vger.kernel.org, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= Subject: [PATCH v13 05/10] drm/bridge: anx7625: Check for Type-C during panel registration Date: Fri, 3 Mar 2023 22:33:45 +0800 Message-Id: <20230303143350.815623-6-treapking@chromium.org> X-Mailer: git-send-email 2.40.0.rc0.216.gc4246ad0f0-goog In-Reply-To: <20230303143350.815623-1-treapking@chromium.org> References: <20230303143350.815623-1-treapking@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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 v13: - Use the new typec_mode_switch_node_count helper 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 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 6846199a2ee1..3f6bf7674d32 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; + unsigned int count; int bus_type, mipi_lanes; anx7625_get_swing_setting(dev, pdata); @@ -1687,6 +1688,15 @@ 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); + count = typec_mode_switch_node_count(&port_node->fwnode); + if (count) + 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) {