@@ -891,6 +891,9 @@ int rvin_dma_on(struct rvin_dev *vin)
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_mbus_framefmt *mf = &fmt.format;
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ int pad_idx;
+#endif
int ret;
sd = vin_to_sd(vin);
@@ -924,6 +927,18 @@ int rvin_dma_on(struct rvin_dev *vin)
/* TODO: ret = rvin_sensor_setup(vin, pix, ...); */
+ vin->src_pad_idx = 0;
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
+ if (sd->entity.pads[pad_idx].flags
+ == MEDIA_PAD_FL_SOURCE)
+ break;
+ if (pad_idx >= sd->entity.num_pads)
+ goto remove_device;
+
+ vin->src_pad_idx = pad_idx;
+#endif
+
vin->format.field = V4L2_FIELD_ANY;
video_set_drvdata(&vin->vdev, vin);
@@ -106,6 +106,7 @@ struct rvin_dev {
enum chip_id chip;
struct v4l2_device v4l2_dev;
+ int src_pad_idx; /* For media-controller drivers */
struct v4l2_ctrl_handler ctrl_handler;
struct video_device vdev;