From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Steve Longerbeam <slongerbeam@gmail.com>
Cc: Yong Zhi <yong.zhi@intel.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
niklas.soderlund@ragnatech.se, Sebastian Reichel <sre@kernel.org>,
Hans Verkuil <hans.verkuil@cisco.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
linux-media@vger.kernel.org,
Steve Longerbeam <steve_longerbeam@mentor.com>
Subject: Re: [PATCH 01/13] media: v4l2-fwnode: Let parse_endpoint callback decide if no remote is error
Date: Fri, 23 Feb 2018 11:29:54 +0200 [thread overview]
Message-ID: <3283028.CgXzGkPyKt@avalon> (raw)
In-Reply-To: <1519263589-19647-2-git-send-email-steve_longerbeam@mentor.com>
Hi Steve,
Thank you for the patch.
On Thursday, 22 February 2018 03:39:37 EET Steve Longerbeam wrote:
> For some subdevices, a fwnode endpoint that has no connection to a remote
> endpoint may not be an error. Let the parse_endpoint callback make that
> decision in v4l2_async_notifier_fwnode_parse_endpoint(). If the callback
> indicates that is not an error, skip adding the asd to the notifier and
> return 0.
>
> For the current users of v4l2_async_notifier_parse_fwnode_endpoints()
> (omap3isp, rcar-vin, intel-ipu3), return -EINVAL in the callback for
> unavailable remote fwnodes to maintain the previous behavior.
I'm not sure this should be a per-driver decision.
Generally speaking, if an endpoint node has no remote-endpoint property, the
endpoint node is not needed. I've always considered such an endpoint node as
invalid. The OF graphs DT bindings are however not clear on this subject. I
have either failed to notice when they got merged, or they slowly evolved over
time to contain contradictory information. In any case, I think we should
decide on whether such a situation is valid or not from an OF graph point of
view, and then always reject or always accept and ignore those endpoints.
> Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
> ---
> drivers/media/pci/intel/ipu3/ipu3-cio2.c | 3 +++
> drivers/media/platform/omap3isp/isp.c | 3 +++
> drivers/media/platform/rcar-vin/rcar-core.c | 3 +++
> drivers/media/v4l2-core/v4l2-fwnode.c | 4 ++--
> 4 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> b/drivers/media/pci/intel/ipu3/ipu3-cio2.c index 6c4444b..2323151 100644
> --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> @@ -1477,6 +1477,9 @@ static int cio2_fwnode_parse(struct device *dev,
> struct sensor_async_subdev *s_asd =
> container_of(asd, struct sensor_async_subdev, asd);
>
> + if (!fwnode_device_is_available(asd->match.fwnode))
> + return -EINVAL;
> +
> if (vep->bus_type != V4L2_MBUS_CSI2) {
> dev_err(dev, "Only CSI2 bus type is currently supported\n");
> return -EINVAL;
> diff --git a/drivers/media/platform/omap3isp/isp.c
> b/drivers/media/platform/omap3isp/isp.c index 8eb000e..4a302f2 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -2025,6 +2025,9 @@ static int isp_fwnode_parse(struct device *dev,
> dev_dbg(dev, "parsing endpoint %pOF, interface %u\n",
> to_of_node(vep->base.local_fwnode), vep->base.port);
>
> + if (!fwnode_device_is_available(asd->match.fwnode))
> + return -EINVAL;
> +
> switch (vep->base.port) {
> case ISP_OF_PHY_PARALLEL:
> buscfg->interface = ISP_INTERFACE_PARALLEL;
> diff --git a/drivers/media/platform/rcar-vin/rcar-core.c
> b/drivers/media/platform/rcar-vin/rcar-core.c index f1fc797..51bb8f1 100644
> --- a/drivers/media/platform/rcar-vin/rcar-core.c
> +++ b/drivers/media/platform/rcar-vin/rcar-core.c
> @@ -149,6 +149,9 @@ static int rvin_digital_parse_v4l2(struct device *dev,
> struct rvin_graph_entity *rvge =
> container_of(asd, struct rvin_graph_entity, asd);
>
> + if (!fwnode_device_is_available(asd->match.fwnode))
> + return -EINVAL;
> +
> if (vep->base.port || vep->base.id)
> return -ENOTCONN;
>
> diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c
> b/drivers/media/v4l2-core/v4l2-fwnode.c index d630640..446646b 100644
> --- a/drivers/media/v4l2-core/v4l2-fwnode.c
> +++ b/drivers/media/v4l2-core/v4l2-fwnode.c
> @@ -361,7 +361,7 @@ static int v4l2_async_notifier_fwnode_parse_endpoint(
> asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
> asd->match.fwnode =
> fwnode_graph_get_remote_port_parent(endpoint);
> - if (!asd->match.fwnode) {
> + if (!asd->match.fwnode && !parse_endpoint) {
> dev_warn(dev, "bad remote port parent\n");
> ret = -EINVAL;
> goto out_err;
> @@ -384,7 +384,7 @@ static int v4l2_async_notifier_fwnode_parse_endpoint(
> "driver could not parse port@%u/endpoint@%u (%d)\n",
> vep->base.port, vep->base.id, ret);
> v4l2_fwnode_endpoint_free(vep);
> - if (ret < 0)
> + if (ret < 0 || !asd->match.fwnode)
> goto out_err;
>
> notifier->subdevs[notifier->num_subdevs] = asd;
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2018-02-23 9:29 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-22 1:39 [PATCH 00/13] media: imx: Switch to subdev notifiers Steve Longerbeam
2018-02-22 1:39 ` [PATCH 01/13] media: v4l2-fwnode: Let parse_endpoint callback decide if no remote is error Steve Longerbeam
2018-02-23 9:29 ` Laurent Pinchart [this message]
2018-02-23 9:56 ` Philipp Zabel
2018-02-23 10:05 ` Laurent Pinchart
2018-02-23 10:14 ` Sakari Ailus
2018-02-23 11:16 ` Philipp Zabel
2018-02-23 12:47 ` Sakari Ailus
2018-02-27 9:13 ` Philipp Zabel
2018-02-27 9:53 ` Laurent Pinchart
2018-02-23 18:22 ` Steve Longerbeam
2018-02-22 1:39 ` [PATCH 02/13] media: v4l2: async: Allow searching for asd of any type Steve Longerbeam
2018-02-22 1:39 ` [PATCH 03/13] media: v4l2: async: Add v4l2_async_notifier_add_subdev Steve Longerbeam
2018-02-22 1:39 ` [PATCH 04/13] media: v4l2-fwnode: Switch to v4l2_async_notifier_add_subdev Steve Longerbeam
2018-02-22 1:39 ` [PATCH 05/13] media: v4l2-fwnode: Add a convenience function for registering subdevs with notifiers Steve Longerbeam
2018-02-23 6:47 ` kbuild test robot
2018-02-22 1:39 ` [PATCH 06/13] media: platform: video-mux: Register a subdev notifier Steve Longerbeam
2018-02-23 4:55 ` kbuild test robot
2018-02-22 1:39 ` [PATCH 07/13] media: imx: csi: " Steve Longerbeam
2018-02-22 1:39 ` [PATCH 08/13] media: imx: mipi csi-2: " Steve Longerbeam
2018-02-22 1:39 ` [PATCH 09/13] media: staging/imx: of: Remove recursive graph walk Steve Longerbeam
2018-02-22 1:39 ` [PATCH 10/13] media: staging/imx: Loop through all registered subdevs for media links Steve Longerbeam
2018-02-22 1:39 ` [PATCH 11/13] media: staging/imx: Rename root notifier Steve Longerbeam
2018-02-22 1:39 ` [PATCH 12/13] media: staging/imx: Switch to v4l2_async_notifier_add_subdev Steve Longerbeam
2018-02-22 1:39 ` [PATCH 13/13] media: staging/imx: TODO: Remove one assumption about OF graph parsing Steve Longerbeam
2018-03-09 12:57 ` [PATCH 00/13] media: imx: Switch to subdev notifiers Hans Verkuil
2018-03-09 17:26 ` Steve Longerbeam
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=3283028.CgXzGkPyKt@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=hans.verkuil@cisco.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=niklas.soderlund@ragnatech.se \
--cc=p.zabel@pengutronix.de \
--cc=sakari.ailus@linux.intel.com \
--cc=slongerbeam@gmail.com \
--cc=sre@kernel.org \
--cc=steve_longerbeam@mentor.com \
--cc=yong.zhi@intel.com \
/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