From patchwork Sat Jan 7 10:22:23 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: 13092077 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (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 70D9D1842 for ; Sat, 7 Jan 2023 10:22:47 +0000 (UTC) Received: by mail-pj1-f47.google.com with SMTP id n12so3942458pjp.1 for ; Sat, 07 Jan 2023 02:22:47 -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=YBlSIcXwtTcNC6c/sLb0A+fA09dZ0F2u1NJHDrT/q2R/iaQ1cjbLt1qyxJ+NZKr+OG sW/aOZ9fN3xTZhfGKzIRuoDqca+1vXKtEQJA08aQuQeMQ1tC3YT2TD5gWitCdQvFDLU6 1EdmUmEOxSdsdM3pqfJQ+lllt2BhcD8Tvj980= 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=c8DnKvy912tIkc9Zm4sJ32200zy4UTiW6Jhwh5Cp7y/W/SnuW67BkheXlPtY6Cz7vI MbmQKyvdiLqsb0RYWgGpGlJm4AIgsVd/kgwM6apRspY9Ga1k48JDWebp/11AJ2C/SJwW 35yHufZZRtvH5XXL5wpYJIUHtRR/AP/YF6yCZdho9hNQyg78YugMRLQ0++tWEAMZbbGL A6OWvbb6zVoUWA4NcmEv8yvFfyAuIS9COYe5DDvYDosoA9SgOrC/I8Re0w3L6czrYx2y LgjwqK0oES3KO3rtPNo5hYr1KHHHy4PGfnuVWpJcMMlbeg5XHefnnoNTbfCy+75N8NXE VqjA== X-Gm-Message-State: AFqh2ko/Obvh2KjGYedFfLNg/b/LiMT6OxqD8P+9QVFU7DPPUlkhk9/K 35UDYtz2NPFFCvufs0sbncid+w== X-Google-Smtp-Source: AMrXdXvGarJZRipkxnWGG7cZHfw/m0d92b3irvWonmWk9YRAc88nnTJSpaQYTRjr83kRgvV6N2mG9A== X-Received: by 2002:a17:902:b493:b0:189:cb73:75f0 with SMTP id y19-20020a170902b49300b00189cb7375f0mr53864845plr.8.1673086967014; Sat, 07 Jan 2023 02:22:47 -0800 (PST) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:180d:95e8:f4:84fb]) by smtp.gmail.com with ESMTPSA id b1-20020a170903228100b001892af9472esm2366362plh.261.2023.01.07.02.22.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Jan 2023 02:22:46 -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: Thomas Zimmermann , dri-devel@lists.freedesktop.org, Lyude Paul , Javier Martinez Canillas , linux-kernel@vger.kernel.org, Xin Ji , Pin-yen Lin , AngeloGioacchino Del Regno , Allen Chen , Hsin-Yi Wang , chrome-platform@lists.linux.dev, =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_P?= =?utf-8?q?rado?= , devicetree@vger.kernel.org, Marek Vasut , linux-acpi@vger.kernel.org, Stephen Boyd Subject: [PATCH v8 1/9] device property: Add remote endpoint to devcon matcher Date: Sat, 7 Jan 2023 18:22:23 +0800 Message-Id: <20230107102231.23682-2-treapking@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230107102231.23682-1-treapking@chromium.org> References: <20230107102231.23682-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 --- (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);