Change camera parameters on the fly (i2c)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change camera parameters on the fly (i2c)

Jump to solution
1,035 Views
janiscoders
Contributor III

Hi, we are using board based on QSB with camera ov5640, but I think this applies globally.

I would like to change specific camera parameters on the fly, without stopping video camera. For example, I have changed default i2c configuration values in ov5640.c driver, so that it goes into night mode (after reading datasheet on how to do it) when initialized. But now I would like to change one value in one of camera's i2c registers on the fly, but it doesn't work.

I have tried to add a character device interface for camera driver and then from there call the internal ov5640_write_reg() function, but it doesn't work this way. The i2c_master_send() returns -5. Does the driver somehow closes connection after it has sent initial parameters or is it blocking i2c?

Can someone help me please?

Thank you.

Labels (3)
0 Kudos
1 Solution
598 Views
janiscoders
Contributor III

The problem is that when starting video capture, then i2c clock is turned on and off in different driver module (not in camera module), that's why it isn't possible later to change these parameters.

.....

ipu_csi_enable_mclk_if(CSI_MCLK_I2C, cam->csi, true, true);

err = vidioc_int_s_parm(cam->sensor, parm);

ipu_csi_enable_mclk_if(CSI_MCLK_I2C, cam->csi, false, false);

......


To overcome this, we had to turn on/off i2c clock manually.

View solution in original post

0 Kudos
2 Replies
599 Views
janiscoders
Contributor III

The problem is that when starting video capture, then i2c clock is turned on and off in different driver module (not in camera module), that's why it isn't possible later to change these parameters.

.....

ipu_csi_enable_mclk_if(CSI_MCLK_I2C, cam->csi, true, true);

err = vidioc_int_s_parm(cam->sensor, parm);

ipu_csi_enable_mclk_if(CSI_MCLK_I2C, cam->csi, false, false);

......


To overcome this, we had to turn on/off i2c clock manually.

0 Kudos
599 Views
BrilliantovKiri
Senior Contributor I

Hello, Janis!

This is a possible and you have several ways:
- use V4L2 IOCTL, e.g.V4L2_CID_CONTRAST

- use V4L2 IOCTL VIDIOC_DBG_G/S_REGISTER

- read/write CMOS registers via I2C from user-space