ov5645: Fix OpenCV related issues

b/128424247

- OpenCV loses information about the resolution because it doesn't
  call G_PARM before calling S_PARM to set framerate and for OV5645
  the resolution is encoded in the capturemode.
- The way the csi host driver was implemented did not conform with
  the v4l2 spec and this patch fixes that, but only for the one
  csi camera case, which completely breaks the two camera case even
  when STREAMON/STREAMOFF come in a well coreographed pattern.
  TODO: Fix the two camera case in mxc-mipi-csi2-yav.c

Change-Id: I2d11a17f4f0574ff577dd1c3b30725fa0bd09a8a
diff --git a/drivers/media/platform/mxc/capture/ov5645_mipi_v2.c b/drivers/media/platform/mxc/capture/ov5645_mipi_v2.c
index e1e4475..6ae6aa3 100644
--- a/drivers/media/platform/mxc/capture/ov5645_mipi_v2.c
+++ b/drivers/media/platform/mxc/capture/ov5645_mipi_v2.c
@@ -3149,6 +3149,13 @@
 			return -EINVAL;
 		}
 
+		// This check is necessary because OpenCV doesn't call G_PARM on the
+		// zeroed structure before setting FPS through S_PARM
+		if ((u32)a->parm.capture.capturemode == 0) {
+			a->parm.capture.capturemode = get_capturemode(ov5645_data.pix.width,
+				ov5645_data.pix.height);
+		}
+
 		orig_mode = ov5645_data.loaded_mode;
 		if ((orig_mode != (u32)a->parm.capture.capturemode) ||
 				(frame_rate != ov5645_data.loaded_fps)) {