From patchwork Mon Jan 9 08:40:53 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: 13093125 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A5E62571 for ; Mon, 9 Jan 2023 08:41:16 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id p24so8732687plw.11 for ; Mon, 09 Jan 2023 00:41:16 -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=cbxRbyImpevpLcgNpmQRY5xjXofgzVP7nhTUY2hiItA=; b=JTe1mK8GkkIlmmdn3zdW5Zhz8+tYp6rDTDe7qfwfWgAIPBtzdSsCHsOV1Nbm+8zBsw 8tI5IoTY+/uiECZQbLoMs4vXnTjvxlQQYuVpVavOAPFMv0OzkqlaOjQjOw4sIM5XuGIu Cz+yvra84/M3rWGvLOTPgVyRjkiQE6K+4GO8M= 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=cbxRbyImpevpLcgNpmQRY5xjXofgzVP7nhTUY2hiItA=; b=Tl0ZYfaZ79M83eXZAqmdRvT7uRTAmI8SR6GVXPCFK+GF/M60hYvIAE3QAJlCGNb3Xf 7KRPCvWTVO55g0BstYxup6GUOS/rs5fADgjpexibYDsB9n6jNlXcLXIxlSGW/1Xuhzwi DJTqr1wnrxn+jzXjd/c75uO1BLvCcvrdPlYvhFSHxf6rM+apoGVUou8lshsQPKChMd0d SghaZuaEiy2jZb3OP95giAld92RI80PfV0AcSdPgihy6wgAZl6maU/H2FHGEIWdBgv6t mpSN5iI/lntps1ZgeuRjJ5Lj4rCfnCUZWzxCyckmbhUi4Y7Y8q03y2q09f9mQKDaim/H 0W7w== X-Gm-Message-State: AFqh2krUml52MKyREzEGRytF7oKSZkz4V1BEx3PTIg+skmcM8mka8e+i yn4H3XHw1D6Ak2TYDQGzzCGmnQ== X-Google-Smtp-Source: AMrXdXuz7m3m2JrRAQuDNVFugi2raUnWnT3EDgHYDhtNliIvVLaFk/uDfqb/xzWYq7EGj/RGX5i+Hg== X-Received: by 2002:a17:902:7c07:b0:193:bec:2122 with SMTP id x7-20020a1709027c0700b001930bec2122mr10562144pll.32.1673253676037; Mon, 09 Jan 2023 00:41:16 -0800 (PST) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:801:a736:715:9a15]) by smtp.gmail.com with ESMTPSA id c14-20020a170902d48e00b00186acb14c4asm5568119plg.67.2023.01.09.00.41.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 00:41:15 -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: Hsin-Yi Wang , Pin-yen Lin , dri-devel@lists.freedesktop.org, Marek Vasut , Stephen Boyd , AngeloGioacchino Del Regno , Xin Ji , linux-acpi@vger.kernel.org, devicetree@vger.kernel.org, chrome-platform@lists.linux.dev, Thomas Zimmermann , Allen Chen , Javier Martinez Canillas , Lyude Paul , =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_Prado?= , linux-kernel@vger.kernel.org Subject: [PATCH v9 1/9] device property: Add remote endpoint to devcon matcher Date: Mon, 9 Jan 2023 16:40:53 +0800 Message-Id: <20230109084101.265664-2-treapking@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230109084101.265664-1-treapking@chromium.org> References: <20230109084101.265664-1-treapking@chromium.org> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Prashant Malani When searching the device graph for device matches, check the remote-endpoint itself for a match. Some drivers register devices for individual endpoints. This allows the matcher code to evaluate those for a match too, instead of only looking at the remote parent devices. This is required when a device supports two mode switches in its endpoints, so we can't simply register the mode switch with the parent node. Signed-off-by: Prashant Malani Signed-off-by: Pin-yen Lin Reviewed-by: Chen-Yu Tsai Tested-by: Chen-Yu Tsai --- (no changes since v6) Changes in v6: - New in v6 drivers/base/property.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/base/property.c b/drivers/base/property.c index 2a5a37fcd998..48877af4e444 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -1223,6 +1223,21 @@ static unsigned int fwnode_graph_devcon_matches(struct fwnode_handle *fwnode, break; } + /* + * Some drivers may register devices for endpoints. Check + * the remote-endpoints for matches in addition to the remote + * port parent. + */ + node = fwnode_graph_get_remote_endpoint(ep); + if (fwnode_device_is_available(node)) { + ret = match(node, con_id, data); + if (ret) { + if (matches) + matches[count] = ret; + count++; + } + } + node = fwnode_graph_get_remote_port_parent(ep); if (!fwnode_device_is_available(node)) { fwnode_handle_put(node);