beginner 发表于 2018-9-21 11:56:31

RK3399开发板调试Mipi接口OV13850摄像头报错

本渣参考http://dev.t-firefly.com/thread-13810-2-1.html做的修改,修改如下:
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-firefly-linux.dts b/arch/arm64/boot/dts/rockchip/rk3399-firefly-linux.dts
index beffd8dbb219..4e7890ff1355 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-firefly-linux.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-firefly-linux.dts
@@ -663,6 +663,46 @@
                io-channels = <&saradc 4>;
                hp-det-adc-value = <500>;
        };
+// MIPI-CIF 位于主板正面外侧, (引脚参考原理图 J22)
+      camera0: camera-module@10 {
+                status = "okay";
+                compatible = "omnivision,ov13850-v4l2-i2c-subdev";
+                reg = < 0x10 >;
+                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 接口索引*/
+      };
};

&i2c3 {
@@ -1028,3 +1068,12 @@
&vpu {
        status = "okay";
};
+&cif_isp0 {
+      rockchip,camera-modules-attached = <&camera0>;
+      rockchip,gpio-cifpower = <&gpio1 22 GPIO_ACTIVE_HIGH>;
+
+      status = "okay";
+};
+&isp0_mmu {
+    status = "okay";
+};
diff --git a/drivers/media/i2c/soc_camera/rockchip/Kconfig b/drivers/media/i2c/soc_camera/rockchip/Kconfig
index fcde42cccf09..30ef3b46c0df 100644
--- a/drivers/media/i2c/soc_camera/rockchip/Kconfig
+++ b/drivers/media/i2c/soc_camera/rockchip/Kconfig
@@ -65,7 +65,7 @@ config VIDEO_NT99230
config VIDEO_OV13850
        tristate "ov13850 driver adapt to rockchip cif isp platform"
        depends on VIDEO_V4L2 && VIDEO_RK_CIF_ISP10 && I2C
-        default n
+        default y
        ---help---
          This is ov13850 camera driver adapt to rockchip cif isp platform.

diff --git a/drivers/media/platform/rk-isp10/Kconfig b/drivers/media/platform/rk-isp10/Kconfig
index 1b25033d6fce..f48c3c478837 100644
--- a/drivers/media/platform/rk-isp10/Kconfig
+++ b/drivers/media/platform/rk-isp10/Kconfig
@@ -6,7 +6,7 @@ config VIDEO_RK_CIF_ISP10
        select VIDEOBUF_GEN
        select VIDEOBUF2_DMA_SG
        select VIDEOBUF2_VMALLOC
-        default n
+        default y

        ---help---
          Say Y here to enable selecting the
diff --git a/drivers/media/platform/rk-isp10/cif_isp10_pltfrm.c b/drivers/media/platform/rk-isp10/cif_isp10_pltfrm.c
old mode 100644
new mode 100755
index 66d694ef8140..55124d69e767
--- a/drivers/media/platform/rk-isp10/cif_isp10_pltfrm.c
+++ b/drivers/media/platform/rk-isp10/cif_isp10_pltfrm.c
@@ -19,6 +19,7 @@
#endif

#include <linux/of.h>
+#include <linux/of_gpio.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
@@ -98,6 +99,29 @@ void cif_isp10_pltfrm_debug_register_print_cb(
        pdata->dbgfs.print_func = print;
#endif
}
+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;
+}

#ifndef CONFIG_DEBUG_FS
#define CIF_ISP10_DBGFS_BUF_SIZE 1024
@@ -1161,7 +1185,7 @@ int cif_isp10_pltfrm_dev_init(

        dev_set_drvdata(dev, cif_isp10_dev);
        cif_isp10_dev->dev = dev;
-
+      init_cif_power(dev);
        pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
        if (!pdata) {
                cif_isp10_pltfrm_pr_err(dev,

串口错误信息如下:
[   13.176502] ov13850.ov_camera_module_write_config(182) ERR: no active sensor configuration
[   13.177250] ov13850.ov_camera_module_write_config(233) ERR: failed with error -14
[   13.178200] usb 1-1: new high-speed USB device number 2 using ehci-platform
[   13.178310] ov13850.pltfrm_camera_module_read_reg(1007) ERR: i2c read from offset 0x0000300a failed with error -6
[   13.179087] ov13850.pltfrm_camera_module_read_reg(1007) ERR: i2c read from offset 0x0000300b failed with error -6
[   13.179097] ov13850.ov13850_check_camera_id(1820) ERR: register read failed, camera module powered off?
[   13.179103] ov13850.ov13850_check_camera_id(1838) ERR: failed with error (-6)
[   13.179215] ov13850.ov_camera_module_attach(256) ERR: failed with error -6
[   13.179260] cif_isp10_img_src_v4l2_i2c_subdev_to_img_src(59) ERR: failed with error -6
[   13.179266] cif_isp10_img_src_to_img_src(70) ERR: to_img_src failed!
[   13.179272] cif_isp10_img_src_to_img_src(78) ERR: failed with error -14
[   13.179279] cif_isp10_img_srcs_init(1099) ERR: failed with error -14
[   13.179284] cif_isp10_create(5772) ERR: cif_isp10_img_srcs_init failed
[   13.179289] cif_isp10_create(5808) ERR: failed with error -14

请问这是少修改了哪个文件么?请帮忙分析

15822579256 发表于 2018-11-14 10:02:43

楼主,你调试成功了吗?

zhihaolan 发表于 2018-12-29 15:43:00

有谁调试成功了

VoiceJourney 发表于 2019-6-17 14:29:22

C:\Users\EDZ\Desktop\微信图片_20190617142758.jpg

大地主因 发表于 2019-6-18 14:43:54

camera在IIC1上,不是在IIC3上

wx_Neal_VzM5s 发表于 2019-8-10 11:55:24

有调试成功的嘛

shawn2011 发表于 2019-8-13 20:21:50

sensor的I2C地址和挂的I2C BUS号是不是错了

harry071 发表于 2021-6-24 20:31:01

楼主成功了吗

harry071 发表于 2021-6-26 11:26:19

遇到同样问题,I2C通信失败
页: [1]
查看完整版本: RK3399开发板调试Mipi接口OV13850摄像头报错