bywayboy 发表于 2018-5-30 21:45:57

debian 尝试使用ov13850摄像头

首先修改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>;

                /*GPIO2B4 = 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' - 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' - 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' - status (0)
[    1.981767] of_get_named_gpiod_flags: parsed 'rockchip,pwr-gpio' property of node '/i2c@ff110000/camera-module@20' - status (0)
[    1.981777] of_get_named_gpiod_flags: can't parse 'rockchip,flash-gpio' property of node '/i2c@ff110000/camera-module@20'
[    1.981787] of_get_named_gpiod_flags: can't parse 'rockchip,torch-gpio' property of node '/i2c@ff110000/camera-module@20'
[    1.981808] of_get_named_gpiod_flags: parsed 'rockchip,rst-gpio' property of node '/i2c@ff110000/camera-module@20' - 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 通信并没有起来,希望大神能提供帮助.

bywayboy 发表于 2018-6-1 02:31:19

阅读了一次原理图dts 修改后如下:

// MIPI-CIF 位于主板正面外侧, (引脚参考原理图 J22)
        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";
                rockchip,camera-module-mclk-name = "clk_cif_out";
                rockchip,camera-module-dovdd = "1.8v";
               

                pinctrl-names = "rockchip,camera_default", "rockchip,camera_sleep";
                pinctrl-0 = <&cam0_default_pins>;
                pinctrl-1 = <&cam0_sleep_pins>;

                /*GPIO2B4 = 12 B6 = 14 MIPI0 D4 = 27 C7 = 23 */
                rockchip,pwr-gpio = <&gpio1 23 GPIO_ACTIVE_HIGH>;        /*Power                        GPIO1_C7 */
                rockchip,pd-gpio= <&gpio2 12 GPIO_ACTIVE_LOW>;        /*Power Down        GPIO2_B4OR GPIO2_D4 */

                // rst 硬件上拉 无需配置
                //rockchip,rst-gpio = <&gpio0 8 GPIO_ACTIVE_LOW>;                /*Reset                        GPIO0_B0 */
               
                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 = <3264 2448 0 0 3264 2448>;

                rockchip,camera-module-flash-support = <0>;                        /*闪光灯控制开关*/
                rockchip,camera-module-mipi-dphy-index = <0>;                /*MIPI 接口索引*/
        };&cif_isp0 {
        rockchip,camera-modules-attached = <&camera0>;
        rockchip,gpios-cifpower = <&gpio1 22 GPIO_ACTIVE_HIGH>;

        status = "okay";
};


&isp0_mmu {
    status = "okay";
};
但还是不行,请大神们指点下.

bywayboy 发表于 2018-6-4 08:14:22

I2C SLAVE 地址修改位 0x10 工作良好

Chary 发表于 2018-6-13 10:39:33

楼主很厉害,不知道有没有尝试过两路MIPI同时使用摄像头

bywayboy 发表于 2018-6-15 21:49:59

暂时没有尝试过.

RICHYDUAN 发表于 2018-6-21 10:11:12

按照楼主20180601的配置,I2C SLAVE 地址修改位 0x10,mipi摄像头接到 J22就可以工作了么

Galenzhang 发表于 2018-6-22 09:56:12

RICHYDUAN 发表于 2018-6-21 10:11
按照楼主20180601的配置,I2C SLAVE 地址修改位 0x10,mipi摄像头接到 J22就可以工作了么

修改了一下,内核无限重启了。。。

RICHYDUAN 发表于 2018-6-22 13:34:37

楼主,参照你的配置,J22这个摄像头i2c可以通信了,但现在的问题是,如果要把摄像头接到J24,I2C SLAVE 地址改成0x6C不能通信,另一路摄像头I2C SLAVE地址应该改成多少呢

bywayboy 发表于 2018-6-27 15:59:58

RICHYDUAN 发表于 2018-6-22 13:34
楼主,参照你的配置,J22这个摄像头i2c可以通信了,但现在的问题是,如果要把摄像头接到J24,I2C SLAVE 地 ...

我也没试过。

RICHYDUAN 发表于 2018-6-29 09:25:01

楼主,想确认一下,J24的rockchip pd-gpio,也就是 GPIO2D4 应该配置成27还是28?
页: [1] 2 3
查看完整版本: debian 尝试使用ov13850摄像头