|
【Linux】
debian 尝试使用ov13850摄像头
发表于 2018-5-30 21:45:57
浏览:42303
|
回复:23
打印
只看该作者
[复制链接]
楼主
首先修改dts文件 rk3399-firefly-linux.dts- &cif_isp0 {
- rockchip,camera-modules-attached = <&camera0>;
- rockchip,gpios-cifpower = <&gpio1 22 GPIO_ACTIVE_HIGH>;
- status = "okay";
- };
复制代码- camera0: camera-module@20 {
- status = "okay";
- compatible = "omnivision,ov13850-v4l2-i2c-subdev";
- reg = < 0x20 >;
- device_type = "v4l2-i2c-subdev";
- clocks = <&cru SCLK_CIF_OUT>;
- clock-names = "clk_cif_out";
- pinctrl-names = "rockchip,camera_default", "rockchip,camera_sleep";
- pinctrl-0 = <&cam0_default_pins>;
- pinctrl-1 = <&cam0_sleep_pins>;
- /*GPIO2 B4 = 12 B6 = 14 MIPI0 D4 = 28 C7 = 23 */
- rockchip,pwr-gpio = <&gpio1 23 GPIO_ACTIVE_HIGH>; /*Power GPIO1_C7 */
- rockchip,pd-gpio = <&gpio2 12 GPIO_ACTIVE_LOW>; /*Power Down GPIO2_B4 */
- rockchip,rst-gpio = <&gpio0 8 GPIO_ACTIVE_LOW>; /*Reset GPIO0_B0 */
-
- rockchip,camera-module-mclk-name = "clk_cif_out";
- rockchip,camera-module-facing = "back";
- rockchip,camera-module-name = "cmk-cb0695-fv1";
- rockchip,camera-module-len-name = "lg9569a2";
- rockchip,camera-module-fov-h = "66.0";
- rockchip,camera-module-fov-v = "50.1";
- rockchip,camera-module-orientation = <0>;
- rockchip,camera-module-iq-flip = <0>;
- rockchip,camera-module-iq-mirror = <0>;
- rockchip,camera-module-flip = <0>;
- rockchip,camera-module-mirror = <0>;
- rockchip,camera-module-defrect0 = <1920 1080 0 0 1920 1080>;
- rockchip,camera-module-defrect1 = <2112 1568 0 0 2112 1568>;
- rockchip,camera-module-defrect2 = <4224 3136 0 0 4224 3136>;
- rockchip,camera-module-defrect3 = <3264 2448 0 0 3264 2448>;
- rockchip,camera-module-flash-support = <0>; /*闪光灯控制开关*/
- rockchip,camera-module-mipi-dphy-index = <0>; /*MIPI 接口索引*/
- };
复制代码
修改 cif_isp10_pltfrm.c 文件 加入 cifpower 设定.
- void init_cif_power(struct device *dev)
- {
- enum of_gpio_flags flags;
- int cifpower_io;
- int io_ret;
-
- cifpower_io = of_get_named_gpio_flags(dev->of_node, "rockchip,gpios-cifpower", 0, &flags);
- cif_isp10_pltfrm_pr_info(dev,"1-gpios-cifpower: gpio=%d", cifpower_io);
- if(gpio_is_valid(cifpower_io)) {
- cifpower_io = of_get_named_gpio_flags(dev->of_node, "rockchip,gpios-cifpower", 0, &flags);
- cif_isp10_pltfrm_pr_info(dev,"gpios-cifpower: gpio_request");
- io_ret = gpio_request(cifpower_io,"cifpower");
- cif_isp10_pltfrm_pr_info(dev,"1-gpios-cifpower: gpio_request=%d", io_ret);
- if(io_ret < 0){
- cif_isp10_pltfrm_pr_err(dev,"Request %s(%d) failed","cifpower", cifpower_io);
- } else {
- gpio_direction_output(cifpower_io, 1);
- gpio_set_value(cifpower_io, 1);
- cif_isp10_pltfrm_pr_info(dev,"gpios-cifpower: %d high", cifpower_io);
- }
- }
- return;
- }
复制代码
在 cif_isp10_pltfrm_dev_init 函数中调用上面的函数.
然后重新编译并替换内核.
启动后查看启动信息如下:
- [ 0.252170] iommu: Adding device ff910000.cif_isp to group 4
- [ 0.252723] platform ff910000.cif_isp: iommu /iommu@ff914000 not found
- [ 0.253310] iommu: Removing device ff910000.cif_isp from group 4
- [ 1.975010] cif_isp10_v4l2_drv_probe: probing...
- [ 1.975541] cif_isp10_pltfrm_dev_init(1249) ERR: could not get default pinstate
- [ 1.976623] cif_isp10_pltfrm_dev_init WARN: could not get pins_sleep pinstate
- [ 1.977252] cif_isp10_pltfrm_dev_init WARN: could not get pins_inactive pinstate
- [ 1.977941] of_get_named_gpiod_flags: parsed 'rockchip,gpios-cifpower' property of node '/cif_isp@ff910000[0]' - status (0)
- [ 1.977947] init_cif_power: 1-gpios-cifpower: gpio=54
- [ 1.978425] of_get_named_gpiod_flags: parsed 'rockchip,gpios-cifpower' property of node '/cif_isp@ff910000[0]' - status (0)
- [ 1.978454] init_cif_power: gpios-cifpower: gpio_request
- [ 1.978939] init_cif_power: 1-gpios-cifpower: gpio_request=0
- [ 1.979484] init_cif_power: gpios-cifpower: 54 high
- [ 1.980060] iommu: Adding device ff910000.cif_isp to group 4
- [ 1.980603] rkisp10 ff910000.cif_isp: Possibly a virtual device
- [ 2.008084] cif_isp10_img_src_v4l2_i2c_subdev_to_img_src(59) ERR: failed with error -6
- [ 2.008087] cif_isp10_img_src_to_img_src(70) ERR: to_img_src failed!
- [ 2.008090] cif_isp10_img_src_to_img_src(78) ERR: failed with error -14
- [ 2.008096] cif_isp10_img_srcs_init(1099) ERR: failed with error -14
- [ 2.008099] cif_isp10_create(5772) ERR: cif_isp10_img_srcs_init failed
- [ 2.008101] cif_isp10_create(5808) ERR: failed with error -14
复制代码
- linaro@linaro-alip:~$ dmesg | grep camera
- [ 1.981743] of_get_named_gpiod_flags: parsed 'rockchip,pd-gpio' property of node '/i2c@ff110000/camera-module@20[0]' - status (0)
- [ 1.981767] of_get_named_gpiod_flags: parsed 'rockchip,pwr-gpio' property of node '/i2c@ff110000/camera-module@20[0]' - status (0)
- [ 1.981777] of_get_named_gpiod_flags: can't parse 'rockchip,flash-gpio' property of node '/i2c@ff110000/camera-module@20[0]'
- [ 1.981787] of_get_named_gpiod_flags: can't parse 'rockchip,torch-gpio' property of node '/i2c@ff110000/camera-module@20[0]'
- [ 1.981808] of_get_named_gpiod_flags: parsed 'rockchip,rst-gpio' property of node '/i2c@ff110000/camera-module@20[0]' - status (0)
- [ 2.007420] ov13850.ov_camera_module_write_config(182) ERR: no active sensor configuration
- [ 2.007421] ov13850.ov_camera_module_write_config(233) ERR: failed with error -14
- [ 2.007725] ov13850.pltfrm_camera_module_read_reg(996) ERR: i2c read from offset 0x0000300a failed with error -6
- [ 2.007888] ov13850.pltfrm_camera_module_read_reg(996) ERR: i2c read from offset 0x0000300b failed with error -6
- [ 2.007893] ov13850.ov13850_check_camera_id(1820) ERR: register read failed, camera module powered off?
- [ 2.007898] ov13850.ov13850_check_camera_id(1838) ERR: failed with error (-6)
- [ 2.007945] ov13850.ov_camera_module_attach(256) ERR: failed with error -6
复制代码
i2c 通信并没有起来,希望大神能提供帮助.
|
|