Developed
Published by King on Tuesday
I got a mini210 development board these days, so I tried to port ov7670 to the Development Board. carefully observe the friendly drive and find that the friendly drive provides the ov9650, because the ov7670 and ov9650 drivers are similar. so I want to modify it based on ov9650. however, no source files related to ov9650 were found in the/opt/friendlyarm/mini210/Android/linux-2.6.35.7-android/Drivers/Media/video directory. after reading the MAKEFILE file, you can see that the friendly version does not provide the ov9650 source code (despise the friendly version ).
So I had to do it myself:
1. Add two files "fpov7670.c" and "fpov7670.h" in the "/opt/friendlyarm/mini210/Android/linux-2.6.35.7-android/Drivers/Media/video" directory ".
2. Find the MAKEFILE file in the "/opt/friendlyarm/mini210/Android/linux-2.6.35.7-android/Drivers/Media/video" directory. Add a line
| 12 |
“obj-$(CONFIG_VIDEO_FPOV7670) += fpov7670.o”. |
3. Find "kconfig" in the "/opt/friendlyarm/mini210/Android/linux-2.6.35.7-android/Drivers/Media/video" Directory"
Add the following five rows
| 123456 |
config VIDEO_FPOV7670
tristate
"FPOV7670 Camera Sensor" depends on I2C && VIDEO_V4L2
---help---
This driver supports FPOV7670 SoC camera module |
4. the most important thing is to modify the code. refer to "s5k4ba. C "and" s5k4ba. h "changed" fpov7670.c "and" fpov7670.h. modify the IIC configuration. then find/opt/friendlyarm/mini210/Android/linux-2.6.35.7-android/ARCH/ARM/mach-s5pv210/mach-mini210.c, add the fpov7670 configuration.
| 01020304050607080910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
#ifdef CONFIG_VIDEO_FPOV7670
static
int ov7670_power_en(int
onoff) {
printk("ov7670_power_en: power %s\n", onoff ?
"ON" : "Off");
return
0; }
static
struct fpov7670_platform_data ov7670_plat = {
.default_width = 640,
.default_height = 480,
.pixelformat = V4L2_PIX_FMT_YUYV,
.freq = 40000000,
.is_mipi = 0,
};
static
struct i2c_board_info ov7670_i2c_info = {
I2C_BOARD_INFO("FPOV7670", (0x42>>1)),
.platform_data = &ov7670_plat,
};
static
struct s3c_platform_camera ov7670 = {
.id = CAMERA_PAR_A,
.type = CAM_TYPE_ITU,
.fmt = ITU_601_YCBCR422_8BIT,
.order422 = CAM_ORDER422_8BIT_CBYCRY,
.i2c_busnum = 0,
.info = &ov7670_i2c_info,
.pixelformat = V4L2_PIX_FMT_YUYV,
.srclk_name =
"mout_mpll", /* .srclk_name = "xusbxti", */ .clk_name =
"sclk_cam1", .clk_rate = 40000000,
.line_length = 640,
.width = 640,
.height = 480,
.window = {
.left = 0,
.top = 0,
.width = 640,
.height = 480,
},
/* Polarity */ .inv_pclk = 1,
.inv_vsync = 1,
.inv_href = 0,
.inv_hsync = 0,
.initialized = 0,
.cam_power = ov7670_power_en,
};
#endif |
Add the ov7670 driver to the driver list.
| 0102030405060708091011121314151617181920212223242526272829303132333435363738 |
/* Interface setting */ static
struct s3c_platform_fimc fimc_plat_lsi = {
.srclk_name =
"mout_mpll", .clk_name =
"sclk_fimc", .lclk_name =
"sclk_fimc_lclk", .clk_rate = 166750000,
#if defined(CONFIG_VIDEO_S5K4EA)
.default_cam = CAMERA_CSI_C,
#else
#ifdef CAM_ITU_CH_A
.default_cam = CAMERA_PAR_A,
#else
.default_cam = CAMERA_PAR_B,
#endif
#endif
.camera = {
#ifdef CONFIG_VIDEO_S5K4ECGX
&s5k4ecgx,
#endif
#ifdef CONFIG_VIDEO_S5KA3DFX
&s5ka3dfx,
#endif
#ifdef CONFIG_VIDEO_S5K4BA
&s5k4ba,
#endif
#ifdef CONFIG_VIDEO_S5K4EA
&s5k4ea,
#endif
#ifdef CONFIG_VIDEO_OV9650
&ov9650,
#endif
# Ifdef config_video_fpov7670 // Add
&ov7670,// New
# Endif // new
},
.hw_ver = 0x43,
}; |
5. in the "/opt/friendlyarm/mini210/Android/linux-2.6.35.7-android" directory, enter "make menuconfig" and press enter, select fpov7670, make. then, burn zimage into the Development Board. open the camera and test the image.
Note that the fpov7670 driver is used for fingerprint collection and does not require automatic exposure, white balance adjustment, and other functions. If it is used for photo taking, you need to add the above features.