Firefly-RK3128 開發板上有 CIF 接口,支持 CIF 攝像頭。 在 kernel/drivers/media/video 目錄里有以下 CIF 攝像頭的驅動:
- gc0307
- gc0308
- gc0309
- gc0328
- gc0329
- gc2015
- gc2035
- gt2005
- hm2057
- hm5065
- mt9p111
- nt99160
- nt99240
- ov2659
- ov5640
- sp0838
- sp2518
本章主要描述如何配置 CIF。
在 kernel/arch/arm/boot/dts/rk3128-cif-sensor.dtsi 定義攝像頭列表:
rk3128_cif_sensor: rk3128_cif_sensor{ compatible = "rockchip,sensor"; status = "disabled"; CONFIG_SENSOR_POWER_IOCTL_USR = <1>; CONFIG_SENSOR_RESET_IOCTL_USR = <0>; CONFIG_SENSOR_POWERDOWN_IOCTL_USR = <0>; CONFIG_SENSOR_FLASH_IOCTL_USR = <0>; CONFIG_SENSOR_AF_IOCTL_USR = <0>; // ... skip some modules gc0329{ is_front = <1>; rockchip,powerdown = <&gpio3 GPIO_D7 GPIO_ACTIVE_HIGH>; pwdn_active = <gc0329_PWRDN_ACTIVE>; #rockchip,power = <>; pwr_active = <PWR_ACTIVE_HIGH>; #rockchip,reset = <>; #rst_active = <>; #rockchip,flash = <>; #rockchip,af = <>; mir = <0>; flash_attach = <0>; resolution = <gc0329_FULL_RESOLUTION>; powerup_sequence = <gc0329_PWRSEQ>; orientation = <0>; i2c_add = <gc0329_I2C_ADDR>; i2c_rata = <100000>; i2c_chl = <0>; cif_chl = <0>; mclk_rate = <24>; }; gc0329_b { is_front = <0>; rockchip,powerdown = <&gpio3 GPIO_B3 GPIO_ACTIVE_HIGH>; pwdn_active = <gc0329_PWRDN_ACTIVE>; #rockchip,power = <>; pwr_active = <PWR_ACTIVE_HIGH>; #rockchip,reset = <>; #rst_active = <>; #rockchip,flash = <>; #rockchip,af = <>; mir = <0>; flash_attach = <0>; resolution = <gc0329_FULL_RESOLUTION>; powerup_sequence = <gc0329_PWRSEQ>; orientation = <0>; i2c_add = <gc0329_I2C_ADDR>; i2c_rata = <100000>; i2c_chl = <0>; // <0>; cif_chl = <0>; mclk_rate = <24>; }; };
這里列出 gc0329 雙攝像頭模組的配置,其屬性解釋如下:
- is_front: 0: 后置攝像頭,1: 前置攝像頭
- rockchip,powerdown: 定義該攝像頭對應的 powerdown gpio
- pwdn_active: powerdown 的有效電平
- mir: 0: 不支持鏡像,1: 支持鏡像,
- resolution: 最大的分辨率
- orientation: 旋轉角度,0: 0 度, 90: 90 度, 180: 180 度, 270: 270 度
- i2c_add: 攝像頭的 I2C 地址
- i2c_rata: I2C 頻率,單位 Hz
- i2c_chl: I2C 通道號
- cif_chl: cif 控制器信息,rk312x 僅有 cif0
- mclk_rate: 傳感器時鐘頻率,單位:MHz
其中的常量值都在 kernel/arch/arm/mach-rockchip/rk_camera_sensor_info.h 中定義:
#define gc0329_FULL_RESOLUTION 0x30000 // 0.3 megapixel #define gc0329_I2C_ADDR 0x62 #define gc0329_PWRDN_ACTIVE 0x01 #define gc0329_PWRSEQ sensor_PWRSEQ_DEFAULT //Sensor power active level define #define PWR_ACTIVE_HIGH 0x01 #define PWR_ACTIVE_LOW 0x0
分辨率對應的圖像長寬,在 kernel/drivers/media/video/generic_sensor.h 的 sensor_get_full_width_height 函數里定義:
static inline int sensor_get_full_width_height(int full_resolution, unsigned short *w, unsigned short *h) { switch (full_resolution) { case 0x30000: { *w = 640; *h = 480; break; } case 0x100000: { *w = 1024; *h = 768; break; } //... } }
要啟用 CIF ,只需在 kernel/arch/arm/boot/dts/rk3128-fireprime.dts 加入:
&rk3128_cif_sensor{ status = "okay"; };
-
嵌入式主板
+關注
關注
7文章
6081瀏覽量
34942 -
Firefly
+關注
關注
2文章
538瀏覽量
6932
發布評論請先 登錄
相關推薦
評論