From patchwork Fri Mar 31 09:11:40 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: 668887 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 CA84DC77B62 for ; Fri, 31 Mar 2023 09:13:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232069AbjCaJNL (ORCPT ); Fri, 31 Mar 2023 05:13:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232067AbjCaJMk (ORCPT ); Fri, 31 Mar 2023 05:12:40 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A943E1E732 for ; Fri, 31 Mar 2023 02:12:24 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id u38so14347115pfg.10 for ; Fri, 31 Mar 2023 02:12:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1680253944; 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=um8Apq5PS0w4vw2h+FoHStjqhneujAsh8s3PG+yoPJU=; b=X1MYjT+7uhS5MGdPK2Wj21iPoxh6eqxnteUDlhMJL0p+MXbIB6g+hfbiNjTNfhPnr7 hqaiMqZhpSYhOlbEiai15gKbDMOYTs5oJdD4V1D9AliUdodPPnSMSgm2y8GezXmPsHVO +b4An7P8iElbXJAUopLDhV2CwpckTAmg+4fJA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680253944; 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=um8Apq5PS0w4vw2h+FoHStjqhneujAsh8s3PG+yoPJU=; b=ZgC8bEsFAgCMZEKb+aTix7djofTPhO5rCq6bq2Y4TcoJq7RzU5AKuLCXvSHQu7o4Aw I/86oGM+T/MjG95SXa7aTFG6p16lUWZSLN1njW/FI1WcAvg7uoi918kkA2GUlYkC89tL gdJavUFMFGkcWYRZM8UdPJPKXamnhrz55mmmt997wfseCXG4poRglYmD5gByRFwn376m fhubQJZpQ5NmKX/LIbL5lIoOewifT44B7kFFwJwmxkGJt1KUEOrNprUby+WuXccDNBTE xILzip8FIQARk6WV5s0NX1J8ugxon6RXEgNpBIYZcIBPy8rBCLb1Vcxut7Lu5L4gx0DJ bi5w== X-Gm-Message-State: AAQBX9cc/VAXBQgsc/3VF9QDr+jhTqDANfjF9XGEjmXJDqC53GMQtYf/ F9fIk9/gig3Wmk61itELKfNoBg== X-Google-Smtp-Source: AKy350bENRmNl7ZKlyZi8YToOpDoNcip1RFXgf3LjMXU4gNpzGTfS31L+PDq/xsmIRUzfqzgq4cbAQ== X-Received: by 2002:a62:4e8f:0:b0:625:cf6d:b260 with SMTP id c137-20020a624e8f000000b00625cf6db260mr25068880pfb.6.1680253943821; Fri, 31 Mar 2023 02:12:23 -0700 (PDT) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:ae9d:db7a:8a71:d458]) by smtp.gmail.com with ESMTPSA id n6-20020a62e506000000b006227c3d5e29sm1360905pff.16.2023.03.31.02.12.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 02:12:23 -0700 (PDT) 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 , Marek Vasut , Hsin-Yi Wang , Thomas Zimmermann , AngeloGioacchino Del Regno , Lyude Paul , devicetree@vger.kernel.org, Stephen Boyd , dri-devel@lists.freedesktop.org, linux-acpi@vger.kernel.org, chrome-platform@lists.linux.dev, =?utf-8?q?N?= =?utf-8?q?=C3=ADcolas_F_=2E_R_=2E_A_=2E_Prado?= , Javier Martinez Canillas , Pin-yen Lin , linux-kernel@vger.kernel.org, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= Subject: [PATCH v15 05/10] drm/bridge: anx7625: Check for Type-C during panel registration Date: Fri, 31 Mar 2023 17:11:40 +0800 Message-Id: <20230331091145.737305-6-treapking@chromium.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230331091145.737305-1-treapking@chromium.org> References: <20230331091145.737305-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 Reviewed-by: Andy Shevchenko Reviewed-by: AngeloGioacchino Del Regno --- Changes in v15: - Collect review tag Changes in v14: - Collect review tag 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) {