User`s guide

Supporting the i.MX53 Camera Sensor Interface CSI0
i.MX53 System Development User’s Guide, Rev. 1
20-6 Freescale Semiconductor
2. Open the i.MX53 camera support Makefile
$ gedit Makefile &
3. Add the cmos driver compilation entry to the end of the Makefile.
ipuv3_csi0_chess_camera-objs := ipuv3_csi0_chess.o sensor_clock.o
obj-$(CONFIG_MXC_IPUV3_CSI0_TEST_MODE) += ipuv3_csi0_chess_camera.o
The kernel object is created using the ipuv3_csi0_chess.c file. You should have the following files as
output:
ipuv3_csi0_chess_camera.mod.c
ipuv3_csi0_chess.o
ipuv3_csi0_chess_camera.o
ipuv3_csi0_chess_camera.mod.o
ipuv3_csi0_chess_camera.ko
20.5 Using the I
2
C Interface
Many camera sensor modules require a synchronous serial interface for initialization and configuration.
This section uses the <ltib dir>/rpm/BUILD/linux/drivers/media/video/mxc/capture/ov3640.c file for
its example code. This file contains a driver that uses the I
2
C interface for sensor configuration.
After the I
2
C interface is running, create a new I
2
C device to handle your camera bus. If the camera sensor
file (called mycamera.c in the following example code) is located in the same folder as ov3640.c, the code
is as follows:
struct i2c_client * mycamera_i2c_client;
static s32 mycamera_read_reg(u16 reg, u8 *val);
static s32 mycamera_write_reg(u16 reg, u8 val);
static const struct i2c_device_id mycamera_id[] = {
{"mycamera", 0},
{},
};
MODULE_DEVICE_TABLE(i2c, mycamera_id);
static struct i2c_driver mycamera_i2c_driver = {
.driver = {
.owner = THIS_MODULE,
.name = "mycamera",
},
.probe = mycamera_probe,
.remove = mycamera_remove,
.id_table = mycamera_id,
};
static s32 ipuv3_csi0_chess_write_reg(u16 reg, u8 val)
{
u8 au8Buf[3] = {0};
au8Buf[0] = reg >> 8;
au8Buf[1] = reg & 0xff;