|
【Linux】
RK3399+OV13850 I2C通信失败
发表于 2021-6-26 11:33:00
浏览:9785
|
回复:1
打印
只看该作者
[复制链接]
楼主
LBD3399+OV13850 ubuntu适配
一、 硬件配置
采用LDB3399 MIPI+ov13850进行连接,连接方式如下
1.1MIPI接口
采用LBD3399的MIPIRX0通道,其中MCLK->GPIO2_B3;MIPI_RST-> GPIO2_D3;MIPI_PDN->GPIO1_B2;CAM_SCL->i2c2-scl;cam_sda->i2c2_sda;
1.2 OV13850接口
二、 Linux内核
Kernel/arch/arm64/boot/dts/rockchip/rk3399-blend-linux.dts增加
&i2c2 {
status = "okay";
i2c-scl-rising-time-ns = <600>;
i2c-scl-falling-time-ns = <20>;
camera0: ov13850@20 {
status = "okay";
compatible = "omnivision,ov13850-v4l2-i2c-subdev";
// compatible = "ovti,ov13850";
reg = < 0x20 >;
device_type = "v4l2-i2c-subdev";
clocks = <&cru SCLK_CIF_OUT>;
clock-names = "clk_cif_out";
vdd33-supply = <&vcc3v3_ahda>;
vdd12-supply = <&vcc1v2_ahda>;
rockchip,camera-module-dovdd = "1.8v";
pinctrl-names = "rockchip,camera_default", "rockchip,camera_sleep";
pinctrl-0 = <&cam0_default_pins >;
pinctrl-1 = <&cam0_sleep_pins>;
// rockchip,pd-gpio = <&gpio1 RK_PB2 GPIO_ACTIVE_LOW>; //&gpio1 RK_PB2 调用与&vcc3v3_ahda冲突,内核会提示GPIO-42 request失败,因此屏蔽掉了
// rockchip,pwr-gpio = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>;
// rockchip,pwr-2nd-gpio = <&gpio1 22 GPIO_ACTIVE_HIGH>;
rockchip,rst-gpio = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>;
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 = <1>;
rockchip,camera-module-mirror = <0>;
rockchip,camera-module-defrect0 = <2112 1568 0 0 2112 1568>;
rockchip,camera-module-defrect1 = <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>;
};
};
&cif_isp0 {
rockchip,camera-modules-attached = <&camera0>;
// rockchip,gpios-cifpower = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>;
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,
三、 测试现象
3.1 内核打印
提示cif_isp1资源获取失败,I2C通信失败。
3.2 硬件测量
1、3.3V、AVDD2.8V、DVDD12V、DOVDD1.8V电压正常
2、MCLK无输出
3、pdn为低、RST为高
4、OV13850的i2c地址硬件厂商反馈为0x20;测试时试过0x20、0x10、0x6c内核打印没有变化
四、 协助
请帮忙看下以上现象,给出进一步排查意见。谢谢
|
|