Linux-Renesas-SoC Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v4 0/4] media: v4l2-async: Accept endpoints and devices for fwnode matching
@ 2020-07-01  6:21 Laurent Pinchart
  2020-07-01  6:21 ` [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint Laurent Pinchart
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Laurent Pinchart @ 2020-07-01  6:21 UTC (permalink / raw)
  To: linux-media
  Cc: linux-renesas-soc, Sakari Ailus, Jacopo Mondi,
	Niklas Söderlund, Kieran Bingham, Lad Prabhakar

Hello,

This patch series is the fourth version of fwnode endpoint matching
support in v4l2-async. The third version can be found at [1].

Compared to v3, a new function has been introduced in 1/4 and used in
2/4.

[1] https://lore.kernel.org/linux-media/20200621000028.4591-1-laurent.pinchart+renesas@ideasonboard.com

Laurent Pinchart (4):
  device property: Add a function to test is a fwnode is a graph
    endpoint
  media: v4l2-async: Accept endpoints and devices for fwnode matching
  media: v4l2-async: Pass notifier pointer to match functions
  media: v4l2-async: Log message in case of heterogeneous fwnode match

 drivers/media/v4l2-core/v4l2-async.c | 83 +++++++++++++++++++++++++---
 include/linux/property.h             |  5 ++
 2 files changed, 80 insertions(+), 8 deletions(-)

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint
  2020-07-01  6:21 [PATCH v4 0/4] media: v4l2-async: Accept endpoints and devices for fwnode matching Laurent Pinchart
@ 2020-07-01  6:21 ` Laurent Pinchart
  2020-07-01  7:34   ` Sakari Ailus
                     ` (3 more replies)
  2020-07-01  6:21 ` [PATCH v4 2/4] media: v4l2-async: Accept endpoints and devices for fwnode matching Laurent Pinchart
                   ` (2 subsequent siblings)
  3 siblings, 4 replies; 13+ messages in thread
From: Laurent Pinchart @ 2020-07-01  6:21 UTC (permalink / raw)
  To: linux-media
  Cc: linux-renesas-soc, Sakari Ailus, Jacopo Mondi,
	Niklas Söderlund, Kieran Bingham, Lad Prabhakar,
	Rafael J. Wysocki

Drivers may need to test if a fwnode is a graph endpoint. To avoid
hand-written solutions that wouldn't work for all fwnode types, add a
new fwnode_graph_is_endpoint() function for this purpose. We don't need
to wire it up to different backends for OF and ACPI for now, as the
implementation can simply be based on checkout the presence of a
remote-endpoint property.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 include/linux/property.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/property.h b/include/linux/property.h
index 10d03572f52e..9f805c442819 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -389,6 +389,11 @@ struct fwnode_handle *
 fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,
 			     u32 endpoint);
 
+static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode)
+{
+	return fwnode_property_present(fwnode, "remote-endpoint");
+}
+
 /*
  * Fwnode lookup flags
  *
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v4 2/4] media: v4l2-async: Accept endpoints and devices for fwnode matching
  2020-07-01  6:21 [PATCH v4 0/4] media: v4l2-async: Accept endpoints and devices for fwnode matching Laurent Pinchart
  2020-07-01  6:21 ` [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint Laurent Pinchart
@ 2020-07-01  6:21 ` Laurent Pinchart
  2020-07-01  6:21 ` [PATCH v4 3/4] media: v4l2-async: Pass notifier pointer to match functions Laurent Pinchart
  2020-07-01  6:21 ` [PATCH v4 4/4] media: v4l2-async: Log message in case of heterogeneous fwnode match Laurent Pinchart
  3 siblings, 0 replies; 13+ messages in thread
From: Laurent Pinchart @ 2020-07-01  6:21 UTC (permalink / raw)
  To: linux-media
  Cc: linux-renesas-soc, Sakari Ailus, Jacopo Mondi,
	Niklas Söderlund, Kieran Bingham, Lad Prabhakar,
	Rafael J. Wysocki

fwnode matching was designed to match on nodes corresponding to a
device. Some drivers, however, needed to match on endpoints, and have
passed endpoint fwnodes to v4l2-async. This works when both the subdev
and the notifier use the same fwnode types (endpoint or device), but
makes drivers that use different types incompatible.

Fix this by extending the fwnode match to handle fwnodes of different
types. When the types (deduced from the presence of remote endpoints)
are different, retrieve the device fwnode for the side that provides an
endpoint fwnode, and compare it with the device fwnode provided by the
other side. This allows interoperability between all drivers, regardless
of which type of fwnode they use for matching.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
Changes since v3:

- Use fwnode_graph_is_endpoint()

Changes since v2:

- Add comment to explain that we're matching connecting endpoints
- Don't check fwnode name to detect endpoint
---
 drivers/media/v4l2-core/v4l2-async.c | 43 +++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index 8bde33c21ce4..e9c3d41c9449 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -71,7 +71,48 @@ static bool match_devname(struct v4l2_subdev *sd,
 
 static bool match_fwnode(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
-	return sd->fwnode == asd->match.fwnode;
+	struct fwnode_handle *other_fwnode;
+	struct fwnode_handle *dev_fwnode;
+	bool asd_fwnode_is_ep;
+	bool sd_fwnode_is_ep;
+
+	/*
+	 * Both the subdev and the async subdev can provide either an endpoint
+	 * fwnode or a device fwnode. Start with the simple case of direct
+	 * fwnode matching.
+	 */
+	if (sd->fwnode == asd->match.fwnode)
+		return true;
+
+	/*
+	 * Otherwise, check if the sd fwnode and the asd fwnode refer to an
+	 * endpoint or a device. If they're of the same type, there's no match.
+	 * Technically speaking this checks if the nodes refer to a connected
+	 * endpoint, which is the simplest check that works for both OF and
+	 * ACPI. This won't make a difference, as drivers should not try to
+	 * match unconnected endpoints.
+	 */
+	sd_fwnode_is_ep = fwnode_graph_is_endpoint(sd->fwnode);
+	asd_fwnode_is_ep = fwnode_graph_is_endpoint(asd->match.fwnode);
+
+	if (sd_fwnode_is_ep == asd_fwnode_is_ep)
+		return false;
+
+	/*
+	 * The sd and asd fwnodes are of different types. Get the device fwnode
+	 * parent of the endpoint fwnode, and compare it with the other fwnode.
+	 */
+	if (sd_fwnode_is_ep) {
+		dev_fwnode = fwnode_graph_get_port_parent(sd->fwnode);
+		other_fwnode = asd->match.fwnode;
+	} else {
+		dev_fwnode = fwnode_graph_get_port_parent(asd->match.fwnode);
+		other_fwnode = sd->fwnode;
+	}
+
+	fwnode_handle_put(dev_fwnode);
+
+	return dev_fwnode == other_fwnode;
 }
 
 static bool match_custom(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v4 3/4] media: v4l2-async: Pass notifier pointer to match functions
  2020-07-01  6:21 [PATCH v4 0/4] media: v4l2-async: Accept endpoints and devices for fwnode matching Laurent Pinchart
  2020-07-01  6:21 ` [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint Laurent Pinchart
  2020-07-01  6:21 ` [PATCH v4 2/4] media: v4l2-async: Accept endpoints and devices for fwnode matching Laurent Pinchart
@ 2020-07-01  6:21 ` Laurent Pinchart
  2020-07-01  6:21 ` [PATCH v4 4/4] media: v4l2-async: Log message in case of heterogeneous fwnode match Laurent Pinchart
  3 siblings, 0 replies; 13+ messages in thread
From: Laurent Pinchart @ 2020-07-01  6:21 UTC (permalink / raw)
  To: linux-media
  Cc: linux-renesas-soc, Sakari Ailus, Jacopo Mondi,
	Niklas Söderlund, Kieran Bingham, Lad Prabhakar

The notifier is useful to match functions to access information about
the device matching a subdev. This will be used to print messages using
the correct struct device and driver name.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/v4l2-core/v4l2-async.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index e9c3d41c9449..60833822ee89 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -50,7 +50,8 @@ static int v4l2_async_notifier_call_complete(struct v4l2_async_notifier *n)
 	return n->ops->complete(n);
 }
 
-static bool match_i2c(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
+static bool match_i2c(struct v4l2_async_notifier *notifier,
+		      struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
 #if IS_ENABLED(CONFIG_I2C)
 	struct i2c_client *client = i2c_verify_client(sd->dev);
@@ -63,13 +64,14 @@ static bool match_i2c(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 #endif
 }
 
-static bool match_devname(struct v4l2_subdev *sd,
-			  struct v4l2_async_subdev *asd)
+static bool match_devname(struct v4l2_async_notifier *notifier,
+			  struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
 	return !strcmp(asd->match.device_name, dev_name(sd->dev));
 }
 
-static bool match_fwnode(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
+static bool match_fwnode(struct v4l2_async_notifier *notifier,
+			 struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
 	struct fwnode_handle *other_fwnode;
 	struct fwnode_handle *dev_fwnode;
@@ -115,7 +117,8 @@ static bool match_fwnode(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 	return dev_fwnode == other_fwnode;
 }
 
-static bool match_custom(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
+static bool match_custom(struct v4l2_async_notifier *notifier,
+			 struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
 	if (!asd->match.custom.match)
 		/* Match always */
@@ -132,7 +135,8 @@ static struct v4l2_async_subdev *
 v4l2_async_find_match(struct v4l2_async_notifier *notifier,
 		      struct v4l2_subdev *sd)
 {
-	bool (*match)(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd);
+	bool (*match)(struct v4l2_async_notifier *notifier,
+		      struct v4l2_subdev *sd, struct v4l2_async_subdev *asd);
 	struct v4l2_async_subdev *asd;
 
 	list_for_each_entry(asd, &notifier->waiting, list) {
@@ -157,7 +161,7 @@ v4l2_async_find_match(struct v4l2_async_notifier *notifier,
 		}
 
 		/* match cannot be NULL here */
-		if (match(sd, asd))
+		if (match(notifier, sd, asd))
 			return asd;
 	}
 
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v4 4/4] media: v4l2-async: Log message in case of heterogeneous fwnode match
  2020-07-01  6:21 [PATCH v4 0/4] media: v4l2-async: Accept endpoints and devices for fwnode matching Laurent Pinchart
                   ` (2 preceding siblings ...)
  2020-07-01  6:21 ` [PATCH v4 3/4] media: v4l2-async: Pass notifier pointer to match functions Laurent Pinchart
@ 2020-07-01  6:21 ` Laurent Pinchart
  3 siblings, 0 replies; 13+ messages in thread
From: Laurent Pinchart @ 2020-07-01  6:21 UTC (permalink / raw)
  To: linux-media
  Cc: linux-renesas-soc, Sakari Ailus, Jacopo Mondi,
	Niklas Söderlund, Kieran Bingham, Lad Prabhakar

When a notifier supplies a device fwnode and a subdev supplies an
endpoint fwnode, incorrect matches may occur if multiple subdevs
correspond to the same device fwnode. This can't be handled
transparently in the framework, and requires the notifier to switch to
endpoint fwnodes. Log a message to notify of this problem. A second
message is added to help accelerating the transition to endpoint
matching.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
Changes since v2:

- Use dev_warn() and dev_notice()
- Fix typo
---
 drivers/media/v4l2-core/v4l2-async.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index 60833822ee89..e3ab003a6c85 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -77,6 +77,7 @@ static bool match_fwnode(struct v4l2_async_notifier *notifier,
 	struct fwnode_handle *dev_fwnode;
 	bool asd_fwnode_is_ep;
 	bool sd_fwnode_is_ep;
+	struct device *dev;
 
 	/*
 	 * Both the subdev and the async subdev can provide either an endpoint
@@ -114,7 +115,28 @@ static bool match_fwnode(struct v4l2_async_notifier *notifier,
 
 	fwnode_handle_put(dev_fwnode);
 
-	return dev_fwnode == other_fwnode;
+	if (dev_fwnode != other_fwnode)
+		return false;
+
+	/*
+	 * We have a heterogeneous match. Retrieve the struct device of the side
+	 * that matched on a device fwnode to print its driver name.
+	 */
+	if (sd_fwnode_is_ep)
+		dev = notifier->v4l2_dev ? notifier->v4l2_dev->dev
+		    : notifier->sd->dev;
+	else
+		dev = sd->dev;
+
+	if (dev && dev->driver) {
+		if (sd_fwnode_is_ep)
+			dev_warn(dev, "Driver %s uses device fwnode, incorrect match may occur\n",
+				 dev->driver->name);
+		dev_notice(dev, "Consider updating driver %s to match on endpoints\n",
+			   dev->driver->name);
+	}
+
+	return true;
 }
 
 static bool match_custom(struct v4l2_async_notifier *notifier,
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint
  2020-07-01  6:21 ` [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint Laurent Pinchart
@ 2020-07-01  7:34   ` Sakari Ailus
  2020-07-01 12:19     ` Rafael J. Wysocki
  2020-07-01 17:06   ` Niklas Söderlund
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Sakari Ailus @ 2020-07-01  7:34 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, linux-renesas-soc, Jacopo Mondi,
	Niklas Söderlund, Kieran Bingham, Lad Prabhakar,
	Rafael J. Wysocki, devicetree, linux-acpi

Hi Laurent,

On Wed, Jul 01, 2020 at 09:21:37AM +0300, Laurent Pinchart wrote:
> Drivers may need to test if a fwnode is a graph endpoint. To avoid
> hand-written solutions that wouldn't work for all fwnode types, add a
> new fwnode_graph_is_endpoint() function for this purpose. We don't need
> to wire it up to different backends for OF and ACPI for now, as the
> implementation can simply be based on checkout the presence of a
> remote-endpoint property.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>  include/linux/property.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/linux/property.h b/include/linux/property.h
> index 10d03572f52e..9f805c442819 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -389,6 +389,11 @@ struct fwnode_handle *
>  fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,
>  			     u32 endpoint);
>  
> +static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode)
> +{
> +	return fwnode_property_present(fwnode, "remote-endpoint");
> +}
> +
>  /*
>   * Fwnode lookup flags
>   *

Thanks for the patch. I've bounced it to devicetree and linux-acpi lists
(now cc'd) --- hope that works.

Rafael: do you think this simple patch could go though the media tree,
assuming that folks are generally fine with the patch as such?
Alternatively,

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Kind regards,

Sakari Ailus

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint
  2020-07-01  7:34   ` Sakari Ailus
@ 2020-07-01 12:19     ` Rafael J. Wysocki
  2020-07-15 20:57       ` Sakari Ailus
  0 siblings, 1 reply; 13+ messages in thread
From: Rafael J. Wysocki @ 2020-07-01 12:19 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Laurent Pinchart, linux-media, Linux-Renesas, Jacopo Mondi,
	Niklas Söderlund, Kieran Bingham, Lad Prabhakar,
	Rafael J. Wysocki, devicetree, ACPI Devel Maling List

On Wed, Jul 1, 2020 at 9:34 AM Sakari Ailus <sakari.ailus@iki.fi> wrote:
>
> Hi Laurent,
>
> On Wed, Jul 01, 2020 at 09:21:37AM +0300, Laurent Pinchart wrote:
> > Drivers may need to test if a fwnode is a graph endpoint. To avoid
> > hand-written solutions that wouldn't work for all fwnode types, add a
> > new fwnode_graph_is_endpoint() function for this purpose. We don't need
> > to wire it up to different backends for OF and ACPI for now, as the
> > implementation can simply be based on checkout the presence of a
> > remote-endpoint property.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> >  include/linux/property.h | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/include/linux/property.h b/include/linux/property.h
> > index 10d03572f52e..9f805c442819 100644
> > --- a/include/linux/property.h
> > +++ b/include/linux/property.h
> > @@ -389,6 +389,11 @@ struct fwnode_handle *
> >  fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,
> >                            u32 endpoint);
> >
> > +static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode)
> > +{
> > +     return fwnode_property_present(fwnode, "remote-endpoint");
> > +}
> > +
> >  /*
> >   * Fwnode lookup flags
> >   *
>
> Thanks for the patch. I've bounced it to devicetree and linux-acpi lists
> (now cc'd) --- hope that works.
>
> Rafael: do you think this simple patch could go though the media tree,
> assuming that folks are generally fine with the patch as such?

Yes, it could.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint
  2020-07-01  6:21 ` [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint Laurent Pinchart
  2020-07-01  7:34   ` Sakari Ailus
@ 2020-07-01 17:06   ` Niklas Söderlund
  2020-07-01 18:46   ` Lad, Prabhakar
  2020-07-01 21:03   ` Kieran Bingham
  3 siblings, 0 replies; 13+ messages in thread
From: Niklas Söderlund @ 2020-07-01 17:06 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, linux-renesas-soc, Sakari Ailus, Jacopo Mondi,
	Kieran Bingham, Lad Prabhakar, Rafael J. Wysocki

Hi Laurent,

Thanks for your work.

On 2020-07-01 09:21:37 +0300, Laurent Pinchart wrote:
> Drivers may need to test if a fwnode is a graph endpoint. To avoid
> hand-written solutions that wouldn't work for all fwnode types, add a
> new fwnode_graph_is_endpoint() function for this purpose. We don't need
> to wire it up to different backends for OF and ACPI for now, as the
> implementation can simply be based on checkout the presence of a
> remote-endpoint property.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
>  include/linux/property.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/linux/property.h b/include/linux/property.h
> index 10d03572f52e..9f805c442819 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -389,6 +389,11 @@ struct fwnode_handle *
>  fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,
>  			     u32 endpoint);
>  
> +static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode)
> +{
> +	return fwnode_property_present(fwnode, "remote-endpoint");
> +}
> +
>  /*
>   * Fwnode lookup flags
>   *
> -- 
> Regards,
> 
> Laurent Pinchart
> 

-- 
Regards,
Niklas Söderlund

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint
  2020-07-01  6:21 ` [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint Laurent Pinchart
  2020-07-01  7:34   ` Sakari Ailus
  2020-07-01 17:06   ` Niklas Söderlund
@ 2020-07-01 18:46   ` Lad, Prabhakar
  2020-07-01 21:03   ` Kieran Bingham
  3 siblings, 0 replies; 13+ messages in thread
From: Lad, Prabhakar @ 2020-07-01 18:46 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, Linux-Renesas, Sakari Ailus, Jacopo Mondi,
	Niklas Söderlund, Kieran Bingham, Rafael J. Wysocki

Hi Laurent,

Thank you for the patch.

On Wed, Jul 1, 2020 at 7:21 AM Laurent Pinchart
<laurent.pinchart+renesas@ideasonboard.com> wrote:
>
> Drivers may need to test if a fwnode is a graph endpoint. To avoid
> hand-written solutions that wouldn't work for all fwnode types, add a
> new fwnode_graph_is_endpoint() function for this purpose. We don't need
> to wire it up to different backends for OF and ACPI for now, as the
> implementation can simply be based on checkout the presence of a
> remote-endpoint property.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>  include/linux/property.h | 5 +++++
>  1 file changed, 5 insertions(+)
>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Cheers,
--Prabhakar

> diff --git a/include/linux/property.h b/include/linux/property.h
> index 10d03572f52e..9f805c442819 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -389,6 +389,11 @@ struct fwnode_handle *
>  fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,
>                              u32 endpoint);
>
> +static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode)
> +{
> +       return fwnode_property_present(fwnode, "remote-endpoint");
> +}
> +
>  /*
>   * Fwnode lookup flags
>   *
> --
> Regards,
>
> Laurent Pinchart
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint
  2020-07-01  6:21 ` [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint Laurent Pinchart
                     ` (2 preceding siblings ...)
  2020-07-01 18:46   ` Lad, Prabhakar
@ 2020-07-01 21:03   ` Kieran Bingham
  3 siblings, 0 replies; 13+ messages in thread
From: Kieran Bingham @ 2020-07-01 21:03 UTC (permalink / raw)
  To: Laurent Pinchart, linux-media
  Cc: linux-renesas-soc, Sakari Ailus, Jacopo Mondi,
	Niklas Söderlund, Lad Prabhakar, Rafael J. Wysocki

Hi Laurent,

On 01/07/2020 07:21, Laurent Pinchart wrote:
> Drivers may need to test if a fwnode is a graph endpoint. To avoid
> hand-written solutions that wouldn't work for all fwnode types, add a
> new fwnode_graph_is_endpoint() function for this purpose. We don't need
> to wire it up to different backends for OF and ACPI for now, as the
> implementation can simply be based on checkout the presence of a
> remote-endpoint property.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Great, this makes the usage in [2/4] much more readable, and isolates
the internal knowledge of fw_node_properties where it should be.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> ---
>  include/linux/property.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/linux/property.h b/include/linux/property.h
> index 10d03572f52e..9f805c442819 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -389,6 +389,11 @@ struct fwnode_handle *
>  fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,
>  			     u32 endpoint);
>  
> +static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode)
> +{
> +	return fwnode_property_present(fwnode, "remote-endpoint");
> +}
> +
>  /*
>   * Fwnode lookup flags
>   *
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint
  2020-07-01 12:19     ` Rafael J. Wysocki
@ 2020-07-15 20:57       ` Sakari Ailus
  2020-07-17  2:19         ` Laurent Pinchart
  0 siblings, 1 reply; 13+ messages in thread
From: Sakari Ailus @ 2020-07-15 20:57 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Laurent Pinchart, linux-media, Linux-Renesas, Jacopo Mondi,
	Niklas Söderlund, Kieran Bingham, Lad Prabhakar,
	Rafael J. Wysocki, devicetree, ACPI Devel Maling List

Rafael,

On Wed, Jul 01, 2020 at 02:19:21PM +0200, Rafael J. Wysocki wrote:
> On Wed, Jul 1, 2020 at 9:34 AM Sakari Ailus <sakari.ailus@iki.fi> wrote:
> >
> > Hi Laurent,
> >
> > On Wed, Jul 01, 2020 at 09:21:37AM +0300, Laurent Pinchart wrote:
> > > Drivers may need to test if a fwnode is a graph endpoint. To avoid
> > > hand-written solutions that wouldn't work for all fwnode types, add a
> > > new fwnode_graph_is_endpoint() function for this purpose. We don't need
> > > to wire it up to different backends for OF and ACPI for now, as the
> > > implementation can simply be based on checkout the presence of a
> > > remote-endpoint property.
> > >
> > > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> > > ---
> > >  include/linux/property.h | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > >
> > > diff --git a/include/linux/property.h b/include/linux/property.h
> > > index 10d03572f52e..9f805c442819 100644
> > > --- a/include/linux/property.h
> > > +++ b/include/linux/property.h
> > > @@ -389,6 +389,11 @@ struct fwnode_handle *
> > >  fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,
> > >                            u32 endpoint);
> > >
> > > +static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode)
> > > +{
> > > +     return fwnode_property_present(fwnode, "remote-endpoint");
> > > +}
> > > +
> > >  /*
> > >   * Fwnode lookup flags
> > >   *
> >
> > Thanks for the patch. I've bounced it to devicetree and linux-acpi lists
> > (now cc'd) --- hope that works.
> >
> > Rafael: do you think this simple patch could go though the media tree,
> > assuming that folks are generally fine with the patch as such?
> 
> Yes, it could.

Thanks! I've applied this to my tree.

-- 
Kind regards,

Sakari Ailus

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint
  2020-07-15 20:57       ` Sakari Ailus
@ 2020-07-17  2:19         ` Laurent Pinchart
  2020-07-17  7:56           ` Sakari Ailus
  0 siblings, 1 reply; 13+ messages in thread
From: Laurent Pinchart @ 2020-07-17  2:19 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Rafael J. Wysocki, Laurent Pinchart, linux-media, Linux-Renesas,
	Jacopo Mondi, Niklas Söderlund, Kieran Bingham,
	Lad Prabhakar, Rafael J. Wysocki, devicetree,
	ACPI Devel Maling List

Hi Sakari,

On Wed, Jul 15, 2020 at 11:57:17PM +0300, Sakari Ailus wrote:
> On Wed, Jul 01, 2020 at 02:19:21PM +0200, Rafael J. Wysocki wrote:
> > On Wed, Jul 1, 2020 at 9:34 AM Sakari Ailus <sakari.ailus@iki.fi> wrote:
> > > On Wed, Jul 01, 2020 at 09:21:37AM +0300, Laurent Pinchart wrote:
> > > > Drivers may need to test if a fwnode is a graph endpoint. To avoid
> > > > hand-written solutions that wouldn't work for all fwnode types, add a
> > > > new fwnode_graph_is_endpoint() function for this purpose. We don't need
> > > > to wire it up to different backends for OF and ACPI for now, as the
> > > > implementation can simply be based on checkout the presence of a
> > > > remote-endpoint property.
> > > >
> > > > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> > > > ---
> > > >  include/linux/property.h | 5 +++++
> > > >  1 file changed, 5 insertions(+)
> > > >
> > > > diff --git a/include/linux/property.h b/include/linux/property.h
> > > > index 10d03572f52e..9f805c442819 100644
> > > > --- a/include/linux/property.h
> > > > +++ b/include/linux/property.h
> > > > @@ -389,6 +389,11 @@ struct fwnode_handle *
> > > >  fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,
> > > >                            u32 endpoint);
> > > >
> > > > +static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode)
> > > > +{
> > > > +     return fwnode_property_present(fwnode, "remote-endpoint");
> > > > +}
> > > > +
> > > >  /*
> > > >   * Fwnode lookup flags
> > > >   *
> > >
> > > Thanks for the patch. I've bounced it to devicetree and linux-acpi lists
> > > (now cc'd) --- hope that works.
> > >
> > > Rafael: do you think this simple patch could go though the media tree,
> > > assuming that folks are generally fine with the patch as such?
> > 
> > Yes, it could.
> 
> Thanks! I've applied this to my tree.

Do you mean the whole series ? :-) Do you intend to send a pull request
for v5.9 ?

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint
  2020-07-17  2:19         ` Laurent Pinchart
@ 2020-07-17  7:56           ` Sakari Ailus
  0 siblings, 0 replies; 13+ messages in thread
From: Sakari Ailus @ 2020-07-17  7:56 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Rafael J. Wysocki, Laurent Pinchart, linux-media, Linux-Renesas,
	Jacopo Mondi, Niklas Söderlund, Kieran Bingham,
	Lad Prabhakar, Rafael J. Wysocki, devicetree,
	ACPI Devel Maling List

On Fri, Jul 17, 2020 at 05:19:16AM +0300, Laurent Pinchart wrote:
> Hi Sakari,
> 
> On Wed, Jul 15, 2020 at 11:57:17PM +0300, Sakari Ailus wrote:
> > On Wed, Jul 01, 2020 at 02:19:21PM +0200, Rafael J. Wysocki wrote:
> > > On Wed, Jul 1, 2020 at 9:34 AM Sakari Ailus <sakari.ailus@iki.fi> wrote:
> > > > On Wed, Jul 01, 2020 at 09:21:37AM +0300, Laurent Pinchart wrote:
> > > > > Drivers may need to test if a fwnode is a graph endpoint. To avoid
> > > > > hand-written solutions that wouldn't work for all fwnode types, add a
> > > > > new fwnode_graph_is_endpoint() function for this purpose. We don't need
> > > > > to wire it up to different backends for OF and ACPI for now, as the
> > > > > implementation can simply be based on checkout the presence of a
> > > > > remote-endpoint property.
> > > > >
> > > > > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> > > > > ---
> > > > >  include/linux/property.h | 5 +++++
> > > > >  1 file changed, 5 insertions(+)
> > > > >
> > > > > diff --git a/include/linux/property.h b/include/linux/property.h
> > > > > index 10d03572f52e..9f805c442819 100644
> > > > > --- a/include/linux/property.h
> > > > > +++ b/include/linux/property.h
> > > > > @@ -389,6 +389,11 @@ struct fwnode_handle *
> > > > >  fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,
> > > > >                            u32 endpoint);
> > > > >
> > > > > +static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode)
> > > > > +{
> > > > > +     return fwnode_property_present(fwnode, "remote-endpoint");
> > > > > +}
> > > > > +
> > > > >  /*
> > > > >   * Fwnode lookup flags
> > > > >   *
> > > >
> > > > Thanks for the patch. I've bounced it to devicetree and linux-acpi lists
> > > > (now cc'd) --- hope that works.
> > > >
> > > > Rafael: do you think this simple patch could go though the media tree,
> > > > assuming that folks are generally fine with the patch as such?
> > > 
> > > Yes, it could.
> > 
> > Thanks! I've applied this to my tree.
> 
> Do you mean the whole series ? :-) Do you intend to send a pull request
> for v5.9 ?

It's here:

<URL:https://patchwork.linuxtv.org/project/linux-media/patch/20200715222030.GG836@valkosipuli.retiisi.org.uk/>

-- 
Sakari Ailus

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, back to index

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01  6:21 [PATCH v4 0/4] media: v4l2-async: Accept endpoints and devices for fwnode matching Laurent Pinchart
2020-07-01  6:21 ` [PATCH v4 1/4] device property: Add a function to test is a fwnode is a graph endpoint Laurent Pinchart
2020-07-01  7:34   ` Sakari Ailus
2020-07-01 12:19     ` Rafael J. Wysocki
2020-07-15 20:57       ` Sakari Ailus
2020-07-17  2:19         ` Laurent Pinchart
2020-07-17  7:56           ` Sakari Ailus
2020-07-01 17:06   ` Niklas Söderlund
2020-07-01 18:46   ` Lad, Prabhakar
2020-07-01 21:03   ` Kieran Bingham
2020-07-01  6:21 ` [PATCH v4 2/4] media: v4l2-async: Accept endpoints and devices for fwnode matching Laurent Pinchart
2020-07-01  6:21 ` [PATCH v4 3/4] media: v4l2-async: Pass notifier pointer to match functions Laurent Pinchart
2020-07-01  6:21 ` [PATCH v4 4/4] media: v4l2-async: Log message in case of heterogeneous fwnode match Laurent Pinchart

Linux-Renesas-SoC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-renesas-soc/0 linux-renesas-soc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-renesas-soc linux-renesas-soc/ https://lore.kernel.org/linux-renesas-soc \
		linux-renesas-soc@vger.kernel.org
	public-inbox-index linux-renesas-soc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-renesas-soc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git