I.MX6 ov5640 camera
Posted zengjf
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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信息查看: [email protected]:/ # dmesg | grep 5640 <6>camera ov5640 is found <6>camera ov5640_mipi is found [email protected]:/ #
以上是关于I.MX6 ov5640 camera的主要内容,如果未能解决你的问题,请参考以下文章