How to access OV5645's register

Hi!
I’d like to use DB410c’s I2C controller to read/write the I2C device registers of the OV5645s of this adapter:
https://www.ebay.com/itm/96Boards-MIPI-Adapter-with-Dual-OV5645/253645902432?

Using i2cdetect I’ve got the following results:

linaro@linaro-developer:~$ sudo i2cdetect -l
i2c-3   i2c             QUP I2C adapter                         I2C adapter
i2c-1   i2c             QUP I2C adapter                         I2C adapter
i2c-4   i2c             Qualcomm Camera Control Interface       I2C adapter
i2c-0   i2c             QUP I2C adapter                         I2C adapter

linaro@linaro-developer:~$ sudo i2cdetect -F 4    
Functionalities implemented by /dev/i2c-4:
I2C                              yes
SMBus Quick Command              no
SMBus Send Byte                  no
SMBus Receive Byte               no
SMBus Write Byte                 no
SMBus Read Byte                  no
SMBus Write Word                 no
SMBus Read Word                  no
SMBus Process Call               no
SMBus Block Write                no
SMBus Block Read                 no
SMBus Block Process Call         no
SMBus PEC                        no
I2C Block Write                  no
I2C Block Read                   no

According to the following information from the boot message:

[   11.685499] ov5645 4-003b: OV5645 detected at address 0x3b
:
[   12.048161] ov5645 4-003a: OV5645 detected at address 0x3a

I assume the I2C device addresses of these OV5645 are 0x3a & 0x3b.

To ensure I can actually access each of the OV5645, I tried to read the SENSOR CHIP HIGH ID BYTE located at address 0x300A. So I experimented to send the following commands:

linaro@linaro-developer:~$ sudo i2cget -y 4 0x3a 0x30 0x0a  
Error: Invalid mode!
Usage: i2cget [-f] [-y] [-a] I2CBUS CHIP-ADDRESS [DATA-ADDRESS [MODE]]
  I2CBUS is an integer or an I2C bus name
  ADDRESS is an integer (0x03 - 0x77, or 0x00 - 0x7f if -a is given)
  MODE is one of:
    b (read byte data, default)
    w (read word data)
    c (write byte/read byte)
    Append p for SMBus PEC

As the address of OV5645’s register is 16-bit, I tried to add a trailing ‘w’ but doesn’t help, either:

linaro@linaro-developer:~$ sudo i2cget -y 4 0x3b 0x30 0x0a w
Error: Invalid mode!
Usage: i2cget [-f] [-y] [-a] I2CBUS CHIP-ADDRESS [DATA-ADDRESS [MODE]]
  I2CBUS is an integer or an I2C bus name
  ADDRESS is an integer (0x03 - 0x77, or 0x00 - 0x7f if -a is given)
  MODE is one of:
b (read byte data, default)
w (read word data)
c (write byte/read byte)
Append p for SMBus PEC

None of them worked.
I’m wondering how I can access OV5645’s reister, no matter using i2c-tools(i2cget, i2cset,…), Python, C/C++?

AFAIK i2c-tools utility doesn’t support reading 16bit address directly. You can however pass LSB or MSB depending on the device BUT, as reported by i2cdetect, CCI-I2C adapter doesn’t support SMbus protocol. So you can’t use this tool at all (it doesn’t support plain i2c). I would suggest you to write a simple kernel driver or modify the existing ov5645 driver to play with it.

Hi @Mani,
OK, I understand.
I’ll try to use C/C++ to access these registers.
Thanks for your reply and explanation!