linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] media: imx: csi: Allow unknown nearest upstream entities
       [not found] <20190119214600.30897-1-slongerbeam@gmail.com>
@ 2019-01-19 21:45 ` Steve Longerbeam
  2019-01-21 16:50   ` Philipp Zabel
  2019-01-19 21:45 ` [PATCH 2/4] media: imx: Clear fwnode link struct for each endpoint iteration Steve Longerbeam
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Steve Longerbeam @ 2019-01-19 21:45 UTC (permalink / raw)
  To: linux-media
  Cc: Steve Longerbeam, stable, Philipp Zabel, Mauro Carvalho Chehab,
	Greg Kroah-Hartman, open list:STAGING SUBSYSTEM, open list

On i.MX6, the nearest upstream entity to the CSI can only be the
CSI video muxes or the Synopsys DW MIPI CSI-2 receiver.

However the i.MX53 has no CSI video muxes or a MIPI CSI-2 receiver.
So allow for the nearest upstream entity to the CSI to be something
other than those.

Fixes: bf3cfaa712e5c ("media: staging/imx: get CSI bus type from nearest
upstream entity")

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Cc: stable@vger.kernel.org
---
 drivers/staging/media/imx/imx-media-csi.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
index 555aa45e02e3..b9af7d3d4974 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -154,9 +154,10 @@ static inline bool requires_passthrough(struct v4l2_fwnode_endpoint *ep,
 /*
  * Parses the fwnode endpoint from the source pad of the entity
  * connected to this CSI. This will either be the entity directly
- * upstream from the CSI-2 receiver, or directly upstream from the
- * video mux. The endpoint is needed to determine the bus type and
- * bus config coming into the CSI.
+ * upstream from the CSI-2 receiver, directly upstream from the
+ * video mux, or directly upstream from the CSI itself. The endpoint
+ * is needed to determine the bus type and bus config coming into
+ * the CSI.
  */
 static int csi_get_upstream_endpoint(struct csi_priv *priv,
 				     struct v4l2_fwnode_endpoint *ep)
@@ -172,7 +173,8 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv,
 	if (!priv->src_sd)
 		return -EPIPE;
 
-	src = &priv->src_sd->entity;
+	sd = priv->src_sd;
+	src = &sd->entity;
 
 	if (src->function == MEDIA_ENT_F_VID_MUX) {
 		/*
@@ -186,6 +188,14 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv,
 			src = &sd->entity;
 	}
 
+	/*
+	 * If the source is neither the video mux nor the CSI-2 receiver,
+	 * get the source pad directly upstream from CSI itself.
+	 */
+	if (src->function != MEDIA_ENT_F_VID_MUX &&
+	    sd->grp_id != IMX_MEDIA_GRP_ID_CSI2)
+		src = &priv->sd.entity;
+
 	/* get source pad of entity directly upstream from src */
 	pad = imx_media_find_upstream_pad(priv->md, src, 0);
 	if (IS_ERR(pad))
-- 
2.17.1


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

* [PATCH 2/4] media: imx: Clear fwnode link struct for each endpoint iteration
       [not found] <20190119214600.30897-1-slongerbeam@gmail.com>
  2019-01-19 21:45 ` [PATCH 1/4] media: imx: csi: Allow unknown nearest upstream entities Steve Longerbeam
@ 2019-01-19 21:45 ` Steve Longerbeam
  2019-01-19 21:45 ` [PATCH 3/4] media: imx: Rename functions that add IPU-internal subdevs/links Steve Longerbeam
  2019-01-19 21:46 ` [PATCH 4/4] media: imx: Don't register IPU subdevs/links if CSI port missing Steve Longerbeam
  3 siblings, 0 replies; 8+ messages in thread
From: Steve Longerbeam @ 2019-01-19 21:45 UTC (permalink / raw)
  To: linux-media
  Cc: Steve Longerbeam, stable, Philipp Zabel, Mauro Carvalho Chehab,
	Greg Kroah-Hartman, open list:STAGING SUBSYSTEM, open list

In imx_media_create_csi_of_links(), the 'struct v4l2_fwnode_link' must
be cleared for each endpoint iteration, otherwise if the remote port
has no "reg" property, link.remote_port will not be reset to zero.
This was discovered on the i.MX53 SMD board, since the OV5642 connects
directly to ipu1_csi0 and has a single source port with no "reg"
property.

Fixes: 621b08eabcddb ("media: staging/imx: remove static media link arrays")

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Cc: stable@vger.kernel.org
---
 drivers/staging/media/imx/imx-media-of.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-of.c b/drivers/staging/media/imx/imx-media-of.c
index a01327f6e045..2da81a5af274 100644
--- a/drivers/staging/media/imx/imx-media-of.c
+++ b/drivers/staging/media/imx/imx-media-of.c
@@ -143,15 +143,18 @@ int imx_media_create_csi_of_links(struct imx_media_dev *imxmd,
 				  struct v4l2_subdev *csi)
 {
 	struct device_node *csi_np = csi->dev->of_node;
-	struct fwnode_handle *fwnode, *csi_ep;
-	struct v4l2_fwnode_link link;
 	struct device_node *ep;
-	int ret;
-
-	link.local_node = of_fwnode_handle(csi_np);
-	link.local_port = CSI_SINK_PAD;
 
 	for_each_child_of_node(csi_np, ep) {
+		struct fwnode_handle *fwnode, *csi_ep;
+		struct v4l2_fwnode_link link;
+		int ret;
+
+		memset(&link, 0, sizeof(link));
+
+		link.local_node = of_fwnode_handle(csi_np);
+		link.local_port = CSI_SINK_PAD;
+
 		csi_ep = of_fwnode_handle(ep);
 
 		fwnode = fwnode_graph_get_remote_endpoint(csi_ep);
-- 
2.17.1


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

* [PATCH 3/4] media: imx: Rename functions that add IPU-internal subdevs/links
       [not found] <20190119214600.30897-1-slongerbeam@gmail.com>
  2019-01-19 21:45 ` [PATCH 1/4] media: imx: csi: Allow unknown nearest upstream entities Steve Longerbeam
  2019-01-19 21:45 ` [PATCH 2/4] media: imx: Clear fwnode link struct for each endpoint iteration Steve Longerbeam
@ 2019-01-19 21:45 ` Steve Longerbeam
  2019-01-21 16:52   ` Philipp Zabel
  2019-01-19 21:46 ` [PATCH 4/4] media: imx: Don't register IPU subdevs/links if CSI port missing Steve Longerbeam
  3 siblings, 1 reply; 8+ messages in thread
From: Steve Longerbeam @ 2019-01-19 21:45 UTC (permalink / raw)
  To: linux-media
  Cc: Steve Longerbeam, stable, Philipp Zabel, Mauro Carvalho Chehab,
	Greg Kroah-Hartman, open list:STAGING SUBSYSTEM, open list

For the functions that add and remove the internal IPU subdevice
descriptors and links between them, rename them to make clear they
are the subdevs and links internal to the IPU. Also rename the
platform data structure for the internal IPU subdevices.
No functional changes.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Cc: stable@vger.kernel.org
---
 drivers/staging/media/imx/imx-ic-common.c        |  2 +-
 drivers/staging/media/imx/imx-media-dev.c        | 10 +++++-----
 .../staging/media/imx/imx-media-internal-sd.c    | 16 ++++++++--------
 drivers/staging/media/imx/imx-media-vdic.c       |  2 +-
 drivers/staging/media/imx/imx-media.h            | 10 +++++-----
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/media/imx/imx-ic-common.c b/drivers/staging/media/imx/imx-ic-common.c
index cfdd4900a3be..94dc5d88a069 100644
--- a/drivers/staging/media/imx/imx-ic-common.c
+++ b/drivers/staging/media/imx/imx-ic-common.c
@@ -26,7 +26,7 @@ static struct imx_ic_ops *ic_ops[IC_NUM_OPS] = {
 
 static int imx_ic_probe(struct platform_device *pdev)
 {
-	struct imx_media_internal_sd_platformdata *pdata;
+	struct imx_media_ipu_internal_sd_pdata *pdata;
 	struct imx_ic_priv *priv;
 	int ret;
 
diff --git a/drivers/staging/media/imx/imx-media-dev.c b/drivers/staging/media/imx/imx-media-dev.c
index 4b344a4a3706..edf9c80bbbc8 100644
--- a/drivers/staging/media/imx/imx-media-dev.c
+++ b/drivers/staging/media/imx/imx-media-dev.c
@@ -155,7 +155,7 @@ static int imx_media_create_links(struct v4l2_async_notifier *notifier)
 		case IMX_MEDIA_GRP_ID_IC_PRPVF:
 		case IMX_MEDIA_GRP_ID_CSI0:
 		case IMX_MEDIA_GRP_ID_CSI1:
-			ret = imx_media_create_internal_links(imxmd, sd);
+			ret = imx_media_create_ipu_internal_links(imxmd, sd);
 			if (ret)
 				return ret;
 			/*
@@ -487,10 +487,10 @@ static int imx_media_probe(struct platform_device *pdev)
 		goto notifier_cleanup;
 	}
 
-	ret = imx_media_add_internal_subdevs(imxmd);
+	ret = imx_media_add_ipu_internal_subdevs(imxmd);
 	if (ret) {
 		v4l2_err(&imxmd->v4l2_dev,
-			 "add_internal_subdevs failed with %d\n", ret);
+			 "add_ipu_internal_subdevs failed with %d\n", ret);
 		goto notifier_cleanup;
 	}
 
@@ -513,7 +513,7 @@ static int imx_media_probe(struct platform_device *pdev)
 	return 0;
 
 del_int:
-	imx_media_remove_internal_subdevs(imxmd);
+	imx_media_remove_ipu_internal_subdevs(imxmd);
 notifier_cleanup:
 	v4l2_async_notifier_cleanup(&imxmd->notifier);
 	v4l2_device_unregister(&imxmd->v4l2_dev);
@@ -530,7 +530,7 @@ static int imx_media_remove(struct platform_device *pdev)
 	v4l2_info(&imxmd->v4l2_dev, "Removing imx-media\n");
 
 	v4l2_async_notifier_unregister(&imxmd->notifier);
-	imx_media_remove_internal_subdevs(imxmd);
+	imx_media_remove_ipu_internal_subdevs(imxmd);
 	v4l2_async_notifier_cleanup(&imxmd->notifier);
 	v4l2_device_unregister(&imxmd->v4l2_dev);
 	media_device_unregister(&imxmd->md);
diff --git a/drivers/staging/media/imx/imx-media-internal-sd.c b/drivers/staging/media/imx/imx-media-internal-sd.c
index 0fdc45dbfb76..b8e763dbbecb 100644
--- a/drivers/staging/media/imx/imx-media-internal-sd.c
+++ b/drivers/staging/media/imx/imx-media-internal-sd.c
@@ -1,7 +1,7 @@
 /*
  * Media driver for Freescale i.MX5/6 SOC
  *
- * Adds the internal subdevices and the media links between them.
+ * Adds the IPU internal subdevices and the media links between them.
  *
  * Copyright (c) 2016 Mentor Graphics Inc.
  *
@@ -192,7 +192,7 @@ static struct v4l2_subdev *find_sink(struct imx_media_dev *imxmd,
 
 	/*
 	 * retrieve IPU id from subdev name, note: can't get this from
-	 * struct imx_media_internal_sd_platformdata because if src is
+	 * struct imx_media_ipu_internal_sd_pdata because if src is
 	 * a CSI, it has different struct ipu_client_platformdata which
 	 * does not contain IPU id.
 	 */
@@ -229,8 +229,8 @@ static int create_ipu_internal_link(struct imx_media_dev *imxmd,
 	return ret;
 }
 
-int imx_media_create_internal_links(struct imx_media_dev *imxmd,
-				    struct v4l2_subdev *sd)
+int imx_media_create_ipu_internal_links(struct imx_media_dev *imxmd,
+					struct v4l2_subdev *sd)
 {
 	const struct internal_subdev *intsd;
 	const struct internal_pad *intpad;
@@ -270,7 +270,7 @@ static int add_internal_subdev(struct imx_media_dev *imxmd,
 			       const struct internal_subdev *isd,
 			       int ipu_id)
 {
-	struct imx_media_internal_sd_platformdata pdata;
+	struct imx_media_ipu_internal_sd_pdata pdata;
 	struct platform_device_info pdevinfo = {};
 	struct platform_device *pdev;
 
@@ -328,7 +328,7 @@ static int add_ipu_internal_subdevs(struct imx_media_dev *imxmd, int ipu_id)
 	return 0;
 }
 
-int imx_media_add_internal_subdevs(struct imx_media_dev *imxmd)
+int imx_media_add_ipu_internal_subdevs(struct imx_media_dev *imxmd)
 {
 	int ret;
 
@@ -343,11 +343,11 @@ int imx_media_add_internal_subdevs(struct imx_media_dev *imxmd)
 	return 0;
 
 remove:
-	imx_media_remove_internal_subdevs(imxmd);
+	imx_media_remove_ipu_internal_subdevs(imxmd);
 	return ret;
 }
 
-void imx_media_remove_internal_subdevs(struct imx_media_dev *imxmd)
+void imx_media_remove_ipu_internal_subdevs(struct imx_media_dev *imxmd)
 {
 	struct imx_media_async_subdev *imxasd;
 	struct v4l2_async_subdev *asd;
diff --git a/drivers/staging/media/imx/imx-media-vdic.c b/drivers/staging/media/imx/imx-media-vdic.c
index 4a890714193e..efd2e028a098 100644
--- a/drivers/staging/media/imx/imx-media-vdic.c
+++ b/drivers/staging/media/imx/imx-media-vdic.c
@@ -931,7 +931,7 @@ static const struct v4l2_subdev_internal_ops vdic_internal_ops = {
 
 static int imx_vdic_probe(struct platform_device *pdev)
 {
-	struct imx_media_internal_sd_platformdata *pdata;
+	struct imx_media_ipu_internal_sd_pdata *pdata;
 	struct vdic_priv *priv;
 	int ret;
 
diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h
index bc7feb81937c..0f915baeac8a 100644
--- a/drivers/staging/media/imx/imx-media.h
+++ b/drivers/staging/media/imx/imx-media.h
@@ -113,7 +113,7 @@ struct imx_media_pad_vdev {
 	struct list_head list;
 };
 
-struct imx_media_internal_sd_platformdata {
+struct imx_media_ipu_internal_sd_pdata {
 	char sd_name[V4L2_SUBDEV_NAME_SIZE];
 	u32 grp_id;
 	int ipu_id;
@@ -237,10 +237,10 @@ struct imx_media_fim *imx_media_fim_init(struct v4l2_subdev *sd);
 void imx_media_fim_free(struct imx_media_fim *fim);
 
 /* imx-media-internal-sd.c */
-int imx_media_add_internal_subdevs(struct imx_media_dev *imxmd);
-int imx_media_create_internal_links(struct imx_media_dev *imxmd,
-				    struct v4l2_subdev *sd);
-void imx_media_remove_internal_subdevs(struct imx_media_dev *imxmd);
+int imx_media_add_ipu_internal_subdevs(struct imx_media_dev *imxmd);
+int imx_media_create_ipu_internal_links(struct imx_media_dev *imxmd,
+					struct v4l2_subdev *sd);
+void imx_media_remove_ipu_internal_subdevs(struct imx_media_dev *imxmd);
 
 /* imx-media-of.c */
 int imx_media_add_of_subdevs(struct imx_media_dev *dev,
-- 
2.17.1


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

* [PATCH 4/4] media: imx: Don't register IPU subdevs/links if CSI port missing
       [not found] <20190119214600.30897-1-slongerbeam@gmail.com>
                   ` (2 preceding siblings ...)
  2019-01-19 21:45 ` [PATCH 3/4] media: imx: Rename functions that add IPU-internal subdevs/links Steve Longerbeam
@ 2019-01-19 21:46 ` Steve Longerbeam
  2019-01-21 16:59   ` Philipp Zabel
  3 siblings, 1 reply; 8+ messages in thread
From: Steve Longerbeam @ 2019-01-19 21:46 UTC (permalink / raw)
  To: linux-media
  Cc: Steve Longerbeam, stable, Philipp Zabel, Mauro Carvalho Chehab,
	Greg Kroah-Hartman, open list:STAGING SUBSYSTEM, open list

The second IPU internal sub-devices were being registered and links
to them created even when the second IPU is not present. This is wrong
for i.MX6 S/DL and i.MX53 which have only a single IPU.

Fixes: e130291212df5 ("[media] media: Add i.MX media core driver")

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Cc: stable@vger.kernel.org
---
 drivers/staging/media/imx/imx-media-dev.c     |  7 --
 .../staging/media/imx/imx-media-internal-sd.c | 22 +-----
 drivers/staging/media/imx/imx-media-of.c      | 76 ++++++++++++-------
 drivers/staging/media/imx/imx-media.h         |  3 +-
 4 files changed, 53 insertions(+), 55 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-dev.c b/drivers/staging/media/imx/imx-media-dev.c
index edf9c80bbbc8..924166cf957b 100644
--- a/drivers/staging/media/imx/imx-media-dev.c
+++ b/drivers/staging/media/imx/imx-media-dev.c
@@ -487,13 +487,6 @@ static int imx_media_probe(struct platform_device *pdev)
 		goto notifier_cleanup;
 	}
 
-	ret = imx_media_add_ipu_internal_subdevs(imxmd);
-	if (ret) {
-		v4l2_err(&imxmd->v4l2_dev,
-			 "add_ipu_internal_subdevs failed with %d\n", ret);
-		goto notifier_cleanup;
-	}
-
 	/* no subdevs? just bail */
 	if (list_empty(&imxmd->notifier.asd_list)) {
 		ret = -ENODEV;
diff --git a/drivers/staging/media/imx/imx-media-internal-sd.c b/drivers/staging/media/imx/imx-media-internal-sd.c
index b8e763dbbecb..3811c12d475b 100644
--- a/drivers/staging/media/imx/imx-media-internal-sd.c
+++ b/drivers/staging/media/imx/imx-media-internal-sd.c
@@ -298,13 +298,14 @@ static int add_internal_subdev(struct imx_media_dev *imxmd,
 }
 
 /* adds the internal subdevs in one ipu */
-static int add_ipu_internal_subdevs(struct imx_media_dev *imxmd, int ipu_id)
+int imx_media_add_ipu_internal_subdevs(struct imx_media_dev *imxmd,
+				       int ipu_id)
 {
 	enum isd_enum i;
+	int ret;
 
 	for (i = 0; i < num_isd; i++) {
 		const struct internal_subdev *isd = &int_subdev[i];
-		int ret;
 
 		/*
 		 * the CSIs are represented in the device-tree, so those
@@ -322,25 +323,10 @@ static int add_ipu_internal_subdevs(struct imx_media_dev *imxmd, int ipu_id)
 		}
 
 		if (ret)
-			return ret;
+			goto remove;
 	}
 
 	return 0;
-}
-
-int imx_media_add_ipu_internal_subdevs(struct imx_media_dev *imxmd)
-{
-	int ret;
-
-	ret = add_ipu_internal_subdevs(imxmd, 0);
-	if (ret)
-		goto remove;
-
-	ret = add_ipu_internal_subdevs(imxmd, 1);
-	if (ret)
-		goto remove;
-
-	return 0;
 
 remove:
 	imx_media_remove_ipu_internal_subdevs(imxmd);
diff --git a/drivers/staging/media/imx/imx-media-of.c b/drivers/staging/media/imx/imx-media-of.c
index 2da81a5af274..32ed1a99813f 100644
--- a/drivers/staging/media/imx/imx-media-of.c
+++ b/drivers/staging/media/imx/imx-media-of.c
@@ -20,50 +20,68 @@
 #include <video/imx-ipu-v3.h>
 #include "imx-media.h"
 
-static int of_add_csi(struct imx_media_dev *imxmd, struct device_node *csi_np)
-{
-	int ret;
-
-	if (!of_device_is_available(csi_np)) {
-		dev_dbg(imxmd->md.dev, "%s: %pOFn not enabled\n", __func__,
-			csi_np);
-		/* unavailable is not an error */
-		return 0;
-	}
-
-	/* add CSI fwnode to async notifier */
-	ret = imx_media_add_async_subdev(imxmd, of_fwnode_handle(csi_np), NULL);
-	if (ret) {
-		if (ret == -EEXIST) {
-			/* already added, everything is fine */
-			return 0;
-		}
-
-		/* other error, can't continue */
-		return ret;
-	}
-
-	return 0;
-}
-
 int imx_media_add_of_subdevs(struct imx_media_dev *imxmd,
 			     struct device_node *np)
 {
+	bool ipu_found[2] = {false, false};
 	struct device_node *csi_np;
 	int i, ret;
+	u32 ipu_id;
 
 	for (i = 0; ; i++) {
 		csi_np = of_parse_phandle(np, "ports", i);
 		if (!csi_np)
 			break;
 
-		ret = of_add_csi(imxmd, csi_np);
+		if (!of_device_is_available(csi_np)) {
+			/* ignore this CSI if not available */
+			of_node_put(csi_np);
+			continue;
+		}
+
+		/* add CSI fwnode to async notifier */
+		ret = imx_media_add_async_subdev(imxmd,
+						 of_fwnode_handle(csi_np),
+						 NULL);
+		if (ret) {
+			if (ret == -EEXIST) {
+				/* already added, everything is fine */
+				of_node_put(csi_np);
+				continue;
+			}
+
+			/* other error, can't continue */
+			goto err_out;
+		}
+
+		ret = of_alias_get_id(csi_np->parent, "ipu");
+		if (ret < 0)
+			goto err_out;
+		if (ret > 1) {
+			ret = -EINVAL;
+			goto err_out;
+		}
+
+		ipu_id = ret;
+
+		if (!ipu_found[ipu_id]) {
+			ret = imx_media_add_ipu_internal_subdevs(imxmd,
+								 ipu_id);
+			if (ret)
+				goto err_out;
+		}
+
+		ipu_found[ipu_id] = true;
+
 		of_node_put(csi_np);
-		if (ret)
-			return ret;
 	}
 
 	return 0;
+
+err_out:
+	imx_media_remove_ipu_internal_subdevs(imxmd);
+	of_node_put(csi_np);
+	return ret;
 }
 
 /*
diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h
index 0f915baeac8a..d2432b8ab67d 100644
--- a/drivers/staging/media/imx/imx-media.h
+++ b/drivers/staging/media/imx/imx-media.h
@@ -237,7 +237,8 @@ struct imx_media_fim *imx_media_fim_init(struct v4l2_subdev *sd);
 void imx_media_fim_free(struct imx_media_fim *fim);
 
 /* imx-media-internal-sd.c */
-int imx_media_add_ipu_internal_subdevs(struct imx_media_dev *imxmd);
+int imx_media_add_ipu_internal_subdevs(struct imx_media_dev *imxmd,
+				       int ipu_id);
 int imx_media_create_ipu_internal_links(struct imx_media_dev *imxmd,
 					struct v4l2_subdev *sd);
 void imx_media_remove_ipu_internal_subdevs(struct imx_media_dev *imxmd);
-- 
2.17.1


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

* Re: [PATCH 1/4] media: imx: csi: Allow unknown nearest upstream entities
  2019-01-19 21:45 ` [PATCH 1/4] media: imx: csi: Allow unknown nearest upstream entities Steve Longerbeam
@ 2019-01-21 16:50   ` Philipp Zabel
  2019-01-22  0:21     ` Steve Longerbeam
  0 siblings, 1 reply; 8+ messages in thread
From: Philipp Zabel @ 2019-01-21 16:50 UTC (permalink / raw)
  To: Steve Longerbeam, linux-media
  Cc: stable, Mauro Carvalho Chehab, Greg Kroah-Hartman,
	open list:STAGING SUBSYSTEM, open list

On Sat, 2019-01-19 at 13:45 -0800, Steve Longerbeam wrote:
> On i.MX6, the nearest upstream entity to the CSI can only be the
> CSI video muxes or the Synopsys DW MIPI CSI-2 receiver.
> 
> However the i.MX53 has no CSI video muxes or a MIPI CSI-2 receiver.
> So allow for the nearest upstream entity to the CSI to be something
> other than those.
> 
> Fixes: bf3cfaa712e5c ("media: staging/imx: get CSI bus type from nearest
> upstream entity")
> 
> Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/staging/media/imx/imx-media-csi.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
> index 555aa45e02e3..b9af7d3d4974 100644
> --- a/drivers/staging/media/imx/imx-media-csi.c
> +++ b/drivers/staging/media/imx/imx-media-csi.c
> @@ -154,9 +154,10 @@ static inline bool requires_passthrough(struct v4l2_fwnode_endpoint *ep,
>  /*
>   * Parses the fwnode endpoint from the source pad of the entity
>   * connected to this CSI. This will either be the entity directly
> - * upstream from the CSI-2 receiver, or directly upstream from the
> - * video mux. The endpoint is needed to determine the bus type and
> - * bus config coming into the CSI.
> + * upstream from the CSI-2 receiver, directly upstream from the
> + * video mux, or directly upstream from the CSI itself. The endpoint
> + * is needed to determine the bus type and bus config coming into
> + * the CSI.
>   */
>  static int csi_get_upstream_endpoint(struct csi_priv *priv,
>  				     struct v4l2_fwnode_endpoint *ep)
> @@ -172,7 +173,8 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv,
>  	if (!priv->src_sd)
>  		return -EPIPE;
>  
> -	src = &priv->src_sd->entity;
> +	sd = priv->src_sd;
> +	src = &sd->entity;
>  
>  	if (src->function == MEDIA_ENT_F_VID_MUX) {
>  		/*
> @@ -186,6 +188,14 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv,
>  			src = &sd->entity;
>  	}
>  
> +	/*
> +	 * If the source is neither the video mux nor the CSI-2 receiver,
> +	 * get the source pad directly upstream from CSI itself.
> +	 */
> +	if (src->function != MEDIA_ENT_F_VID_MUX &&

Will it work correctly if there's an external MUX connected to the CSI?

> +	    sd->grp_id != IMX_MEDIA_GRP_ID_CSI2)
> +		src = &priv->sd.entity;
> +
>  	/* get source pad of entity directly upstream from src */
>  	pad = imx_media_find_upstream_pad(priv->md, src, 0);
>  	if (IS_ERR(pad))

regards
Philipp

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

* Re: [PATCH 3/4] media: imx: Rename functions that add IPU-internal subdevs/links
  2019-01-19 21:45 ` [PATCH 3/4] media: imx: Rename functions that add IPU-internal subdevs/links Steve Longerbeam
@ 2019-01-21 16:52   ` Philipp Zabel
  0 siblings, 0 replies; 8+ messages in thread
From: Philipp Zabel @ 2019-01-21 16:52 UTC (permalink / raw)
  To: Steve Longerbeam, linux-media
  Cc: stable, Mauro Carvalho Chehab, Greg Kroah-Hartman,
	open list:STAGING SUBSYSTEM, open list

On Sat, 2019-01-19 at 13:45 -0800, Steve Longerbeam wrote:
> For the functions that add and remove the internal IPU subdevice
> descriptors and links between them, rename them to make clear they
> are the subdevs and links internal to the IPU. Also rename the
> platform data structure for the internal IPU subdevices.
> No functional changes.
> 
> Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>

Acked-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp

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

* Re: [PATCH 4/4] media: imx: Don't register IPU subdevs/links if CSI port missing
  2019-01-19 21:46 ` [PATCH 4/4] media: imx: Don't register IPU subdevs/links if CSI port missing Steve Longerbeam
@ 2019-01-21 16:59   ` Philipp Zabel
  0 siblings, 0 replies; 8+ messages in thread
From: Philipp Zabel @ 2019-01-21 16:59 UTC (permalink / raw)
  To: Steve Longerbeam, linux-media
  Cc: stable, Mauro Carvalho Chehab, Greg Kroah-Hartman,
	open list:STAGING SUBSYSTEM, open list

On Sat, 2019-01-19 at 13:46 -0800, Steve Longerbeam wrote:
> The second IPU internal sub-devices were being registered and links
> to them created even when the second IPU is not present. This is wrong
> for i.MX6 S/DL and i.MX53 which have only a single IPU.
> 
> Fixes: e130291212df5 ("[media] media: Add i.MX media core driver")
> 
> Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp

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

* Re: [PATCH 1/4] media: imx: csi: Allow unknown nearest upstream entities
  2019-01-21 16:50   ` Philipp Zabel
@ 2019-01-22  0:21     ` Steve Longerbeam
  0 siblings, 0 replies; 8+ messages in thread
From: Steve Longerbeam @ 2019-01-22  0:21 UTC (permalink / raw)
  To: Philipp Zabel, linux-media
  Cc: stable, Mauro Carvalho Chehab, Greg Kroah-Hartman,
	open list:STAGING SUBSYSTEM, open list



On 1/21/19 8:50 AM, Philipp Zabel wrote:
> On Sat, 2019-01-19 at 13:45 -0800, Steve Longerbeam wrote:
>> On i.MX6, the nearest upstream entity to the CSI can only be the
>> CSI video muxes or the Synopsys DW MIPI CSI-2 receiver.
>>
>> However the i.MX53 has no CSI video muxes or a MIPI CSI-2 receiver.
>> So allow for the nearest upstream entity to the CSI to be something
>> other than those.
>>
>> Fixes: bf3cfaa712e5c ("media: staging/imx: get CSI bus type from nearest
>> upstream entity")
>>
>> Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
>> Cc: stable@vger.kernel.org
>> ---
>>   drivers/staging/media/imx/imx-media-csi.c | 18 ++++++++++++++----
>>   1 file changed, 14 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
>> index 555aa45e02e3..b9af7d3d4974 100644
>> --- a/drivers/staging/media/imx/imx-media-csi.c
>> +++ b/drivers/staging/media/imx/imx-media-csi.c
>> @@ -154,9 +154,10 @@ static inline bool requires_passthrough(struct v4l2_fwnode_endpoint *ep,
>>   /*
>>    * Parses the fwnode endpoint from the source pad of the entity
>>    * connected to this CSI. This will either be the entity directly
>> - * upstream from the CSI-2 receiver, or directly upstream from the
>> - * video mux. The endpoint is needed to determine the bus type and
>> - * bus config coming into the CSI.
>> + * upstream from the CSI-2 receiver, directly upstream from the
>> + * video mux, or directly upstream from the CSI itself. The endpoint
>> + * is needed to determine the bus type and bus config coming into
>> + * the CSI.
>>    */
>>   static int csi_get_upstream_endpoint(struct csi_priv *priv,
>>   				     struct v4l2_fwnode_endpoint *ep)
>> @@ -172,7 +173,8 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv,
>>   	if (!priv->src_sd)
>>   		return -EPIPE;
>>   
>> -	src = &priv->src_sd->entity;
>> +	sd = priv->src_sd;
>> +	src = &sd->entity;
>>   
>>   	if (src->function == MEDIA_ENT_F_VID_MUX) {
>>   		/*
>> @@ -186,6 +188,14 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv,
>>   			src = &sd->entity;
>>   	}
>>   
>> +	/*
>> +	 * If the source is neither the video mux nor the CSI-2 receiver,
>> +	 * get the source pad directly upstream from CSI itself.
>> +	 */
>> +	if (src->function != MEDIA_ENT_F_VID_MUX &&
> Will it work correctly if there's an external MUX connected to the CSI?

By external MUX are you referring to some MUX that's external to the SoC 
(e.g. not the CSI muxes which are external to the IPU but internal to 
the SoC)? If so then yes it will still work (and of course it works if 
the MUX in question is the CSI muxes).

The function csi_get_upstream_endpoint() is only looking for, and stops 
at, the first sub-device that is external to the SoC, in order to 
determine the bus type coming into the SoC of the currently enabled 
pipeline. And that sub-device could be anything, including another MUX.

Steve

>
>> +	    sd->grp_id != IMX_MEDIA_GRP_ID_CSI2)
>> +		src = &priv->sd.entity;
>> +
>>   	/* get source pad of entity directly upstream from src */
>>   	pad = imx_media_find_upstream_pad(priv->md, src, 0);
>>   	if (IS_ERR(pad))
> regards
> Philipp


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

end of thread, other threads:[~2019-01-22  0:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190119214600.30897-1-slongerbeam@gmail.com>
2019-01-19 21:45 ` [PATCH 1/4] media: imx: csi: Allow unknown nearest upstream entities Steve Longerbeam
2019-01-21 16:50   ` Philipp Zabel
2019-01-22  0:21     ` Steve Longerbeam
2019-01-19 21:45 ` [PATCH 2/4] media: imx: Clear fwnode link struct for each endpoint iteration Steve Longerbeam
2019-01-19 21:45 ` [PATCH 3/4] media: imx: Rename functions that add IPU-internal subdevs/links Steve Longerbeam
2019-01-21 16:52   ` Philipp Zabel
2019-01-19 21:46 ` [PATCH 4/4] media: imx: Don't register IPU subdevs/links if CSI port missing Steve Longerbeam
2019-01-21 16:59   ` Philipp Zabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).