打印

interrupt with omap3530 camera controller(BT656)

[复制链接]
2084|6
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
yaxon|  楼主 | 2011-3-17 12:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
hi
recently i am porting the camera to android.i have some problems with camera(omap3530).hope somebody can give me an advice.thank you.
1:my setting:
    the follows blow is the setting i made:
1.1 i use the bt656 format with 8 data lines and a pclk line connected to omap3530 camera controller(D0--D7).
1.2 the bt656 data is produced by a decoder(cx25837) similar to tvp5146.
1.3 a key configure c source code is blow:

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/i2c.h>
#include <linux/gpio.h>
#include <linux/mm.h>

/*Include V4l2 ISP_Camera driver related header file*/
#include <../drivers/media/video/omap34xxcam.h>
#include <../drivers/media/video/isp/ispreg.h>

#include "board-omap3beagle-camera.h"
#include "mux.h"

#ifndef CAMERA_DEBUG
#define CAMERA_DEBUG 1
#endif



static struct omap34xxcam_hw_config decoder_hwc = {
    .dev_index        = 0,
    .dev_minor        = 0,
    .dev_type        = OMAP34XXCAM_SLAVE_SENSOR,
    .u.sensor.sensor_isp    = 1,
    .u.sensor.capture_mem    = PAGE_ALIGN(720*625*2*4),//PAL
};

static struct isp_interface_config cx25837_if_config = {
    .ccdc_par_ser        = ISP_PARLL_YUV_BT,
    .dataline_shift        = 0x0,
    .hsvs_syncdetect    = ISPCTRL_SYNC_DETECT_VSRISE,
    .strobe            = 0x0,
    .prestrobe        = 0x0,
    .shutter        = 0x0,
    .wait_hs_vs        = 2,
    .u.par.par_bridge    = 0x0,
    .u.par.par_clk_pol    = 0x0,
};

#define CX25837_XCLK_BT656         (27000000)
#if 1
static struct v4l2_ifparm ifparm = {
    .if_type = V4L2_IF_TYPE_BT656,
    .u      = {
        .bt656 = {
            .frame_start_on_rising_vs = 1,
            .bt_sync_correct = 0,
            .latch_clk_inv    = 0,
            .nobt_hs_inv    = 0,    /* active high */
            .nobt_vs_inv    = 0,    /* active high */
            .mode        = V4L2_IF_TYPE_BT656_MODE_BT_8BIT,
            .clock_min    = CX25837_XCLK_BT656,
            .clock_max    = CX25837_XCLK_BT656,
        },
    },
};
#else
static struct v4l2_ifparm ifparm = {
    .if_type = V4L2_IF_TYPE_YCbCr,
    .u = {
        .ycbcr = {
            .frame_start_on_rising_vs = 1,
            .bt_sync_correct = 0,
            .swap = 0,
            .latch_clk_inv = 0,
            .nobt_hs_inv = 0, /* active high */
            .nobt_vs_inv = 0, /* active high */
            .clock_min = CX25837_XCLK_BT656,
            .clock_max = CX25837_XCLK_BT656,
        },
    },
};
#endif

static int cx25837_ifparm(struct v4l2_ifparm *p)
{
    if(p == NULL){
        return -EINVAL;
    }

    *p = ifparm;
    return 0;
}

static int cx25837_set_prv_data(struct v4l2_int_device *s, void *priv)
{
    struct omap34xxcam_hw_config *hwc = priv;

    if (priv == NULL)
        return -EINVAL;

    hwc->u.sensor.sensor_isp = decoder_hwc.u.sensor.sensor_isp;
    hwc->u.sensor.capture_mem = decoder_hwc.u.sensor.capture_mem;
    hwc->dev_index = decoder_hwc.dev_index;
    hwc->dev_minor = decoder_hwc.dev_minor;
    hwc->dev_type = decoder_hwc.dev_type;
    return 0;
}

static int cx25837_power_set(struct v4l2_int_device *s, enum v4l2_power power)
{
    struct omap34xxcam_videodev *vdev = s->u.slave->master->priv;

    printk("cx25837_power_set\n");
    switch (power) {
    case V4L2_POWER_OFF:
        /*can add some codes as you like here*/
        break;

    case V4L2_POWER_STANDBY:
        /*can add some codes as you like here*/
        break;

    case V4L2_POWER_ON:
        /*can add some codes as you like here*/      
        isp_configure_interface(vdev->cam->isp, &cx25837_if_config);
        break;

    default:
        return -ENODEV;
        break;
    }
    return 0;
}

static struct cx25837_platform_data cx25837_pdata = {
    .master            = "omap34xxcam",
    .ifparm            = cx25837_ifparm,
    .power_set        = cx25837_power_set,
    .priv_data_set     = cx25837_set_prv_data,
    .clk_polarity    = 0,
    .hs_polarity    =1,
    .vs_polarity    =1,
};

static struct i2c_board_info __initdata cx25837_i2c_board_info = {
    I2C_BOARD_INFO("cx25837",0x45),//the i2c chip address(7-bits) of cx25837
    .platform_data = &cx25837_pdata,
};

#define CX25837_RESET 167
#define CX25837_SLEEP 98

static  int omap3beagle_pin_mux_config(void)
{   
    int err = 0;;
    //mux the ball F18 as gpio(167)
    //check wether the gpio167 has been requested?   
    err = gpio_request(CX25837_RESET, "cx25837_reset");
    if(err){
        printk("the goio %d you apply has been requested!\n",CX25837_RESET);
        return -1;      
    }
    //mux the ball F18 as gpio(gpio167)
    omap_mux_init_gpio(CX25837_RESET,OMAP_PIN_OUTPUT);

    //set the gpio167 as output
    gpio_direction_output(CX25837_RESET,0);

#if CAMERA_DEBUG
    gpio_set_value(CX25837_RESET,0);
#endif   

    err = gpio_request(CX25837_SLEEP, "cx25837_sleep");
    if(err){
        printk("the goio %d you apply has been requested!\n",CX25837_SLEEP);
        return -1;      
    }
    //mux the ball H24 as gpio(gpio98)
    omap_mux_init_gpio(CX25837_SLEEP,OMAP_PIN_OUTPUT);

    //set the gpio98 as output
    gpio_direction_output(CX25837_SLEEP,0);

#if CAMERA_DEBUG
    gpio_set_value(CX25837_SLEEP,0);
#endif     

    return 0;
}


static int before_init(void)
{
    int err;
    err = omap3beagle_pin_mux_config();
    if(err == -1){
        printk("omap3beagle_pin_mux_config failed\n");
        return -1;
    }   
    //here,you may add some code in the further
   
    return 0;
}

static void after_init(void)
{
    //here,you may add some code in the further
}

#define CX25837_I2C_BUSNUM 2   //the cx25837 is connected to the i2c2 controller
int __init omap3beagledc_init(void)
{
    printk("omap3 beagleboard camera(a i2c_client init is beaginning\n)");

    before_init();
    i2c_register_board_info(CX25837_I2C_BUSNUM,&cx25837_i2c_board_info,1);
    after_init();   
      
   
    printk("omap3 beagleboard camera (a i2c_client init is over\n)");
    return 0;
}

arch_initcall(omap3beagledc_init);

1.4 the camera registers setting is blow:

----isp iomem register----
address:0x0,data:0x20
address:0x4,data:0x2000
address:0x8,data:0x1
address:0xc,data:0x80083311
address:0x10,data:0x80000000
address:0x14,data:0x0
address:0x18,data:0x80000000
address:0x1c,data:0x0
address:0x20,data:0x0
address:0x24,data:0x0
address:0x28,data:0x0
address:0x2c,data:0x0
address:0x30,data:0x0
address:0x34,data:0x0
address:0x38,data:0x0
address:0x3c,data:0x0
address:0x40,data:0x29c110
address:0x44,data:0x0
address:0x48,data:0x0
address:0x4c,data:0x0
address:0x50,data:0x0
address:0x54,data:0x0
address:0x58,data:0x0
address:0x5c,data:0x0
address:0x60,data:0x0
address:0x64,data:0x0
address:0x68,data:0x10000
address:0x6c,data:0x0

---isp ccdc register----
address:0x0,data:0x1fe01
address:0x4,data:0x1
address:0x8,data:0x32f84
address:0xc,data:0x0
address:0x10,data:0x0
address:0x14,data:0x59f
address:0x18,data:0x20002
address:0x1c,data:0x11f
address:0x20,data:0xffff00ff
address:0x24,data:0x5a0
address:0x28,data:0x249
address:0x2c,data:0x1000
address:0x30,data:0x10
address:0x34,data:0x0
address:0x38,data:0x0
address:0x3c,data:0x4
address:0x40,data:0x0
address:0x44,data:0x0
address:0x48,data:0x11f0032
address:0x4c,data:0x4
address:0x50,data:0x3
address:0x54,data:0x8800
address:0x58,data:0x4000
address:0x5c,data:0x0
address:0x60,data:0x0
address:0x64,data:0x0
address:0x68,data:0x2f840000
address:0x6c,data:0x0
address:0x70,data:0x0
address:0x74,data:0x0
address:0x78,data:0x0
address:0x7c,data:0x0
address:0x80,data:0x0
address:0x84,data:0x0
address:0x88,data:0x0
address:0x8c,data:0x0
address:0x90,data:0x0
address:0x94,data:0x0
address:0x98,data:0x6600
address:0x9c,data:0x0
address:0xa0,data:0x0
address:0xa4,data:0x0
2.my problems:
    with the seting above , the camera controller can not produce interrupt.because the isr(omap34xx_isp_isr) do not be excuted.the CCDC_VD0_IRQ interrupt is what i want.
what is wrong with my seeting.I hope some body help me out.thanks!

相关帖子

沙发
jancey| | 2011-3-17 14:42 | 只看该作者
帮顶~为什么不写中文啊,能帮LZ忙的大师未必有功夫仔细看啊。。。。

使用特权

评论回复
板凳
yaxon|  楼主 | 2011-3-17 17:04 | 只看该作者
不好意思了,这个帖子是我在ti  e2e上发的,我从那里copy到这里,还望各位大虾多多指点!

使用特权

评论回复
地板
思行合一| | 2011-3-18 16:59 | 只看该作者
就是啊,还是中文的看着舒服

使用特权

评论回复
5
米其林r| | 2011-3-20 17:52 | 只看该作者
楼主发这个是何用意

使用特权

评论回复
6
yaxon|  楼主 | 2011-3-21 19:54 | 只看该作者
由于现在调试camera驱动,一直得不到中断。所以在此发贴,还望各位指点!

使用特权

评论回复
7
yaxon|  楼主 | 2011-3-23 08:30 | 只看该作者
this problem has been resolved.and it it the hardware problem.Thanks!

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

0

主题

4

帖子

1

粉丝