From patchwork Thu Nov 24 10:20:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pin-yen Lin X-Patchwork-Id: 25428 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3305284wrr; Thu, 24 Nov 2022 02:22:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf5fdZOKiaptOVMFuWfmwXqeg2OKHVYKBityiwCOMpokGgxiUKai5sJpijLT/SyHiBzZp8SL X-Received: by 2002:a17:906:fca7:b0:7ae:9677:d8dd with SMTP id qw7-20020a170906fca700b007ae9677d8ddmr10756384ejb.71.1669285358828; Thu, 24 Nov 2022 02:22:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669285358; cv=none; d=google.com; s=arc-20160816; b=NZ/N7Yj+N7F4x6LMem7hCDgZBtmW6uHlEqQLPW1DVzOQ+jSB4+sNcwpxw/2J1ptGkw MfMOk33kZlv8qCL1MWeO/FAATA9R45QDk/WgucBvaeqovSjz+64l/2kx49HCBzlefjZG cQyEWPrfrNsdZb5QrQ646xsSmWY7JF8fIJCWXOecr+cy9sSUMncjIpw3dmWM+xHDx4MC JS1wnDpdAs2Wf02fUlRCUKFqNKvtxlqVSGbZ+DGROyOSNumKXXl23Gq4PMXLoHwUDHlF aX2AaJFtz4hZlC6EtiPd83Cq9Of6mgHASpJxJOTeVmTVRPUI5nPvTCa0Y6mAUpNPFUz/ wO7w== 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=bhjmEX7h7UKuTd3pV2F0JRbYwLj/obCLhiM6HTgRw0A=; b=UvBPoWvz+zQ07NNbXDmFP3dlUU4K4B3SuZmgcBtdnHr2+OSnQtQoQAUige0m2OnvJc EAcpo5ahRKM15NPQ8k0I6SHKJnNjp69j4vWDLwUOxOg0GXl/hfvExJHC5T3Nb+10c9RJ tlGuj3Ckh3mcbzcY+ckGDx2VieAeTGa6Xdy6K6guzH8CMZPf6LbycGTvMazYPtk5I/5q fFZ0mQ3622iCj/nTlJlBl6S0Kb2Cf/fWXfe2ew47c6ZVpvTWWCpa9yDu6ykHt67lr5xj 1/pBELI1LA/mDEv1x0jYaJn5t/1qrtjrOZ5FryL4O0AAF2Lv0F+juryoBN6r5ZxiqOCZ pzVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hyEW92Qg; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i6-20020a05640242c600b00461e582ef0fsi818132edc.381.2022.11.24.02.22.13; Thu, 24 Nov 2022 02:22:38 -0800 (PST) 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=hyEW92Qg; 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 S229946AbiKXKVe (ORCPT + 99 others); Thu, 24 Nov 2022 05:21:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229828AbiKXKVX (ORCPT ); Thu, 24 Nov 2022 05:21:23 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 087F214F52C for ; Thu, 24 Nov 2022 02:21:15 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id w79so1275072pfc.2 for ; Thu, 24 Nov 2022 02:21:15 -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=bhjmEX7h7UKuTd3pV2F0JRbYwLj/obCLhiM6HTgRw0A=; b=hyEW92Qgxc5TQnLZWHdyOLmDAEq5T8M7V0iOgxHI7fmQKv4wqB5EmzbNffcjGDXl1y vmD6r+xRz62PtEZwYK8WpFdk3i1WCAg8MvTKFFyhdAR3U03Upmodz/Sk2+R459pZt5ue KoM27RRJTxSG0VqLVljHKplaFJmL3x9ILSBTk= 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=bhjmEX7h7UKuTd3pV2F0JRbYwLj/obCLhiM6HTgRw0A=; b=uph0xCzKEipcTLNwBr/GnZ1Vvmne5XCKz4uLHqHbGdKpioJucLuKDurDTnIJX2AAdl XfG34WN00BnZFkUn4uoWlwseX03eO8ziSjjqCcnFuNz+HThZ18kqJofmMPBRwwUl71+w 1QRzlW4s1AvQoHa4CAiSIDQigaoxcLXNadKc5+TQIxFJqco/8c94MscUaLzAQbfhvK7u RkQrVEoOsfvJglblbi3LL/y3+3IoARo6GM/1elsMcxvzSVlUDxEsjYP78FnM959LAExP DUVejx6233Zp4h323hqx9/c5ad+G6Zn256jXU7qkSxoWOIONJGMqHnQMfYc5w6iohO2Z F4HQ== X-Gm-Message-State: ANoB5pkjk0htpHWtvQh5ld4w9amlFm29CpLi1zTAXhijEfVgO/wHZo6O Ddm2xPEvTQDTKahwKVoVqHOTow== X-Received: by 2002:a63:4043:0:b0:470:2ecd:333e with SMTP id n64-20020a634043000000b004702ecd333emr30066989pga.596.1669285274569; Thu, 24 Nov 2022 02:21:14 -0800 (PST) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:d446:708:8556:dfee]) by smtp.gmail.com with ESMTPSA id t123-20020a625f81000000b005747b59fc54sm854584pfb.172.2022.11.24.02.21.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 02:21:14 -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: Javier Martinez Canillas , Stephen Boyd , dri-devel@lists.freedesktop.org, Hsin-Yi Wang , Thomas Zimmermann , devicetree@vger.kernel.org, Pin-yen Lin , chrome-platform@lists.linux.dev, linux-acpi@vger.kernel.org, Marek Vasut , Xin Ji , Lyude Paul , =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_Pra?= =?utf-8?q?do?= , AngeloGioacchino Del Regno , linux-kernel@vger.kernel.org, Allen Chen Subject: [PATCH v6 1/7] device property: Add remote endpoint to devcon matcher Date: Thu, 24 Nov 2022 18:20:50 +0800 Message-Id: <20221124102056.393220-2-treapking@chromium.org> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog In-Reply-To: <20221124102056.393220-1-treapking@chromium.org> References: <20221124102056.393220-1-treapking@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750372564676352458?= X-GMAIL-MSGID: =?utf-8?q?1750372564676352458?= 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 --- 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 4d6278a84868..2ab8be8ca45e 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);