All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] media: adv748x: Add CSI-2 VC support
@ 2021-12-16 17:03 Jacopo Mondi
  2021-12-16 17:03 ` [PATCH 1/5] media: adv748x: Add flags to adv748x_subdev_init() Jacopo Mondi
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Jacopo Mondi @ 2021-12-16 17:03 UTC (permalink / raw)
  To: tomi.valkeinen, sakari.ailus, laurent.pinchart, niklas.soderlund,
	kieran.bingham
  Cc: Jacopo Mondi, Mauro Carvalho Chehab, Hans Verkuil, linux-media,
	linux-renesas-soc

Hello
   based on Tomi's v10, this series adds support for configurable virtual
channel selection to the adv748x driver.

A branch for testing is available at
https://git.sr.ht/~jmondi_/linux #multistream/tomba-v10/gmsl

This series upports BSP commit
https://github.com/renesas-rcar/linux-bsp/commit/8340a028b21a5ba1dc09a55a6d2ec6cbd47d557b?diff=unified

Tested on R-Car M3-W

Thanks
   j

Jacopo Mondi (5):
  media: adv748x: Add flags to adv748x_subdev_init()
  media: adv748x: Add support for v4l2_subdev_state
  media: adv748x: Move format to subdev state
  media: adv748x: Implement .get_frame_desc()
  media: adv748x: Implement set_routing

 drivers/media/i2c/adv748x/adv748x-afe.c  |   2 +-
 drivers/media/i2c/adv748x/adv748x-core.c |   4 +-
 drivers/media/i2c/adv748x/adv748x-csi2.c | 292 ++++++++++++++++++-----
 drivers/media/i2c/adv748x/adv748x-hdmi.c |   2 +-
 drivers/media/i2c/adv748x/adv748x.h      |   6 +-
 5 files changed, 244 insertions(+), 62 deletions(-)

--
2.33.1


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

* [PATCH 1/5] media: adv748x: Add flags to adv748x_subdev_init()
  2021-12-16 17:03 [PATCH 0/5] media: adv748x: Add CSI-2 VC support Jacopo Mondi
@ 2021-12-16 17:03 ` Jacopo Mondi
  2021-12-16 17:03 ` [PATCH 2/5] media: adv748x: Add support for v4l2_subdev_state Jacopo Mondi
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 14+ messages in thread
From: Jacopo Mondi @ 2021-12-16 17:03 UTC (permalink / raw)
  To: tomi.valkeinen, sakari.ailus, laurent.pinchart, niklas.soderlund,
	kieran.bingham
  Cc: Jacopo Mondi, Mauro Carvalho Chehab, Hans Verkuil, linux-media,
	linux-renesas-soc

Add a flags parameter to the adv748x_subdev_init() function that
allows to pass additional flags to the v4l2_subdevice.

This will be used to identify the CSI-2 subdevices as multiplexed.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/i2c/adv748x/adv748x-afe.c  | 2 +-
 drivers/media/i2c/adv748x/adv748x-core.c | 4 ++--
 drivers/media/i2c/adv748x/adv748x-csi2.c | 2 +-
 drivers/media/i2c/adv748x/adv748x-hdmi.c | 2 +-
 drivers/media/i2c/adv748x/adv748x.h      | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/i2c/adv748x/adv748x-afe.c b/drivers/media/i2c/adv748x/adv748x-afe.c
index 02eabe10ab97..0d05e8a8887f 100644
--- a/drivers/media/i2c/adv748x/adv748x-afe.c
+++ b/drivers/media/i2c/adv748x/adv748x-afe.c
@@ -510,7 +510,7 @@ int adv748x_afe_init(struct adv748x_afe *afe)
 	afe->curr_norm = V4L2_STD_NTSC_M;
 
 	adv748x_subdev_init(&afe->sd, state, &adv748x_afe_ops,
-			    MEDIA_ENT_F_ATV_DECODER, "afe");
+			    MEDIA_ENT_F_ATV_DECODER, 0, "afe");
 
 	/* Identify the first connector found as a default input if set */
 	for (i = ADV748X_PORT_AIN0; i <= ADV748X_PORT_AIN7; i++) {
diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c
index 4e54148147b9..0961b1468465 100644
--- a/drivers/media/i2c/adv748x/adv748x-core.c
+++ b/drivers/media/i2c/adv748x/adv748x-core.c
@@ -583,10 +583,10 @@ static int __maybe_unused adv748x_resume_early(struct device *dev)
 
 void adv748x_subdev_init(struct v4l2_subdev *sd, struct adv748x_state *state,
 			 const struct v4l2_subdev_ops *ops, u32 function,
-			 const char *ident)
+			 u32 flags, const char *ident)
 {
 	v4l2_subdev_init(sd, ops);
-	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | flags;
 
 	/* the owner is the same as the i2c_client's driver owner */
 	sd->owner = state->dev->driver->owner;
diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c
index 589e9644fcdc..6cbb47a715ab 100644
--- a/drivers/media/i2c/adv748x/adv748x-csi2.c
+++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
@@ -313,7 +313,7 @@ int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx)
 		return 0;
 
 	adv748x_subdev_init(&tx->sd, state, &adv748x_csi2_ops,
-			    MEDIA_ENT_F_VID_IF_BRIDGE,
+			    MEDIA_ENT_F_VID_IF_BRIDGE, 0,
 			    is_txa(tx) ? "txa" : "txb");
 
 	/* Ensure that matching is based upon the endpoint fwnodes */
diff --git a/drivers/media/i2c/adv748x/adv748x-hdmi.c b/drivers/media/i2c/adv748x/adv748x-hdmi.c
index 52fa7bd75660..535a21b3c350 100644
--- a/drivers/media/i2c/adv748x/adv748x-hdmi.c
+++ b/drivers/media/i2c/adv748x/adv748x-hdmi.c
@@ -732,7 +732,7 @@ int adv748x_hdmi_init(struct adv748x_hdmi *hdmi)
 	hdmi->aspect_ratio.denominator = 9;
 
 	adv748x_subdev_init(&hdmi->sd, state, &adv748x_ops_hdmi,
-			    MEDIA_ENT_F_IO_DTV, "hdmi");
+			    MEDIA_ENT_F_IO_DTV, 0, "hdmi");
 
 	hdmi->pads[ADV748X_HDMI_SINK].flags = MEDIA_PAD_FL_SINK;
 	hdmi->pads[ADV748X_HDMI_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h
index 31bac06d46b5..92c8caee6a42 100644
--- a/drivers/media/i2c/adv748x/adv748x.h
+++ b/drivers/media/i2c/adv748x/adv748x.h
@@ -426,7 +426,7 @@ static inline struct v4l2_subdev *adv748x_get_remote_sd(struct media_pad *pad)
 
 void adv748x_subdev_init(struct v4l2_subdev *sd, struct adv748x_state *state,
 			 const struct v4l2_subdev_ops *ops, u32 function,
-			 const char *ident);
+			 u32 flags, const char *ident);
 
 int adv748x_register_subdevs(struct adv748x_state *state,
 			     struct v4l2_device *v4l2_dev);
-- 
2.33.1


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

* [PATCH 2/5] media: adv748x: Add support for v4l2_subdev_state
  2021-12-16 17:03 [PATCH 0/5] media: adv748x: Add CSI-2 VC support Jacopo Mondi
  2021-12-16 17:03 ` [PATCH 1/5] media: adv748x: Add flags to adv748x_subdev_init() Jacopo Mondi
@ 2021-12-16 17:03 ` Jacopo Mondi
  2021-12-17  2:41     ` kernel test robot
  2021-12-17  4:24     ` kernel test robot
  2021-12-16 17:03 ` [PATCH 3/5] media: adv748x: Move format to subdev state Jacopo Mondi
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 14+ messages in thread
From: Jacopo Mondi @ 2021-12-16 17:03 UTC (permalink / raw)
  To: tomi.valkeinen, sakari.ailus, laurent.pinchart, niklas.soderlund,
	kieran.bingham
  Cc: Jacopo Mondi, Mauro Carvalho Chehab, Hans Verkuil, linux-media,
	linux-renesas-soc

Create and initialize the v4l2_subdev_state for the adv748x CSI-2
subdevice in order to prepare to support routing of the video stream.

Create the subdevice state with v4l2_subdev_init_finalize() and
implement the init_cfg() operation to guarantee the state is initialized
correctly with the default routing set.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/i2c/adv748x/adv748x-csi2.c | 57 +++++++++++++++++++++++-
 drivers/media/i2c/adv748x/adv748x.h      |  3 ++
 2 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c
index 6cbb47a715ab..9061c34ba561 100644
--- a/drivers/media/i2c/adv748x/adv748x-csi2.c
+++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
@@ -139,6 +139,50 @@ static const struct v4l2_subdev_video_ops adv748x_csi2_video_ops = {
  * But we must support setting the pad formats for format propagation.
  */
 
+static int adv748x_csi2_init_cfg(struct v4l2_subdev *sd,
+				 struct v4l2_subdev_state *state)
+{
+	/* One route for each virtual channel. Route 0 enabled by default. */
+	struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
+		{
+			.sink_pad = ADV748X_CSI2_SINK,
+			.sink_stream = 0,
+			.source_pad = ADV748X_CSI2_SOURCE,
+			.source_stream = 0,
+			.flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
+		},
+		{
+			.sink_pad = ADV748X_CSI2_SINK,
+			.sink_stream = 0,
+			.source_pad = ADV748X_CSI2_SOURCE,
+			.source_stream = 1,
+		},
+		{
+			.sink_pad = ADV748X_CSI2_SINK,
+			.sink_stream = 0,
+			.source_pad = ADV748X_CSI2_SOURCE,
+			.source_stream = 2,
+		},
+		{
+			.sink_pad = ADV748X_CSI2_SINK,
+			.sink_stream = 0,
+			.source_pad = ADV748X_CSI2_SOURCE,
+			.source_stream = 3,
+		},
+	};
+	struct v4l2_subdev_krouting routing;
+	int ret;
+
+	routing.num_routes = ADV748X_CSI2_STREAMS;
+	routing.routes = routes;
+
+	v4l2_subdev_lock_state(state);
+	ret = v4l2_subdev_set_routing(sd, state, &routing);
+	v4l2_subdev_unlock_state(state);
+
+	return ret;
+}
+
 static struct v4l2_mbus_framefmt *
 adv748x_csi2_get_pad_format(struct v4l2_subdev *sd,
 			    struct v4l2_subdev_state *sd_state,
@@ -244,6 +288,7 @@ static int adv748x_csi2_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad
 }
 
 static const struct v4l2_subdev_pad_ops adv748x_csi2_pad_ops = {
+	.init_cfg = adv748x_csi2_init_cfg,
 	.get_fmt = adv748x_csi2_get_format,
 	.set_fmt = adv748x_csi2_set_format,
 	.get_mbus_config = adv748x_csi2_get_mbus_config,
@@ -313,7 +358,8 @@ int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx)
 		return 0;
 
 	adv748x_subdev_init(&tx->sd, state, &adv748x_csi2_ops,
-			    MEDIA_ENT_F_VID_IF_BRIDGE, 0,
+			    MEDIA_ENT_F_VID_IF_BRIDGE,
+			    V4L2_SUBDEV_FL_MULTIPLEXED,
 			    is_txa(tx) ? "txa" : "txb");
 
 	/* Ensure that matching is based upon the endpoint fwnodes */
@@ -330,10 +376,14 @@ int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx)
 	if (ret)
 		return ret;
 
-	ret = adv748x_csi2_init_controls(tx);
+	ret = v4l2_subdev_init_finalize(&tx->sd);
 	if (ret)
 		goto err_free_media;
 
+	ret = adv748x_csi2_init_controls(tx);
+	if (ret)
+		goto err_free_state;
+
 	ret = v4l2_async_register_subdev(&tx->sd);
 	if (ret)
 		goto err_free_ctrl;
@@ -342,6 +392,8 @@ int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx)
 
 err_free_ctrl:
 	v4l2_ctrl_handler_free(&tx->ctrl_hdl);
+err_free_state:
+	v4l2_subdev_cleanup(&tx->sd);
 err_free_media:
 	media_entity_cleanup(&tx->sd.entity);
 
@@ -354,6 +406,7 @@ void adv748x_csi2_cleanup(struct adv748x_csi2 *tx)
 		return;
 
 	v4l2_async_unregister_subdev(&tx->sd);
+	v4l2_subdev_cleanup(&tx->sd);
 	media_entity_cleanup(&tx->sd.entity);
 	v4l2_ctrl_handler_free(&tx->ctrl_hdl);
 }
diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h
index 92c8caee6a42..d651c8390e6f 100644
--- a/drivers/media/i2c/adv748x/adv748x.h
+++ b/drivers/media/i2c/adv748x/adv748x.h
@@ -73,6 +73,9 @@ enum adv748x_csi2_pads {
 /* CSI2 transmitters can have 2 internal connections, HDMI/AFE */
 #define ADV748X_CSI2_MAX_SUBDEVS 2
 
+/* CSI2 number of streams: 1 for each CSI-2 Virtual channel output. */
+#define ADV748X_CSI2_STREAMS	4
+
 struct adv748x_csi2 {
 	struct adv748x_state *state;
 	struct v4l2_mbus_framefmt format;
-- 
2.33.1


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

* [PATCH 3/5] media: adv748x: Move format to subdev state
  2021-12-16 17:03 [PATCH 0/5] media: adv748x: Add CSI-2 VC support Jacopo Mondi
  2021-12-16 17:03 ` [PATCH 1/5] media: adv748x: Add flags to adv748x_subdev_init() Jacopo Mondi
  2021-12-16 17:03 ` [PATCH 2/5] media: adv748x: Add support for v4l2_subdev_state Jacopo Mondi
@ 2021-12-16 17:03 ` Jacopo Mondi
  2021-12-17  7:30     ` kernel test robot
  2021-12-16 17:03 ` [PATCH 4/5] media: adv748x: Implement .get_frame_desc() Jacopo Mondi
  2021-12-16 17:03 ` [PATCH 5/5] media: adv748x: Implement set_routing Jacopo Mondi
  4 siblings, 1 reply; 14+ messages in thread
From: Jacopo Mondi @ 2021-12-16 17:03 UTC (permalink / raw)
  To: tomi.valkeinen, sakari.ailus, laurent.pinchart, niklas.soderlund,
	kieran.bingham
  Cc: Jacopo Mondi, Mauro Carvalho Chehab, Hans Verkuil, linux-media,
	linux-renesas-soc

Move format handling to the v4l2_subdev state and store it per
(pad, stream) combination.

Now that the image format is stored in the subdev state, it can be
accessed through v4l2_subdev_get_fmt() instead of open-coding it.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/i2c/adv748x/adv748x-csi2.c | 83 +++++++-----------------
 drivers/media/i2c/adv748x/adv748x.h      |  1 -
 2 files changed, 22 insertions(+), 62 deletions(-)

diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c
index 9061c34ba561..549c3cd96006 100644
--- a/drivers/media/i2c/adv748x/adv748x-csi2.c
+++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
@@ -183,76 +183,37 @@ static int adv748x_csi2_init_cfg(struct v4l2_subdev *sd,
 	return ret;
 }
 
-static struct v4l2_mbus_framefmt *
-adv748x_csi2_get_pad_format(struct v4l2_subdev *sd,
-			    struct v4l2_subdev_state *sd_state,
-			    unsigned int pad, u32 which)
-{
-	struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
-
-	if (which == V4L2_SUBDEV_FORMAT_TRY)
-		return v4l2_subdev_get_try_format(sd, sd_state, pad);
-
-	return &tx->format;
-}
-
-static int adv748x_csi2_get_format(struct v4l2_subdev *sd,
-				   struct v4l2_subdev_state *sd_state,
-				   struct v4l2_subdev_format *sdformat)
-{
-	struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
-	struct adv748x_state *state = tx->state;
-	struct v4l2_mbus_framefmt *mbusformat;
-
-	mbusformat = adv748x_csi2_get_pad_format(sd, sd_state, sdformat->pad,
-						 sdformat->which);
-	if (!mbusformat)
-		return -EINVAL;
-
-	mutex_lock(&state->mutex);
-
-	sdformat->format = *mbusformat;
-
-	mutex_unlock(&state->mutex);
-
-	return 0;
-}
-
 static int adv748x_csi2_set_format(struct v4l2_subdev *sd,
 				   struct v4l2_subdev_state *sd_state,
 				   struct v4l2_subdev_format *sdformat)
 {
-	struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
-	struct adv748x_state *state = tx->state;
-	struct v4l2_mbus_framefmt *mbusformat;
+	struct v4l2_mbus_framefmt *fmt;
 	int ret = 0;
 
-	mbusformat = adv748x_csi2_get_pad_format(sd, sd_state, sdformat->pad,
-						 sdformat->which);
-	if (!mbusformat)
+	/* Do not allow to set format on the multiplexed source pad. */
+	if (sdformat->pad == ADV748X_CSI2_SOURCE)
 		return -EINVAL;
 
-	mutex_lock(&state->mutex);
-
-	if (sdformat->pad == ADV748X_CSI2_SOURCE) {
-		const struct v4l2_mbus_framefmt *sink_fmt;
-
-		sink_fmt = adv748x_csi2_get_pad_format(sd, sd_state,
-						       ADV748X_CSI2_SINK,
-						       sdformat->which);
-
-		if (!sink_fmt) {
-			ret = -EINVAL;
-			goto unlock;
-		}
-
-		sdformat->format = *sink_fmt;
+	v4l2_subdev_lock_state(sd_state);
+	fmt = v4l2_state_get_stream_format(sd_state, sdformat->pad,
+					   sdformat->stream);
+	if (!fmt) {
+		ret = -EINVAL;
+		goto out;
+	};
+	*fmt = sdformat->format;
+
+	/* Propagate format to the other end of the route. */
+	fmt = v4l2_subdev_state_get_opposite_stream_format(sd_state, sdformat->pad,
+							   sdformat->stream);
+	if (!fmt) {
+		ret = -EINVAL;
+		goto out;
 	}
+	*fmt = sdformat->format;
 
-	*mbusformat = sdformat->format;
-
-unlock:
-	mutex_unlock(&state->mutex);
+out:
+	v4l2_subdev_unlock_state(sd_state);
 
 	return ret;
 }
@@ -289,7 +250,7 @@ static int adv748x_csi2_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad
 
 static const struct v4l2_subdev_pad_ops adv748x_csi2_pad_ops = {
 	.init_cfg = adv748x_csi2_init_cfg,
-	.get_fmt = adv748x_csi2_get_format,
+	.get_fmt = v4l2_subdev_get_fmt,
 	.set_fmt = adv748x_csi2_set_format,
 	.get_mbus_config = adv748x_csi2_get_mbus_config,
 };
diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h
index d651c8390e6f..98a3b3e0642a 100644
--- a/drivers/media/i2c/adv748x/adv748x.h
+++ b/drivers/media/i2c/adv748x/adv748x.h
@@ -78,7 +78,6 @@ enum adv748x_csi2_pads {
 
 struct adv748x_csi2 {
 	struct adv748x_state *state;
-	struct v4l2_mbus_framefmt format;
 	unsigned int page;
 	unsigned int port;
 	unsigned int num_lanes;
-- 
2.33.1


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

* [PATCH 4/5] media: adv748x: Implement .get_frame_desc()
  2021-12-16 17:03 [PATCH 0/5] media: adv748x: Add CSI-2 VC support Jacopo Mondi
                   ` (2 preceding siblings ...)
  2021-12-16 17:03 ` [PATCH 3/5] media: adv748x: Move format to subdev state Jacopo Mondi
@ 2021-12-16 17:03 ` Jacopo Mondi
  2021-12-17  3:12     ` kernel test robot
  2021-12-16 17:03 ` [PATCH 5/5] media: adv748x: Implement set_routing Jacopo Mondi
  4 siblings, 1 reply; 14+ messages in thread
From: Jacopo Mondi @ 2021-12-16 17:03 UTC (permalink / raw)
  To: tomi.valkeinen, sakari.ailus, laurent.pinchart, niklas.soderlund,
	kieran.bingham
  Cc: Jacopo Mondi, Mauro Carvalho Chehab, Hans Verkuil, linux-media,
	linux-renesas-soc

Implement the get_frame_desc subdev pad operation.

Implement the get_frame_desc pad operation to allow retrieving the
stream configuration of the adv748x csi2 subdevice.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/i2c/adv748x/adv748x-csi2.c | 93 ++++++++++++++++++++++++
 1 file changed, 93 insertions(+)

diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c
index 549c3cd96006..9824ebe44eb1 100644
--- a/drivers/media/i2c/adv748x/adv748x-csi2.c
+++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
@@ -14,6 +14,50 @@
 
 #include "adv748x.h"
 
+/* Describes a format bit depth and CSI-2 defined Data Type. */
+struct adv748x_csi2_format_info {
+	u8 dt;
+	u8 bpp;
+};
+
+static int adv748x_csi2_get_format_info(struct adv748x_csi2 *tx,
+					u32 mbus_code,
+					struct adv748x_csi2_format_info *fmt)
+{
+	switch (mbus_code) {
+	case MEDIA_BUS_FMT_YUYV8_1X16:
+	case MEDIA_BUS_FMT_YUYV8_2X8:
+		fmt->dt = 0x1e;
+		fmt->bpp = 16;
+		break;
+	case MEDIA_BUS_FMT_YUYV10_2X10:
+	case MEDIA_BUS_FMT_YUYV10_1X20:
+		fmt->dt = 0x1f;
+		fmt->bpp = 20;
+		break;
+	case MEDIA_BUS_FMT_RGB565_1X16:
+	case MEDIA_BUS_FMT_RGB565_2X8_LE:
+	case MEDIA_BUS_FMT_RGB565_2X8_BE:
+		fmt->dt = 0x22;
+		fmt->bpp = 16;
+		break;
+	case MEDIA_BUS_FMT_RGB666_1X18:
+		fmt->dt = 0x23;
+		fmt->bpp = 18;
+		break;
+	case MEDIA_BUS_FMT_RGB888_1X24:
+		fmt->dt = 0x24;
+		fmt->bpp = 24;
+		break;
+	default:
+		dev_err(tx->state->dev,
+			"Unsupported media bus code: %u\n", mbus_code);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 int adv748x_csi2_set_virtual_channel(struct adv748x_csi2 *tx, unsigned int vc)
 {
 	return tx_write(tx, ADV748X_CSI_VC_REF, vc << ADV748X_CSI_VC_REF_SHIFT);
@@ -248,11 +292,60 @@ static int adv748x_csi2_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad
 	return 0;
 }
 
+static int adv748x_csi2_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
+				       struct v4l2_mbus_frame_desc *fd)
+{
+	struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
+	struct adv748x_csi2_format_info info = {};
+	struct v4l2_mbus_frame_desc_entry *entry;
+	struct v4l2_subdev_route *route;
+	struct v4l2_subdev_state *state;
+	struct v4l2_mbus_framefmt *fmt;
+	int ret;
+
+	if (pad != ADV748X_CSI2_SOURCE)
+		return -EINVAL;
+
+	state = v4l2_subdev_lock_active_state(sd);
+
+	/* A single route is available. */
+	route = &state->routing.routes[0];
+	fmt = v4l2_state_get_stream_format(state, pad, route->source_stream);
+	if (!fmt) {
+		ret = -EINVAL;
+		goto out;
+	}
+
+	ret = adv748x_csi2_get_format_info(tx, fmt->code, &info);
+	if (ret)
+		goto out;
+
+	memset(fd, 0, sizeof(*fd));
+
+	/* A single stream is available. */
+	fd->num_entries = 1;
+	fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
+
+	entry = &fd->entry[0];
+	entry->stream = 0;
+	entry->flags = V4L2_MBUS_FRAME_DESC_FL_LEN_MAX;
+	entry->length = fmt->width * fmt->height * info.bpp / 8;
+	entry->pixelcode = fmt->code;
+	entry->bus.csi2.vc = route->source_stream;
+	entry->bus.csi2.dt = info.dt;
+
+out:
+	v4l2_subdev_unlock_state(state);
+
+	return ret;
+}
+
 static const struct v4l2_subdev_pad_ops adv748x_csi2_pad_ops = {
 	.init_cfg = adv748x_csi2_init_cfg,
 	.get_fmt = v4l2_subdev_get_fmt,
 	.set_fmt = adv748x_csi2_set_format,
 	.get_mbus_config = adv748x_csi2_get_mbus_config,
+	.get_frame_desc = adv748x_csi2_get_frame_desc,
 };
 
 /* -----------------------------------------------------------------------------
-- 
2.33.1


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

* [PATCH 5/5] media: adv748x: Implement set_routing
  2021-12-16 17:03 [PATCH 0/5] media: adv748x: Add CSI-2 VC support Jacopo Mondi
                   ` (3 preceding siblings ...)
  2021-12-16 17:03 ` [PATCH 4/5] media: adv748x: Implement .get_frame_desc() Jacopo Mondi
@ 2021-12-16 17:03 ` Jacopo Mondi
  4 siblings, 0 replies; 14+ messages in thread
From: Jacopo Mondi @ 2021-12-16 17:03 UTC (permalink / raw)
  To: tomi.valkeinen, sakari.ailus, laurent.pinchart, niklas.soderlund,
	kieran.bingham
  Cc: Jacopo Mondi, Mauro Carvalho Chehab, Hans Verkuil, linux-media,
	linux-renesas-soc

Add the set_routing() subdev operation to allow userspace to configure
the CSI-2 virtual channel.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/i2c/adv748x/adv748x-csi2.c | 73 ++++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c
index 9824ebe44eb1..bf927898b918 100644
--- a/drivers/media/i2c/adv748x/adv748x-csi2.c
+++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
@@ -340,12 +340,85 @@ static int adv748x_csi2_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
 	return ret;
 }
 
+static int adv748x_csi2_routing_validate(struct adv748x_csi2 *tx,
+					 struct v4l2_subdev_krouting *routing)
+{
+	struct v4l2_subdev_route *route;
+
+	if (routing->num_routes != 1) {
+		dev_err(tx->state->dev, "Unsupported number of routes %u",
+			routing->num_routes);
+		return -EINVAL;
+	}
+
+	route = &routing->routes[0];
+
+	if (route->sink_pad != ADV748X_CSI2_SINK ||
+	    route->source_pad != ADV748X_CSI2_SOURCE) {
+		dev_err(tx->state->dev,
+			"Routes should go from the sink to the source pads.\n");
+		return -EINVAL;
+	}
+
+	if (route->source_stream > 4) {
+		dev_err(tx->state->dev, "Unsupported source stream %u\n",
+			route->source_stream);
+		return -EINVAL;
+	}
+
+	if (route->sink_stream != 0) {
+		dev_err(tx->state->dev, "Unsupported sink stream %u\n",
+			route->sink_stream);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int adv748x_csi2_set_vc_with_routing(struct adv748x_csi2 *tx,
+					    struct v4l2_subdev_krouting *routing)
+{
+	struct v4l2_subdev_route *route = &routing->routes[0];
+
+	return adv748x_csi2_set_virtual_channel(tx, route->source_stream);
+}
+
+static int adv748x_csi2_set_routing(struct v4l2_subdev *sd,
+				    struct v4l2_subdev_state *state,
+				    enum v4l2_subdev_format_whence which,
+				    struct v4l2_subdev_krouting *routing)
+{
+	struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
+	int ret;
+
+	v4l2_subdev_lock_state(state);
+
+	ret = adv748x_csi2_routing_validate(tx, routing);
+	if (ret)
+		goto out;
+
+	ret = v4l2_subdev_set_routing(sd, state, routing);
+	if (ret)
+		goto out;
+
+	if (which == V4L2_SUBDEV_FORMAT_TRY)
+		goto out;
+
+	ret = adv748x_csi2_set_vc_with_routing(tx, routing);
+
+out:
+	v4l2_subdev_unlock_state(state);
+
+	return ret;
+}
+
 static const struct v4l2_subdev_pad_ops adv748x_csi2_pad_ops = {
 	.init_cfg = adv748x_csi2_init_cfg,
 	.get_fmt = v4l2_subdev_get_fmt,
 	.set_fmt = adv748x_csi2_set_format,
 	.get_mbus_config = adv748x_csi2_get_mbus_config,
 	.get_frame_desc = adv748x_csi2_get_frame_desc,
+	.set_routing = adv748x_csi2_set_routing,
 };
 
 /* -----------------------------------------------------------------------------
-- 
2.33.1


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

* Re: [PATCH 2/5] media: adv748x: Add support for v4l2_subdev_state
  2021-12-16 17:03 ` [PATCH 2/5] media: adv748x: Add support for v4l2_subdev_state Jacopo Mondi
@ 2021-12-17  2:41     ` kernel test robot
  2021-12-17  4:24     ` kernel test robot
  1 sibling, 0 replies; 14+ messages in thread
From: kernel test robot @ 2021-12-17  2:41 UTC (permalink / raw)
  To: Jacopo Mondi, tomi.valkeinen, sakari.ailus, laurent.pinchart,
	niklas.soderlund, kieran.bingham
  Cc: kbuild-all, Jacopo Mondi, Mauro Carvalho Chehab, linux-media,
	Hans Verkuil, linux-renesas-soc

Hi Jacopo,

I love your patch! Yet something to improve:

[auto build test ERROR on media-tree/master]
[also build test ERROR on v5.16-rc5 next-20211215]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jacopo-Mondi/media-adv748x-Add-CSI-2-VC-support/20211217-010519
base:   git://linuxtv.org/media_tree.git master
config: arc-randconfig-r043-20211216 (https://download.01.org/0day-ci/archive/20211217/202112171052.3JgXYSA4-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/beac1be47b64ce291e1647699be3f26d88028b3b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jacopo-Mondi/media-adv748x-Add-CSI-2-VC-support/20211217-010519
        git checkout beac1be47b64ce291e1647699be3f26d88028b3b
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/media/i2c/adv748x/adv748x-csi2.c: In function 'adv748x_csi2_init_cfg':
>> drivers/media/i2c/adv748x/adv748x-csi2.c:146:34: error: array type has incomplete element type 'struct v4l2_subdev_route'
     146 |         struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
         |                                  ^~~~~~
>> drivers/media/i2c/adv748x/adv748x-csi2.c:152:34: error: 'V4L2_SUBDEV_ROUTE_FL_ACTIVE' undeclared (first use in this function); did you mean 'V4L2_SUBDEV_FORMAT_ACTIVE'?
     152 |                         .flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
         |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                  V4L2_SUBDEV_FORMAT_ACTIVE
   drivers/media/i2c/adv748x/adv748x-csi2.c:152:34: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/media/i2c/adv748x/adv748x-csi2.c:173:37: error: storage size of 'routing' isn't known
     173 |         struct v4l2_subdev_krouting routing;
         |                                     ^~~~~~~
>> drivers/media/i2c/adv748x/adv748x-csi2.c:179:9: error: implicit declaration of function 'v4l2_subdev_lock_state'; did you mean 'v4l2_subdev_alloc_state'? [-Werror=implicit-function-declaration]
     179 |         v4l2_subdev_lock_state(state);
         |         ^~~~~~~~~~~~~~~~~~~~~~
         |         v4l2_subdev_alloc_state
>> drivers/media/i2c/adv748x/adv748x-csi2.c:180:15: error: implicit declaration of function 'v4l2_subdev_set_routing'; did you mean 'v4l2_subdev_notify'? [-Werror=implicit-function-declaration]
     180 |         ret = v4l2_subdev_set_routing(sd, state, &routing);
         |               ^~~~~~~~~~~~~~~~~~~~~~~
         |               v4l2_subdev_notify
>> drivers/media/i2c/adv748x/adv748x-csi2.c:181:9: error: implicit declaration of function 'v4l2_subdev_unlock_state'; did you mean 'v4l2_subdev_alloc_state'? [-Werror=implicit-function-declaration]
     181 |         v4l2_subdev_unlock_state(state);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~
         |         v4l2_subdev_alloc_state
   drivers/media/i2c/adv748x/adv748x-csi2.c:173:37: warning: unused variable 'routing' [-Wunused-variable]
     173 |         struct v4l2_subdev_krouting routing;
         |                                     ^~~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c:146:34: warning: unused variable 'routes' [-Wunused-variable]
     146 |         struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
         |                                  ^~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c: In function 'adv748x_csi2_init':
>> drivers/media/i2c/adv748x/adv748x-csi2.c:362:29: error: 'V4L2_SUBDEV_FL_MULTIPLEXED' undeclared (first use in this function)
     362 |                             V4L2_SUBDEV_FL_MULTIPLEXED,
         |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/i2c/adv748x/adv748x-csi2.c:379:15: error: implicit declaration of function 'v4l2_subdev_init_finalize'; did you mean 'v4l2_subdev_init'? [-Werror=implicit-function-declaration]
     379 |         ret = v4l2_subdev_init_finalize(&tx->sd);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~
         |               v4l2_subdev_init
>> drivers/media/i2c/adv748x/adv748x-csi2.c:396:9: error: implicit declaration of function 'v4l2_subdev_cleanup'; did you mean 'v4l2_subdev_call'? [-Werror=implicit-function-declaration]
     396 |         v4l2_subdev_cleanup(&tx->sd);
         |         ^~~~~~~~~~~~~~~~~~~
         |         v4l2_subdev_call
   cc1: some warnings being treated as errors


vim +146 drivers/media/i2c/adv748x/adv748x-csi2.c

   134	
   135	/* -----------------------------------------------------------------------------
   136	 * v4l2_subdev_pad_ops
   137	 *
   138	 * The CSI2 bus pads are ignorant to the data sizes or formats.
   139	 * But we must support setting the pad formats for format propagation.
   140	 */
   141	
   142	static int adv748x_csi2_init_cfg(struct v4l2_subdev *sd,
   143					 struct v4l2_subdev_state *state)
   144	{
   145		/* One route for each virtual channel. Route 0 enabled by default. */
 > 146		struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
   147			{
   148				.sink_pad = ADV748X_CSI2_SINK,
   149				.sink_stream = 0,
   150				.source_pad = ADV748X_CSI2_SOURCE,
   151				.source_stream = 0,
 > 152				.flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
   153			},
   154			{
   155				.sink_pad = ADV748X_CSI2_SINK,
   156				.sink_stream = 0,
   157				.source_pad = ADV748X_CSI2_SOURCE,
   158				.source_stream = 1,
   159			},
   160			{
   161				.sink_pad = ADV748X_CSI2_SINK,
   162				.sink_stream = 0,
   163				.source_pad = ADV748X_CSI2_SOURCE,
   164				.source_stream = 2,
   165			},
   166			{
   167				.sink_pad = ADV748X_CSI2_SINK,
   168				.sink_stream = 0,
   169				.source_pad = ADV748X_CSI2_SOURCE,
   170				.source_stream = 3,
   171			},
   172		};
 > 173		struct v4l2_subdev_krouting routing;
   174		int ret;
   175	
   176		routing.num_routes = ADV748X_CSI2_STREAMS;
   177		routing.routes = routes;
   178	
 > 179		v4l2_subdev_lock_state(state);
 > 180		ret = v4l2_subdev_set_routing(sd, state, &routing);
 > 181		v4l2_subdev_unlock_state(state);
   182	
   183		return ret;
   184	}
   185	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

* Re: [PATCH 2/5] media: adv748x: Add support for v4l2_subdev_state
@ 2021-12-17  2:41     ` kernel test robot
  0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2021-12-17  2:41 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 7037 bytes --]

Hi Jacopo,

I love your patch! Yet something to improve:

[auto build test ERROR on media-tree/master]
[also build test ERROR on v5.16-rc5 next-20211215]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jacopo-Mondi/media-adv748x-Add-CSI-2-VC-support/20211217-010519
base:   git://linuxtv.org/media_tree.git master
config: arc-randconfig-r043-20211216 (https://download.01.org/0day-ci/archive/20211217/202112171052.3JgXYSA4-lkp(a)intel.com/config)
compiler: arc-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/beac1be47b64ce291e1647699be3f26d88028b3b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jacopo-Mondi/media-adv748x-Add-CSI-2-VC-support/20211217-010519
        git checkout beac1be47b64ce291e1647699be3f26d88028b3b
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/media/i2c/adv748x/adv748x-csi2.c: In function 'adv748x_csi2_init_cfg':
>> drivers/media/i2c/adv748x/adv748x-csi2.c:146:34: error: array type has incomplete element type 'struct v4l2_subdev_route'
     146 |         struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
         |                                  ^~~~~~
>> drivers/media/i2c/adv748x/adv748x-csi2.c:152:34: error: 'V4L2_SUBDEV_ROUTE_FL_ACTIVE' undeclared (first use in this function); did you mean 'V4L2_SUBDEV_FORMAT_ACTIVE'?
     152 |                         .flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
         |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                  V4L2_SUBDEV_FORMAT_ACTIVE
   drivers/media/i2c/adv748x/adv748x-csi2.c:152:34: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/media/i2c/adv748x/adv748x-csi2.c:173:37: error: storage size of 'routing' isn't known
     173 |         struct v4l2_subdev_krouting routing;
         |                                     ^~~~~~~
>> drivers/media/i2c/adv748x/adv748x-csi2.c:179:9: error: implicit declaration of function 'v4l2_subdev_lock_state'; did you mean 'v4l2_subdev_alloc_state'? [-Werror=implicit-function-declaration]
     179 |         v4l2_subdev_lock_state(state);
         |         ^~~~~~~~~~~~~~~~~~~~~~
         |         v4l2_subdev_alloc_state
>> drivers/media/i2c/adv748x/adv748x-csi2.c:180:15: error: implicit declaration of function 'v4l2_subdev_set_routing'; did you mean 'v4l2_subdev_notify'? [-Werror=implicit-function-declaration]
     180 |         ret = v4l2_subdev_set_routing(sd, state, &routing);
         |               ^~~~~~~~~~~~~~~~~~~~~~~
         |               v4l2_subdev_notify
>> drivers/media/i2c/adv748x/adv748x-csi2.c:181:9: error: implicit declaration of function 'v4l2_subdev_unlock_state'; did you mean 'v4l2_subdev_alloc_state'? [-Werror=implicit-function-declaration]
     181 |         v4l2_subdev_unlock_state(state);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~
         |         v4l2_subdev_alloc_state
   drivers/media/i2c/adv748x/adv748x-csi2.c:173:37: warning: unused variable 'routing' [-Wunused-variable]
     173 |         struct v4l2_subdev_krouting routing;
         |                                     ^~~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c:146:34: warning: unused variable 'routes' [-Wunused-variable]
     146 |         struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
         |                                  ^~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c: In function 'adv748x_csi2_init':
>> drivers/media/i2c/adv748x/adv748x-csi2.c:362:29: error: 'V4L2_SUBDEV_FL_MULTIPLEXED' undeclared (first use in this function)
     362 |                             V4L2_SUBDEV_FL_MULTIPLEXED,
         |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/i2c/adv748x/adv748x-csi2.c:379:15: error: implicit declaration of function 'v4l2_subdev_init_finalize'; did you mean 'v4l2_subdev_init'? [-Werror=implicit-function-declaration]
     379 |         ret = v4l2_subdev_init_finalize(&tx->sd);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~
         |               v4l2_subdev_init
>> drivers/media/i2c/adv748x/adv748x-csi2.c:396:9: error: implicit declaration of function 'v4l2_subdev_cleanup'; did you mean 'v4l2_subdev_call'? [-Werror=implicit-function-declaration]
     396 |         v4l2_subdev_cleanup(&tx->sd);
         |         ^~~~~~~~~~~~~~~~~~~
         |         v4l2_subdev_call
   cc1: some warnings being treated as errors


vim +146 drivers/media/i2c/adv748x/adv748x-csi2.c

   134	
   135	/* -----------------------------------------------------------------------------
   136	 * v4l2_subdev_pad_ops
   137	 *
   138	 * The CSI2 bus pads are ignorant to the data sizes or formats.
   139	 * But we must support setting the pad formats for format propagation.
   140	 */
   141	
   142	static int adv748x_csi2_init_cfg(struct v4l2_subdev *sd,
   143					 struct v4l2_subdev_state *state)
   144	{
   145		/* One route for each virtual channel. Route 0 enabled by default. */
 > 146		struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
   147			{
   148				.sink_pad = ADV748X_CSI2_SINK,
   149				.sink_stream = 0,
   150				.source_pad = ADV748X_CSI2_SOURCE,
   151				.source_stream = 0,
 > 152				.flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
   153			},
   154			{
   155				.sink_pad = ADV748X_CSI2_SINK,
   156				.sink_stream = 0,
   157				.source_pad = ADV748X_CSI2_SOURCE,
   158				.source_stream = 1,
   159			},
   160			{
   161				.sink_pad = ADV748X_CSI2_SINK,
   162				.sink_stream = 0,
   163				.source_pad = ADV748X_CSI2_SOURCE,
   164				.source_stream = 2,
   165			},
   166			{
   167				.sink_pad = ADV748X_CSI2_SINK,
   168				.sink_stream = 0,
   169				.source_pad = ADV748X_CSI2_SOURCE,
   170				.source_stream = 3,
   171			},
   172		};
 > 173		struct v4l2_subdev_krouting routing;
   174		int ret;
   175	
   176		routing.num_routes = ADV748X_CSI2_STREAMS;
   177		routing.routes = routes;
   178	
 > 179		v4l2_subdev_lock_state(state);
 > 180		ret = v4l2_subdev_set_routing(sd, state, &routing);
 > 181		v4l2_subdev_unlock_state(state);
   182	
   183		return ret;
   184	}
   185	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

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

* Re: [PATCH 4/5] media: adv748x: Implement .get_frame_desc()
  2021-12-16 17:03 ` [PATCH 4/5] media: adv748x: Implement .get_frame_desc() Jacopo Mondi
@ 2021-12-17  3:12     ` kernel test robot
  0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2021-12-17  3:12 UTC (permalink / raw)
  To: Jacopo Mondi, tomi.valkeinen, sakari.ailus, laurent.pinchart,
	niklas.soderlund, kieran.bingham
  Cc: llvm, kbuild-all, Jacopo Mondi, Mauro Carvalho Chehab,
	linux-media, Hans Verkuil, linux-renesas-soc

Hi Jacopo,

I love your patch! Perhaps something to improve:

[auto build test WARNING on media-tree/master]
[also build test WARNING on v5.16-rc5 next-20211215]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jacopo-Mondi/media-adv748x-Add-CSI-2-VC-support/20211217-010519
base:   git://linuxtv.org/media_tree.git master
config: arm-randconfig-r032-20211216 (https://download.01.org/0day-ci/archive/20211217/202112171102.NMwa0uem-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dd245bab9fbb364faa1581e4f92ba3119a872fba)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/0day-ci/linux/commit/3baa5f567748a7235338c2547dcec595902888b7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jacopo-Mondi/media-adv748x-Add-CSI-2-VC-support/20211217-010519
        git checkout 3baa5f567748a7235338c2547dcec595902888b7
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/media/i2c/adv748x/ kernel/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/media/i2c/adv748x/adv748x-csi2.c:190:33: error: array has incomplete element type 'struct v4l2_subdev_route'
           struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
                                          ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:190:9: note: forward declaration of 'struct v4l2_subdev_route'
           struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
                  ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:196:13: error: use of undeclared identifier 'V4L2_SUBDEV_ROUTE_FL_ACTIVE'; did you mean 'V4L2_SUBDEV_FORMAT_ACTIVE'?
                           .flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    V4L2_SUBDEV_FORMAT_ACTIVE
   include/uapi/linux/v4l2-subdev.h:39:2: note: 'V4L2_SUBDEV_FORMAT_ACTIVE' declared here
           V4L2_SUBDEV_FORMAT_ACTIVE = 1,
           ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:217:30: error: variable has incomplete type 'struct v4l2_subdev_krouting'
           struct v4l2_subdev_krouting routing;
                                       ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:217:9: note: forward declaration of 'struct v4l2_subdev_krouting'
           struct v4l2_subdev_krouting routing;
                  ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:223:2: error: implicit declaration of function 'v4l2_subdev_lock_state' [-Werror,-Wimplicit-function-declaration]
           v4l2_subdev_lock_state(state);
           ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:223:2: note: did you mean 'v4l2_subdev_alloc_state'?
   include/media/v4l2-subdev.h:1144:27: note: 'v4l2_subdev_alloc_state' declared here
   struct v4l2_subdev_state *v4l2_subdev_alloc_state(struct v4l2_subdev *sd);
                             ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:224:8: error: implicit declaration of function 'v4l2_subdev_set_routing' [-Werror,-Wimplicit-function-declaration]
           ret = v4l2_subdev_set_routing(sd, state, &routing);
                 ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:225:2: error: implicit declaration of function 'v4l2_subdev_unlock_state' [-Werror,-Wimplicit-function-declaration]
           v4l2_subdev_unlock_state(state);
           ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:225:2: note: did you mean 'v4l2_subdev_lock_state'?
   drivers/media/i2c/adv748x/adv748x-csi2.c:223:2: note: 'v4l2_subdev_lock_state' declared here
           v4l2_subdev_lock_state(state);
           ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:241:2: error: implicit declaration of function 'v4l2_subdev_lock_state' [-Werror,-Wimplicit-function-declaration]
           v4l2_subdev_lock_state(sd_state);
           ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:242:8: error: implicit declaration of function 'v4l2_state_get_stream_format' [-Werror,-Wimplicit-function-declaration]
           fmt = v4l2_state_get_stream_format(sd_state, sdformat->pad,
                 ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:242:8: note: did you mean 'v4l2_subdev_get_try_format'?
   include/media/v4l2-subdev.h:994:1: note: 'v4l2_subdev_get_try_format' declared here
   v4l2_subdev_get_try_format(struct v4l2_subdev *sd,
   ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:243:19: error: no member named 'stream' in 'struct v4l2_subdev_format'
                                              sdformat->stream);
                                              ~~~~~~~~  ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:251:8: error: implicit declaration of function 'v4l2_subdev_state_get_opposite_stream_format' [-Werror,-Wimplicit-function-declaration]
           fmt = v4l2_subdev_state_get_opposite_stream_format(sd_state, sdformat->pad,
                 ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:252:21: error: no member named 'stream' in 'struct v4l2_subdev_format'
                                                              sdformat->stream);
                                                              ~~~~~~~~  ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:260:2: error: implicit declaration of function 'v4l2_subdev_unlock_state' [-Werror,-Wimplicit-function-declaration]
           v4l2_subdev_unlock_state(sd_state);
           ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:309:10: error: implicit declaration of function 'v4l2_subdev_lock_active_state' [-Werror,-Wimplicit-function-declaration]
           state = v4l2_subdev_lock_active_state(sd);
                   ^
>> drivers/media/i2c/adv748x/adv748x-csi2.c:309:8: warning: incompatible integer to pointer conversion assigning to 'struct v4l2_subdev_state *' from 'int' [-Wint-conversion]
           state = v4l2_subdev_lock_active_state(sd);
                 ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c:312:18: error: no member named 'routing' in 'struct v4l2_subdev_state'
           route = &state->routing.routes[0];
                    ~~~~~  ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:313:8: error: implicit declaration of function 'v4l2_state_get_stream_format' [-Werror,-Wimplicit-function-declaration]
           fmt = v4l2_state_get_stream_format(state, pad, route->source_stream);
                 ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:313:54: error: incomplete definition of type 'struct v4l2_subdev_route'
           fmt = v4l2_state_get_stream_format(state, pad, route->source_stream);
                                                          ~~~~~^
   drivers/media/i2c/adv748x/adv748x-csi2.c:301:9: note: forward declaration of 'struct v4l2_subdev_route'
           struct v4l2_subdev_route *route;
                  ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:327:6: error: no member named 'type' in 'struct v4l2_mbus_frame_desc'
           fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
           ~~  ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:327:13: error: use of undeclared identifier 'V4L2_MBUS_FRAME_DESC_TYPE_CSI2'; did you mean 'V4L2_MBUS_FRAME_DESC_FL_BLOB'?
           fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      V4L2_MBUS_FRAME_DESC_FL_BLOB
   include/media/v4l2-subdev.h:327:2: note: 'V4L2_MBUS_FRAME_DESC_FL_BLOB' declared here
           V4L2_MBUS_FRAME_DESC_FL_BLOB    = BIT(1),
           ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:330:9: error: no member named 'stream' in 'struct v4l2_mbus_frame_desc_entry'
           entry->stream = 0;
           ~~~~~  ^
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   1 warning and 20 errors generated.


vim +309 drivers/media/i2c/adv748x/adv748x-csi2.c

   229	
   230	static int adv748x_csi2_set_format(struct v4l2_subdev *sd,
   231					   struct v4l2_subdev_state *sd_state,
   232					   struct v4l2_subdev_format *sdformat)
   233	{
   234		struct v4l2_mbus_framefmt *fmt;
   235		int ret = 0;
   236	
   237		/* Do not allow to set format on the multiplexed source pad. */
   238		if (sdformat->pad == ADV748X_CSI2_SOURCE)
   239			return -EINVAL;
   240	
   241		v4l2_subdev_lock_state(sd_state);
   242		fmt = v4l2_state_get_stream_format(sd_state, sdformat->pad,
   243						   sdformat->stream);
   244		if (!fmt) {
   245			ret = -EINVAL;
   246			goto out;
   247		};
   248		*fmt = sdformat->format;
   249	
   250		/* Propagate format to the other end of the route. */
   251		fmt = v4l2_subdev_state_get_opposite_stream_format(sd_state, sdformat->pad,
 > 252								   sdformat->stream);
   253		if (!fmt) {
   254			ret = -EINVAL;
   255			goto out;
   256		}
   257		*fmt = sdformat->format;
   258	
   259	out:
   260		v4l2_subdev_unlock_state(sd_state);
   261	
   262		return ret;
   263	}
   264	
   265	static int adv748x_csi2_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad,
   266						struct v4l2_mbus_config *config)
   267	{
   268		struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
   269	
   270		if (pad != ADV748X_CSI2_SOURCE)
   271			return -EINVAL;
   272	
   273		config->type = V4L2_MBUS_CSI2_DPHY;
   274		switch (tx->active_lanes) {
   275		case 1:
   276			config->flags = V4L2_MBUS_CSI2_1_LANE;
   277			break;
   278	
   279		case 2:
   280			config->flags = V4L2_MBUS_CSI2_2_LANE;
   281			break;
   282	
   283		case 3:
   284			config->flags = V4L2_MBUS_CSI2_3_LANE;
   285			break;
   286	
   287		case 4:
   288			config->flags = V4L2_MBUS_CSI2_4_LANE;
   289			break;
   290		}
   291	
   292		return 0;
   293	}
   294	
   295	static int adv748x_csi2_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
   296					       struct v4l2_mbus_frame_desc *fd)
   297	{
   298		struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
   299		struct adv748x_csi2_format_info info = {};
   300		struct v4l2_mbus_frame_desc_entry *entry;
   301		struct v4l2_subdev_route *route;
   302		struct v4l2_subdev_state *state;
   303		struct v4l2_mbus_framefmt *fmt;
   304		int ret;
   305	
   306		if (pad != ADV748X_CSI2_SOURCE)
   307			return -EINVAL;
   308	
 > 309		state = v4l2_subdev_lock_active_state(sd);
   310	
   311		/* A single route is available. */
   312		route = &state->routing.routes[0];
   313		fmt = v4l2_state_get_stream_format(state, pad, route->source_stream);
   314		if (!fmt) {
   315			ret = -EINVAL;
   316			goto out;
   317		}
   318	
   319		ret = adv748x_csi2_get_format_info(tx, fmt->code, &info);
   320		if (ret)
   321			goto out;
   322	
   323		memset(fd, 0, sizeof(*fd));
   324	
   325		/* A single stream is available. */
   326		fd->num_entries = 1;
   327		fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
   328	
   329		entry = &fd->entry[0];
   330		entry->stream = 0;
   331		entry->flags = V4L2_MBUS_FRAME_DESC_FL_LEN_MAX;
   332		entry->length = fmt->width * fmt->height * info.bpp / 8;
   333		entry->pixelcode = fmt->code;
   334		entry->bus.csi2.vc = route->source_stream;
   335		entry->bus.csi2.dt = info.dt;
   336	
   337	out:
   338		v4l2_subdev_unlock_state(state);
   339	
   340		return ret;
   341	}
   342	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

* Re: [PATCH 4/5] media: adv748x: Implement .get_frame_desc()
@ 2021-12-17  3:12     ` kernel test robot
  0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2021-12-17  3:12 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 12107 bytes --]

Hi Jacopo,

I love your patch! Perhaps something to improve:

[auto build test WARNING on media-tree/master]
[also build test WARNING on v5.16-rc5 next-20211215]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jacopo-Mondi/media-adv748x-Add-CSI-2-VC-support/20211217-010519
base:   git://linuxtv.org/media_tree.git master
config: arm-randconfig-r032-20211216 (https://download.01.org/0day-ci/archive/20211217/202112171102.NMwa0uem-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dd245bab9fbb364faa1581e4f92ba3119a872fba)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/0day-ci/linux/commit/3baa5f567748a7235338c2547dcec595902888b7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jacopo-Mondi/media-adv748x-Add-CSI-2-VC-support/20211217-010519
        git checkout 3baa5f567748a7235338c2547dcec595902888b7
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/media/i2c/adv748x/ kernel/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/media/i2c/adv748x/adv748x-csi2.c:190:33: error: array has incomplete element type 'struct v4l2_subdev_route'
           struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
                                          ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:190:9: note: forward declaration of 'struct v4l2_subdev_route'
           struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
                  ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:196:13: error: use of undeclared identifier 'V4L2_SUBDEV_ROUTE_FL_ACTIVE'; did you mean 'V4L2_SUBDEV_FORMAT_ACTIVE'?
                           .flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    V4L2_SUBDEV_FORMAT_ACTIVE
   include/uapi/linux/v4l2-subdev.h:39:2: note: 'V4L2_SUBDEV_FORMAT_ACTIVE' declared here
           V4L2_SUBDEV_FORMAT_ACTIVE = 1,
           ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:217:30: error: variable has incomplete type 'struct v4l2_subdev_krouting'
           struct v4l2_subdev_krouting routing;
                                       ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:217:9: note: forward declaration of 'struct v4l2_subdev_krouting'
           struct v4l2_subdev_krouting routing;
                  ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:223:2: error: implicit declaration of function 'v4l2_subdev_lock_state' [-Werror,-Wimplicit-function-declaration]
           v4l2_subdev_lock_state(state);
           ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:223:2: note: did you mean 'v4l2_subdev_alloc_state'?
   include/media/v4l2-subdev.h:1144:27: note: 'v4l2_subdev_alloc_state' declared here
   struct v4l2_subdev_state *v4l2_subdev_alloc_state(struct v4l2_subdev *sd);
                             ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:224:8: error: implicit declaration of function 'v4l2_subdev_set_routing' [-Werror,-Wimplicit-function-declaration]
           ret = v4l2_subdev_set_routing(sd, state, &routing);
                 ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:225:2: error: implicit declaration of function 'v4l2_subdev_unlock_state' [-Werror,-Wimplicit-function-declaration]
           v4l2_subdev_unlock_state(state);
           ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:225:2: note: did you mean 'v4l2_subdev_lock_state'?
   drivers/media/i2c/adv748x/adv748x-csi2.c:223:2: note: 'v4l2_subdev_lock_state' declared here
           v4l2_subdev_lock_state(state);
           ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:241:2: error: implicit declaration of function 'v4l2_subdev_lock_state' [-Werror,-Wimplicit-function-declaration]
           v4l2_subdev_lock_state(sd_state);
           ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:242:8: error: implicit declaration of function 'v4l2_state_get_stream_format' [-Werror,-Wimplicit-function-declaration]
           fmt = v4l2_state_get_stream_format(sd_state, sdformat->pad,
                 ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:242:8: note: did you mean 'v4l2_subdev_get_try_format'?
   include/media/v4l2-subdev.h:994:1: note: 'v4l2_subdev_get_try_format' declared here
   v4l2_subdev_get_try_format(struct v4l2_subdev *sd,
   ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:243:19: error: no member named 'stream' in 'struct v4l2_subdev_format'
                                              sdformat->stream);
                                              ~~~~~~~~  ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:251:8: error: implicit declaration of function 'v4l2_subdev_state_get_opposite_stream_format' [-Werror,-Wimplicit-function-declaration]
           fmt = v4l2_subdev_state_get_opposite_stream_format(sd_state, sdformat->pad,
                 ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:252:21: error: no member named 'stream' in 'struct v4l2_subdev_format'
                                                              sdformat->stream);
                                                              ~~~~~~~~  ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:260:2: error: implicit declaration of function 'v4l2_subdev_unlock_state' [-Werror,-Wimplicit-function-declaration]
           v4l2_subdev_unlock_state(sd_state);
           ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:309:10: error: implicit declaration of function 'v4l2_subdev_lock_active_state' [-Werror,-Wimplicit-function-declaration]
           state = v4l2_subdev_lock_active_state(sd);
                   ^
>> drivers/media/i2c/adv748x/adv748x-csi2.c:309:8: warning: incompatible integer to pointer conversion assigning to 'struct v4l2_subdev_state *' from 'int' [-Wint-conversion]
           state = v4l2_subdev_lock_active_state(sd);
                 ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c:312:18: error: no member named 'routing' in 'struct v4l2_subdev_state'
           route = &state->routing.routes[0];
                    ~~~~~  ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:313:8: error: implicit declaration of function 'v4l2_state_get_stream_format' [-Werror,-Wimplicit-function-declaration]
           fmt = v4l2_state_get_stream_format(state, pad, route->source_stream);
                 ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:313:54: error: incomplete definition of type 'struct v4l2_subdev_route'
           fmt = v4l2_state_get_stream_format(state, pad, route->source_stream);
                                                          ~~~~~^
   drivers/media/i2c/adv748x/adv748x-csi2.c:301:9: note: forward declaration of 'struct v4l2_subdev_route'
           struct v4l2_subdev_route *route;
                  ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:327:6: error: no member named 'type' in 'struct v4l2_mbus_frame_desc'
           fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
           ~~  ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:327:13: error: use of undeclared identifier 'V4L2_MBUS_FRAME_DESC_TYPE_CSI2'; did you mean 'V4L2_MBUS_FRAME_DESC_FL_BLOB'?
           fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      V4L2_MBUS_FRAME_DESC_FL_BLOB
   include/media/v4l2-subdev.h:327:2: note: 'V4L2_MBUS_FRAME_DESC_FL_BLOB' declared here
           V4L2_MBUS_FRAME_DESC_FL_BLOB    = BIT(1),
           ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:330:9: error: no member named 'stream' in 'struct v4l2_mbus_frame_desc_entry'
           entry->stream = 0;
           ~~~~~  ^
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   1 warning and 20 errors generated.


vim +309 drivers/media/i2c/adv748x/adv748x-csi2.c

   229	
   230	static int adv748x_csi2_set_format(struct v4l2_subdev *sd,
   231					   struct v4l2_subdev_state *sd_state,
   232					   struct v4l2_subdev_format *sdformat)
   233	{
   234		struct v4l2_mbus_framefmt *fmt;
   235		int ret = 0;
   236	
   237		/* Do not allow to set format on the multiplexed source pad. */
   238		if (sdformat->pad == ADV748X_CSI2_SOURCE)
   239			return -EINVAL;
   240	
   241		v4l2_subdev_lock_state(sd_state);
   242		fmt = v4l2_state_get_stream_format(sd_state, sdformat->pad,
   243						   sdformat->stream);
   244		if (!fmt) {
   245			ret = -EINVAL;
   246			goto out;
   247		};
   248		*fmt = sdformat->format;
   249	
   250		/* Propagate format to the other end of the route. */
   251		fmt = v4l2_subdev_state_get_opposite_stream_format(sd_state, sdformat->pad,
 > 252								   sdformat->stream);
   253		if (!fmt) {
   254			ret = -EINVAL;
   255			goto out;
   256		}
   257		*fmt = sdformat->format;
   258	
   259	out:
   260		v4l2_subdev_unlock_state(sd_state);
   261	
   262		return ret;
   263	}
   264	
   265	static int adv748x_csi2_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad,
   266						struct v4l2_mbus_config *config)
   267	{
   268		struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
   269	
   270		if (pad != ADV748X_CSI2_SOURCE)
   271			return -EINVAL;
   272	
   273		config->type = V4L2_MBUS_CSI2_DPHY;
   274		switch (tx->active_lanes) {
   275		case 1:
   276			config->flags = V4L2_MBUS_CSI2_1_LANE;
   277			break;
   278	
   279		case 2:
   280			config->flags = V4L2_MBUS_CSI2_2_LANE;
   281			break;
   282	
   283		case 3:
   284			config->flags = V4L2_MBUS_CSI2_3_LANE;
   285			break;
   286	
   287		case 4:
   288			config->flags = V4L2_MBUS_CSI2_4_LANE;
   289			break;
   290		}
   291	
   292		return 0;
   293	}
   294	
   295	static int adv748x_csi2_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
   296					       struct v4l2_mbus_frame_desc *fd)
   297	{
   298		struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
   299		struct adv748x_csi2_format_info info = {};
   300		struct v4l2_mbus_frame_desc_entry *entry;
   301		struct v4l2_subdev_route *route;
   302		struct v4l2_subdev_state *state;
   303		struct v4l2_mbus_framefmt *fmt;
   304		int ret;
   305	
   306		if (pad != ADV748X_CSI2_SOURCE)
   307			return -EINVAL;
   308	
 > 309		state = v4l2_subdev_lock_active_state(sd);
   310	
   311		/* A single route is available. */
   312		route = &state->routing.routes[0];
   313		fmt = v4l2_state_get_stream_format(state, pad, route->source_stream);
   314		if (!fmt) {
   315			ret = -EINVAL;
   316			goto out;
   317		}
   318	
   319		ret = adv748x_csi2_get_format_info(tx, fmt->code, &info);
   320		if (ret)
   321			goto out;
   322	
   323		memset(fd, 0, sizeof(*fd));
   324	
   325		/* A single stream is available. */
   326		fd->num_entries = 1;
   327		fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
   328	
   329		entry = &fd->entry[0];
   330		entry->stream = 0;
   331		entry->flags = V4L2_MBUS_FRAME_DESC_FL_LEN_MAX;
   332		entry->length = fmt->width * fmt->height * info.bpp / 8;
   333		entry->pixelcode = fmt->code;
   334		entry->bus.csi2.vc = route->source_stream;
   335		entry->bus.csi2.dt = info.dt;
   336	
   337	out:
   338		v4l2_subdev_unlock_state(state);
   339	
   340		return ret;
   341	}
   342	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

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

* Re: [PATCH 2/5] media: adv748x: Add support for v4l2_subdev_state
  2021-12-16 17:03 ` [PATCH 2/5] media: adv748x: Add support for v4l2_subdev_state Jacopo Mondi
@ 2021-12-17  4:24     ` kernel test robot
  2021-12-17  4:24     ` kernel test robot
  1 sibling, 0 replies; 14+ messages in thread
From: kernel test robot @ 2021-12-17  4:24 UTC (permalink / raw)
  To: Jacopo Mondi, tomi.valkeinen, sakari.ailus, laurent.pinchart,
	niklas.soderlund, kieran.bingham
  Cc: kbuild-all, Jacopo Mondi, Mauro Carvalho Chehab, linux-media,
	Hans Verkuil, linux-renesas-soc

Hi Jacopo,

I love your patch! Yet something to improve:

[auto build test ERROR on media-tree/master]
[also build test ERROR on v5.16-rc5 next-20211215]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jacopo-Mondi/media-adv748x-Add-CSI-2-VC-support/20211217-010519
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-m031-20211216 (https://download.01.org/0day-ci/archive/20211217/202112171114.znOy3iE9-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/beac1be47b64ce291e1647699be3f26d88028b3b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jacopo-Mondi/media-adv748x-Add-CSI-2-VC-support/20211217-010519
        git checkout beac1be47b64ce291e1647699be3f26d88028b3b
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/media/i2c/adv748x/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/media/i2c/adv748x/adv748x-csi2.c: In function 'adv748x_csi2_init_cfg':
>> drivers/media/i2c/adv748x/adv748x-csi2.c:146:27: error: array type has incomplete element type 'struct v4l2_subdev_route'
     146 |  struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
         |                           ^~~~~~
>> drivers/media/i2c/adv748x/adv748x-csi2.c:148:4: error: field name not in record or union initializer
     148 |    .sink_pad = ADV748X_CSI2_SINK,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:148:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:149:4: error: field name not in record or union initializer
     149 |    .sink_stream = 0,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:149:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:150:4: error: field name not in record or union initializer
     150 |    .source_pad = ADV748X_CSI2_SOURCE,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:150:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:151:4: error: field name not in record or union initializer
     151 |    .source_stream = 0,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:151:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:152:4: error: field name not in record or union initializer
     152 |    .flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:152:4: note: (near initialization for 'routes')
>> drivers/media/i2c/adv748x/adv748x-csi2.c:152:13: error: 'V4L2_SUBDEV_ROUTE_FL_ACTIVE' undeclared (first use in this function); did you mean 'V4L2_SUBDEV_FORMAT_ACTIVE'?
     152 |    .flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
         |             V4L2_SUBDEV_FORMAT_ACTIVE
   drivers/media/i2c/adv748x/adv748x-csi2.c:152:13: note: each undeclared identifier is reported only once for each function it appears in
   drivers/media/i2c/adv748x/adv748x-csi2.c:155:4: error: field name not in record or union initializer
     155 |    .sink_pad = ADV748X_CSI2_SINK,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:155:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:156:4: error: field name not in record or union initializer
     156 |    .sink_stream = 0,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:156:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:157:4: error: field name not in record or union initializer
     157 |    .source_pad = ADV748X_CSI2_SOURCE,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:157:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:158:4: error: field name not in record or union initializer
     158 |    .source_stream = 1,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:158:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:161:4: error: field name not in record or union initializer
     161 |    .sink_pad = ADV748X_CSI2_SINK,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:161:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:162:4: error: field name not in record or union initializer
     162 |    .sink_stream = 0,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:162:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:163:4: error: field name not in record or union initializer
     163 |    .source_pad = ADV748X_CSI2_SOURCE,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:163:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:164:4: error: field name not in record or union initializer
     164 |    .source_stream = 2,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:164:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:167:4: error: field name not in record or union initializer
     167 |    .sink_pad = ADV748X_CSI2_SINK,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:167:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:168:4: error: field name not in record or union initializer
     168 |    .sink_stream = 0,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:168:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:169:4: error: field name not in record or union initializer
     169 |    .source_pad = ADV748X_CSI2_SOURCE,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:169:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:170:4: error: field name not in record or union initializer
     170 |    .source_stream = 3,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:170:4: note: (near initialization for 'routes')
>> drivers/media/i2c/adv748x/adv748x-csi2.c:173:30: error: storage size of 'routing' isn't known
     173 |  struct v4l2_subdev_krouting routing;
         |                              ^~~~~~~
>> drivers/media/i2c/adv748x/adv748x-csi2.c:179:2: error: implicit declaration of function 'v4l2_subdev_lock_state'; did you mean 'v4l2_subdev_alloc_state'? [-Werror=implicit-function-declaration]
     179 |  v4l2_subdev_lock_state(state);
         |  ^~~~~~~~~~~~~~~~~~~~~~
         |  v4l2_subdev_alloc_state
>> drivers/media/i2c/adv748x/adv748x-csi2.c:180:8: error: implicit declaration of function 'v4l2_subdev_set_routing'; did you mean 'v4l2_subdev_notify'? [-Werror=implicit-function-declaration]
     180 |  ret = v4l2_subdev_set_routing(sd, state, &routing);
         |        ^~~~~~~~~~~~~~~~~~~~~~~
         |        v4l2_subdev_notify
>> drivers/media/i2c/adv748x/adv748x-csi2.c:181:2: error: implicit declaration of function 'v4l2_subdev_unlock_state'; did you mean 'v4l2_subdev_alloc_state'? [-Werror=implicit-function-declaration]
     181 |  v4l2_subdev_unlock_state(state);
         |  ^~~~~~~~~~~~~~~~~~~~~~~~
         |  v4l2_subdev_alloc_state
   drivers/media/i2c/adv748x/adv748x-csi2.c:173:30: warning: unused variable 'routing' [-Wunused-variable]
     173 |  struct v4l2_subdev_krouting routing;
         |                              ^~~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c:146:27: warning: unused variable 'routes' [-Wunused-variable]
     146 |  struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
         |                           ^~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c: In function 'adv748x_csi2_init':
>> drivers/media/i2c/adv748x/adv748x-csi2.c:362:8: error: 'V4L2_SUBDEV_FL_MULTIPLEXED' undeclared (first use in this function)
     362 |        V4L2_SUBDEV_FL_MULTIPLEXED,
         |        ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/i2c/adv748x/adv748x-csi2.c:379:8: error: implicit declaration of function 'v4l2_subdev_init_finalize'; did you mean 'v4l2_subdev_init'? [-Werror=implicit-function-declaration]
     379 |  ret = v4l2_subdev_init_finalize(&tx->sd);
         |        ^~~~~~~~~~~~~~~~~~~~~~~~~
         |        v4l2_subdev_init
>> drivers/media/i2c/adv748x/adv748x-csi2.c:396:2: error: implicit declaration of function 'v4l2_subdev_cleanup'; did you mean 'v4l2_subdev_call'? [-Werror=implicit-function-declaration]
     396 |  v4l2_subdev_cleanup(&tx->sd);
         |  ^~~~~~~~~~~~~~~~~~~
         |  v4l2_subdev_call
   cc1: some warnings being treated as errors


vim +146 drivers/media/i2c/adv748x/adv748x-csi2.c

   134	
   135	/* -----------------------------------------------------------------------------
   136	 * v4l2_subdev_pad_ops
   137	 *
   138	 * The CSI2 bus pads are ignorant to the data sizes or formats.
   139	 * But we must support setting the pad formats for format propagation.
   140	 */
   141	
   142	static int adv748x_csi2_init_cfg(struct v4l2_subdev *sd,
   143					 struct v4l2_subdev_state *state)
   144	{
   145		/* One route for each virtual channel. Route 0 enabled by default. */
 > 146		struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
   147			{
 > 148				.sink_pad = ADV748X_CSI2_SINK,
   149				.sink_stream = 0,
   150				.source_pad = ADV748X_CSI2_SOURCE,
   151				.source_stream = 0,
 > 152				.flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
   153			},
   154			{
   155				.sink_pad = ADV748X_CSI2_SINK,
   156				.sink_stream = 0,
   157				.source_pad = ADV748X_CSI2_SOURCE,
   158				.source_stream = 1,
   159			},
   160			{
   161				.sink_pad = ADV748X_CSI2_SINK,
   162				.sink_stream = 0,
   163				.source_pad = ADV748X_CSI2_SOURCE,
   164				.source_stream = 2,
   165			},
   166			{
   167				.sink_pad = ADV748X_CSI2_SINK,
   168				.sink_stream = 0,
   169				.source_pad = ADV748X_CSI2_SOURCE,
   170				.source_stream = 3,
   171			},
   172		};
 > 173		struct v4l2_subdev_krouting routing;
   174		int ret;
   175	
   176		routing.num_routes = ADV748X_CSI2_STREAMS;
   177		routing.routes = routes;
   178	
 > 179		v4l2_subdev_lock_state(state);
 > 180		ret = v4l2_subdev_set_routing(sd, state, &routing);
 > 181		v4l2_subdev_unlock_state(state);
   182	
   183		return ret;
   184	}
   185	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

* Re: [PATCH 2/5] media: adv748x: Add support for v4l2_subdev_state
@ 2021-12-17  4:24     ` kernel test robot
  0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2021-12-17  4:24 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 10969 bytes --]

Hi Jacopo,

I love your patch! Yet something to improve:

[auto build test ERROR on media-tree/master]
[also build test ERROR on v5.16-rc5 next-20211215]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jacopo-Mondi/media-adv748x-Add-CSI-2-VC-support/20211217-010519
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-m031-20211216 (https://download.01.org/0day-ci/archive/20211217/202112171114.znOy3iE9-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/beac1be47b64ce291e1647699be3f26d88028b3b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jacopo-Mondi/media-adv748x-Add-CSI-2-VC-support/20211217-010519
        git checkout beac1be47b64ce291e1647699be3f26d88028b3b
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/media/i2c/adv748x/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/media/i2c/adv748x/adv748x-csi2.c: In function 'adv748x_csi2_init_cfg':
>> drivers/media/i2c/adv748x/adv748x-csi2.c:146:27: error: array type has incomplete element type 'struct v4l2_subdev_route'
     146 |  struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
         |                           ^~~~~~
>> drivers/media/i2c/adv748x/adv748x-csi2.c:148:4: error: field name not in record or union initializer
     148 |    .sink_pad = ADV748X_CSI2_SINK,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:148:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:149:4: error: field name not in record or union initializer
     149 |    .sink_stream = 0,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:149:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:150:4: error: field name not in record or union initializer
     150 |    .source_pad = ADV748X_CSI2_SOURCE,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:150:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:151:4: error: field name not in record or union initializer
     151 |    .source_stream = 0,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:151:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:152:4: error: field name not in record or union initializer
     152 |    .flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:152:4: note: (near initialization for 'routes')
>> drivers/media/i2c/adv748x/adv748x-csi2.c:152:13: error: 'V4L2_SUBDEV_ROUTE_FL_ACTIVE' undeclared (first use in this function); did you mean 'V4L2_SUBDEV_FORMAT_ACTIVE'?
     152 |    .flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
         |             V4L2_SUBDEV_FORMAT_ACTIVE
   drivers/media/i2c/adv748x/adv748x-csi2.c:152:13: note: each undeclared identifier is reported only once for each function it appears in
   drivers/media/i2c/adv748x/adv748x-csi2.c:155:4: error: field name not in record or union initializer
     155 |    .sink_pad = ADV748X_CSI2_SINK,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:155:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:156:4: error: field name not in record or union initializer
     156 |    .sink_stream = 0,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:156:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:157:4: error: field name not in record or union initializer
     157 |    .source_pad = ADV748X_CSI2_SOURCE,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:157:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:158:4: error: field name not in record or union initializer
     158 |    .source_stream = 1,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:158:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:161:4: error: field name not in record or union initializer
     161 |    .sink_pad = ADV748X_CSI2_SINK,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:161:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:162:4: error: field name not in record or union initializer
     162 |    .sink_stream = 0,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:162:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:163:4: error: field name not in record or union initializer
     163 |    .source_pad = ADV748X_CSI2_SOURCE,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:163:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:164:4: error: field name not in record or union initializer
     164 |    .source_stream = 2,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:164:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:167:4: error: field name not in record or union initializer
     167 |    .sink_pad = ADV748X_CSI2_SINK,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:167:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:168:4: error: field name not in record or union initializer
     168 |    .sink_stream = 0,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:168:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:169:4: error: field name not in record or union initializer
     169 |    .source_pad = ADV748X_CSI2_SOURCE,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:169:4: note: (near initialization for 'routes')
   drivers/media/i2c/adv748x/adv748x-csi2.c:170:4: error: field name not in record or union initializer
     170 |    .source_stream = 3,
         |    ^
   drivers/media/i2c/adv748x/adv748x-csi2.c:170:4: note: (near initialization for 'routes')
>> drivers/media/i2c/adv748x/adv748x-csi2.c:173:30: error: storage size of 'routing' isn't known
     173 |  struct v4l2_subdev_krouting routing;
         |                              ^~~~~~~
>> drivers/media/i2c/adv748x/adv748x-csi2.c:179:2: error: implicit declaration of function 'v4l2_subdev_lock_state'; did you mean 'v4l2_subdev_alloc_state'? [-Werror=implicit-function-declaration]
     179 |  v4l2_subdev_lock_state(state);
         |  ^~~~~~~~~~~~~~~~~~~~~~
         |  v4l2_subdev_alloc_state
>> drivers/media/i2c/adv748x/adv748x-csi2.c:180:8: error: implicit declaration of function 'v4l2_subdev_set_routing'; did you mean 'v4l2_subdev_notify'? [-Werror=implicit-function-declaration]
     180 |  ret = v4l2_subdev_set_routing(sd, state, &routing);
         |        ^~~~~~~~~~~~~~~~~~~~~~~
         |        v4l2_subdev_notify
>> drivers/media/i2c/adv748x/adv748x-csi2.c:181:2: error: implicit declaration of function 'v4l2_subdev_unlock_state'; did you mean 'v4l2_subdev_alloc_state'? [-Werror=implicit-function-declaration]
     181 |  v4l2_subdev_unlock_state(state);
         |  ^~~~~~~~~~~~~~~~~~~~~~~~
         |  v4l2_subdev_alloc_state
   drivers/media/i2c/adv748x/adv748x-csi2.c:173:30: warning: unused variable 'routing' [-Wunused-variable]
     173 |  struct v4l2_subdev_krouting routing;
         |                              ^~~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c:146:27: warning: unused variable 'routes' [-Wunused-variable]
     146 |  struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
         |                           ^~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c: In function 'adv748x_csi2_init':
>> drivers/media/i2c/adv748x/adv748x-csi2.c:362:8: error: 'V4L2_SUBDEV_FL_MULTIPLEXED' undeclared (first use in this function)
     362 |        V4L2_SUBDEV_FL_MULTIPLEXED,
         |        ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/i2c/adv748x/adv748x-csi2.c:379:8: error: implicit declaration of function 'v4l2_subdev_init_finalize'; did you mean 'v4l2_subdev_init'? [-Werror=implicit-function-declaration]
     379 |  ret = v4l2_subdev_init_finalize(&tx->sd);
         |        ^~~~~~~~~~~~~~~~~~~~~~~~~
         |        v4l2_subdev_init
>> drivers/media/i2c/adv748x/adv748x-csi2.c:396:2: error: implicit declaration of function 'v4l2_subdev_cleanup'; did you mean 'v4l2_subdev_call'? [-Werror=implicit-function-declaration]
     396 |  v4l2_subdev_cleanup(&tx->sd);
         |  ^~~~~~~~~~~~~~~~~~~
         |  v4l2_subdev_call
   cc1: some warnings being treated as errors


vim +146 drivers/media/i2c/adv748x/adv748x-csi2.c

   134	
   135	/* -----------------------------------------------------------------------------
   136	 * v4l2_subdev_pad_ops
   137	 *
   138	 * The CSI2 bus pads are ignorant to the data sizes or formats.
   139	 * But we must support setting the pad formats for format propagation.
   140	 */
   141	
   142	static int adv748x_csi2_init_cfg(struct v4l2_subdev *sd,
   143					 struct v4l2_subdev_state *state)
   144	{
   145		/* One route for each virtual channel. Route 0 enabled by default. */
 > 146		struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
   147			{
 > 148				.sink_pad = ADV748X_CSI2_SINK,
   149				.sink_stream = 0,
   150				.source_pad = ADV748X_CSI2_SOURCE,
   151				.source_stream = 0,
 > 152				.flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
   153			},
   154			{
   155				.sink_pad = ADV748X_CSI2_SINK,
   156				.sink_stream = 0,
   157				.source_pad = ADV748X_CSI2_SOURCE,
   158				.source_stream = 1,
   159			},
   160			{
   161				.sink_pad = ADV748X_CSI2_SINK,
   162				.sink_stream = 0,
   163				.source_pad = ADV748X_CSI2_SOURCE,
   164				.source_stream = 2,
   165			},
   166			{
   167				.sink_pad = ADV748X_CSI2_SINK,
   168				.sink_stream = 0,
   169				.source_pad = ADV748X_CSI2_SOURCE,
   170				.source_stream = 3,
   171			},
   172		};
 > 173		struct v4l2_subdev_krouting routing;
   174		int ret;
   175	
   176		routing.num_routes = ADV748X_CSI2_STREAMS;
   177		routing.routes = routes;
   178	
 > 179		v4l2_subdev_lock_state(state);
 > 180		ret = v4l2_subdev_set_routing(sd, state, &routing);
 > 181		v4l2_subdev_unlock_state(state);
   182	
   183		return ret;
   184	}
   185	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

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

* Re: [PATCH 3/5] media: adv748x: Move format to subdev state
  2021-12-16 17:03 ` [PATCH 3/5] media: adv748x: Move format to subdev state Jacopo Mondi
@ 2021-12-17  7:30     ` kernel test robot
  0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2021-12-17  7:30 UTC (permalink / raw)
  To: Jacopo Mondi, tomi.valkeinen, sakari.ailus, laurent.pinchart,
	niklas.soderlund, kieran.bingham
  Cc: kbuild-all, Jacopo Mondi, Mauro Carvalho Chehab, linux-media,
	Hans Verkuil, linux-renesas-soc

Hi Jacopo,

I love your patch! Yet something to improve:

[auto build test ERROR on media-tree/master]
[also build test ERROR on v5.16-rc5 next-20211216]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jacopo-Mondi/media-adv748x-Add-CSI-2-VC-support/20211217-010519
base:   git://linuxtv.org/media_tree.git master
config: arc-randconfig-r043-20211216 (https://download.01.org/0day-ci/archive/20211217/202112171539.cPT19ZOz-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/90158bf217d9df03d83fac378198a756af229010
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jacopo-Mondi/media-adv748x-Add-CSI-2-VC-support/20211217-010519
        git checkout 90158bf217d9df03d83fac378198a756af229010
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/media/i2c/adv748x/adv748x-csi2.c: In function 'adv748x_csi2_init_cfg':
   drivers/media/i2c/adv748x/adv748x-csi2.c:146:34: error: array type has incomplete element type 'struct v4l2_subdev_route'
     146 |         struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
         |                                  ^~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c:152:34: error: 'V4L2_SUBDEV_ROUTE_FL_ACTIVE' undeclared (first use in this function); did you mean 'V4L2_SUBDEV_FORMAT_ACTIVE'?
     152 |                         .flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
         |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                  V4L2_SUBDEV_FORMAT_ACTIVE
   drivers/media/i2c/adv748x/adv748x-csi2.c:152:34: note: each undeclared identifier is reported only once for each function it appears in
   drivers/media/i2c/adv748x/adv748x-csi2.c:173:37: error: storage size of 'routing' isn't known
     173 |         struct v4l2_subdev_krouting routing;
         |                                     ^~~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c:179:9: error: implicit declaration of function 'v4l2_subdev_lock_state'; did you mean 'v4l2_subdev_alloc_state'? [-Werror=implicit-function-declaration]
     179 |         v4l2_subdev_lock_state(state);
         |         ^~~~~~~~~~~~~~~~~~~~~~
         |         v4l2_subdev_alloc_state
   drivers/media/i2c/adv748x/adv748x-csi2.c:180:15: error: implicit declaration of function 'v4l2_subdev_set_routing'; did you mean 'v4l2_subdev_notify'? [-Werror=implicit-function-declaration]
     180 |         ret = v4l2_subdev_set_routing(sd, state, &routing);
         |               ^~~~~~~~~~~~~~~~~~~~~~~
         |               v4l2_subdev_notify
   drivers/media/i2c/adv748x/adv748x-csi2.c:181:9: error: implicit declaration of function 'v4l2_subdev_unlock_state'; did you mean 'v4l2_subdev_alloc_state'? [-Werror=implicit-function-declaration]
     181 |         v4l2_subdev_unlock_state(state);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~
         |         v4l2_subdev_alloc_state
   drivers/media/i2c/adv748x/adv748x-csi2.c:173:37: warning: unused variable 'routing' [-Wunused-variable]
     173 |         struct v4l2_subdev_krouting routing;
         |                                     ^~~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c:146:34: warning: unused variable 'routes' [-Wunused-variable]
     146 |         struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
         |                                  ^~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c: In function 'adv748x_csi2_set_format':
>> drivers/media/i2c/adv748x/adv748x-csi2.c:198:15: error: implicit declaration of function 'v4l2_state_get_stream_format'; did you mean 'v4l2_subdev_get_try_format'? [-Werror=implicit-function-declaration]
     198 |         fmt = v4l2_state_get_stream_format(sd_state, sdformat->pad,
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |               v4l2_subdev_get_try_format
>> drivers/media/i2c/adv748x/adv748x-csi2.c:199:52: error: 'struct v4l2_subdev_format' has no member named 'stream'
     199 |                                            sdformat->stream);
         |                                                    ^~
>> drivers/media/i2c/adv748x/adv748x-csi2.c:207:15: error: implicit declaration of function 'v4l2_subdev_state_get_opposite_stream_format' [-Werror=implicit-function-declaration]
     207 |         fmt = v4l2_subdev_state_get_opposite_stream_format(sd_state, sdformat->pad,
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c:208:68: error: 'struct v4l2_subdev_format' has no member named 'stream'
     208 |                                                            sdformat->stream);
         |                                                                    ^~
   drivers/media/i2c/adv748x/adv748x-csi2.c: At top level:
>> drivers/media/i2c/adv748x/adv748x-csi2.c:253:20: error: 'v4l2_subdev_get_fmt' undeclared here (not in a function); did you mean 'v4l2_subdev_notify'?
     253 |         .get_fmt = v4l2_subdev_get_fmt,
         |                    ^~~~~~~~~~~~~~~~~~~
         |                    v4l2_subdev_notify
   drivers/media/i2c/adv748x/adv748x-csi2.c: In function 'adv748x_csi2_init':
   drivers/media/i2c/adv748x/adv748x-csi2.c:323:29: error: 'V4L2_SUBDEV_FL_MULTIPLEXED' undeclared (first use in this function)
     323 |                             V4L2_SUBDEV_FL_MULTIPLEXED,
         |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c:340:15: error: implicit declaration of function 'v4l2_subdev_init_finalize'; did you mean 'v4l2_subdev_init'? [-Werror=implicit-function-declaration]
     340 |         ret = v4l2_subdev_init_finalize(&tx->sd);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~
         |               v4l2_subdev_init
   drivers/media/i2c/adv748x/adv748x-csi2.c:357:9: error: implicit declaration of function 'v4l2_subdev_cleanup'; did you mean 'v4l2_subdev_call'? [-Werror=implicit-function-declaration]
     357 |         v4l2_subdev_cleanup(&tx->sd);
         |         ^~~~~~~~~~~~~~~~~~~
         |         v4l2_subdev_call
   cc1: some warnings being treated as errors


vim +198 drivers/media/i2c/adv748x/adv748x-csi2.c

   185	
   186	static int adv748x_csi2_set_format(struct v4l2_subdev *sd,
   187					   struct v4l2_subdev_state *sd_state,
   188					   struct v4l2_subdev_format *sdformat)
   189	{
   190		struct v4l2_mbus_framefmt *fmt;
   191		int ret = 0;
   192	
   193		/* Do not allow to set format on the multiplexed source pad. */
   194		if (sdformat->pad == ADV748X_CSI2_SOURCE)
   195			return -EINVAL;
   196	
   197		v4l2_subdev_lock_state(sd_state);
 > 198		fmt = v4l2_state_get_stream_format(sd_state, sdformat->pad,
 > 199						   sdformat->stream);
   200		if (!fmt) {
   201			ret = -EINVAL;
   202			goto out;
   203		};
   204		*fmt = sdformat->format;
   205	
   206		/* Propagate format to the other end of the route. */
 > 207		fmt = v4l2_subdev_state_get_opposite_stream_format(sd_state, sdformat->pad,
   208								   sdformat->stream);
   209		if (!fmt) {
   210			ret = -EINVAL;
   211			goto out;
   212		}
   213		*fmt = sdformat->format;
   214	
   215	out:
   216		v4l2_subdev_unlock_state(sd_state);
   217	
   218		return ret;
   219	}
   220	
   221	static int adv748x_csi2_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad,
   222						struct v4l2_mbus_config *config)
   223	{
   224		struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
   225	
   226		if (pad != ADV748X_CSI2_SOURCE)
   227			return -EINVAL;
   228	
   229		config->type = V4L2_MBUS_CSI2_DPHY;
   230		switch (tx->active_lanes) {
   231		case 1:
   232			config->flags = V4L2_MBUS_CSI2_1_LANE;
   233			break;
   234	
   235		case 2:
   236			config->flags = V4L2_MBUS_CSI2_2_LANE;
   237			break;
   238	
   239		case 3:
   240			config->flags = V4L2_MBUS_CSI2_3_LANE;
   241			break;
   242	
   243		case 4:
   244			config->flags = V4L2_MBUS_CSI2_4_LANE;
   245			break;
   246		}
   247	
   248		return 0;
   249	}
   250	
   251	static const struct v4l2_subdev_pad_ops adv748x_csi2_pad_ops = {
   252		.init_cfg = adv748x_csi2_init_cfg,
 > 253		.get_fmt = v4l2_subdev_get_fmt,
   254		.set_fmt = adv748x_csi2_set_format,
   255		.get_mbus_config = adv748x_csi2_get_mbus_config,
   256	};
   257	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

* Re: [PATCH 3/5] media: adv748x: Move format to subdev state
@ 2021-12-17  7:30     ` kernel test robot
  0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2021-12-17  7:30 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 9256 bytes --]

Hi Jacopo,

I love your patch! Yet something to improve:

[auto build test ERROR on media-tree/master]
[also build test ERROR on v5.16-rc5 next-20211216]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jacopo-Mondi/media-adv748x-Add-CSI-2-VC-support/20211217-010519
base:   git://linuxtv.org/media_tree.git master
config: arc-randconfig-r043-20211216 (https://download.01.org/0day-ci/archive/20211217/202112171539.cPT19ZOz-lkp(a)intel.com/config)
compiler: arc-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/90158bf217d9df03d83fac378198a756af229010
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jacopo-Mondi/media-adv748x-Add-CSI-2-VC-support/20211217-010519
        git checkout 90158bf217d9df03d83fac378198a756af229010
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/media/i2c/adv748x/adv748x-csi2.c: In function 'adv748x_csi2_init_cfg':
   drivers/media/i2c/adv748x/adv748x-csi2.c:146:34: error: array type has incomplete element type 'struct v4l2_subdev_route'
     146 |         struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
         |                                  ^~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c:152:34: error: 'V4L2_SUBDEV_ROUTE_FL_ACTIVE' undeclared (first use in this function); did you mean 'V4L2_SUBDEV_FORMAT_ACTIVE'?
     152 |                         .flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
         |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                  V4L2_SUBDEV_FORMAT_ACTIVE
   drivers/media/i2c/adv748x/adv748x-csi2.c:152:34: note: each undeclared identifier is reported only once for each function it appears in
   drivers/media/i2c/adv748x/adv748x-csi2.c:173:37: error: storage size of 'routing' isn't known
     173 |         struct v4l2_subdev_krouting routing;
         |                                     ^~~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c:179:9: error: implicit declaration of function 'v4l2_subdev_lock_state'; did you mean 'v4l2_subdev_alloc_state'? [-Werror=implicit-function-declaration]
     179 |         v4l2_subdev_lock_state(state);
         |         ^~~~~~~~~~~~~~~~~~~~~~
         |         v4l2_subdev_alloc_state
   drivers/media/i2c/adv748x/adv748x-csi2.c:180:15: error: implicit declaration of function 'v4l2_subdev_set_routing'; did you mean 'v4l2_subdev_notify'? [-Werror=implicit-function-declaration]
     180 |         ret = v4l2_subdev_set_routing(sd, state, &routing);
         |               ^~~~~~~~~~~~~~~~~~~~~~~
         |               v4l2_subdev_notify
   drivers/media/i2c/adv748x/adv748x-csi2.c:181:9: error: implicit declaration of function 'v4l2_subdev_unlock_state'; did you mean 'v4l2_subdev_alloc_state'? [-Werror=implicit-function-declaration]
     181 |         v4l2_subdev_unlock_state(state);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~
         |         v4l2_subdev_alloc_state
   drivers/media/i2c/adv748x/adv748x-csi2.c:173:37: warning: unused variable 'routing' [-Wunused-variable]
     173 |         struct v4l2_subdev_krouting routing;
         |                                     ^~~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c:146:34: warning: unused variable 'routes' [-Wunused-variable]
     146 |         struct v4l2_subdev_route routes[ADV748X_CSI2_STREAMS] = {
         |                                  ^~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c: In function 'adv748x_csi2_set_format':
>> drivers/media/i2c/adv748x/adv748x-csi2.c:198:15: error: implicit declaration of function 'v4l2_state_get_stream_format'; did you mean 'v4l2_subdev_get_try_format'? [-Werror=implicit-function-declaration]
     198 |         fmt = v4l2_state_get_stream_format(sd_state, sdformat->pad,
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |               v4l2_subdev_get_try_format
>> drivers/media/i2c/adv748x/adv748x-csi2.c:199:52: error: 'struct v4l2_subdev_format' has no member named 'stream'
     199 |                                            sdformat->stream);
         |                                                    ^~
>> drivers/media/i2c/adv748x/adv748x-csi2.c:207:15: error: implicit declaration of function 'v4l2_subdev_state_get_opposite_stream_format' [-Werror=implicit-function-declaration]
     207 |         fmt = v4l2_subdev_state_get_opposite_stream_format(sd_state, sdformat->pad,
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c:208:68: error: 'struct v4l2_subdev_format' has no member named 'stream'
     208 |                                                            sdformat->stream);
         |                                                                    ^~
   drivers/media/i2c/adv748x/adv748x-csi2.c: At top level:
>> drivers/media/i2c/adv748x/adv748x-csi2.c:253:20: error: 'v4l2_subdev_get_fmt' undeclared here (not in a function); did you mean 'v4l2_subdev_notify'?
     253 |         .get_fmt = v4l2_subdev_get_fmt,
         |                    ^~~~~~~~~~~~~~~~~~~
         |                    v4l2_subdev_notify
   drivers/media/i2c/adv748x/adv748x-csi2.c: In function 'adv748x_csi2_init':
   drivers/media/i2c/adv748x/adv748x-csi2.c:323:29: error: 'V4L2_SUBDEV_FL_MULTIPLEXED' undeclared (first use in this function)
     323 |                             V4L2_SUBDEV_FL_MULTIPLEXED,
         |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/adv748x/adv748x-csi2.c:340:15: error: implicit declaration of function 'v4l2_subdev_init_finalize'; did you mean 'v4l2_subdev_init'? [-Werror=implicit-function-declaration]
     340 |         ret = v4l2_subdev_init_finalize(&tx->sd);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~
         |               v4l2_subdev_init
   drivers/media/i2c/adv748x/adv748x-csi2.c:357:9: error: implicit declaration of function 'v4l2_subdev_cleanup'; did you mean 'v4l2_subdev_call'? [-Werror=implicit-function-declaration]
     357 |         v4l2_subdev_cleanup(&tx->sd);
         |         ^~~~~~~~~~~~~~~~~~~
         |         v4l2_subdev_call
   cc1: some warnings being treated as errors


vim +198 drivers/media/i2c/adv748x/adv748x-csi2.c

   185	
   186	static int adv748x_csi2_set_format(struct v4l2_subdev *sd,
   187					   struct v4l2_subdev_state *sd_state,
   188					   struct v4l2_subdev_format *sdformat)
   189	{
   190		struct v4l2_mbus_framefmt *fmt;
   191		int ret = 0;
   192	
   193		/* Do not allow to set format on the multiplexed source pad. */
   194		if (sdformat->pad == ADV748X_CSI2_SOURCE)
   195			return -EINVAL;
   196	
   197		v4l2_subdev_lock_state(sd_state);
 > 198		fmt = v4l2_state_get_stream_format(sd_state, sdformat->pad,
 > 199						   sdformat->stream);
   200		if (!fmt) {
   201			ret = -EINVAL;
   202			goto out;
   203		};
   204		*fmt = sdformat->format;
   205	
   206		/* Propagate format to the other end of the route. */
 > 207		fmt = v4l2_subdev_state_get_opposite_stream_format(sd_state, sdformat->pad,
   208								   sdformat->stream);
   209		if (!fmt) {
   210			ret = -EINVAL;
   211			goto out;
   212		}
   213		*fmt = sdformat->format;
   214	
   215	out:
   216		v4l2_subdev_unlock_state(sd_state);
   217	
   218		return ret;
   219	}
   220	
   221	static int adv748x_csi2_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad,
   222						struct v4l2_mbus_config *config)
   223	{
   224		struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
   225	
   226		if (pad != ADV748X_CSI2_SOURCE)
   227			return -EINVAL;
   228	
   229		config->type = V4L2_MBUS_CSI2_DPHY;
   230		switch (tx->active_lanes) {
   231		case 1:
   232			config->flags = V4L2_MBUS_CSI2_1_LANE;
   233			break;
   234	
   235		case 2:
   236			config->flags = V4L2_MBUS_CSI2_2_LANE;
   237			break;
   238	
   239		case 3:
   240			config->flags = V4L2_MBUS_CSI2_3_LANE;
   241			break;
   242	
   243		case 4:
   244			config->flags = V4L2_MBUS_CSI2_4_LANE;
   245			break;
   246		}
   247	
   248		return 0;
   249	}
   250	
   251	static const struct v4l2_subdev_pad_ops adv748x_csi2_pad_ops = {
   252		.init_cfg = adv748x_csi2_init_cfg,
 > 253		.get_fmt = v4l2_subdev_get_fmt,
   254		.set_fmt = adv748x_csi2_set_format,
   255		.get_mbus_config = adv748x_csi2_get_mbus_config,
   256	};
   257	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

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

end of thread, other threads:[~2021-12-17  7:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16 17:03 [PATCH 0/5] media: adv748x: Add CSI-2 VC support Jacopo Mondi
2021-12-16 17:03 ` [PATCH 1/5] media: adv748x: Add flags to adv748x_subdev_init() Jacopo Mondi
2021-12-16 17:03 ` [PATCH 2/5] media: adv748x: Add support for v4l2_subdev_state Jacopo Mondi
2021-12-17  2:41   ` kernel test robot
2021-12-17  2:41     ` kernel test robot
2021-12-17  4:24   ` kernel test robot
2021-12-17  4:24     ` kernel test robot
2021-12-16 17:03 ` [PATCH 3/5] media: adv748x: Move format to subdev state Jacopo Mondi
2021-12-17  7:30   ` kernel test robot
2021-12-17  7:30     ` kernel test robot
2021-12-16 17:03 ` [PATCH 4/5] media: adv748x: Implement .get_frame_desc() Jacopo Mondi
2021-12-17  3:12   ` kernel test robot
2021-12-17  3:12     ` kernel test robot
2021-12-16 17:03 ` [PATCH 5/5] media: adv748x: Implement set_routing Jacopo Mondi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.