Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5885018rwl; Wed, 22 Mar 2023 03:49:33 -0700 (PDT) X-Google-Smtp-Source: AK7set+NMuGhWtsakQRXh1/LDw21bzozTKAVyPPPBaXkK3YcLNsfCPiLyEaF6rXoLMc4dSyP2gCE X-Received: by 2002:a05:6402:205:b0:4f9:f07d:a978 with SMTP id t5-20020a056402020500b004f9f07da978mr6687835edv.5.1679482172878; Wed, 22 Mar 2023 03:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679482172; cv=none; d=google.com; s=arc-20160816; b=a6x1rOAJKA/LtjklCNsfZX/Eaab6K+Z6shQEdYq5Ad+tKKE5qSm+9ZTBTXjs/Ua/Rw t/pPLCUm7VHUBtxN+xQRw7reprGDhIaOxGLxTVc/SNwUSqO5iAAs2q/56eCePXEnmEhs hfm2zbMVAzSSZJdLHnWDsuCQuk2cI0OQ7I/Q3F/hgmFtTm6kGhjzCBbamhrwrBxF6VIT Pypq+jXSAkP1TurCfzrd1HEAXeMYv1g2FITX5KN65Up+wtvA+1xC0qJMVTQFqBaSRe8Y 3oSuxiVg3XnYB9CBoga7VEW9G59ghxL5qbRl0AFTnzKy7pJ5qMQwy/efEfeZ1TnSiWMz SEkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cS29WoxUQLo4BQ309Cl3H3ZApJrAXVrclnM2SVgJFsU=; b=NQHOcc4zosAKxiTh1N4/AaD2C5PqRoXdJHbNJx8Ii0sG0aQSAsI5brAq29NrQwlBJn sLUGLiKkFV7kFCDN1L5NTNK0A/1INHK4xKz5CQ6XHAfuKHaqX5lkWIR9IgWVfajyPgVm tZAOXwgd351P1xz47RUk8lStFe3FcEbV+qd3d+K3eLuUfi0PDfNP0kRT7nkdL69gXxaO T0Z5qI1GR15FGV4hJk6IrYww335DtzVLKWCYxDnrG27M5d59MuhVicThD+kFzAVT6Hi+ T42R/rQmmmrL68WIlr2EBIJOpjulzDiZGi1FH6G82GvKbPRxhnQWZLKzHk/ZF07Y2q6Y +pHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OMtCtiUa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z17-20020aa7cf91000000b004ad0caf3dc0si17016395edx.480.2023.03.22.03.49.07; Wed, 22 Mar 2023 03:49:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OMtCtiUa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230185AbjCVKs0 (ORCPT + 99 others); Wed, 22 Mar 2023 06:48:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230451AbjCVKrz (ORCPT ); Wed, 22 Mar 2023 06:47:55 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D60345F524 for ; Wed, 22 Mar 2023 03:47:19 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id f6-20020a17090ac28600b0023b9bf9eb63so18696355pjt.5 for ; Wed, 22 Mar 2023 03:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679482037; 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=cS29WoxUQLo4BQ309Cl3H3ZApJrAXVrclnM2SVgJFsU=; b=OMtCtiUazE3zaX2l1R50ngdXVHr+uI3FBVunt9kTXSHbM/uN7wiJOvx+pdFWt2TiqP 9OT8Xv/U8O1i6s5otVZUfFwAvpqurw4vsHaNl4ctoDbP2lDqxe4pJswDEGt0q0UxfbM5 WBtYPrhNigAP5Qhtnhg3p6Xlh6jiHhH172wzA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679482037; 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=cS29WoxUQLo4BQ309Cl3H3ZApJrAXVrclnM2SVgJFsU=; b=XgVQyjUEliIN7FBQ/RKJKqSfeyHf2bkVJdTyxyq9sahEvN8TkReovZQzugXw8xR26U GTwzc9NBb5u1gYznaWxQpcaBc/HN76LZkezbep1Sx7KnUhJ4NQPeVZWd2iMgmhP/RRvX nS+YAuGHgBJFbNQZQXrbWo7kwJitAcX4v4bNuwj5pNj9vBAyR4NeAIeh7jHFM6KlpoEq nelwt6gml+G1wWjmyZIRQoSfEbW10qIyZIrxSvsUJKMGzFRRmRMZxD7icv4wOPiF3g6f l0bJrtOYECrw6auvryzvCGADGaVbuqSsH7mPR4dnog/SK9o/W4brUEEgo3hHEtyW1K4s 4GFA== X-Gm-Message-State: AO0yUKXwUl2TWRFXPxNaMvDbVShkkEidSyygNCwhRuuWYHoYPJv06jly SAq0ZqRvvHuUx0taGP0JOWQdPw== X-Received: by 2002:a17:90a:191e:b0:237:50b6:9838 with SMTP id 30-20020a17090a191e00b0023750b69838mr3135278pjg.45.1679482036826; Wed, 22 Mar 2023 03:47:16 -0700 (PDT) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:343d:79bf:55f9:1da5]) by smtp.gmail.com with ESMTPSA id hg4-20020a17090b300400b002340d317f3esm9508742pjb.52.2023.03.22.03.47.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Mar 2023 03:47:16 -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 , linux-kernel@vger.kernel.org, Thomas Zimmermann , linux-acpi@vger.kernel.org, Javier Martinez Canillas , AngeloGioacchino Del Regno , Pin-yen Lin , Hsin-Yi Wang , Lyude Paul , =?UTF-8?q?N=C3=ADcolas=20F=20=2E=20R=20=2E=20A=20=2E=20Prado?= , Allen Chen , dri-devel@lists.freedesktop.org, Marek Vasut , Stephen Boyd , chrome-platform@lists.linux.dev, devicetree@vger.kernel.org Subject: [PATCH v14 05/10] drm/bridge: anx7625: Check for Type-C during panel registration Date: Wed, 22 Mar 2023 18:46:34 +0800 Message-Id: <20230322104639.221402-6-treapking@chromium.org> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog In-Reply-To: <20230322104639.221402-1-treapking@chromium.org> References: <20230322104639.221402-1-treapking@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 Reviewed-by: Andy Shevchenko --- 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) { -- 2.40.0.rc1.284.g88254d51c5-goog