public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Ivan Vecera <ivecera@redhat.com>
To: netdev@vger.kernel.org
Cc: Vadim Fedorenko <vadim.fedorenko@linux.dev>,
	Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>,
	Jiri Pirko <jiri@resnulli.us>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Prathosh Satish <Prathosh.Satish@microchip.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Leon Romanovsky <leon@kernel.org>,
	Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,
	Jonathan Lemon <jonathan.lemon@gmail.com>,
	Richard Cochran <richardcochran@gmail.com>,
	Alexander Lobakin <aleksander.lobakin@intel.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	intel-wired-lan@lists.osuosl.org, linux-rdma@vger.kernel.org,
	Michal Schmidt <mschmidt@redhat.com>,
	Petr Oros <poros@redhat.com>,
	Grzegorz Nitka <grzegorz.nitka@intel.com>
Subject: [PATCH net-next 03/12] dpll: Add helpers to find DPLL pin fwnode
Date: Thu,  8 Jan 2026 19:23:09 +0100	[thread overview]
Message-ID: <20260108182318.20935-4-ivecera@redhat.com> (raw)
In-Reply-To: <20260108182318.20935-1-ivecera@redhat.com>

Add helper functions to the DPLL core to retrieve a DPLL pin's firmware
node handle based on the "dpll-pins" and "dpll-pin-names" properties.

* `fwnode_dpll_pin_node_get()`: matches the given name against the
  "dpll-pin-names" property to find the correct index, then retrieves
  the reference from "dpll-pins".
* `device_dpll_pin_node_get()`: a wrapper around the fwnode helper for
  convenience when using a `struct device`.

These helpers simplify the process for consumer drivers (such as Ethernet
controllers or PHYs) to look up their associated DPLL pins defined in
the DT or ACPI, which can then be passed to the DPLL subsystem to acquire
the pin object.

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
 drivers/dpll/dpll_core.c | 20 ++++++++++++++++++++
 include/linux/dpll.h     | 15 +++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
index fb68b5e19b480..23d04a9d022d7 100644
--- a/drivers/dpll/dpll_core.c
+++ b/drivers/dpll/dpll_core.c
@@ -654,6 +654,26 @@ struct dpll_pin *fwnode_dpll_pin_find(struct fwnode_handle *fwnode)
 }
 EXPORT_SYMBOL_GPL(fwnode_dpll_pin_find);
 
+/**
+ * fwnode_dpll_pin_node_get - get dpll pin node from given fw node and pin name
+ * @fwnode: firmware node that uses the dpll pin
+ * @name: dpll pin name from dpll-pin-names property
+ *
+ * Return: ERR_PTR() on error or a valid firmware node handle on success.
+ */
+struct fwnode_handle *fwnode_dpll_pin_node_get(struct fwnode_handle *fwnode,
+					       const char *name)
+{
+	int index = 0;
+
+	if (name)
+		index = fwnode_property_match_string(fwnode, "dpll-pin-names",
+						     name);
+
+	return fwnode_find_reference(fwnode, "dpll-pins", index);
+}
+EXPORT_SYMBOL_GPL(fwnode_dpll_pin_node_get);
+
 static int
 __dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin,
 		    const struct dpll_pin_ops *ops, void *priv, void *cookie)
diff --git a/include/linux/dpll.h b/include/linux/dpll.h
index f0c31a111c304..755c36d1ef45a 100644
--- a/include/linux/dpll.h
+++ b/include/linux/dpll.h
@@ -11,6 +11,7 @@
 #include <linux/device.h>
 #include <linux/netlink.h>
 #include <linux/netdevice.h>
+#include <linux/property.h>
 #include <linux/rtnetlink.h>
 
 struct dpll_device;
@@ -176,6 +177,8 @@ int dpll_netdev_add_pin_handle(struct sk_buff *msg,
 			       const struct net_device *dev);
 
 struct dpll_pin *fwnode_dpll_pin_find(struct fwnode_handle *fwnode);
+struct fwnode_handle *fwnode_dpll_pin_node_get(struct fwnode_handle *fwnode,
+					       const char *name);
 #else
 static inline void
 dpll_netdev_pin_set(struct net_device *dev, struct dpll_pin *dpll_pin) { }
@@ -197,8 +200,20 @@ fwnode_dpll_pin_find(struct fwnode_handle *fwnode)
 {
 	return NULL;
 }
+
+static inline struct fwnode_handle *
+fwnode_dpll_pin_node_get(struct fwnode_handle *fwnode, const char *name)
+{
+	return NULL;
+}
 #endif
 
+static inline struct fwnode_handle *
+device_dpll_pin_node_get(struct device *dev, const char *name)
+{
+	return fwnode_dpll_pin_node_get(dev_fwnode(dev), name);
+}
+
 struct dpll_device *
 dpll_device_get(u64 clock_id, u32 dev_driver_id, struct module *module);
 
-- 
2.52.0


  parent reply	other threads:[~2026-01-08 18:24 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-08 18:23 [PATCH net-next 00/12] dpll: Core improvements and ice E825-C SyncE support Ivan Vecera
2026-01-08 18:23 ` [PATCH net-next 01/12] dt-bindings: dpll: add common dpll-pin-consumer schema Ivan Vecera
2026-01-09  9:48   ` Krzysztof Kozlowski
2026-01-09 10:22     ` [Intel-wired-lan] " Ivan Vecera
2026-01-09 14:11       ` Ivan Vecera
2026-01-12 16:14         ` Krzysztof Kozlowski
2026-01-12 16:48           ` Ivan Vecera
2026-01-12 18:07             ` Ivan Vecera
2026-01-15 12:01   ` Ivan Vecera
2026-01-16 15:23     ` Rob Herring
2026-01-16 19:00       ` Ivan Vecera
2026-01-16 23:39         ` Rob Herring
2026-01-17 18:21           ` Ivan Vecera
2026-01-08 18:23 ` [PATCH net-next 02/12] dpll: Allow associating dpll pin with a firmware node Ivan Vecera
2026-01-09 15:46   ` Vadim Fedorenko
2026-01-08 18:23 ` Ivan Vecera [this message]
2026-01-09  9:55   ` [PATCH net-next 03/12] dpll: Add helpers to find DPLL pin fwnode Krzysztof Kozlowski
2026-01-09 10:22     ` Ivan Vecera
2026-01-12 16:16       ` Krzysztof Kozlowski
2026-01-12 16:52         ` Ivan Vecera
2026-01-09 14:19     ` Ivan Vecera
2026-01-12 16:20       ` Krzysztof Kozlowski
2026-01-12 16:55         ` Ivan Vecera
2026-01-08 18:23 ` [PATCH net-next 04/12] dpll: zl3073x: Associate pin with fwnode handle Ivan Vecera
2026-01-08 18:23 ` [PATCH net-next 05/12] dpll: Add notifier chain for dpll events Ivan Vecera
2026-01-09 16:12   ` Vadim Fedorenko
2026-01-08 18:23 ` [PATCH net-next 06/12] dpll: Support dynamic pin index allocation Ivan Vecera
2026-01-09 23:34   ` [Intel-wired-lan] " kernel test robot
2026-01-12 15:13   ` kernel test robot
2026-01-12 16:56     ` Ivan Vecera
2026-01-12 19:19   ` kernel test robot
2026-01-08 18:23 ` [PATCH net-next 07/12] dpll: zl3073x: Add support for mux pin type Ivan Vecera
2026-01-08 18:23 ` [PATCH net-next 08/12] dpll: Enhance and consolidate reference counting logic Ivan Vecera
2026-01-08 18:23 ` [PATCH net-next 09/12] dpll: Prevent duplicate registrations Ivan Vecera
2026-01-08 18:23 ` [PATCH net-next 10/12] dpll: Add reference count tracking support Ivan Vecera
2026-01-12 16:06   ` [Intel-wired-lan] " kernel test robot
2026-01-08 18:23 ` [PATCH net-next 11/12] drivers: Add support for DPLL reference count tracking Ivan Vecera
2026-01-08 18:23 ` [PATCH net-next 12/12] ice: dpll: Support E825-C SyncE and dynamic pin discovery Ivan Vecera
2026-01-09  6:15   ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-09 14:47     ` Ivan Vecera

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260108182318.20935-4-ivecera@redhat.com \
    --to=ivecera@redhat.com \
    --cc=Prathosh.Satish@microchip.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=grzegorz.nitka@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jiri@resnulli.us \
    --cc=jonathan.lemon@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=mschmidt@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=poros@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=vadim.fedorenko@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox