[11/15] media: soc_camera: soc_scale_crop: Use correct pad when calling subdev try_fmt

Message ID 1432743053-13479-12-git-send-email-william.towle@codethink.co.uk (mailing list archive)
State Superseded, archived
Delegated to: Guennadi Liakhovetski
Headers

Commit Message

William Towle May 27, 2015, 4:10 p.m. UTC
  From: Rob Taylor <rob.taylor@codethink.co.uk>

Fix calls to subdev try_fmt to use correct pad. Fixes failures with
subdevs that care about having the right pad number set.

Signed-off-by: William Towle <william.towle@codethink.co.uk>
Reviewed-by: Rob Taylor <rob.taylor@codethink.co.uk>
---
 drivers/media/platform/soc_camera/soc_scale_crop.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)
  

Patch

diff --git a/drivers/media/platform/soc_camera/soc_scale_crop.c b/drivers/media/platform/soc_camera/soc_scale_crop.c
index bda29bc..d2b377f 100644
--- a/drivers/media/platform/soc_camera/soc_scale_crop.c
+++ b/drivers/media/platform/soc_camera/soc_scale_crop.c
@@ -224,6 +224,12 @@  static int client_set_fmt(struct soc_camera_device *icd,
 	struct v4l2_cropcap cap;
 	bool host_1to1;
 	int ret;
+#if defined(CONFIG_MEDIA_CONTROLLER)
+	struct media_pad *remote_pad;
+
+	remote_pad = media_entity_remote_pad(&icd->vdev->entity.pads[0]);
+	format->pad = remote_pad->index;
+#endif
 
 	ret = v4l2_device_call_until_err(sd->v4l2_dev,
 					 soc_camera_grp_id(icd), pad,
@@ -261,10 +267,21 @@  static int client_set_fmt(struct soc_camera_device *icd,
 	/* width <= max_width && height <= max_height - guaranteed by try_fmt */
 	while ((width > tmp_w || height > tmp_h) &&
 	       tmp_w < max_width && tmp_h < max_height) {
+#if defined(CONFIG_MEDIA_CONTROLLER)
+		struct media_pad *remote_pad;
+#endif
+
 		tmp_w = min(2 * tmp_w, max_width);
 		tmp_h = min(2 * tmp_h, max_height);
 		mf->width = tmp_w;
 		mf->height = tmp_h;
+
+#if defined(CONFIG_MEDIA_CONTROLLER)
+		remote_pad = media_entity_remote_pad(
+			&icd->vdev->entity.pads[0]);
+		format->pad = remote_pad->index;
+#endif
+
 		ret = v4l2_device_call_until_err(sd->v4l2_dev,
 					soc_camera_grp_id(icd), pad,
 					set_fmt, NULL, format);