linux kernel - How to connect ov5642 camera module Pixel clock (8MHz) to imx6 quad -
i using i.mx6quad debian jessie (3.14.60-fslc-imx6-sr).
i want co connect ov5642 camera module parallel 8bit interface (using 8gpios data , 3 control signals). wrote linux kernel module service interrupts control signals. interrupts vsync , href signals serviced when connect pclk (about 8mhz) signal faster href or vsync linux hangs untill disconnect wire pclk (everything stucks). connect pclk use gpio90 (disp1_data22) tried other gpios.
now question gpio should use service such fast signals pclk or can avoid linux hang ups ??
i include linux kernel module code use.
#include<linux/init.h> #include<linux/module.h> #include<linux/kernel.h> #include<linux/gpio.h> #include<linux/interrupt.h> static unsigned int vsync_gpio_number=79; static unsigned int href_gpio_number=76; static unsigned int pclk_gpio_number=90; static unsigned int vsync_irqnumber; static unsigned int href_irqnumber; static unsigned int pclk_irqnumber; static irq_handler_t vsync_gpio_irq_handler(unsigned int irq,void *dev_id,struct pt_regs *regs); static irq_handler_t href_gpio_irq_handler(unsigned int irq,void *dev_id,struct pt_regs *regs); static irq_handler_t pclk_gpio_irq_handler(unsigned int irq,void *dev_id,struct pt_regs *regs); int __init camera_module_test_init(void){//init_module() int result=0; printk(kern_info "gpio_test: initializing gpio_test lkm\n"); //vsync init if(!gpio_is_valid(vsync_gpio_number)){ printk(kern_info "gpio test: invalid vsync gpio\n"); return -enodev; } //href init if(!gpio_is_valid(href_gpio_number)){ printk(kern_info "gpio test: invalid href gpio\n"); return -enodev; } //pclk init if(!gpio_is_valid(pclk_gpio_number)){ printk(kern_info "gpio test: invalid pclk gpio\n"); return -enodev; } //ledon=true; //vsync gpio_request(vsync_gpio_number,"sysfs"); gpio_direction_input(vsync_gpio_number); gpio_export(vsync_gpio_number,false); // causes gpiox appear in sysfs /sys/class/gpio/ //href gpio_request(href_gpio_number,"sysfs"); gpio_direction_input(href_gpio_number); gpio_export(href_gpio_number,false); //pclk gpio_request(pclk_gpio_number,"sysfs"); gpio_direction_input(pclk_gpio_number); gpio_export(pclk_gpio_number,false); // gpio numbers , irq numbers not same //mapping gpio numbers irq numbers //--------- vsync_irqnumber = gpio_to_irq(vsync_gpio_number); printk(kern_info "gpio_test: vsync signal mapped irq: %d\n",vsync_irqnumber); // href_irqnumber=gpio_to_irq(href_gpio_number); printk(kern_info "gpio test: href signal mapped irq: %d\n",href_irqnumber); // pclk_irqnumber=gpio_to_irq(pclk_gpio_number); printk(kern_info "gpio test: pclk signal mapped irq: %d\n",pclk_irqnumber); //requests interrupt line //vsync result=request_irq(vsync_irqnumber,(irq_handler_t)vsync_gpio_irq_handler,irqf_trigger_rising,"vsync_gpio_handler",null); if(result==0){ //if success printk(kern_info "gpio_test: vsync interrupt request result is: %d\n",result); } else{ printk(kern_info "gpio_test: vsync interrupt request fail !!! (%d)\n",result); return result; } //href result=request_irq(href_irqnumber,(irq_handler_t)href_gpio_irq_handler,irqf_trigger_rising,"href_gpio_handler",null); if(result==0){ //if success printk(kern_info "gpio_test: href interrupt request result is: %d\n",result); } else{ printk(kern_info "gpio_test: href interrupt request fail !!! (%d)\n",result); return result; } //pclk result=request_irq(pclk_irqnumber,(irq_handler_t)pclk_gpio_irq_handler,irqf_trigger_rising,"pclk_gpio_handler",null); if(result==0){// if success printk(kern_info "gpio_test: pclk interrupt request result is: %d\n",result); } else{ printk(kern_info "gpio_test: pclk interrupt request fail !!! (%d)\n",result); return result; } printk(kern_info "module loaded.... waiting interruption\n"); return result; } static void __exit camera_module_test_exit(void){ //cleanup_module(void){ printk(kern_info "exiting camera_lkm_module_test\n"); //unexporting gpios gpio_unexport(vsync_gpio_number); gpio_unexport(href_gpio_number); gpio_unexport(pclk_gpio_number); //freeing irqs free_irq(vsync_irqnumber,null); free_irq(href_irqnumber,null); free_irq(pclk_irqnumber,null); //freeing memory gpio_free(vsync_gpio_number); gpio_free(href_gpio_number); gpio_free(pclk_gpio_number); printk(kern_info "goodbye world - module closed\n"); } static irq_handler_t vsync_gpio_irq_handler(unsigned int irq,void *dev_id,struct pt_regs *regs){ printk(kern_info "* vsync interrupt on rising! *\n"); return (irq_handler_t)irq_handled; } static irq_handler_t href_gpio_irq_handler(unsigned int irq,void *dev_id,struct pt_regs *regs){ printk(kern_info "-- href interrupt! on rising --\n"); return (irq_handler_t)irq_handled; } static irq_handler_t pclk_gpio_irq_handler(unsigned int irq,void *dev_id,struct pt_regs *regs){ printk(kern_info "// pclk interrupt! on rising //\n"); return (irq_handler_t)irq_handled; } module_init(camera_module_test_init); module_exit(camera_module_test_exit); module_license("gpl");
i can add using hummingboard gate available gpios shown in attached image.
Comments
Post a Comment