平台
内核版本
安卓版本
PX3
Linux3.1
Android7.1
文章目录
GM7150BN_BC
是一款
9
位视频解码芯片,该芯片采用
CMOS
工艺,通过
I2C
总线与
PC
或
DSP
相连构成应用系统。芯片内部只包含一路模拟处理通道,能实现
CVBS
、
S-Video
视频信号源选择、
A/D
转换、自动钳位、自动增益控制(
AGC
)、时钟发生(
CGC
)、多制式解码、亮度/对比度/饱和度控制(
BCS
)。
改的目录:
内核目录下改动文件如下:
arch/arm/mach-rk30/board-rk3168-tb-camera.c
arch/arm/plat-rk/include/plat/rk_camera.h
drivers/media/video/Kconfig
drivers/media/video/Makefile
drivers/media/video/gm7150.c
drivers/media/video/gm7150.h
drivers/video/rockchip/vehicle/Makefile
drivers/video/rockchip/vehicle/vehicle_ad_gm7150.c
drivers/video/rockchip/vehicle/vehicle_ad_gm7150.h
.../rockchip/vehicle/vehicle_generic_sensor.c
include/media/v4l2-chip-ident.h
其中新增文件如下:
create mode 100644 drivers/media/video/gm7150.c
create mode 100644 drivers/media/video/gm7150.h
create mode 100644 drivers/video/rockchip/vehicle/vehicle_ad_gm7150.c
create mode 100644 drivers/video/rockchip/vehicle/vehicle_ad_gm7150.h
部分修改内容如下:
目录:
arch/arm/mach-rk30/board-rk3168-tb-camera.c
注册一个
Camera Sensor
设备只需要在
board
文件
static struct rkcamera_platform_data
类型的
new_camera[]
中定义一个
Camera
设备即可。
static struct rkcamera_platform_data new_camera[ ] = {
. . .
+ #ifdef CONFIG_SOC_CAMERA_GM7150
+ new_camera_device ( RK29_CAM_SENSOR_GM7150,
+ back,
+ RK30_PIN0_PA6,
+ 0 ,
+ 3 ,
+ 3 ,
+ 0 ) ,
+ #endif
new_camera_device ( RK29_CAM_SENSOR_TVP5150,
back,
RK30_PIN0_PA6,
该函数原型如下:
new_camera_device ( sensor_name,
face,
pwdn_io,
flash_attach,
mir,
i2c_chl,
cif_chl)
其中:
face
Sensor 设备作为前置还是作为后置的配置;前置直接填写 front,后置直接填写 back
pwdn_io
Sensor 设 备 powerdown ( standby ) 连 接 GPIO 的 配 置
flash_attach
该 Sensor 设备是否连接 flash 闪光灯的配置
Mir
该 Sensor 设备的镜像配置
i2c_chl
该
Sensor
设备连接的
i2c
通道号配置
cif_chl
cif的通道
其中
mirde
详细配置:
bit0
0: mirror off
1: mirror on
bit1
0: flip off
1: flip on
设备名字添加
Sensor
设 备 名 字 , 采 用
arch/arm/plat-rk/include/plat/rk_camera.h
#define RK29_CAM_SENSOR_DM5150 dm5150
+#define RK29_CAM_SENSOR_GM7150 gm7150
#define dm5150_SENSOR_ORIENTATION 90
+#define gm7150_SENSOR_ORIENTATION 90
#define dm5150_FULL_RESOLUTION 0x30000 // 0.3 megapixel
+#define gm7150_FULL_RESOLUTION 0x30000 // 0.3 megapixel
#define dm5150_I2C_ADDR 0xba
+#define gm7150_I2C_ADDR 0xba
#define dm5150_PWRDN_ACTIVE 0x00
+#define gm7150_PWRDN_ACTIVE 0x00
#define dm5150_PWRSEQ sensor_PWRSEQ_DEFAULT
+#define gm7150_PWRSEQ sensor_PWRSEQ_DEFAULT
make kconfig 相关修改
接下来就是移植工作了:
目录:
drivers/media/video/Kconfig
+
+ config SOC_CAMERA_GM7150
+ tristate "gm7150 camera support for rockchip"
+ depends on SOC_CAMERA && I2C
+ help
+ This is a gm7150 camera driver for rockchip
目录:
drivers/media/video/Makefile
`+obj-$(CONFIG_SOC_CAMERA_GM7150) += gm7150.o`
drivers/video/rockchip/vehicle/Makefile
`+obj-$(CONFIG_VIDEO_REVERSE_IMAGE) += vehicle_ad_gm7150.o`
文件目录:
drivers/video/rockchip/vehicle/vehicle_generic_sensor.c
+ #include "vehicle_ad_gm7150.h"
static struct vehicle_sensor_ops sensor_cb_series[ ] = {
+ #ifdef CONFIG_SOC_CAMERA_GM7150
+ {
+ . name = STR ( RK29_CAM_SENSOR_GM7150) ,
+ . sensor_init = gm7150_ad_init,
+ . sensor_deinit = gm7150_ad_deinit,
+ . sensor_get_cfg = gm7150_ad_get_cfg,
+ . sensor_check_cif_error = gm7150_ad_check_cif_error,
+ . sensor_check_id_cb = gm7150_check_id
+ } ,
+ #endif
目录:
include/media/v4l2-chip-ident.h
+ V4L2_IDENT_GM7150 = 274,
剩下这个四个文件
drivers/media/video/gm7150.c
drivers/media/video/gm7150.h
drivers/video/rockchip/vehicle/vehicle_ad_gm7150.c
drivers/video/rockchip/vehicle/vehicle_ad_gm7150.h
可以从
我的github仓库 下载。