android 摄像头 ov2655 驱动注册

android 摄像头 ov2655 驱动注册


#ifdef CONFIG_VIDEO_OV2655
// CAM_PWR:GPF3_4
#define  CAM_PWR    S5PV210_GPJ4(1)
#define  CAM_RESET  S5PV210_GPE1(4)

#define CAM_PWR_ENABLE()                gpio_direction_output(CAM_PWR, 0);
#define CAM_PWR_DISABLE()               gpio_direction_output(CAM_PWR, 1);
#define CAM_RESET_HIGH()                gpio_direction_output(CAM_RESET, 1);
#define CAM_RESET_LOW()                 gpio_direction_output(CAM_RESET, 0);

static int smdkv210_ov2655_power(int onoff)
{
        int err;

        //printk("Open OV2655 camema sensor \n");
#if 0
 //! ov2655 tvp514x switch 
	gpio_request(S5PV210_GPH2(7), "GPH2");
        s3c_gpio_setpull(S5PV210_GPH2(7), S3C_GPIO_PULL_UP);
        s3c_gpio_cfgpin(S5PV210_GPH2(2), S3C_GPIO_SFN(1));
        gpio_direction_output(S5PV210_GPH2(7), 1);
        gpio_free(S5PV210_GPH2(2));
#endif

	err = gpio_request(CAM_PWR, "GPF34");
    if (err){
		printk(KERN_ERR "#### failed to request GPF34 for cam_pwr\n");
    }

	err = gpio_request(CAM_RESET, "GPE14");
    if (err){
		printk(KERN_ERR "#### failed to request GPE14 for cam_reset\n");
	}

	if(onoff){
		CAM_PWR_DISABLE();
		msleep(20);
		CAM_PWR_ENABLE();
		msleep(20);

		CAM_RESET_LOW();
		msleep(50);
		CAM_RESET_HIGH();
		msleep(15);
	}
	else{
		CAM_PWR_DISABLE();
		CAM_RESET_LOW();
	}

	gpio_free(CAM_PWR);
	gpio_free(CAM_RESET);

	return 0;
}

static struct ov2655_platform_data ov2655_plat = {
       .default_width = 800,
       .default_height = 600,
       .pixelformat = V4L2_PIX_FMT_UYVY,
       .freq = 24000000,
       .is_mipi = 0,
};

static struct i2c_board_info  ov2655_i2c_info = {
       I2C_BOARD_INFO("ov2655", 0x30), //7位的i2c地址
       .platform_data = &ov2655_plat,
};

static struct s3c_platform_camera ov2655 = {
#ifdef CAM_ITU_CH_A
        .id             = CAMERA_PAR_A,
#else
        .id             = CAMERA_PAR_B,
#endif
       .type           = CAM_TYPE_ITU,
       .fmt            = ITU_601_YCBCR422_8BIT,
       .order422       = CAM_ORDER422_8BIT_CBYCRY,
       .i2c_busnum     = 1,
       .info           = &ov2655_i2c_info,
       .pixelformat    = V4L2_PIX_FMT_UYVY,
       .srclk_name     = "mout_mpll",
       .clk_name       = "sclk_cam0",
       .clk_rate       = 24000000,
       .line_length    = 1920,
       .width          = 800,
       .height         = 600,
       .window         = {
               .left   = 0,
               .top    = 0,
               .width  = 800,
               .height = 600,
       },

       /* Polarity */
       .inv_pclk       = 0,
       .inv_vsync      = 1,
       .inv_href       = 0,
       .inv_hsync      = 0,

       .initialized    = 0,
       .cam_power      = smdkv210_ov2655_power,
};
#endif


static struct s3c_platform_fimc fimc_plat_lsi = {
	.srclk_name	= "mout_mpll",
	.clk_name	= "sclk_fimc",
	.lclk_name	= "fimc",
	.clk_rate	= 166750000,
#if defined(CONFIG_VIDEO_S5K4EA)
	.default_cam	= CAMERA_CSI_C,
#else
#ifdef CAM_ITU_CH_A
	.default_cam	= CAMERA_PAR_A,
#else
	.default_cam	= CAMERA_PAR_B,
#endif
#endif
	.camera		= {
#ifdef CONFIG_VIDEO_S5K4ECGX
			&s5k4ecgx,
#endif
#ifdef CONFIG_VIDEO_S5KA3DFX
			&s5ka3dfx,
#endif
#ifdef CONFIG_VIDEO_S5K4BA
			&s5k4ba,
#endif
#ifdef CONFIG_VIDEO_S5K4EA
			&s5k4ea,
#endif
#ifdef CONFIG_VIDEO_TVP514X
			&tvp514x_cam,
#endif
#ifdef CONFIG_VIDEO_OV9650
			&ov9650,
#endif
#ifdef CONFIG_VIDEO_OV2655
			&ov2655, //注册平台驱动
#endif
	},
	.hw_ver		= 0x43,
};


你可能感兴趣的:(android)