Re: Issues with ov5640 camera on i.MX6Q

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Fabio!

I tried tweaking the PLL configuration in the driver and did some further tests on 5.2 kernel.

I was finally able to capture RAW frames that match the test pattern for 1280x720 and 1920x1080 resolutions. The 2592x1944 frame is still not perfectly aligned, but it looks much closer to the test pattern.

I uploaded the images here:

https://imgur.com/a/ywHokMf

The changes I made in the driver are below. Not sure these changes make much sense, but they seem to fix 1280x720 and 1920x1080 frames.

diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index 759d60c6..cfa678e 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -795,13 +795,13 @@ static int ov5640_mod_reg(struct ov5640_dev *sensor, u16 reg,
  * FIXME: to be re-calcualted for 1 data lanes setups
  */
 #define OV5640_MIPI_DIV_PCLK	2
-#define OV5640_MIPI_DIV_SCLK	1
+#define OV5640_MIPI_DIV_SCLK	2

 /*
  * This is supposed to be ranging from 1 to 2, but the value is always
  * set to 2 in the vendor kernels.
  */
-#define OV5640_PLL_ROOT_DIV			2
+#define OV5640_PLL_ROOT_DIV			1
 #define OV5640_PLL_CTRL3_PLL_ROOT_DIV_2		BIT(4)

 /*
@@ -836,8 +836,8 @@ static unsigned long ov5640_compute_sys_clk(struct ov5640_dev *sensor,
 	unsigned long sysclk = sensor->xclk_freq / pll_prediv * pll_mult;

 	/* PLL1 output cannot exceed 1GHz. */
-	if (sysclk / 1000000 > 1000)
-		return 0;
+	// if (sysclk / 1000000 > 1000)
+	// 	return 0;

 	return sysclk / sysdiv;
 }
@@ -1818,7 +1824,7 @@ static int ov5640_set_mode(struct ov5640_dev *sensor)
 	 * All the formats we support have 16 bits per pixel, seems to require
 	 * the same rate than YUV, so we can just use 16 bpp all the time.
 	 */
-	rate = mode->vtot * mode->htot * 16;
+	rate = mode->vtot * mode->htot * 8;
 	rate *= ov5640_framerates[sensor->current_fr];
 	if (sensor->ep.bus_type == V4L2_MBUS_CSI2_DPHY) {
 		rate = rate / sensor->ep.bus.mipi_csi2.num_data_lanes;

Thanks,

Best,

Laura

On 7/22/19 2:45 PM, Fabio Estevam wrote:
[Adding Steve and Philipp]

On Thu, Jul 18, 2019 at 10:06 AM Laura Nao <laura.nao@xxxxxxxxxxxx> wrote:

Hello Loic,

I'm having some issues with RAW8 mode on the OV5640 camera and I'd like
to kindly ask for your advice, as I saw that you added support for RAW
mode in the mainline kernel driver.

I'm trying to capture some raw images on a i.MX6Q based board. I
configured the pipeline as follows:

media-ctl -l "'ov5640 1-003c':0 -> 'imx6-mipi-csi2':0[1]"
media-ctl -l "'imx6-mipi-csi2':2 -> 'ipu1_csi1':0[1]"
media-ctl -l "'ipu1_csi1':2 -> 'ipu1_csi1 capture':0[1]"
media-ctl -V "'ov5640 1-003c':0 [fmt:SBGGR8_1X8/2592x1944 field:none]"
media-ctl -V "'imx6-mipi-csi2':2 [fmt:SBGGR8_1X8/2592x1944 field:none]"

I'm capturing the frame using v4l-utils:

v4l2-ctl -d /dev/video5 --verbose --set-fmt
video=width=2592,height=1944,pixelformat=BA81 --stream-mmap
--stream-count=1 --stream-to=bggr_2592x1944.raw

The images I'm obtaining are completely garbled. I tried both 5.2
mainline and 5.1.18 kernels.

I'm able to correctly capture YUV frames in all resolutions with the
same driver (with the pipeline configured to go through the
ipu1_ic_prpenc node first).

Do you have any insight on what might be causing these issues? Is the
PLL configuration supposed to be changed when RAW8 format is selected?

Thanks for your help,

Best regards,

Laura



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux