User`s guide
Supporting the i.MX53 Camera Sensor Interface CSI0
i.MX53 System Development User’s Guide, Rev. 1
20-8 Freescale Semiconductor
Check ov3640.c for the complete example code.
After creating the new I
2
C device, add the following lines to your platform file (located at <ltib
dir>/rpm/BUILD/linux/arch/arm/mach-mx5/mx53_<board name>.c
).
static struct mxc_camera_platform_data camera_data = {
.analog_regulator = "VSD",
.mclk = 24000000,
.csi = 0,
.pwdn = camera_pwdn,
};
static struct i2c_board_info mxc_i2c0_board_info[] __initdata = {
{
.type = "ov3640",
.addr = 0x3C,
.platform_data = (void *)&camera_data,
},
{
.type = "adv7180", .addr = 0x21, .platform_data = (void *)&adv7180_data, },
{ .type = "cs42888",
.addr = 0x48,
},
{
.type = "mycamera",
.addr = 0x2E,
.platform_data = (void *)&camera_data,
},
};
static void __init mxc_board_init(void)
{
...
i2c_register_board_info(0, mxc_i2c0_board_info,ARRAY_SIZE(mxc_i2c0_board_info));
...
}
You may modify the platform file at this point to specify features about your camera such as the CSI
interface used (CSI0 or CSI1), the MCLK frequency, and some power supply settings related to the
module. Notice that “.addr” is used to specify the I
2
C address of the camera sensor module.
NOTE
It is mandatory that “.type” be equal to the i2c_device_id on your camera
sensor file (mycamera.c).
You can now read and write from/to the sensor in the camera sensor file by using the following:
retval = mycamera_write_reg(RegAddr, Val);
retval = mycamera_read_reg(RegAddr, &RegVal);