• I.MX6 ov5640 camera


    /************************************************************************
     *                       I.MX6 ov5640 camera
     * 说明:
     *     记录ov5640摄像头的设备注册方式。
     *
     *                                      2016-6-8 深圳 南山平山村 曾剑锋
     ***********************************************************************/
    
    一、设备注册:
        cat arch/arm/mach-mx6/board-mx6q_sabresd.c
            ......
            static void mx6q_csi0_io_init(void)
            {
                if (cpu_is_mx6q())
                    mxc_iomux_v3_setup_multiple_pads(mx6q_sabresd_csi0_sensor_pads,
                        ARRAY_SIZE(mx6q_sabresd_csi0_sensor_pads));
                else if (cpu_is_mx6dl())
                    mxc_iomux_v3_setup_multiple_pads(mx6dl_sabresd_csi0_sensor_pads,
                        ARRAY_SIZE(mx6dl_sabresd_csi0_sensor_pads));
    
                /* Camera reset */
                gpio_request(SABRESD_CSI0_RST, "cam-reset");
                gpio_direction_output(SABRESD_CSI0_RST, 1);
    
                /* Camera power down */
                gpio_request(SABRESD_CSI0_PWN, "cam-pwdn");
                gpio_direction_output(SABRESD_CSI0_PWN, 1);
                msleep(5);
                gpio_set_value(SABRESD_CSI0_PWN, 0);
                msleep(5);
                gpio_set_value(SABRESD_CSI0_RST, 0);
                msleep(1);
                gpio_set_value(SABRESD_CSI0_RST, 1);
                msleep(5);
                gpio_set_value(SABRESD_CSI0_PWN, 1);
    
                /* For MX6Q:
                 * GPR1 bit19 and bit20 meaning:
                 * Bit19:       0 - Enable mipi to IPU1 CSI0
                 *                      virtual channel is fixed to 0
                 *              1 - Enable parallel interface to IPU1 CSI0
                 * Bit20:       0 - Enable mipi to IPU2 CSI1
                 *                      virtual channel is fixed to 3
                 *              1 - Enable parallel interface to IPU2 CSI1
                 * IPU1 CSI1 directly connect to mipi csi2,
                 *      virtual channel is fixed to 1
                 * IPU2 CSI0 directly connect to mipi csi2,
                 *      virtual channel is fixed to 2
                 *
                 * For MX6DL:
                 * GPR13 bit 0-2 IPU_CSI0_MUX
                 *   000 MIPI_CSI0
                 *   100 IPU CSI0
                 */
                if (cpu_is_mx6q())
                    mxc_iomux_set_gpr_register(1, 19, 1, 1);
                else if (cpu_is_mx6dl())
                    mxc_iomux_set_gpr_register(13, 0, 3, 4);
            }
            ......
            static void mx6q_mipi_sensor_io_init(void)
            {
                if (cpu_is_mx6q())
                    mxc_iomux_v3_setup_multiple_pads(mx6q_sabresd_mipi_sensor_pads,
                        ARRAY_SIZE(mx6q_sabresd_mipi_sensor_pads));
                else if (cpu_is_mx6dl())
                    mxc_iomux_v3_setup_multiple_pads(mx6dl_sabresd_mipi_sensor_pads,
                        ARRAY_SIZE(mx6dl_sabresd_mipi_sensor_pads));
    
                /* Camera reset */
                gpio_request(SABRESD_MIPICSI_RST, "cam-reset");
                gpio_direction_output(SABRESD_MIPICSI_RST, 1);
    
                /* Camera power down */
                gpio_request(SABRESD_MIPICSI_PWN, "cam-pwdn");
                gpio_direction_output(SABRESD_MIPICSI_PWN, 1);
                msleep(5);
                gpio_set_value(SABRESD_MIPICSI_PWN, 0);
                msleep(5);
                gpio_set_value(SABRESD_MIPICSI_RST, 0);
                msleep(1);
                gpio_set_value(SABRESD_MIPICSI_RST, 1);
                msleep(5);
                gpio_set_value(SABRESD_MIPICSI_PWN, 1);
    
                /*for mx6dl, mipi virtual channel 1 connect to csi 1*/
                if (cpu_is_mx6dl())
                    mxc_iomux_set_gpr_register(13, 3, 3, 1);
            }
            ......
            static struct fsl_mxc_camera_platform_data mipi_csi2_data = {
                .mclk = 24000000,
                .mclk_source = 0,
                .csi = 1,
                .io_init = mx6q_mipi_sensor_io_init,
                .pwdn = mx6q_mipi_powerdown,
            };
            ......
            static struct fsl_mxc_camera_platform_data camera_data = {
                .mclk = 24000000,
                .mclk_source = 0,
                .csi = 0,
                .io_init = mx6q_csi0_io_init,
                .pwdn = mx6q_csi0_cam_powerdown,
            };
            ......
            static struct i2c_board_info mxc_i2c0_board_info[] __initdata = {
                ......
                {
                    I2C_BOARD_INFO("ov564x", 0x3c),
                    .platform_data = (void *)&camera_data,
                },
                ......
            }
            ......
            static struct i2c_board_info mxc_i2c2_board_info[] __initdata = {
                ......
                {
                    I2C_BOARD_INFO("ov5640_mipi", 0x3c),
                    .platform_data = (void *)&mipi_csi2_data,
                },
                ......
            }
            ......
                
    二、dmesg信息查看:
        root@android:/ # dmesg | grep 5640
        <6>camera ov5640 is found
        <6>camera ov5640_mipi is found
        root@android:/ # 
  • 相关阅读:
    求最短路径的三种算法: Ford, Dijkstra和Floyd
    Huffman树与编码
    Logistic回归模型和Python实现
    LibSVM for Python 使用
    支持向量机原理
    朴素贝叶斯分类器及Python实现
    Http协议简介
    介绍50个 WordPress 动作挂钩
    决定如何开发你的WordPress主题框架
    WordPress 主题框架是如何工作的
  • 原文地址:https://www.cnblogs.com/zengjfgit/p/5569162.html
Copyright © 2020-2023  润新知