6.4.6. 常见问题¶
6.4.6.1. 摄像头初始化失败¶
6.4.6.1.1. 现象¶
板子启动后,摄像头的V4L2 device注册失败,此时DVP的注册流程也因此不完整,在Sysfs中会找不到 /dev/video0 不存在。
6.4.6.1.2. 原因分析¶
一般情况下,摄像头需要通过 I2C 来访问,所以要确保 I2C和摄像头两个模块是否打开。
- 摄像头的打开方法: 配置 OV5640 摄像头 
- I2C的打开方法,请参考I2C模块的使用说明 
同时,要确认以下配置是否正确:
- 硬件上,摄像头是连接到哪个I2C通道,对应的DTS配置是否正确,配置参见 配置 OV5640 摄像头 
- 摄像头的I2C 设备地址是否正确,参见 配置 OV5640 摄像头 中的参数 - camera@3C
- 摄像头的供电是否正常。 
#ifdef AIC_ONLY
<<<< 以下内容仅供内部使用
注意
在FPGA环境中,摄像头的电源GPIO在上电时已正常工作,不能去复位,否则会导致摄像头的寄存器读写失败。
屏蔽OV5640的GPIO复位的patch:
    ov5640: Must not set the power GPIO in FPGA.
    Signed-off-by: matteo <duanmt@artinchip.com>
    Change-Id: I55b163f8c59f257532e0c047931765bda6a89c85
diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index 8f0812e85..c240ead99 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -1857,7 +1857,7 @@ static void ov5640_power(struct ov5640_dev *sensor, bool enable)
 {
        gpiod_set_value_cansleep(sensor->pwdn_gpio, enable ? 0 : 1);
 }
-
+#ifndef CONFIG_DEBUG_ON_FPGA_BOARD_ARTINCHIP
 static void ov5640_reset(struct ov5640_dev *sensor)
 {
        if (!sensor->reset_gpio)
@@ -1877,6 +1877,7 @@ static void ov5640_reset(struct ov5640_dev *sensor)
        gpiod_set_value_cansleep(sensor->reset_gpio, 0);
        usleep_range(20000, 25000);
 }
+#endif
 static int ov5640_set_power_on(struct ov5640_dev *sensor)
 {
@@ -1898,8 +1899,10 @@ static int ov5640_set_power_on(struct ov5640_dev *sensor)
                goto xclk_off;
        }
+#ifndef CONFIG_DEBUG_ON_FPGA_BOARD_ARTINCHIP
        ov5640_reset(sensor);
        ov5640_power(sensor, true);
+#endif
        ret = ov5640_init_slave_id(sensor);
        if (ret)
>>>> 以上内容仅供内部使用
#endif